aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-07-05 00:03:56 +0200
committerSebastian Geerken <devnull@localhost>2013-07-05 00:03:56 +0200
commit5115c6b711cd1b85f2115aafd0d86976709f3d47 (patch)
treea56e409c7b4b752d2ebb332dcf664528f3209f6b
parent2241c9cbc86185697bbfd25b451ef4e9881f28ac (diff)
Relative float sizes are now (halfway) correctly recalculated.
-rw-r--r--dw/outofflowmgr.cc8
-rw-r--r--dw/outofflowmgr.hh3
2 files changed, 10 insertions, 1 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index 615f6efe..c952be84 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -1299,7 +1299,12 @@ bool OutOfFlowMgr::hasFloat (Textblock *textblock, Side side, int y, int h,
void OutOfFlowMgr::ensureFloatSize (Float *vloat)
{
- if (vloat->dirty) {
+ if (vloat->dirty ||
+ // If the size of the containing block has changed (represented
+ // currently by the available width), a recalculation of a
+ // relative float width may also be necessary.
+ (isPerLength (vloat->widget->getStyle()->width) &&
+ vloat->cbAvailWidth != containingBlock->getAvailWidth ())) {
// TODO Ugly. Soon to be replaced by cleaner code? See also
// comment in Textblock::calcWidgetSize.
if (vloat->widget->usesHints ()) {
@@ -1353,6 +1358,7 @@ void OutOfFlowMgr::ensureFloatSize (Float *vloat)
// vloat, vloat->widget->getClassName(), vloat->widget,
// vloat->size.width, vloat->size.ascent, vloat->size.descent);
+ vloat->cbAvailWidth = containingBlock->getAvailWidth ();
vloat->dirty = false;
}
}
diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh
index 67edcbd5..716c7d36 100644
--- a/dw/outofflowmgr.hh
+++ b/dw/outofflowmgr.hh
@@ -59,6 +59,9 @@ private:
TBInfo::*FloatsGB. */
int sideSpanningIndex, mark;
core::Requisition size;
+ int cbAvailWidth; /* On which the calculation of relative sizes
+ is based. Height not yet used, and probably
+ not added before size redesign. */
bool dirty;
bool inCBList; /* Neccessary to prevent floats from being moved
twice from GB to CB list. */