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

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

Issue 2153283002: [css-tables] Clean up code that detects significant border changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: the big refactor 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
Index: third_party/WebKit/Source/core/layout/LayoutTableRow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp b/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp
index 2d726bcd8ba8adf2aab88a76d8044d237b787290..39bdbe41f383311d058cea2b39f8bacc7c4cd6db 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableRow.cpp
@@ -60,34 +60,39 @@ void LayoutTableRow::styleDidChange(StyleDifference diff, const ComputedStyle* o
LayoutTableBoxComponent::styleDidChange(diff, oldStyle);
propagateStyleToAnonymousChildren();
- if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHeight())
+ if (!oldStyle)
+ return;
+
+ if (section() && style()->logicalHeight() != oldStyle->logicalHeight())
section()->rowLogicalHeightChanged(this);
- // If border was changed, notify table.
- if (parent()) {
- LayoutTable* table = this->table();
- if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border())
- table->invalidateCollapsedBorders();
-
- if (table && oldStyle && diff.needsFullLayout() && needsLayout() && table->collapseBorders() && oldStyle->border().sizeEquals(style()->border())) {
- // If the border width changes on a row, we need to make sure the cells in the row know to lay out again.
- // This only happens when borders are collapsed, since they end up affecting the border sides of the cell
- // itself.
- for (LayoutBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
- if (!childBox->isTableCell())
- continue;
- // TODO(dgrogan) Add a layout test showing that setChildNeedsLayout is needed instead of setNeedsLayout.
- childBox->setChildNeedsLayout();
- childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis);
- }
- // Most table componenents can rely on LayoutObject::styleDidChange
- // to mark the container chain dirty. But LayoutTableSection seems
- // to never clear its dirty bit, which stops the propagation. So
- // anything under LayoutTableSection has to restart the propagation
- // at the table.
- // TODO(dgrogan): Make LayoutTableSection clear its dirty bit.
- table->setPreferredLogicalWidthsDirty();
+ if (!parent())
+ return;
+ LayoutTable* table = this->table();
+ if (!table)
+ return;
+
+ if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle->border() != style()->border())
+ table->invalidateCollapsedBorders();
+
+ if (LayoutTableBoxComponent::doCellsHaveDirtyWidth(*this, *table, diff, *oldStyle)) {
+ // If the border width changes on a row, we need to make sure the cells in the row know to lay out again.
+ // This only happens when borders are collapsed, since they end up affecting the border sides of the cell
+ // itself.
+ for (LayoutBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
+ if (!childBox->isTableCell())
+ continue;
+ // TODO(dgrogan) Add a layout test showing that setChildNeedsLayout is needed instead of setNeedsLayout.
+ childBox->setChildNeedsLayout();
+ childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis);
}
+ // Most table componenents can rely on LayoutObject::styleDidChange
+ // to mark the container chain dirty. But LayoutTableSection seems
+ // to never clear its dirty bit, which stops the propagation. So
+ // anything under LayoutTableSection has to restart the propagation
+ // at the table.
+ // TODO(dgrogan): Make LayoutTableSection clear its dirty bit.
+ table->setPreferredLogicalWidthsDirty();
}
}

Powered by Google App Engine
This is Rietveld 408576698