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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2821193003: Store nonAttachedStyle on NodeLayoutData instead of on HashMap in Document. (Closed)
Patch Set: Revert back to rune@'s lgtmed patch Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 ComputedStyle::StylePropagationDiff(old_style.Get(), new_style.Get()); 2009 ComputedStyle::StylePropagationDiff(old_style.Get(), new_style.Get());
2010 if (local_change == kNoChange) { 2010 if (local_change == kNoChange) {
2011 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(), 2011 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(),
2012 styles_unchanged, 1); 2012 styles_unchanged, 1);
2013 } else { 2013 } else {
2014 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(), 2014 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(),
2015 styles_changed, 1); 2015 styles_changed, 1);
2016 } 2016 }
2017 2017
2018 if (local_change == kReattach) { 2018 if (local_change == kReattach) {
2019 GetDocument().AddNonAttachedStyle(*this, std::move(new_style)); 2019 SetNonAttachedStyle(std::move(new_style));
2020 SetNeedsReattachLayoutTree(); 2020 SetNeedsReattachLayoutTree();
2021 return kReattach; 2021 return kReattach;
2022 } 2022 }
2023 2023
2024 DCHECK(old_style); 2024 DCHECK(old_style);
2025 2025
2026 if (local_change != kNoChange) 2026 if (local_change != kNoChange)
2027 UpdateCallbackSelectors(old_style.Get(), new_style.Get()); 2027 UpdateCallbackSelectors(old_style.Get(), new_style.Get());
2028 2028
2029 if (LayoutObject* layout_object = this->GetLayoutObject()) { 2029 if (LayoutObject* layout_object = this->GetLayoutObject()) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 2065
2066 return local_change; 2066 return local_change;
2067 } 2067 }
2068 2068
2069 void Element::RebuildLayoutTree(Text* next_text_sibling) { 2069 void Element::RebuildLayoutTree(Text* next_text_sibling) {
2070 DCHECK(InActiveDocument()); 2070 DCHECK(InActiveDocument());
2071 DCHECK(parentNode()); 2071 DCHECK(parentNode());
2072 2072
2073 if (NeedsReattachLayoutTree()) { 2073 if (NeedsReattachLayoutTree()) {
2074 AttachContext reattach_context; 2074 AttachContext reattach_context;
2075 reattach_context.resolved_style = GetDocument().GetNonAttachedStyle(*this); 2075 reattach_context.resolved_style = GetNonAttachedStyle();
2076 bool layout_object_will_change = NeedsAttach() || GetLayoutObject(); 2076 bool layout_object_will_change = NeedsAttach() || GetLayoutObject();
2077 ReattachLayoutTree(reattach_context); 2077 ReattachLayoutTree(reattach_context);
2078 if (layout_object_will_change || GetLayoutObject()) 2078 if (layout_object_will_change || GetLayoutObject())
2079 ReattachWhitespaceSiblingsIfNeeded(next_text_sibling); 2079 ReattachWhitespaceSiblingsIfNeeded(next_text_sibling);
2080 SetNonAttachedStyle(nullptr);
2080 } else if (ChildNeedsReattachLayoutTree()) { 2081 } else if (ChildNeedsReattachLayoutTree()) {
2081 DCHECK(!NeedsReattachLayoutTree()); 2082 DCHECK(!NeedsReattachLayoutTree());
2082 SelectorFilterParentScope filter_scope(*this); 2083 SelectorFilterParentScope filter_scope(*this);
2083 StyleSharingDepthScope sharing_scope(*this); 2084 StyleSharingDepthScope sharing_scope(*this);
2084 Text* next_text_sibling = nullptr; 2085 Text* next_text_sibling = nullptr;
2085 RebuildPseudoElementLayoutTree(kPseudoIdAfter); 2086 RebuildPseudoElementLayoutTree(kPseudoIdAfter);
2086 RebuildShadowRootLayoutTree(next_text_sibling); 2087 RebuildShadowRootLayoutTree(next_text_sibling);
2087 RebuildChildrenLayoutTrees(next_text_sibling); 2088 RebuildChildrenLayoutTrees(next_text_sibling);
2088 RebuildPseudoElementLayoutTree(kPseudoIdBefore, next_text_sibling); 2089 RebuildPseudoElementLayoutTree(kPseudoIdBefore, next_text_sibling);
2089 RebuildPseudoElementLayoutTree(kPseudoIdBackdrop); 2090 RebuildPseudoElementLayoutTree(kPseudoIdBackdrop);
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4336 } 4337 }
4337 4338
4338 DEFINE_TRACE_WRAPPERS(Element) { 4339 DEFINE_TRACE_WRAPPERS(Element) {
4339 if (HasRareData()) { 4340 if (HasRareData()) {
4340 visitor->TraceWrappers(GetElementRareData()); 4341 visitor->TraceWrappers(GetElementRareData());
4341 } 4342 }
4342 ContainerNode::TraceWrappers(visitor); 4343 ContainerNode::TraceWrappers(visitor);
4343 } 4344 }
4344 4345
4345 } // namespace blink 4346 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698