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 3f31f0a9877d3845d5260312a9899c18ed08faaf..69681ef0e0741daa29cc7dc128eaa2dba1cbc90a 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -1742,6 +1742,7 @@ void Element::AttachLayoutTree(const AttachContext& context) { |
if (HasRareData() && NeedsAttach()) { |
ElementRareData* data = GetElementRareData(); |
data->ClearComputedStyle(); |
+ SetNonAttachedStyle(nullptr); |
} |
if (!IsActiveSlotOrActiveInsertionPoint()) { |
@@ -1794,8 +1795,10 @@ void Element::DetachLayoutTree(const AttachContext& context) { |
// attachLayoutTree() will clear the computed style for us when inside |
// recalcStyle. |
- if (!GetDocument().InStyleRecalc()) |
+ if (!GetDocument().InStyleRecalc()) { |
data->ClearComputedStyle(); |
+ SetNonAttachedStyle(nullptr); |
+ } |
if (ElementAnimations* element_animations = data->GetElementAnimations()) { |
if (context.performing_reattach) { |
@@ -2016,7 +2019,7 @@ StyleRecalcChange Element::RecalcOwnStyle(StyleRecalcChange change) { |
} |
if (local_change == kReattach) { |
- GetDocument().AddNonAttachedStyle(*this, std::move(new_style)); |
+ SetNonAttachedStyle(std::move(new_style)); |
SetNeedsReattachLayoutTree(); |
return kReattach; |
} |
@@ -2072,11 +2075,12 @@ void Element::RebuildLayoutTree(Text* next_text_sibling) { |
if (NeedsReattachLayoutTree()) { |
AttachContext reattach_context; |
- reattach_context.resolved_style = GetDocument().GetNonAttachedStyle(*this); |
+ reattach_context.resolved_style = GetNonAttachedStyle(); |
bool layout_object_will_change = NeedsAttach() || GetLayoutObject(); |
ReattachLayoutTree(reattach_context); |
if (layout_object_will_change || GetLayoutObject()) |
ReattachWhitespaceSiblingsIfNeeded(next_text_sibling); |
+ SetNonAttachedStyle(nullptr); |
} else if (ChildNeedsReattachLayoutTree()) { |
DCHECK(!NeedsReattachLayoutTree()); |
SelectorFilterParentScope filter_scope(*this); |