aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/outofflowmgr.cc106
-rw-r--r--dw/outofflowmgr.hh3
2 files changed, 22 insertions, 87 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index 67e38c63..d8df51a7 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -1491,95 +1491,33 @@ void OutOfFlowMgr::getFloatsExtremes (Side side, int *minWidth, int *maxWidth)
for (int i = 0; i < list->size(); i++) {
Float *vloat = list->get(i);
- int minBorderDiff = getMinBorderDiff (vloat, side);
- int maxBorderDiff = getMaxBorderDiff (vloat, side);
- Extremes extr;
- vloat->getWidget()->getExtremes (&extr);
-
- DBG_OBJ_MSGF ("resize", 1, "float %p: (%d + %d) / (%d + %d)",
- vloat->getWidget(), extr.minWidth, minBorderDiff,
- extr.maxWidth, maxBorderDiff);
-
-
- *minWidth = max (*minWidth, extr.minWidth + minBorderDiff);
- *maxWidth = max (*maxWidth, extr.maxWidth + maxBorderDiff);
-
- DBG_OBJ_MSGF ("resize", 1, "=> %d / %d", *minWidth, *maxWidth);
- }
+ if (wasAllocated (vloat->generatingBlock)) {
+ Extremes extr;
+ vloat->getWidget()->getExtremes (&extr);
+ Allocation *gba = getAllocation(vloat->generatingBlock);
+ int leftDiff = gba->x - containingBlockAllocation.x;
+ int rightDiff =
+ (containingBlockAllocation.x + containingBlockAllocation.width)
+ - (gba->x - gba->width);
- DBG_OBJ_MSG_END ();
-}
+ // TODO: Or zero (instead of rightDiff) for right floats?
+ *minWidth = max (*minWidth,
+ extr.minWidth + side == LEFT ? leftDiff : rightDiff);
+ *maxWidth = max (*maxWidth, extr.maxWidth + leftDiff + rightDiff);
-/**
- * Minimal difference between generating block and to containing
- * block, Greater or equal than 0, so dealing with 0 when it cannot
- * yet be calculated is safe. (No distiction whether it is defined or
- * not is necessary.)
- */
-int OutOfFlowMgr::getMinBorderDiff (Float *vloat, Side side)
-{
- if (vloat->generatingBlock == containingBlock)
- // Simplest case: the generator is the container.
- // Since the way, how left and right floats are positioned when
- // there is not much space, is not symmetric, the *minimal* value
- // considered for the margin/border/padding of the generating block
- // is *zero* for floats on the right.
- return
- side == LEFT ? vloat->generatingBlock->getStyle()->boxOffsetX() : 0;
- else {
- if (wasAllocated (containingBlock)) {
- if (wasAllocated (vloat->generatingBlock)) {
- // Simple case: both containing block and generating block
- // are defined.
- Allocation *gba = getAllocation(vloat->generatingBlock);
- Allocation *cba = getAllocation(containingBlock);
- if (side == LEFT)
- return gba->x - cba->x +
- vloat->generatingBlock->getStyle()->boxOffsetX();
- else
- // For margin/border/padding see comment above. Also,
- // in the worst case, the float can take the whole CB
- // (not GB!) width. Therefore:
- return 0;
- } else
- // Generating block not yet allocation; the next
- // allocation will, when necessary, trigger
- // getExtremes. (TODO: Is this really the case?)
- return 0;
+ DBG_OBJ_MSGF ("resize.oofm", 1,
+ "considering float %p generated by %p: (%d, %d / %d, %d)"
+ " => %d / %d",
+ vloat->getWidget (), vloat->generatingBlock,
+ leftDiff, extr.minWidth, extr.maxWidth, rightDiff,
+ *minWidth, *maxWidth);
} else
- // Nothing can be done now, but the next allocation will
- // trigger getExtremes. (TODO: Is this really the case?)
- return 0;
+ DBG_OBJ_MSGF ("resize.oofm", 1,
+ "considering float %p generated by %p: not allocated",
+ vloat->getWidget (), vloat->generatingBlock);
}
-}
-/**
- * Maximal difference between generating block and to containing
- * block, i. e. sum on both sides.
- */
-int OutOfFlowMgr::getMaxBorderDiff (Float *vloat, Side side)
-{
- if (vloat->generatingBlock == containingBlock)
- // Simplest case: the generator is the container.
- return vloat->generatingBlock->getStyle()->boxDiffWidth();
- else {
- if (wasAllocated (containingBlock)) {
- if (wasAllocated (vloat->generatingBlock))
- // Simple case: both containing block and generating block
- // are defined.
- return getAllocation(containingBlock)->width -
- getAllocation(vloat->generatingBlock)->width +
- vloat->generatingBlock->getStyle()->boxDiffWidth();
- else
- // Generating block not yet allocation; the next
- // allocation will, when necessary, trigger
- // getExtremes. (TODO: Is this really the case?)
- return 0;
- } else
- // Nothing can be done now, but the next allocation will
- // trigger getExtremes. (TODO: Is this really the case?)
- return 0;
- }
+ DBG_OBJ_MSG_END ();
}
OutOfFlowMgr::TBInfo *OutOfFlowMgr::getTextblock (Textblock *textblock)
diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh
index 018c8d87..88e3afb4 100644
--- a/dw/outofflowmgr.hh
+++ b/dw/outofflowmgr.hh
@@ -275,9 +275,6 @@ private:
void getFloatsSize (Side side, int *width, int *height);
void getFloatsExtremes (Side side, int *minWidth, int *maxWidth);
- int getMinBorderDiff (Float *vloat, Side side);
- int getMaxBorderDiff (Float *vloat, Side side);
-
TBInfo *getTextblock (Textblock *textblock);
int getBorder (Textblock *textblock, Side side, int y, int h,
Textblock *lastGB, int lastExtIndex);