diff options
Diffstat (limited to 'dw/outofflowmgr.cc')
-rw-r--r-- | dw/outofflowmgr.cc | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index f97ec5f9..67e38c63 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -1426,55 +1426,29 @@ void OutOfFlowMgr::getFloatsSize (Side side, int *width, int *height) for (int i = 0; i < list->size(); i++) { Float *vloat = list->get(i); - - if (vloat->generatingBlock == containingBlock) { - ensureFloatSize (vloat); - *width = max (*width, - vloat->size.width + side == LEFT ? - containingBlock->getStyle()->boxOffsetX () : - containingBlock->getStyle()->boxRestWidth ()); - *height = - max (*height, - vloat->yReal + vloat->size.ascent + vloat->size.descent - + containingBlock->getStyle()->boxRestHeight ()); + if (wasAllocated (vloat->generatingBlock)) { + ensureFloatSize (vloat); + Allocation *gba = getAllocation(vloat->generatingBlock); + int x = calcFloatX (vloat, side, + gba->x - containingBlockAllocation.x, gba->width, + vloat->generatingBlock->getAvailWidth ()); + int y = gba->y - containingBlockAllocation.y + vloat->yReal; + + *width = max (*width, x + vloat->size.width); + *height = max (*height, y + vloat->size.ascent + vloat->size.descent); DBG_OBJ_MSGF ("resize.oofm", 1, - "considering float %p generated by CB: (%d + %d) * " - "(%d + (%d + %d) + %d) => %d * %d", - vloat->getWidget (), vloat->size.width, - side == LEFT ? - containingBlock->getStyle()->boxOffsetX () : - containingBlock->getStyle()->boxRestWidth (), - vloat->yReal, vloat->size.ascent, vloat->size.descent, - containingBlock->getStyle()->boxRestHeight (), + "considering float %p generated by %p: (%d + %d) * " + "(%d + (%d + %d)) => %d * %d", + vloat->getWidget (), vloat->generatingBlock, + x, vloat->size.width, + y, vloat->size.ascent, vloat->size.descent, *width, *height); - } else { - // The GB must be allocated, but the float may not yet be allocated; - // it is ignored in this case. - assert (wasAllocated (vloat->generatingBlock)); - DBG_OBJ_MSGF ("resize.oofm", 1, "considering float %p generated by %p", + } else + DBG_OBJ_MSGF ("resize.oofm", 1, + "considering float %p generated by %p: not allocated", vloat->getWidget (), vloat->generatingBlock); - - if (vloat->getWidget()->wasAllocated ()) { - Allocation *fla = vloat->getWidget()->getAllocation (); - *width = max (*width, - fla->x - containingBlockAllocation.x + fla->width); - *height = max (*height, - fla->y - containingBlockAllocation.y - + fla->ascent + fla->descent - + containingBlock->getStyle()->boxRestHeight ()); - - DBG_OBJ_MSGF ("resize.oofm", 1, "... (%d - %d + %d) * " - "(%d - %d + (%d + %d) + %d) => %d * %d", - fla->x, containingBlockAllocation.x, fla->width, - fla->y, containingBlockAllocation.y, - fla->ascent, fla->descent, - containingBlock->getStyle()->boxRestHeight (), - *width, *height); - } else - DBG_OBJ_MSG ("resize.oofm", 1, "... not allocated"); - } } DBG_OBJ_MSG_END (); |