aboutsummaryrefslogtreecommitdiff
path: root/dw/outofflowmgr.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-05-01 21:19:22 +0200
committerSebastian Geerken <devnull@localhost>2014-05-01 21:19:22 +0200
commit413e63c3527d29d9a762a56a076ec55f244ebb57 (patch)
tree78da6d3cd033ba81a0d168b26147ff7a9242c2d2 /dw/outofflowmgr.cc
parent8afd0e5a02887e72fb2c947c074fb499658af95f (diff)
Fixed OutOfFlowMgr::getClearPosition(Textblock*, Side), and so an endless resize cycle.
Diffstat (limited to 'dw/outofflowmgr.cc')
-rw-r--r--dw/outofflowmgr.cc63
1 files changed, 41 insertions, 22 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index dd462caf..57e6fd09 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -1935,6 +1935,11 @@ bool OutOfFlowMgr::hasFloat (Textblock *textblock, Side side, int y, int h,
*/
int OutOfFlowMgr::getClearPosition (Textblock *tb)
{
+ DBG_OBJ_MSGF ("resize.oofm", 0, "<b>getClearPosition</b> (%p)", tb);
+ DBG_OBJ_MSG_START ();
+
+ int pos;
+
if (tb->getStyle()) {
bool left = false, right = false;
switch (tb->getStyle()->clear) {
@@ -1945,40 +1950,54 @@ int OutOfFlowMgr::getClearPosition (Textblock *tb)
default: assertNotReached ();
}
- return max (left ? getClearPosition (tb, LEFT) : 0,
- right ? getClearPosition (tb, RIGHT) : 0);
+ pos = max (left ? getClearPosition (tb, LEFT) : 0,
+ right ? getClearPosition (tb, RIGHT) : 0);
} else
- return 0;
+ pos = 0;
+
+ DBG_OBJ_MSGF ("resize.oofm", 1, "=> %d", pos);
+ DBG_OBJ_MSG_END ();
+
+ return pos;
}
int OutOfFlowMgr::getClearPosition (Textblock *tb, Side side)
{
+ DBG_OBJ_MSGF ("resize.oofm", 0, "<b>getClearPosition</b> (%p, %s)",
+ tb, side == LEFT ? "LEFT" : "RIGHT");
+ DBG_OBJ_MSG_START ();
+
+ int pos;
+
if (!wasAllocated (tb))
// There is no relation yet to floats generated by other
// textblocks, and this textblocks floats are unimportant for
// the "clear" property.
- return 0;
-
- SortedFloatsVector *list = side == LEFT ? leftFloatsCB : rightFloatsCB;
+ pos = 0;
+ else {
+ SortedFloatsVector *list = side == LEFT ? leftFloatsCB : rightFloatsCB;
- int i = list->findFloatIndex (tb, 0);
- if (i < 0)
- return 0;
+ // Search the last float before (therfore -1) this textblock.
+ int i = list->findFloatIndex (tb, -1);
+ if (i < 0) {
+ pos = 0;
+ DBG_OBJ_MSG ("resize.oofm", 1, "no float");
+ } else {
+ Float *vloat = list->get(i);
+ assert (vloat->generatingBlock != tb);
+ ensureFloatSize (vloat);
+ pos = vloat->yReal + vloat->size.ascent + vloat->size.descent -
+ getAllocation(tb)->y;
+ DBG_OBJ_MSGF ("resize.oofm", 1, "float %p => %d + (%d + %d) - %d",
+ vloat->getWidget (), vloat->yReal, vloat->size.ascent,
+ vloat->size.descent, getAllocation(tb)->y);
+ }
+ }
- Float *vloat = list->get(i);
- // We pass this texblock and 0 (first word, or smallest external
- // index, respectively), but search for the last float before this
- // position. Therefore this check.
- if (vloat->generatingBlock== tb)
- i--;
- if (i < 0)
- return 0;
+ DBG_OBJ_MSGF ("resize.oofm", 1, "=> %d", pos);
+ DBG_OBJ_MSG_END ();
- vloat = list->get(i);
- ensureFloatSize (vloat);
- return
- vloat->yReal + vloat->size.ascent + vloat->size.descent -
- getAllocation(tb)->y;
+ return pos;
}
void OutOfFlowMgr::ensureFloatSize (Float *vloat)