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

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: Send over for review 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 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 DCHECK(newStyle); 1820 DCHECK(newStyle);
1821 1821
1822 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get()); 1822 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get());
1823 if (localChange == NoChange) { 1823 if (localChange == NoChange) {
1824 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); 1824 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1);
1825 } else { 1825 } else {
1826 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 ); 1826 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 );
1827 } 1827 }
1828 1828
1829 if (localChange == Reattach) { 1829 if (localChange == Reattach) {
1830 // TODO(nainar): Remove the style parameter being passed into buildLayou tTree(). 1830 setComputedStyle(newStyle);
1831 // ComputedStyle will now be stored on Node and accessed in buildLayoutT ree() 1831 return buildLayoutTree();
1832 // using mutableComputedStyle().
1833 return buildLayoutTree(*newStyle);
1834 } 1832 }
1835 1833
1836 DCHECK(oldStyle); 1834 DCHECK(oldStyle);
1837 1835
1838 if (localChange != NoChange) 1836 if (localChange != NoChange)
1839 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 1837 updateCallbackSelectors(oldStyle.get(), newStyle.get());
1840 1838
1841 if (LayoutObject* layoutObject = this->layoutObject()) { 1839 if (LayoutObject* layoutObject = this->layoutObject()) {
1842 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) { 1840 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) {
1843 layoutObject->setStyle(newStyle.get()); 1841 layoutObject->setStyle(newStyle.get());
(...skipping 18 matching lines...) Expand all
1862 return Inherit; 1860 return Inherit;
1863 newStyle->copyChildDependentFlagsFrom(*oldStyle); 1861 newStyle->copyChildDependentFlagsFrom(*oldStyle);
1864 } 1862 }
1865 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ()) 1863 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ())
1866 return UpdatePseudoElements; 1864 return UpdatePseudoElements;
1867 } 1865 }
1868 1866
1869 return localChange; 1867 return localChange;
1870 } 1868 }
1871 1869
1872 StyleRecalcChange Element::buildLayoutTree(ComputedStyle& newStyle) 1870 StyleRecalcChange Element::buildLayoutTree()
1873 { 1871 {
1874 AttachContext reattachContext; 1872 AttachContext reattachContext;
1875 reattachContext.resolvedStyle = &newStyle; 1873 reattachContext.resolvedStyle = mutableComputedStyle();
1876 bool layoutObjectWillChange = needsAttach() || layoutObject(); 1874 bool layoutObjectWillChange = needsAttach() || layoutObject();
1877 reattachLayoutTree(reattachContext); 1875 reattachLayoutTree(reattachContext);
1878 if (layoutObjectWillChange || layoutObject()) 1876 if (layoutObjectWillChange || layoutObject())
1879 return Reattach; 1877 return Reattach;
1880 return ReattachNoLayoutObject; 1878 return ReattachNoLayoutObject;
1881 } 1879 }
1882 1880
1883 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle) 1881 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle)
1884 { 1882 {
1885 Vector<String> emptyVector; 1883 Vector<String> emptyVector;
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
3828 3826
3829 DEFINE_TRACE_WRAPPERS(Element) 3827 DEFINE_TRACE_WRAPPERS(Element)
3830 { 3828 {
3831 if (hasRareData()) { 3829 if (hasRareData()) {
3832 visitor->traceWrappers(elementRareData()); 3830 visitor->traceWrappers(elementRareData());
3833 } 3831 }
3834 ContainerNode::traceWrappers(visitor); 3832 ContainerNode::traceWrappers(visitor);
3835 } 3833 }
3836 3834
3837 } // namespace blink 3835 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698