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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 | 119 |
| 120 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle) | 120 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle) |
| 121 { | 121 { |
| 122 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); | 122 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); |
| 123 propagateStyleToAnonymousChildren(); | 123 propagateStyleToAnonymousChildren(); |
| 124 | 124 |
| 125 // If border was changed, notify table. | 125 // If border was changed, notify table. |
| 126 LayoutTable* table = this->table(); | 126 LayoutTable* table = this->table(); |
| 127 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() & & oldStyle && oldStyle->border() != style()->border()) | 127 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() & & oldStyle && oldStyle->border() != style()->border()) |
| 128 table->invalidateCollapsedBorders(); | 128 table->invalidateCollapsedBorders(); |
| 129 | |
| 130 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && table->c ollapseBorders() && oldStyle->border() != style()->border()) { | |
| 131 markAllCellsWidthsDirtyAndOrNeedsLayout(true /*markNeedsLayout*/); | |
|
Xianzhu
2016/07/07 23:13:30
This is a good example that we prefer enum to bool
| |
| 132 } | |
| 129 } | 133 } |
| 130 | 134 |
| 131 void LayoutTableSection::willBeRemovedFromTree() | 135 void LayoutTableSection::willBeRemovedFromTree() |
| 132 { | 136 { |
| 133 LayoutTableBoxComponent::willBeRemovedFromTree(); | 137 LayoutTableBoxComponent::willBeRemovedFromTree(); |
| 134 | 138 |
| 135 // Preventively invalidate our cells as we may be re-inserted into | 139 // Preventively invalidate our cells as we may be re-inserted into |
| 136 // a new table which would require us to rebuild our structure. | 140 // a new table which would require us to rebuild our structure. |
| 137 setNeedsCellRecalc(); | 141 setNeedsCellRecalc(); |
| 138 } | 142 } |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1214 if (rowChildrenOverflowChanged) | 1218 if (rowChildrenOverflowChanged) |
| 1215 rowLayouter->computeOverflow(); | 1219 rowLayouter->computeOverflow(); |
| 1216 childrenOverflowChanged |= rowChildrenOverflowChanged; | 1220 childrenOverflowChanged |= rowChildrenOverflowChanged; |
| 1217 } | 1221 } |
| 1218 // TODO(crbug.com/604136): Add visual overflow from rows too. | 1222 // TODO(crbug.com/604136): Add visual overflow from rows too. |
| 1219 if (childrenOverflowChanged) | 1223 if (childrenOverflowChanged) |
| 1220 computeOverflowFromCells(totalRows, numEffCols); | 1224 computeOverflowFromCells(totalRows, numEffCols); |
| 1221 return childrenOverflowChanged; | 1225 return childrenOverflowChanged; |
| 1222 } | 1226 } |
| 1223 | 1227 |
| 1228 void LayoutTableSection::markAllCellsWidthsDirtyAndOrNeedsLayout(bool markNeedsL ayout) | |
|
Xianzhu
2016/07/07 23:13:30
Please change the parameter to an enum (or you can
| |
| 1229 { | |
| 1230 for (unsigned i = 0; i < numRows(); i++) { | |
| 1231 LayoutTableRow* row = rowLayoutObjectAt(i); | |
| 1232 // CHECK instead of DCHECK to see if this can be triggered in the wild. | |
| 1233 // TODO(dgrogan): Change to DCHECK after m54 hits stable. | |
| 1234 CHECK(row); | |
| 1235 for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCe ll()) { | |
| 1236 cell->setPreferredLogicalWidthsDirty(); | |
| 1237 if (markNeedsLayout) | |
| 1238 cell->setChildNeedsLayout(); | |
| 1239 } | |
| 1240 } | |
| 1241 } | |
| 1242 | |
| 1224 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t | 1243 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t |
| 1225 { | 1244 { |
| 1226 unsigned totalCols = table()->numEffectiveColumns(); | 1245 unsigned totalCols = table()->numEffectiveColumns(); |
| 1227 if (!m_grid.size() || !totalCols) | 1246 if (!m_grid.size() || !totalCols) |
| 1228 return 0; | 1247 return 0; |
| 1229 | 1248 |
| 1230 int borderWidth = 0; | 1249 int borderWidth = 0; |
| 1231 | 1250 |
| 1232 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter(); | 1251 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter(); |
| 1233 if (sb.style() == BorderStyleHidden) | 1252 if (sb.style() == BorderStyleHidden) |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1710 // Repeating table headers are painted once per fragmentation page/column. T his does not go through the regular fragmentation machinery, | 1729 // Repeating table headers are painted once per fragmentation page/column. T his does not go through the regular fragmentation machinery, |
| 1711 // so we need special code to expand the invalidation rect to contain all po sitions of the header in all columns. | 1730 // so we need special code to expand the invalidation rect to contain all po sitions of the header in all columns. |
| 1712 // Note that this is in flow thread coordinates, not visual coordinates. The enclosing LayoutFlowThread will convert to visual coordinates. | 1731 // Note that this is in flow thread coordinates, not visual coordinates. The enclosing LayoutFlowThread will convert to visual coordinates. |
| 1713 if (table()->header() == this && hasRepeatingHeaderGroup()) | 1732 if (table()->header() == this && hasRepeatingHeaderGroup()) |
| 1714 rect.setHeight(table()->logicalHeight()); | 1733 rect.setHeight(table()->logicalHeight()); |
| 1715 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags); | 1734 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags); |
| 1716 } | 1735 } |
| 1717 | 1736 |
| 1718 | 1737 |
| 1719 } // namespace blink | 1738 } // namespace blink |
| OLD | NEW |