diff options
-rw-r--r-- | dw/outofflowmgr.cc | 34 | ||||
-rw-r--r-- | dw/table.cc | 14 |
2 files changed, 41 insertions, 7 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index caa7fee5..d9c19cc5 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -217,16 +217,36 @@ int OutOfFlowMgr::Float::ComparePosition::compare (Object *o1, Object *o2) bool a2 = fl2->getWidget () ? fl2->getWidget()->wasAllocated () : true; DBG_OBJ_MSGF_O ("border", 2, oofm, - "float 1 allocated: %s; float 2 allocated: %s", - a1 ? "yes" : "no", a2 ? "yes" : "no"); + "float 1 (%p) allocated: %s; float 2 (%p) allocated: %s", + fl1->getWidget (), a1 ? "yes" : "no", fl2->getWidget (), + a2 ? "yes" : "no"); if (a1 && a2) { - int fly1 = fl1->getWidget() ? fl1->getWidget()->getAllocation()->y : - oofm->getAllocation(fl1->generatingBlock)->y + fl1->yReal; - int fly2 = fl2->getWidget() ? fl2->getWidget()->getAllocation()->y : - oofm->getAllocation(fl2->generatingBlock)->y + fl2->yReal; - DBG_OBJ_MSGF_O ("border", 2, oofm, "y diff = %d - %d", fly1, fly2); + int fly1, fly2; + + if (fl1->getWidget()) { + fly1 = fl1->getWidget()->getAllocation()->y; + DBG_OBJ_MSGF_O ("border", 2, oofm, "fly1 = %d", fly1); + } else { + fly1 = oofm->getAllocation(fl1->generatingBlock)->y + fl1->yReal; + DBG_OBJ_MSGF_O ("border", 2, oofm, "fly1 = %d + %d = %d", + oofm->getAllocation(fl1->generatingBlock)->y, + fl1->yReal, fly1); + } + + if (fl2->getWidget()) { + fly2 = fl2->getWidget()->getAllocation()->y; + DBG_OBJ_MSGF_O ("border", 2, oofm, "fly2 = %d", fly2); + } else { + fly2 = oofm->getAllocation(fl2->generatingBlock)->y + fl2->yReal; + DBG_OBJ_MSGF_O ("border", 2, oofm, "fly2 = %d + %d = %d", + oofm->getAllocation(fl2->generatingBlock)->y, + fl2->yReal, fly2); + } + r = fly1 - fly2; + + DBG_OBJ_MSGF_O ("border", 2, oofm, "r = %d - %d = %d", fly1, fly2, r); } else if (a1 && !a2) r = -1; else if (!a1 && a2) diff --git a/dw/table.cc b/dw/table.cc index 9922543f..746856c7 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -259,6 +259,20 @@ int Table::calcAvailWidthForDescendant (Widget *child) for (int i = 0; i < children->get(n)->cell.colspanEff; i++) width += colWidths->get (col + i); width = misc::max (width, 0); + + if (child != actualChild) { + // For table cells (direct children: child == actualChild), + // CSS 'width' is already regarded in the column calculation. + // However, for children of the table cells, CSS 'width' must + // be regarded here. + + int corrWidth = width; + child->calcFinalWidth (child->getStyle(), -1, this, 0, true, + &corrWidth); + + // But better not exceed it ... (TODO: Only here?) + width = misc::min (width, corrWidth); + } } } } |