aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
Diffstat (limited to 'dw')
-rw-r--r--dw/ooffloatsmgr.cc56
-rw-r--r--dw/ooffloatsmgr.hh1
-rw-r--r--dw/textblock.cc13
3 files changed, 37 insertions, 33 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index 84b2f6ff..0d701b0b 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -340,6 +340,9 @@ OOFFloatsMgr::OOFFloatsMgr (OOFAwareWidget *container, int oofmIndex)
leftFloatsMark = rightFloatsMark = 0;
lastLeftTBIndex = lastRightTBIndex = 0;
+ floatRef = -1;
+ DBG_OBJ_SET_NUM ("floatRef", floatRef);
+
containerAllocation = *(container->getAllocation());
addWidgetInFlow (this->container, NULL, 0);
@@ -633,32 +636,40 @@ void OOFFloatsMgr::markSizeChange (int ref)
{
DBG_OBJ_ENTER ("resize.oofm", 0, "markSizeChange", "%d", ref);
- Float *vloat;
+ // We implement "incremental resizing" (kind of), by remembering the largest
+ // value for "ref", in "floatRef". It is reset again in getSize(), which is
+ // called by sizeRequest().
+ if (floatRef == -1 || ref > floatRef) {
+ Float *vloat;
- if (isSubRefLeftFloat (ref))
- vloat = leftFloats->get (getFloatIndexFromSubRef (ref));
- else if (isSubRefRightFloat (ref))
- vloat = rightFloats->get (getFloatIndexFromSubRef (ref));
- else {
- assertNotReached();
- vloat = NULL; // compiler happiness
- }
+ if (isSubRefLeftFloat (ref))
+ vloat = leftFloats->get (getFloatIndexFromSubRef (ref));
+ else if (isSubRefRightFloat (ref))
+ vloat = rightFloats->get (getFloatIndexFromSubRef (ref));
+ else {
+ assertNotReached();
+ vloat = NULL; // compiler happiness
+ }
- vloat->dirty = true;
- DBG_OBJ_SET_BOOL_O (vloat->getWidget (), "<Float>.dirty", vloat->dirty);
+ vloat->dirty = true;
+ DBG_OBJ_SET_BOOL_O (vloat->getWidget (), "<Float>.dirty", vloat->dirty);
- assert (vloat->getWidget()->getWidgetReference() != NULL);
+ assert (vloat->getWidget()->getWidgetReference() != NULL);
- int first = getOOFAwareWidget(vloat->generator)->index;
- DBG_OBJ_MSGF ("resize.oofm", 1, "updating from %d", first);
-
- tbInfos->get(first)->getOOFAwareWidget()
- ->updateReference (vloat->getWidget()->getWidgetReference()
- ->parentRef);
-
- for (int i = first + 1; i < tbInfos->size(); i++)
- tbInfos->get(i)->getOOFAwareWidget()->updateReference(0);
+ int first = getOOFAwareWidget(vloat->generator)->index;
+ DBG_OBJ_MSGF ("resize.oofm", 1, "updating from %d", first);
+
+ tbInfos->get(first)->getOOFAwareWidget()
+ ->updateReference (vloat->getWidget()->getWidgetReference()
+ ->parentRef);
+
+ for (int i = first + 1; i < tbInfos->size(); i++)
+ tbInfos->get(i)->getOOFAwareWidget()->updateReference(0);
+ floatRef = ref;
+ DBG_OBJ_SET_NUM ("floatRef", floatRef);
+ }
+
DBG_OBJ_LEAVE ();
}
@@ -925,6 +936,9 @@ void OOFFloatsMgr::getSize (Requisition *cbReq, int *oofWidth, int *oofHeight)
*oofHeight =
max (oofHeightLeft, oofHeightRight) + container->boxRestHeight ();
+ floatRef = -1;
+ DBG_OBJ_SET_NUM ("floatRef", floatRef);
+
DBG_OBJ_MSGF ("resize.oofm", 1,
"=> (l: %d, r: %d => %d) * (l: %d, r: %d => %d)",
oofWidthtLeft, oofWidthRight, *oofWidth, oofHeightLeft,
diff --git a/dw/ooffloatsmgr.hh b/dw/ooffloatsmgr.hh
index 87cdc866..c342f4a7 100644
--- a/dw/ooffloatsmgr.hh
+++ b/dw/ooffloatsmgr.hh
@@ -164,6 +164,7 @@ private:
TBInfo> *tbInfosByOOFAwareWidget;
int lastLeftTBIndex, lastRightTBIndex, leftFloatsMark, rightFloatsMark;
+ int floatRef;
void moveExternalIndices (lout::container::typed::Vector<Float> *list,
int oldStartIndex, int diff);
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 700c748b..f0bfb3d8 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -3035,18 +3035,7 @@ void Textblock::queueDrawRange (int index1, int index2)
void Textblock::updateReference (int ref)
{
- // The condition "(lines->size () > 0)" prevents CPU hogging in some cases,
- // see devdoc/dw-miscellaneous.doc, "Relation between
- // dw::core::Widget::markSizeChange and dw::core::Widget::queueResize".
- //
- // This condition is safe, since an implementation of
- // dw::oof::OOFAwareWidget::updateReference should only affect content in
- // flow, not widgets out of flow, like floats.
-
- if (lines->size () > 0)
- queueResize (ref, false);
-
- // TODO: "if (words->size () > 0)" has to be considered.
+ queueResize (ref, false);
}
void Textblock::widgetRefSizeChanged (int externalIndex)