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

Unified 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: Created 4 years, 7 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/LayoutTableSection.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index fc6328921f0d096245b5cf5b09d47034ea2e6f98..fc1b01f22c59c58b9005c0de171d080da16c9102 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -116,6 +116,15 @@ LayoutTableSection::~LayoutTableSection()
{
}
+// TODO(dgrogan): Where should this go? It is duplicated in LayoutTableRow.cpp.
mstensho (USE GERRIT) 2016/05/25 12:18:28 There's a common LayoutTableBoxComponent base clas
dgrogan 2016/05/25 20:01:09 Yes, good call.
+static bool borderWidthChanged(const ComputedStyle* oldStyle, const ComputedStyle* newStyle)
+{
+ return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth()
+ || oldStyle->borderTopWidth() != newStyle->borderTopWidth()
+ || oldStyle->borderRightWidth() != newStyle->borderRightWidth()
+ || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth();
+}
+
void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
{
LayoutTableBoxComponent::styleDidChange(diff, oldStyle);
@@ -125,6 +134,21 @@ void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl
LayoutTable* table = this->table();
if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border())
table->invalidateCollapsedBorders();
+
+ // TODO(dgrogan): Do we need to setPreferredLogicalWidthsDirty even when !diff.needsFullLayout()?
mstensho (USE GERRIT) 2016/05/25 12:18:28 Can we really schedule for layout as part of prefe
dgrogan 2016/05/25 20:01:09 This reasoning makes sense to me. I just didn't kn
+ if (table && oldStyle && diff.needsFullLayout() && needsLayout() && table->collapseBorders() && borderWidthChanged(oldStyle, style())) {
+ table->setPreferredLogicalWidthsDirty(MarkOnlyThis);
+ for (unsigned r = 0; r < m_grid.size(); ++r) {
+ LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
+ if (!rowLayoutObject)
+ continue;
+ for (LayoutBox* childBox = rowLayoutObject->firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
+ if (!childBox->isTableCell())
+ continue;
+ childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis);
mstensho (USE GERRIT) 2016/05/25 12:18:28 Why MarkOnlyThis? If that's not necessary (or even
dgrogan 2016/05/25 20:01:09 The idea was that it was an optimization: parents
mstensho (USE GERRIT) 2016/05/26 18:08:48 Yes, I really think the parents DO need their pref
dgrogan 2016/05/27 00:21:38 You're right, LayoutObject::styleDidChange marks t
+ }
+ }
+ }
}
void LayoutTableSection::willBeRemovedFromTree()

Powered by Google App Engine
This is Rietveld 408576698