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

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

Issue 2821193003: Store nonAttachedStyle on NodeLayoutData instead of on HashMap in Document. (Closed)
Patch Set: Clear NonAttachedStyle in (Attach/Detach)LayoutTree Created 3 years, 8 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 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);

Powered by Google App Engine
This is Rietveld 408576698