Chromium Code Reviews| 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()); |