aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/ooffloatsmgr.cc20
-rw-r--r--dw/textblock.cc8
2 files changed, 20 insertions, 8 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index cce69718..655fa743 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -2206,12 +2206,20 @@ int OOFFloatsMgr::getClearPosition (OOFAwareWidget *textblock, Side side)
} else {
Float *vloat = list->get(i);
assert (vloat->generatingBlock != textblock);
- ensureFloatSize (vloat);
- pos = vloat->yReal + vloat->size.ascent + vloat->size.descent -
- getAllocation(textblock)->y;
- DBG_OBJ_MSGF ("resize.oofm", 1, "float %p => %d + (%d + %d) - %d",
- vloat->getWidget (), vloat->yReal, vloat->size.ascent,
- vloat->size.descent, getAllocation(textblock)->y);
+ if (!wasAllocated (vloat->generatingBlock))
+ pos = 0; // See above.
+ else {
+ ensureFloatSize (vloat);
+ pos = getAllocation(vloat->generatingBlock)->y + vloat->yReal
+ + vloat->size.ascent + vloat->size.descent
+ - getAllocation(textblock)->y;
+ DBG_OBJ_MSGF ("resize.oofm", 1,
+ "float %p => %d + %d + (%d + %d) - %d",
+ vloat->getWidget (),
+ getAllocation(vloat->generatingBlock)->y,
+ vloat->yReal, vloat->size.ascent, vloat->size.descent,
+ getAllocation(textblock)->y);
+ }
}
}
diff --git a/dw/textblock.cc b/dw/textblock.cc
index b31cbfbd..5e5bd264 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -557,8 +557,12 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
for (lineIndex = 0; lineIndex < lines->size (); lineIndex++) {
// Especially for floats, allocation->width may be different
// from the line break width, so that for centered and right
- // text, the offsets have to be recalculated again.
- calcTextOffset (lineIndex, childBaseAllocation.width);
+ // text, the offsets have to be recalculated again. However, if
+ // the allocation width is greater than the line break width,
+ // due to wide unbreakable lines (large image etc.), use the
+ // original line break width.
+ calcTextOffset (lineIndex,
+ misc::min (childBaseAllocation.width, lineBreakWidth));
line = lines->getRef (lineIndex);
xCursor = line->textOffset;