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

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: refactor and remove some table->setPreferredLogicalWidthsDirty Created 4 years, 6 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // TODO(dgrogan): Do we need to call cell->setChildNeedsLayout() like La youtTableRow::styleDidChange does?
dgrogan 2016/05/27 00:21:38 I'll dig into this tomorrow if you don't know off
131 markAllCellWidthsDirty();
132 }
128 } 133 }
129 134
130 void LayoutTableSection::willBeRemovedFromTree() 135 void LayoutTableSection::willBeRemovedFromTree()
131 { 136 {
132 LayoutTableBoxComponent::willBeRemovedFromTree(); 137 LayoutTableBoxComponent::willBeRemovedFromTree();
133 138
134 // Preventively invalidate our cells as we may be re-inserted into 139 // Preventively invalidate our cells as we may be re-inserted into
135 // a new table which would require us to rebuild our structure. 140 // a new table which would require us to rebuild our structure.
136 setNeedsCellRecalc(); 141 setNeedsCellRecalc();
137 } 142 }
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 if (rowChildrenOverflowChanged) 1203 if (rowChildrenOverflowChanged)
1199 rowLayouter->computeOverflow(); 1204 rowLayouter->computeOverflow();
1200 childrenOverflowChanged |= rowChildrenOverflowChanged; 1205 childrenOverflowChanged |= rowChildrenOverflowChanged;
1201 } 1206 }
1202 // TODO(crbug.com/604136): Add visual overflow from rows too. 1207 // TODO(crbug.com/604136): Add visual overflow from rows too.
1203 if (childrenOverflowChanged) 1208 if (childrenOverflowChanged)
1204 computeOverflowFromCells(totalRows, numEffCols); 1209 computeOverflowFromCells(totalRows, numEffCols);
1205 return childrenOverflowChanged; 1210 return childrenOverflowChanged;
1206 } 1211 }
1207 1212
1213 void LayoutTableSection::markAllCellWidthsDirty()
1214 {
1215 for (unsigned i = 0; i < numRows(); i++) {
1216 LayoutTableRow* row = rowLayoutObjectAt(i);
1217 if (!row)
1218 continue;
1219 for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCe ll())
1220 cell->setPreferredLogicalWidthsDirty();
1221 }
1222 }
1223
1208 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t 1224 int LayoutTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons t
1209 { 1225 {
1210 unsigned totalCols = table()->numEffectiveColumns(); 1226 unsigned totalCols = table()->numEffectiveColumns();
1211 if (!m_grid.size() || !totalCols) 1227 if (!m_grid.size() || !totalCols)
1212 return 0; 1228 return 0;
1213 1229
1214 int borderWidth = 0; 1230 int borderWidth = 0;
1215 1231
1216 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter(); 1232 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty le()->borderAfter();
1217 if (sb.style() == BorderStyleHidden) 1233 if (sb.style() == BorderStyleHidden)
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1680 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1665 if (!style()->isLeftToRightDirection()) 1681 if (!style()->isLeftToRightDirection())
1666 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); 1682 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing));
1667 else 1683 else
1668 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); 1684 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing));
1669 1685
1670 cell->setLogicalLocation(cellLocation); 1686 cell->setLogicalLocation(cellLocation);
1671 } 1687 }
1672 1688
1673 } // namespace blink 1689 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698