diff options
author | Sebastian Geerken <devnull@localhost> | 2015-01-24 23:36:11 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2015-01-24 23:36:11 +0100 |
commit | 6476d8c4ea896fa0f6f727d279898dc0abbd460c (patch) | |
tree | ccec26a0b0b9fdbfe901853b4e923e5e3979dc92 /dw/table.cc | |
parent | 76aa3046ab667f01465963ab9a16c185c267dae0 (diff) |
Fixed table bug (introduced by incompatible mix of recent optimization in the main repository and work on absolute positions etc in 'dillo_grows').
Diffstat (limited to 'dw/table.cc')
-rw-r--r-- | dw/table.cc | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/dw/table.cc b/dw/table.cc index 1df5d862..3e7d30df 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -279,10 +279,17 @@ int Table::calcAvailWidthForDescendant (Widget *child) assert (actualChild != NULL); - // ActualChild->parentRef contains the position in the children - // array (see addCell()), so the column can be easily determined. - int col = actualChild->parentRef % numCols; - int colspanEff = children->get(actualChild->parentRef)->cell.colspanEff; + // ActualChild->parentRef contains (indirectly) the position in the + // children array (see addCell()), so the column can be easily + // determined. + int childNo = getParentRefInFlowSubRef (actualChild->parentRef); + int col = childNo % numCols; + DBG_OBJ_MSGF ("resize", 1, "actualChild = %p, " + "childNo = getParentRefInFlowSubRef (%d) = %d, " + "column = %d %% %d = %d", + actualChild, actualChild->parentRef, childNo, childNo, + numCols, col); + int colspanEff = children->get(childNo)->cell.colspanEff; DBG_OBJ_MSGF ("resize", 1, "calculated from column %d, colspanEff = %d", col, colspanEff); @@ -537,15 +544,13 @@ void Table::addCell (Widget *widget, int colspan, int rowspan) child->cell.rowspan = rowspan; children->set (curRow * numCols + curCol, child); - // The position in the children array is assigned to parentRef, - // although incremental resizing is not implemented. Useful, e. g., - // in calcAvailWidthForDescendant(). See also reallocChildren(). - widget->parentRef = curRow * numCols + curCol; + // The position in the children array is (indirectly) assigned to parentRef, + // although incremental resizing is not implemented. Useful, e. g., in + // calcAvailWidthForDescendant(). See also reallocChildren(). + widget->parentRef = makeParentRefInFlow (curRow * numCols + curCol); DBG_OBJ_SET_NUM_O (widget, "parentRef", widget->parentRef); curCol += colspanEff; - - widget->parentRef = makeParentRefInFlow (0); widget->setParent (this); if (rowStyle->get (curRow)) @@ -786,7 +791,7 @@ void Table::reallocChildren (int newNumCols, int newNumRows) int n = row * newNumCols + col; Child *child = children->get (n); if (child != NULL && child->type == Child::CELL) { - child->cell.widget->parentRef = n; + child->cell.widget->parentRef = makeParentRefInFlow (n); DBG_OBJ_SET_NUM_O (child->cell.widget, "parentRef", child->cell.widget->parentRef); } @@ -832,6 +837,9 @@ void Table::calcCellSizes (bool calcHeights) void Table::forceCalcCellSizes (bool calcHeights) { + DBG_OBJ_ENTER ("resize", 0, "forceCalcCellSizes", "%s", + calcHeights ? "true" : "false"); + // Since Table::getAvailWidthOfChild does not calculate the column // widths, and so initially a random value (100) is returned, a // correction is necessary. The old values are temporary preserved @@ -886,11 +894,14 @@ void Table::forceCalcCellSizes (bool calcHeights) } } } + + DBG_OBJ_LEAVE (); } void Table::actuallyCalcCellSizes (bool calcHeights) { - DBG_OBJ_ENTER0 ("resize", 0, "forceCalcCellSizes"); + DBG_OBJ_ENTER ("resize", 0, "actuallyCalcCellSizes", "%s", + calcHeights ? "true" : "false"); int childHeight; core::Extremes extremes; |