aboutsummaryrefslogtreecommitdiff
path: root/dw/ooffloatsmgr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dw/ooffloatsmgr.cc')
-rw-r--r--dw/ooffloatsmgr.cc39
1 files changed, 27 insertions, 12 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index 0553e25d..4025ab77 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -1930,27 +1930,42 @@ void OOFFloatsMgr::getFloatsExtremes (Extremes *cbExtr, Side side,
DBG_OBJ_MSGF ("resize.oofm", 1,
"float %p has generator %p (container is %p)",
vloat->getWidget (), vloat->generatingBlock,
- containingBlock);
-
+ container);
+
if (vloat->generatingBlock == container ||
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 == container)
- 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 - containerAllocation.x, gba->width,
- vloat->generatingBlock->getLineBreakWidth ());
+ Allocation *gba = getAllocation (vloat->generatingBlock);
+ *maxWidth =
+ max (*maxWidth,
+ extr.maxWidth
+ + vloat->generatingBlock->getStyle()->boxDiffWidth()
+ + max (containerAllocation.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