From 8fd012cc0ebc43cd2890a6ea0cb66104d55f823f Mon Sep 17 00:00:00 2001 From: Jorge Arellano Cid Date: Thu, 4 Aug 2016 10:12:09 -0400 Subject: Revert commit #4651 Introduces regressions: .-------.--------.------.-----------.-----------------------.-----.-----. | | BTG | test | pravda.ru | 4ta.html | VT | PV | | | render | t.* | #1 | #2 | Girl | footb. | horos.| | | |-------|--------|------|-----------|-----------------------|-----|-----| |d4594 | ok | ok | x a | x b | x c | ok | x d | x i | x k | '-----------------------------------------------------------------------' Note: patch #4594 is the same as patch #4651. (we use d4594 to avoid side effects from other patches). Check this testsuite [1] for more details. [1] http://www.dillo.org/test/4648/test-suite.v1.txt --- dw/ooffloatsmgr.cc | 68 ++++++++++++++++++++++++++++++------------------------ dw/ooffloatsmgr.hh | 2 +- 2 files changed, 39 insertions(+), 31 deletions(-) (limited to 'dw') diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index 5e6570fa..4f16ae42 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -338,8 +338,8 @@ OOFFloatsMgr::OOFFloatsMgr (OOFAwareWidget *container, int oofmIndex) leftFloatsMark = rightFloatsMark = 0; lastLeftTBIndex = lastRightTBIndex = 0; - floatRef = -1; - DBG_OBJ_SET_NUM ("floatRef", floatRef); + SizeChanged = true; + DBG_OBJ_SET_BOOL ("SizeChanged", SizeChanged); containerAllocation = *(container->getAllocation()); @@ -630,43 +630,51 @@ OOFFloatsMgr::Float *OOFFloatsMgr::findFloatByWidget (Widget *widget) return vloat; } +/* + * Currently this is a compound recursion for textblocks: + * markSizeChange -> updateReference -> queueResize -> markSizeChange + * One way to see it is as a widget tree coverage problem. i.e. to cover all + * the nodes that need a resize when a float changes its size. + * The coverage logic of it is shared between resize code and mark code (here). + * + * This implementation works for all the test cases so far. It relies on the + * fact that Widget::queueResize should be called whenever a widget changes its + * size. When "SizeChanged" is true, we notify the parent, when not, just the + * following textblocks. + */ void OOFFloatsMgr::markSizeChange (int ref) { DBG_OBJ_ENTER ("resize.oofm", 0, "markSizeChange", "%d", ref); - // 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 - } + // When "SizeChanged" is true, we know this float changed its size. + // This helps to prune redundant passes. + // "SizeChanged" is set by getSize(), which is called by sizeRequest(). - vloat->dirty = true; - DBG_OBJ_SET_BOOL_O (vloat->getWidget (), ".dirty", vloat->dirty); + SortedFloatsVector *list; + list = isSubRefLeftFloat(ref) ? leftFloats : rightFloats; + Float *vloat = list->get (getFloatIndexFromSubRef (ref)); - assert (vloat->getWidget()->getWidgetReference() != NULL); - - int first = getOOFAwareWidget(vloat->generator)->index; - DBG_OBJ_MSGF ("resize.oofm", 1, "updating from %d", first); - + vloat->dirty = true; + DBG_OBJ_SET_BOOL_O (vloat->getWidget (), ".dirty", vloat->dirty); + + assert (vloat->getWidget()->getWidgetReference() != NULL); + + int first = getOOFAwareWidget(vloat->generator)->index; + DBG_OBJ_MSGF ("resize.oofm", 1, "updating from %d", first); + + //printf("IN markSizeChange %p ref %d SzCh=%d\n", this, ref, + // (int)SizeChanged); + + if (SizeChanged) 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); - } + for (int i = first + 1; i < tbInfos->size(); i++) + tbInfos->get(i)->getOOFAwareWidget()->updateReference(0); + + SizeChanged = false; // Done. + DBG_OBJ_SET_BOOL ("SizeChanged", SizeChanged); DBG_OBJ_LEAVE (); } @@ -921,7 +929,7 @@ void OOFFloatsMgr::getSize (Requisition *cbReq, int *oofWidth, int *oofHeight) *oofHeight = max (oofHeightLeft, oofHeightRight) + container->boxRestHeight (); - floatRef = -1; + SizeChanged = true; DBG_OBJ_SET_NUM ("floatRef", floatRef); DBG_OBJ_MSGF ("resize.oofm", 1, diff --git a/dw/ooffloatsmgr.hh b/dw/ooffloatsmgr.hh index fdc59fb4..d514d28b 100644 --- a/dw/ooffloatsmgr.hh +++ b/dw/ooffloatsmgr.hh @@ -165,7 +165,7 @@ private: TBInfo> *tbInfosByOOFAwareWidget; int lastLeftTBIndex, lastRightTBIndex, leftFloatsMark, rightFloatsMark; - int floatRef; + bool SizeChanged; void moveExternalIndices (lout::container::typed::Vector *list, int oldStartIndex, int diff); -- cgit v1.2.3