aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/outofflowmgr.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index 2e6171ad..a924d107 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -2052,9 +2052,30 @@ int OutOfFlowMgr::getFloatHeight (Textblock *textblock, Side side, int y, int h,
float on the respective side. */
Float *vloat = list->get(first);
+ int yRelToFloat;
+
+ if (vloat->generatingBlock == textblock) {
+ yRelToFloat = y - vloat->yReal;
+ DBG_OBJ_MSGF ("border", 1, "caller is CB: yRelToFloat = %d - %d = %d",
+ y, vloat->yReal, yRelToFloat);
+ } else {
+ // The respective widgets are allocated; otherwise, hasFloat() would have
+ // returned false.
+ assert (wasAllocated (textblock));
+ assert (vloat->getWidget()->wasAllocated ());
+
+ Allocation *tba = getAllocation(textblock),
+ *fla = vloat->getWidget()->getAllocation ();
+ yRelToFloat = y + fla->y - tba->y;
+
+ DBG_OBJ_MSGF ("border", 1,
+ "caller is not CB: yRelToFloat = %d + %d - %d = %d",
+ y, fla->y, tba->y, yRelToFloat);
+ }
+
ensureFloatSize (vloat);
- int height = vloat->size.ascent + vloat->size.descent + vloat->yReal - y;
-
+ int height = vloat->size.ascent + vloat->size.descent + yRelToFloat;
+
DBG_OBJ_MSGF ("border", 1, "=> %d", height);
DBG_OBJ_LEAVE ();
return height;