Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp

Issue 2013693002: [css-tables] Set table and cell widths dirty when section border changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle case where row is null Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(MarkDirtyAndNeedsLayout);
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
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(WhatToMarkAllCe lls whatToMark)
1229 {
1230 for (unsigned i = 0; i < numRows(); i++) {
1231 LayoutTableRow* row = rowLayoutObjectAt(i);
1232 if (!row)
1233 continue;
1234 for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCe ll()) {
1235 cell->setPreferredLogicalWidthsDirty();
1236 if (whatToMark == MarkDirtyAndNeedsLayout)
1237 cell->setChildNeedsLayout();
1238 }
1239 }
1240 }
1241
1224 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t 1242 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t
1225 { 1243 {
1226 unsigned totalCols = table()->numEffectiveColumns(); 1244 unsigned totalCols = table()->numEffectiveColumns();
1227 if (!m_grid.size() || !totalCols) 1245 if (!m_grid.size() || !totalCols)
1228 return 0; 1246 return 0;
1229 1247
1230 int borderWidth = 0; 1248 int borderWidth = 0;
1231 1249
1232 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter(); 1250 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter();
1233 if (sb.style() == BorderStyleHidden) 1251 if (sb.style() == BorderStyleHidden)
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 // Repeating table headers are painted once per fragmentation page/column. T his does not go through the regular fragmentation machinery, 1728 // 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. 1729 // 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. 1730 // 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()) 1731 if (table()->header() == this && hasRepeatingHeaderGroup())
1714 rect.setHeight(table()->logicalHeight()); 1732 rect.setHeight(table()->logicalHeight());
1715 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags); 1733 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags);
1716 } 1734 }
1717 1735
1718 1736
1719 } // namespace blink 1737 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698