diff options
author | Sebastian Geerken <devnull@localhost> | 2014-04-10 20:31:58 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-04-10 20:31:58 +0200 |
commit | 14c8dc8706be54b8ade7962455848eed299db765 (patch) | |
tree | b172724f91e8c1f389b32ed829f234a1c82509f3 /dw | |
parent | 2f053c51c454e3051ccf736fdb8015a62dc220d1 (diff) |
Floats are now allocated earlier.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/outofflowmgr.cc | 34 | ||||
-rw-r--r-- | dw/outofflowmgr.hh | 2 | ||||
-rw-r--r-- | dw/textblock.cc | 6 |
3 files changed, 21 insertions, 21 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 50144c6f..3fcb6959 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -558,18 +558,16 @@ void OutOfFlowMgr::sizeAllocateEnd (Textblock *caller) DBG_OBJ_MSGF ("resize.oofm", 0, "<b>sizeAllocateEnd</b> (%p)", caller); DBG_OBJ_MSG_START (); + // Floats (and later absolutely positioned blocks) have to be allocated. + TBInfo *tbInfo = getTextblock (caller); + sizeAllocateFloats (tbInfo, LEFT); + sizeAllocateFloats (tbInfo, RIGHT); + if (caller == containingBlock) { // Move floats from GB lists to the one CB list. moveFromGBToCB (LEFT); moveFromGBToCB (RIGHT); - - // Floats and absolutely positioned blocks have to be allocated - sizeAllocateFloats (LEFT); - sizeAllocateFloats (RIGHT); - sizeAllocateAbsolutelyPositioned (); - - // Textblocks have already been allocated here. - + // Check changes of both textblocks and floats allocation. (All // is checked by hasRelationChanged (...).) for (lout::container::typed::Iterator<TypedPointer <Textblock> > it = @@ -971,23 +969,23 @@ void OutOfFlowMgr::moveFromGBToCB (Side side) // printf (" %d: %s\n", i, dest->get(i)->toString()); } -void OutOfFlowMgr::sizeAllocateFloats (Side side) +void OutOfFlowMgr::sizeAllocateFloats (TBInfo *textblock, Side side) { - SortedFloatsVector *list = side == LEFT ? leftFloatsCB : rightFloatsCB; + SortedFloatsVector *list = side == LEFT ? + textblock->leftFloatsGB : textblock->rightFloatsGB; + + Allocation *gba = &(textblock->allocation); + Allocation *cba = &containingBlockAllocation; + int availWidth = textblock->getTextblock()->getAvailWidth(); for (int i = 0; i < list->size(); i++) { Float *vloat = list->get(i); ensureFloatSize (vloat); - Allocation *gbAllocation = getAllocation(vloat->generatingBlock); - Allocation *cbAllocation = getAllocation(containingBlock); - Allocation childAllocation; - childAllocation.x = cbAllocation->x + - calcFloatX (vloat, side, gbAllocation->x - cbAllocation->x, - gbAllocation->width, - vloat->generatingBlock->getAvailWidth()); - childAllocation.y = gbAllocation->y + vloat->yReal; + childAllocation.x = cba->x + + calcFloatX (vloat, side, gba->x - cba->x, gba->width, availWidth); + childAllocation.y = gba->y + vloat->yReal; childAllocation.width = vloat->size.width; childAllocation.ascent = vloat->size.ascent; childAllocation.descent = vloat->size.descent; diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh index 1a72f6dc..6dd49361 100644 --- a/dw/outofflowmgr.hh +++ b/dw/outofflowmgr.hh @@ -260,7 +260,7 @@ private: Float *findFloatByWidget (core::Widget *widget); void moveFromGBToCB (Side side); - void sizeAllocateFloats (Side side); + void sizeAllocateFloats (TBInfo *textblock, Side side); int calcFloatX (Float *vloat, Side side, int gbX, int gbWidth, int gbAvailWidth); diff --git a/dw/textblock.cc b/dw/textblock.cc index 47f7d7b7..92e59c59 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -492,7 +492,8 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) showMissingLines (); - containingBlock->outOfFlowMgr->sizeAllocateStart (this, allocation); + if (containingBlock->outOfFlowMgr) + containingBlock->outOfFlowMgr->sizeAllocateStart (this, allocation); int lineIndex, wordIndex; Line *line; @@ -590,7 +591,8 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) } } - containingBlock->outOfFlowMgr->sizeAllocateEnd (this); + if (containingBlock->outOfFlowMgr) + containingBlock->outOfFlowMgr->sizeAllocateEnd (this); for (int i = 0; i < anchors->size(); i++) { Anchor *anchor = anchors->getRef(i); |