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

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

Issue 2001453002: Set ComputedStyle on Node and use that in buildOwnLayout() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@storage
Patch Set: Sending for Bugs' input Created 4 years, 3 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. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 DCHECK(newStyle); 1789 DCHECK(newStyle);
1790 1790
1791 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get()); 1791 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get());
1792 if (localChange == NoChange) { 1792 if (localChange == NoChange) {
1793 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); 1793 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1);
1794 } else { 1794 } else {
1795 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 ); 1795 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 );
1796 } 1796 }
1797 1797
1798 if (localChange == Reattach) { 1798 if (localChange == Reattach) {
1799 // TODO(nainar): Remove the style parameter being passed into buildLayou tTree(). 1799 setComputedStyle(newStyle);
1800 // ComputedStyle will now be stored on Node and accessed in buildLayoutT ree() 1800 return buildLayoutTree();
1801 // using mutableComputedStyle().
1802 return buildLayoutTree(*newStyle);
1803 } 1801 }
1804 1802
1805 DCHECK(oldStyle); 1803 DCHECK(oldStyle);
1806 1804
1807 if (localChange != NoChange) 1805 if (localChange != NoChange)
1808 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 1806 updateCallbackSelectors(oldStyle.get(), newStyle.get());
1809 1807
1810 if (LayoutObject* layoutObject = this->layoutObject()) { 1808 if (LayoutObject* layoutObject = this->layoutObject()) {
1811 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) { 1809 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) {
1812 layoutObject->setStyle(newStyle.get()); 1810 layoutObject->setStyle(newStyle.get());
(...skipping 18 matching lines...) Expand all
1831 return Inherit; 1829 return Inherit;
1832 newStyle->copyChildDependentFlagsFrom(*oldStyle); 1830 newStyle->copyChildDependentFlagsFrom(*oldStyle);
1833 } 1831 }
1834 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ()) 1832 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ())
1835 return UpdatePseudoElements; 1833 return UpdatePseudoElements;
1836 } 1834 }
1837 1835
1838 return localChange; 1836 return localChange;
1839 } 1837 }
1840 1838
1841 StyleRecalcChange Element::buildLayoutTree(ComputedStyle& newStyle) 1839 StyleRecalcChange Element::buildLayoutTree()
1842 { 1840 {
1843 AttachContext reattachContext; 1841 AttachContext reattachContext;
1844 reattachContext.resolvedStyle = &newStyle; 1842 reattachContext.resolvedStyle = mutableComputedStyle();
1845 bool layoutObjectWillChange = needsAttach() || layoutObject(); 1843 bool layoutObjectWillChange = needsAttach() || layoutObject();
1846 reattachLayoutTree(reattachContext); 1844 reattachLayoutTree(reattachContext);
1847 if (layoutObjectWillChange || layoutObject()) 1845 if (layoutObjectWillChange || layoutObject())
1848 return Reattach; 1846 return Reattach;
1849 return ReattachNoLayoutObject; 1847 return ReattachNoLayoutObject;
1850 } 1848 }
1851 1849
1852 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle) 1850 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle)
1853 { 1851 {
1854 Vector<String> emptyVector; 1852 Vector<String> emptyVector;
(...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after
3815 3813
3816 DEFINE_TRACE_WRAPPERS(Element) 3814 DEFINE_TRACE_WRAPPERS(Element)
3817 { 3815 {
3818 if (hasRareData()) { 3816 if (hasRareData()) {
3819 visitor->traceWrappers(elementRareData()); 3817 visitor->traceWrappers(elementRareData());
3820 } 3818 }
3821 ContainerNode::traceWrappers(visitor); 3819 ContainerNode::traceWrappers(visitor);
3822 } 3820 }
3823 3821
3824 } // namespace blink 3822 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698