diff options
author | Sebastian Geerken <devnull@localhost> | 2014-03-07 14:16:01 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-03-07 14:16:01 +0100 |
commit | 849689acf0da4e68fcaf98b203c587c6412e7782 (patch) | |
tree | f5bebbeba4d34fe9903ee31a9a18fc0a31ffce74 /dw | |
parent | c83427057a2f189cc8b237cfd35153d0f4ec6ae6 (diff) |
Some cleanup and normalization.
Diffstat (limited to 'dw')
-rw-r--r-- | dw/outofflowmgr.cc | 48 | ||||
-rw-r--r-- | dw/outofflowmgr.hh | 5 |
2 files changed, 36 insertions, 17 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index f3a89ef2..a307ebcc 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -1483,16 +1483,33 @@ void OutOfFlowMgr::getFloatsSize (Side side, int *width, int *height) void OutOfFlowMgr::getExtremes (int *oofMinWidth, int *oofMaxWidth) { - *oofMinWidth = *oofMaxWidth = 0; - accumExtremes (leftFloatsCB, LEFT, oofMinWidth, oofMaxWidth); - accumExtremes (rightFloatsCB, RIGHT, oofMinWidth, oofMaxWidth); - // TODO Absolutely positioned elements + DBG_OBJ_MSG ("resize.oofm", 0, "<b>getExtremes</b> ()"); + DBG_OBJ_MSG_START (); + + int oofMinWidthAbsPos, oofMaxWidthAbsPos; + getAbsolutelyPositionedExtremes (&oofMinWidthAbsPos, &oofMaxWidthAbsPos); + + int oofMinWidthtLeft, oofMinWidthRight, oofMaxWidthLeft, oofMaxWidthRight; + getFloatsExtremes (LEFT, &oofMinWidthtLeft, &oofMaxWidthLeft); + getFloatsExtremes (RIGHT, &oofMinWidthRight, &oofMaxWidthRight); + + *oofMinWidth = max (oofMinWidthtLeft, oofMinWidthRight, oofMinWidthAbsPos); + *oofMaxWidth = max (oofMaxWidthLeft, oofMaxWidthRight, oofMaxWidthAbsPos); + + DBG_OBJ_MSGF ("resize.oofm", 1, + "=> (a: %d, l: %d, r: %d => %d) * (a: %d, l: %d, r: %d => %d)", + oofMinWidthAbsPos, oofMinWidthtLeft, oofMinWidthRight, + *oofMinWidth, oofMaxWidthAbsPos, oofMaxWidthLeft, + oofMaxWidthRight, *oofMaxWidth); + DBG_OBJ_MSG_END (); } -void OutOfFlowMgr::accumExtremes (SortedFloatsVector *list, Side side, - int *oofMinWidth, int *oofMaxWidth) +void OutOfFlowMgr::getFloatsExtremes (Side side, int *minWidth, int *maxWidth) { // Idea for a faster implementation: use incremental resizing? + *minWidth = *maxWidth = 0; + + SortedFloatsVector *list = getFloatsListForTextblock (containingBlock, side); DBG_OBJ_MSGF ("resize", 0, "<b>accumExtremes</b> (..., %s, ...)", side == LEFT ? "LEFT" : "RIGHT"); @@ -1511,10 +1528,10 @@ void OutOfFlowMgr::accumExtremes (SortedFloatsVector *list, Side side, extr.maxWidth, maxBorderDiff); - *oofMinWidth = max (*oofMinWidth, extr.minWidth + minBorderDiff); - *oofMaxWidth = max (*oofMaxWidth, extr.maxWidth + maxBorderDiff); + *minWidth = max (*minWidth, extr.minWidth + minBorderDiff); + *maxWidth = max (*maxWidth, extr.maxWidth + maxBorderDiff); - DBG_OBJ_MSGF ("resize", 1, "=> %d / %d", *oofMinWidth, *oofMaxWidth); + DBG_OBJ_MSGF ("resize", 1, "=> %d / %d", *minWidth, *maxWidth); } DBG_OBJ_MSG_END (); @@ -1901,14 +1918,15 @@ void OutOfFlowMgr::ensureFloatSize (Float *vloat) void OutOfFlowMgr::getAbsolutelyPositionedSize (int *oofWidthAbsPos, int *oofHeightAbsPos) { + // TODO *oofWidthAbsPos = *oofHeightAbsPos = 0; +} - for (int i = 0; i < absolutelyPositioned->size(); i++) { - AbsolutelyPositioned *abspos = absolutelyPositioned->get (i); - ensureAbsolutelyPositionedSizeAndPosition (abspos); - *oofWidthAbsPos = max (*oofWidthAbsPos, abspos->xCB + abspos->width); - *oofHeightAbsPos = max (*oofHeightAbsPos, abspos->yCB + abspos->height); - } +void OutOfFlowMgr::getAbsolutelyPositionedExtremes (int *minWidth, + int *maxWidth) +{ + // TODO + *minWidth = *maxWidth = 0; } void OutOfFlowMgr::ensureAbsolutelyPositionedSizeAndPosition diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh index f33913ab..018c8d87 100644 --- a/dw/outofflowmgr.hh +++ b/dw/outofflowmgr.hh @@ -273,8 +273,8 @@ private: SortedFloatsVector **listOpp, Side *side); void getFloatsSize (Side side, int *width, int *height); - void accumExtremes (SortedFloatsVector *list, Side side, int *oofMinWidth, - int *oofMaxWidth); + void getFloatsExtremes (Side side, int *minWidth, int *maxWidth); + int getMinBorderDiff (Float *vloat, Side side); int getMaxBorderDiff (Float *vloat, Side side); @@ -293,6 +293,7 @@ private: void tellFloatPosition (core::Widget *widget, int yReq); void getAbsolutelyPositionedSize (int *oofWidthAbsPos, int *oofHeightAbsPos); + void getAbsolutelyPositionedExtremes (int *minWidth, int *maxWidth); void ensureAbsolutelyPositionedSizeAndPosition (AbsolutelyPositioned *abspos); int calcValueForAbsolutelyPositioned (AbsolutelyPositioned *abspos, |