Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
| 3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
| 4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
| 5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved. |
| 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 118 |
| 119 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle) | 119 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle) |
| 120 { | 120 { |
| 121 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); | 121 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); |
| 122 propagateStyleToAnonymousChildren(); | 122 propagateStyleToAnonymousChildren(); |
| 123 | 123 |
| 124 // If border was changed, notify table. | 124 // If border was changed, notify table. |
| 125 LayoutTable* table = this->table(); | 125 LayoutTable* table = this->table(); |
| 126 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() & & oldStyle && oldStyle->border() != style()->border()) | 126 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() & & oldStyle && oldStyle->border() != style()->border()) |
| 127 table->invalidateCollapsedBorders(); | 127 table->invalidateCollapsedBorders(); |
| 128 | |
| 129 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && table->c ollapseBorders() && borderWidthChanged(oldStyle, style())) { | |
| 130 markAllCellsWidthsDirtyAndOrNeedsLayout(true /*markNeedsLayout*/); | |
| 131 } | |
| 128 } | 132 } |
| 129 | 133 |
| 130 void LayoutTableSection::willBeRemovedFromTree() | 134 void LayoutTableSection::willBeRemovedFromTree() |
| 131 { | 135 { |
| 132 LayoutTableBoxComponent::willBeRemovedFromTree(); | 136 LayoutTableBoxComponent::willBeRemovedFromTree(); |
| 133 | 137 |
| 134 // Preventively invalidate our cells as we may be re-inserted into | 138 // Preventively invalidate our cells as we may be re-inserted into |
| 135 // a new table which would require us to rebuild our structure. | 139 // a new table which would require us to rebuild our structure. |
| 136 setNeedsCellRecalc(); | 140 setNeedsCellRecalc(); |
| 137 } | 141 } |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1209 if (rowChildrenOverflowChanged) | 1213 if (rowChildrenOverflowChanged) |
| 1210 rowLayouter->computeOverflow(); | 1214 rowLayouter->computeOverflow(); |
| 1211 childrenOverflowChanged |= rowChildrenOverflowChanged; | 1215 childrenOverflowChanged |= rowChildrenOverflowChanged; |
| 1212 } | 1216 } |
| 1213 // TODO(crbug.com/604136): Add visual overflow from rows too. | 1217 // TODO(crbug.com/604136): Add visual overflow from rows too. |
| 1214 if (childrenOverflowChanged) | 1218 if (childrenOverflowChanged) |
| 1215 computeOverflowFromCells(totalRows, numEffCols); | 1219 computeOverflowFromCells(totalRows, numEffCols); |
| 1216 return childrenOverflowChanged; | 1220 return childrenOverflowChanged; |
| 1217 } | 1221 } |
| 1218 | 1222 |
| 1223 void LayoutTableSection::markAllCellsWidthsDirtyAndOrNeedsLayout(bool markNeedsL ayout) | |
| 1224 { | |
| 1225 for (unsigned i = 0; i < numRows(); i++) { | |
| 1226 LayoutTableRow* row = rowLayoutObjectAt(i); | |
| 1227 if (!row) | |
|
eae
2016/07/01 22:20:25
When would row ever be null? Sparse tables?
dgrogan
2016/07/06 23:10:29
Good question. I don't think it will be. I cargo c
trchen
2016/07/11 21:12:32
I don't remember, but other functions in LayoutTab
dgrogan
2016/07/11 22:27:16
You nailed it; cells with rowspan that exceeded th
| |
| 1228 continue; | |
| 1229 for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCe ll()) { | |
| 1230 cell->setPreferredLogicalWidthsDirty(); | |
| 1231 if (markNeedsLayout) | |
| 1232 cell->setChildNeedsLayout(); | |
| 1233 } | |
| 1234 } | |
| 1235 } | |
| 1236 | |
| 1219 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t | 1237 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t |
| 1220 { | 1238 { |
| 1221 unsigned totalCols = table()->numEffectiveColumns(); | 1239 unsigned totalCols = table()->numEffectiveColumns(); |
| 1222 if (!m_grid.size() || !totalCols) | 1240 if (!m_grid.size() || !totalCols) |
| 1223 return 0; | 1241 return 0; |
| 1224 | 1242 |
| 1225 int borderWidth = 0; | 1243 int borderWidth = 0; |
| 1226 | 1244 |
| 1227 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter(); | 1245 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter(); |
| 1228 if (sb.style() == BorderStyleHidden) | 1246 if (sb.style() == BorderStyleHidden) |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1679 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). | 1697 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). |
| 1680 if (!style()->isLeftToRightDirection()) | 1698 if (!style()->isLeftToRightDirection()) |
| 1681 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); | 1699 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); |
| 1682 else | 1700 else |
| 1683 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); | 1701 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); |
| 1684 | 1702 |
| 1685 cell->setLogicalLocation(cellLocation); | 1703 cell->setLogicalLocation(cellLocation); |
| 1686 } | 1704 } |
| 1687 | 1705 |
| 1688 } // namespace blink | 1706 } // namespace blink |
| OLD | NEW |