diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/outofflowmgr.cc | 36 | ||||
-rw-r--r-- | dw/outofflowmgr.hh | 2 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 7 |
3 files changed, 30 insertions, 15 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 1e3067d7..2cbf5e9c 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -1364,19 +1364,25 @@ bool OutOfFlowMgr::hasFloat (Textblock *textblock, Side side, int y, int h, return list->findFirst (textblock, y, h, lastGB, lastExtIndex) != -1; } -int OutOfFlowMgr::getClearPosition (Textblock *tb, core::style::ClearType clear) -{ - bool left = false, right = false; - switch (clear) { - case core::style::CLEAR_NONE: break; - case core::style::CLEAR_LEFT: left = true; break; - case core::style::CLEAR_RIGHT: right = true; break; - case core::style::CLEAR_BOTH: left = right = true; break; - default: assertNotReached (); - } - - return max (left ? getClearPosition (tb, LEFT) : 0, - right ? getClearPosition (tb, RIGHT) : 0); +/** + * Returns position relative to the textblock "tb". + */ +int OutOfFlowMgr::getClearPosition (Textblock *tb) +{ + if (tb->getStyle()) { + bool left = false, right = false; + switch (tb->getStyle()->clear) { + case core::style::CLEAR_NONE: break; + case core::style::CLEAR_LEFT: left = true; break; + case core::style::CLEAR_RIGHT: right = true; break; + case core::style::CLEAR_BOTH: left = right = true; break; + default: assertNotReached (); + } + + return max (left ? getClearPosition (tb, LEFT) : 0, + right ? getClearPosition (tb, RIGHT) : 0); + } else + return 0; } int OutOfFlowMgr::getClearPosition (Textblock *tb, Side side) @@ -1404,7 +1410,9 @@ int OutOfFlowMgr::getClearPosition (Textblock *tb, Side side) vloat = list->get(i); ensureFloatSize (vloat); - return vloat->yReal + vloat->size.ascent + vloat->size.descent; + return + vloat->yReal + vloat->size.ascent + vloat->size.descent - + getAllocation(tb)->y; } void OutOfFlowMgr::ensureFloatSize (Float *vloat) diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh index a97af4b9..69f39471 100644 --- a/dw/outofflowmgr.hh +++ b/dw/outofflowmgr.hh @@ -342,7 +342,7 @@ public: bool hasFloatRight (Textblock *textblock, int y, int h, Textblock *lastGB, int lastExtIndex); - int getClearPosition (Textblock *tb, core::style::ClearType clear); + int getClearPosition (Textblock *tb); inline static bool isRefOutOfFlow (int ref) { return ref != -1 && (ref & 1) != 0; } diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 3f06cb6d..328dd448 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -1438,6 +1438,13 @@ void Textblock::initNewLine () // method is called, containingBlock is not yet defined. if (containingBlock && containingBlock->outOfFlowMgr) { + if (lines->size () == 0) { + int clearPosition = + containingBlock->outOfFlowMgr->getClearPosition (this); + printf ("%p: %d -> %d\n", this, getStyle()->clear, clearPosition); + verticalOffset = misc::max (clearPosition, 0); + } + int y = topOfPossiblyMissingLine (lines->size ()); int h = heightOfPossiblyMissingLine (lines->size ()); int lastRef = lines->size() > 0 ? lines->getLastRef()->lastWord : -1; |