# HG changeset patch # User Jorge Arellano Cid # Date 1470749035 14400 # Tue Aug 09 09:23:55 2016 -0400 # Node ID 9862ad8cc8f8ea1e9a25eaf9ecb2e8594ec8df98 # Parent 6bf4db806b570cb752b81ef24a794aacb1f4fb43 Merged commit #4653 (float clearance). Test case:
main
footer
Note: passes all the tests at http://www.dillo.org/test/4648/test-suite.v1.txt diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -657,6 +657,19 @@ vloat->dirty = true; DBG_OBJ_SET_BOOL_O (vloat->getWidget (), ".dirty", vloat->dirty); + updateGenerators (vloat); + + DBG_OBJ_LEAVE (); +} + +/** + * \brief Update all generators which are affected by a given float. + */ +void OOFFloatsMgr::updateGenerators (Float *vloat) +{ + DBG_OBJ_ENTER ("resize.oofm", 0, "updateGenerators", "#%d [%p]", + vloat->index, vloat->getWidget ()); + assert (vloat->getWidget()->getWidgetReference() != NULL); int first = getOOFAwareWidget(vloat->generator)->index; @@ -674,8 +687,7 @@ tbInfos->get(i)->getOOFAwareWidget()->updateReference(0); SizeChanged = false; // Done. - DBG_OBJ_SET_BOOL ("SizeChanged", SizeChanged); - + DBG_OBJ_LEAVE (); } @@ -749,6 +761,8 @@ getFloatsListsAndSide (vloat, &listSame, &listOpp, &side); ensureFloatSize (vloat); + int oldYReal = vloat->yReal; + // "yReal" may change due to collisions (see below). vloat->yReq = vloat->yReal = y; @@ -813,6 +827,25 @@ DBG_OBJ_MSGF ("resize.oofm", 1, "vloat->yReq = %d, vloat->yReal = %d", vloat->yReq, vloat->yReal); + // In some cases, an explicit update is neccessary, as in this example: + // + // + //
+ //
main
+ //
+ //
x
+ //
footer
+ // + // + // Without an explicit update, #c would keep an old value for extraSpace.top, + // based on the old value of vloat->yReal. + // + // Notice that #c would be updated otherwise, if it had at least one word + // content. + + if (vloat->yReal != oldYReal) + updateGenerators (vloat); + DBG_OBJ_LEAVE (); } diff --git a/dw/ooffloatsmgr.hh b/dw/ooffloatsmgr.hh --- a/dw/ooffloatsmgr.hh +++ b/dw/ooffloatsmgr.hh @@ -170,6 +170,7 @@ void moveExternalIndices (lout::container::typed::Vector *list, int oldStartIndex, int diff); Float *findFloatByWidget (core::Widget *widget); + void updateGenerators (Float *vloat); int findTBInfo (int y); void sizeAllocateFloats (Side side); diff --git a/dw/textblock.cc b/dw/textblock.cc --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -3044,8 +3044,14 @@ void Textblock::updateReference (int ref) { - if (words->size () > 0) + DBG_OBJ_ENTER ("resize", 0, "updateReference", "%d", ref); + + // Only `queueResize` when there're words or float clearance + // (float clearance may change `extraSpace.top`). + if (words->size () > 0 || getStyle()->clear != core::style::CLEAR_NONE) queueResize (ref, false); + + DBG_OBJ_LEAVE (); } void Textblock::widgetRefSizeChanged (int externalIndex)