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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableCol.cpp

Issue 2149953004: [css-tables] Set needsLayout on cells when column border width changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/table/change-col-border-width-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
index 9cfd517810b5ef32da00a0cb3eaa5164777bcd95..c5f256e701f39a32fc329c920355357966d9f7b2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
@@ -50,21 +50,23 @@ void LayoutTableCol::styleDidChange(StyleDifference diff, const ComputedStyle* o
if (LayoutTable* table = this->table()) {
if (!oldStyle)
return;
+
+ // TODO(dgrogan): Is the "else" necessary for correctness or just a brittle optimization? The optimization would be:
+ // if the first branch is taken then the next one can't be, so don't even check its condition.
if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle->border() != style()->border()) {
// If border was changed, notify table.
table->invalidateCollapsedBorders();
- } else if (oldStyle->logicalWidth() != style()->logicalWidth()) {
- // FIXME : setPreferredLogicalWidthsDirty is done for all cells as of now.
- // Need to find a better way so that only the cells which are changed by
- // the col width should have preferred logical widths recomputed.
+ } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || (diff.needsFullLayout() && needsLayout() && table->collapseBorders() && oldStyle->border().sizeEquals(style()->border()))) {
+ // TODO(dgrogan): Move second clause above to LayoutTableBoxComponent for re-use.
+ // TODO(dgrogan): Optimization opportunities:
+ // (1) Only mark cells which are affected by this col, not every cell in the table.
+ // (2) If only the col width changes and its border width doesn't, do the cells need to be marked as
+ // needing layout or just given dirty widths?
for (LayoutObject* child = table->children()->firstChild(); child; child = child->nextSibling()) {
if (!child->isTableSection())
continue;
LayoutTableSection* section = toLayoutTableSection(child);
- for (LayoutTableRow* row = section->firstRow(); row; row = row->nextRow()) {
- for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCell())
- cell->setPreferredLogicalWidthsDirty();
- }
+ section->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTableSection::MarkDirtyAndNeedsLayout);
}
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/table/change-col-border-width-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698