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

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

Issue 2118393002: Reorganize Layout Tree Construction code to be its own function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final patch for landinh Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 DCHECK(newStyle); 1764 DCHECK(newStyle);
1765 1765
1766 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get()); 1766 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get());
1767 if (localChange == NoChange) { 1767 if (localChange == NoChange) {
1768 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); 1768 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1);
1769 } else { 1769 } else {
1770 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 ); 1770 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 );
1771 } 1771 }
1772 1772
1773 if (localChange == Reattach) { 1773 if (localChange == Reattach) {
1774 AttachContext reattachContext; 1774 // TODO(nainar): Remove the style parameter being passed into buildOwnLa yout().
1775 reattachContext.resolvedStyle = newStyle.get(); 1775 // ComputedStyle will now be stored on Node and accessed in buildOwnLayo ut()
1776 bool layoutObjectWillChange = needsAttach() || layoutObject(); 1776 // using mutableComputedStyle().
1777 reattach(reattachContext); 1777 return buildOwnLayout(*newStyle);
1778 if (layoutObjectWillChange || layoutObject())
1779 return Reattach;
1780 return ReattachNoLayoutObject;
1781 } 1778 }
1782 1779
1783 DCHECK(oldStyle); 1780 DCHECK(oldStyle);
1784 1781
1785 if (localChange != NoChange) 1782 if (localChange != NoChange)
1786 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 1783 updateCallbackSelectors(oldStyle.get(), newStyle.get());
1787 1784
1788 if (LayoutObject* layoutObject = this->layoutObject()) { 1785 if (LayoutObject* layoutObject = this->layoutObject()) {
1789 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) { 1786 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) {
1790 layoutObject->setStyle(newStyle.get()); 1787 layoutObject->setStyle(newStyle.get());
(...skipping 18 matching lines...) Expand all
1809 return Inherit; 1806 return Inherit;
1810 newStyle->copyChildDependentFlagsFrom(*oldStyle); 1807 newStyle->copyChildDependentFlagsFrom(*oldStyle);
1811 } 1808 }
1812 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ()) 1809 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ())
1813 return UpdatePseudoElements; 1810 return UpdatePseudoElements;
1814 } 1811 }
1815 1812
1816 return localChange; 1813 return localChange;
1817 } 1814 }
1818 1815
1816 StyleRecalcChange Element::buildOwnLayout(ComputedStyle& newStyle)
1817 {
1818 AttachContext reattachContext;
1819 reattachContext.resolvedStyle = &newStyle;
1820 bool layoutObjectWillChange = needsAttach() || layoutObject();
1821 reattach(reattachContext);
1822 if (layoutObjectWillChange || layoutObject())
1823 return Reattach;
1824 return ReattachNoLayoutObject;
1825 }
1826
1819 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle) 1827 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle)
1820 { 1828 {
1821 Vector<String> emptyVector; 1829 Vector<String> emptyVector;
1822 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector; 1830 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector;
1823 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector; 1831 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector;
1824 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty()) 1832 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty())
1825 return; 1833 return;
1826 if (oldCallbackSelectors != newCallbackSelectors) 1834 if (oldCallbackSelectors != newCallbackSelectors)
1827 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors); 1835 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors);
1828 } 1836 }
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
3730 3738
3731 DEFINE_TRACE_WRAPPERS(Element) 3739 DEFINE_TRACE_WRAPPERS(Element)
3732 { 3740 {
3733 if (hasRareData()) { 3741 if (hasRareData()) {
3734 visitor->traceWrappers(elementRareData()); 3742 visitor->traceWrappers(elementRareData());
3735 } 3743 }
3736 ContainerNode::traceWrappers(visitor); 3744 ContainerNode::traceWrappers(visitor);
3737 } 3745 }
3738 3746
3739 } // namespace blink 3747 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698