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

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2727233005: Remove calls to styleForLayoutObject() in LayoutTreeBuilder::style() (Closed)
Patch Set: Created 3 years, 10 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/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 1bc8f3e7d3e1a98e6aef82217091da4ea9581c2e..db4811cf9cba15311573d19715c7df0976210cee 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -2020,11 +2020,15 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change,
}
if (localChange == Reattach) {
+ // This mimicks Element::recalcStyleForLayout except it also stores the
+ // nextTextSibling information and sets the NeedsReattachLayoutTree flag.
StyleReattachData styleReattachData;
styleReattachData.computedStyle = std::move(newStyle);
styleReattachData.nextTextSibling = nextTextSibling;
document().addStyleReattachData(*this, styleReattachData);
setNeedsReattachLayoutTree();
+ recalcShadowRootStylesForLayout();
nainar 2017/03/03 06:08:52 This only goes over the descendants (ContainerNode
+ recalcDescendantStylesForLayout();
return Reattach;
}
@@ -2069,6 +2073,23 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change,
return localChange;
}
+void Element::recalcStyleForLayout() {
+ if (!hasCustomStyleCallbacks()) {
+ StyleReattachData styleReattachData;
+ styleReattachData.computedStyle = styleForLayoutObject();
+ document().addStyleReattachData(*this, styleReattachData);
+ }
+ recalcShadowRootStylesForLayout();
nainar 2017/03/03 06:08:52 Need to add a function here to deal with the relev
+ recalcDescendantStylesForLayout();
+}
+
+void Element::recalcShadowRootStylesForLayout() {
+ for (ShadowRoot* root = youngestShadowRoot(); root;
+ root = root->olderShadowRoot()) {
+ root->recalcDescendantStylesForLayout();
+ }
+}
+
void Element::rebuildLayoutTree() {
DCHECK(inActiveDocument());
DCHECK(parentNode());
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698