diff options
author | Sebastian Geerken <devnull@localhost> | 2015-01-03 13:38:20 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2015-01-03 13:38:20 +0100 |
commit | dd13476e56f8e629ef5510920f09bc0d54c421be (patch) | |
tree | 9dbdf15247e0ca500a1419d19ee7a31ad350500d | |
parent | 42ace21a7e1299acca7883f249247e3dd56d5724 (diff) |
Floats: work on extremes.
-rw-r--r-- | dw/outofflowmgr.cc | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 251a25f0..2f7a4243 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -1880,26 +1880,41 @@ void OutOfFlowMgr::getFloatsExtremes (Extremes *cbExtr, Side side, "float %p has generator %p (container is %p)", vloat->getWidget (), vloat->generatingBlock, containingBlock); - + if (vloat->generatingBlock == containingBlock || wasAllocated (vloat->generatingBlock)) { Extremes extr; vloat->getWidget()->getExtremes (&extr); - int x; + + // The calculation of extremes must be kept consistent with + // getSize(). Especially this means for the *minimal* width: + // + // - The right border (difference between float and + // container) does not have to be considered (see + // getSize()). + // + // - This is also the case for the left border, as seen in + // calcFloatX() ("... but when the float exceeds the line + // break width" ...). + + *minWidth = max (*minWidth, extr.minWidth); + // For the maximal width, borders must be considered. + if (vloat->generatingBlock == containingBlock) - x = side == LEFT ? - vloat->generatingBlock->getStyle()->boxOffsetX() : 0; + *maxWidth = + max (*maxWidth, + extr.maxWidth + + vloat->generatingBlock->getStyle()->boxDiffWidth()); else { - Allocation *gba = getAllocation(vloat->generatingBlock); - x = calcFloatX (vloat, side, - gba->x - containingBlockAllocation.x, gba->width, - vloat->generatingBlock->getLineBreakWidth ()); + Allocation *gba = getAllocation (vloat->generatingBlock); + *maxWidth = + max (*maxWidth, + extr.maxWidth + + vloat->generatingBlock->getStyle()->boxDiffWidth() + + max (containingBlockAllocation.width - gba->width, 0)); } - *minWidth = max (*minWidth, x + extr.minWidth); - *maxWidth = max (*maxWidth, x + extr.maxWidth); - DBG_OBJ_MSGF ("resize.oofm", 1, "%d + %d / %d => %d * %d", x, extr.minWidth, extr.maxWidth, *minWidth, *maxWidth); } else |