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

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

Powered by Google App Engine
This is Rietveld 408576698