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

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

Issue 2376453004: Stash ComputedStyles on new HeapHashMap on Document. (Closed)
Patch Set: Post Elliott's review Created 4 years, 2 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 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 1939
1940 StyleRecalcChange localChange = 1940 StyleRecalcChange localChange =
1941 ComputedStyle::stylePropagationDiff(oldStyle.get(), newStyle.get()); 1941 ComputedStyle::stylePropagationDiff(oldStyle.get(), newStyle.get());
1942 if (localChange == NoChange) { 1942 if (localChange == NoChange) {
1943 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); 1943 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1);
1944 } else { 1944 } else {
1945 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1); 1945 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1);
1946 } 1946 }
1947 1947
1948 if (localChange == Reattach) { 1948 if (localChange == Reattach) {
1949 // TODO(nainar): Remove the style parameter being passed into 1949 document().addNonAttachedStyle(this, std::move(newStyle));
nainar 2016/10/05 03:32:37 Changed to -> *this
1950 // buildLayoutTree(). ComputedStyle will now be stored on Node and accessed 1950 return rebuildLayoutTree();
1951 // in buildLayoutTree() using mutableComputedStyle().
1952 return rebuildLayoutTree(*newStyle);
1953 } 1951 }
1954 1952
1955 DCHECK(oldStyle); 1953 DCHECK(oldStyle);
1956 1954
1957 if (localChange != NoChange) 1955 if (localChange != NoChange)
1958 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 1956 updateCallbackSelectors(oldStyle.get(), newStyle.get());
1959 1957
1960 if (LayoutObject* layoutObject = this->layoutObject()) { 1958 if (LayoutObject* layoutObject = this->layoutObject()) {
1961 if (localChange != NoChange || 1959 if (localChange != NoChange ||
1962 pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || 1960 pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) ||
(...skipping 21 matching lines...) Expand all
1984 return Inherit; 1982 return Inherit;
1985 newStyle->copyChildDependentFlagsFrom(*oldStyle); 1983 newStyle->copyChildDependentFlagsFrom(*oldStyle);
1986 } 1984 }
1987 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle()) 1985 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle())
1988 return UpdatePseudoElements; 1986 return UpdatePseudoElements;
1989 } 1987 }
1990 1988
1991 return localChange; 1989 return localChange;
1992 } 1990 }
1993 1991
1994 StyleRecalcChange Element::rebuildLayoutTree(ComputedStyle& newStyle) { 1992 StyleRecalcChange Element::rebuildLayoutTree() {
1995 AttachContext reattachContext; 1993 AttachContext reattachContext;
1996 reattachContext.resolvedStyle = &newStyle; 1994 reattachContext.resolvedStyle = document().getNonAttachedStyle(this).get();
nainar 2016/10/05 03:32:37 Changed to -> *this
1997 bool layoutObjectWillChange = needsAttach() || layoutObject(); 1995 bool layoutObjectWillChange = needsAttach() || layoutObject();
1998 reattachLayoutTree(reattachContext); 1996 reattachLayoutTree(reattachContext);
1999 if (layoutObjectWillChange || layoutObject()) 1997 if (layoutObjectWillChange || layoutObject())
2000 return Reattach; 1998 return Reattach;
2001 return ReattachNoLayoutObject; 1999 return ReattachNoLayoutObject;
2002 } 2000 }
2003 2001
2004 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, 2002 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle,
2005 const ComputedStyle* newStyle) { 2003 const ComputedStyle* newStyle) {
2006 Vector<String> emptyVector; 2004 Vector<String> emptyVector;
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after
4081 } 4079 }
4082 4080
4083 DEFINE_TRACE_WRAPPERS(Element) { 4081 DEFINE_TRACE_WRAPPERS(Element) {
4084 if (hasRareData()) { 4082 if (hasRareData()) {
4085 visitor->traceWrappers(elementRareData()); 4083 visitor->traceWrappers(elementRareData());
4086 } 4084 }
4087 ContainerNode::traceWrappers(visitor); 4085 ContainerNode::traceWrappers(visitor);
4088 } 4086 }
4089 4087
4090 } // namespace blink 4088 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698