aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/outofflowmgr.cc28
-rw-r--r--dw/outofflowmgr.hh2
-rw-r--r--dw/textblock.hh1
3 files changed, 30 insertions, 1 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index da5a6e0b..be556378 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -558,6 +558,11 @@ void OutOfFlowMgr::sizeAllocateEnd ()
for (int i = 0; i < rightFloatsCB->size(); i++)
rightFloatsCB->get(i)->updateAllocation ();
+ // There are cases where some allocated floats (TODO: later also absolutely
+ // positioned elements) exceed the CB allocation.
+ if (doFloatsExceedCB (LEFT) || doFloatsExceedCB (RIGHT))
+ containingBlock->oofSizeChanged ();
+
DBG_OBJ_MSG_END ();
}
@@ -809,6 +814,27 @@ bool OutOfFlowMgr::hasRelationChanged (bool oldTBAlloc,
return result;
}
+bool OutOfFlowMgr::doFloatsExceedCB (Side side)
+{
+ SortedFloatsVector *list = side == LEFT ? leftFloatsCB : rightFloatsCB;
+ bool exceeds = false;
+
+ for (int i = 0; i < list->size () && !exceeds; i++) {
+ Float *vloat = list->get (i);
+ if (vloat->getWidget()->wasAllocated ()) {
+ Allocation *fla = vloat->getWidget()->getAllocation ();
+ if (fla->x + fla->width >
+ containingBlockAllocation.x + containingBlockAllocation.width ||
+ fla->y + fla->ascent + fla->descent >
+ containingBlockAllocation.y + containingBlockAllocation.ascent
+ + containingBlockAllocation.descent)
+ exceeds = true;
+ }
+ }
+
+ return exceeds;
+}
+
void OutOfFlowMgr::moveFromGBToCB (Side side)
{
SortedFloatsVector *dest = side == LEFT ? leftFloatsCB : rightFloatsCB;
@@ -821,7 +847,7 @@ void OutOfFlowMgr::moveFromGBToCB (Side side)
SortedFloatsVector *src =
side == LEFT ? tbInfo->leftFloatsGB : tbInfo->rightFloatsGB;
for (int i = 0; i < src->size (); i++) {
- Float *vloat = src->get(i);
+ Float *vloat = src->get (i);
if (!vloat->inCBList && vloat->mark == mark) {
dest->put (vloat);
//printf("[%p] moving %s float %p (%s %p, mark %d) to CB list\n",
diff --git a/dw/outofflowmgr.hh b/dw/outofflowmgr.hh
index fdd985e3..dcd25dd5 100644
--- a/dw/outofflowmgr.hh
+++ b/dw/outofflowmgr.hh
@@ -256,6 +256,8 @@ private:
int newFlx, int newFly, int newFlw, int newFlh,
Side side, int *floatPos);
+ bool doFloatsExceedCB (Side side);
+
void drawFloats (SortedFloatsVector *list, core::View *view,
core::Rectangle *area);
void drawAbsolutelyPositioned (core::View *view, core::Rectangle *area);
diff --git a/dw/textblock.hh b/dw/textblock.hh
index a56816ec..d68974c5 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -775,6 +775,7 @@ public:
bool includeFirstSpace, bool includeLastSpace);
void borderChanged (int y, core::Widget *vloat);
+ inline void oofSizeChanged () { queueResize (-1, false); }
inline int getAvailWidth () { return availWidth; }
inline int getAvailAscent () { return availAscent; }
inline int getAvailDescent () { return availDescent; }