diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2016-08-09 09:23:55 -0400 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2016-08-09 09:23:55 -0400 |
commit | 8c6caa83a1d686091bdf5668c4c6320ce191bb93 (patch) | |
tree | e243c906fa9db872713419df05c1372f60af8793 /dw/ooffloatsmgr.cc | |
parent | 8fd012cc0ebc43cd2890a6ea0cb66104d55f823f (diff) |
Merged commit #4653 (float clearance).
Test case:
<body>
<div id="a">
<div id="b" style="float:left">main</div>
</div>
<div id="c" style="clear:left"></div>
<div id="d">footer</div>
</body>
Note: passes all the tests at
http://www.dillo.org/test/4648/test-suite.v1.txt
Diffstat (limited to 'dw/ooffloatsmgr.cc')
-rw-r--r-- | dw/ooffloatsmgr.cc | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index 4f16ae42..721d74ac 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -657,6 +657,19 @@ void OOFFloatsMgr::markSizeChange (int ref) vloat->dirty = true; DBG_OBJ_SET_BOOL_O (vloat->getWidget (), "<Float>.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 @@ void OOFFloatsMgr::markSizeChange (int ref) tbInfos->get(i)->getOOFAwareWidget()->updateReference(0); SizeChanged = false; // Done. - DBG_OBJ_SET_BOOL ("SizeChanged", SizeChanged); - + DBG_OBJ_LEAVE (); } @@ -749,6 +761,8 @@ void OOFFloatsMgr::tellPosition1 (Widget *widget, int x, int y) 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 @@ void OOFFloatsMgr::tellPosition1 (Widget *widget, int x, int y) 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: + // + // <body> + // <div id="a"> + // <div id="b" style="float:left">main</div> + // </div> + // <div id="c" style="clear:both">x</div> + // <div id="d">footer</div> + // </body> + // + // 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 (); } |