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

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: 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
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 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 DCHECK(newStyle); 1762 DCHECK(newStyle);
1763 1763
1764 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get()); 1764 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(oldStyle .get(), newStyle.get());
1765 if (localChange == NoChange) { 1765 if (localChange == NoChange) {
1766 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); 1766 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1);
1767 } else { 1767 } else {
1768 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 ); 1768 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1 );
1769 } 1769 }
1770 1770
1771 if (localChange == Reattach) { 1771 if (localChange == Reattach) {
1772 AttachContext reattachContext; 1772 // TODO(nainar): Remove the style parameter being passed into buildOwnLa yout()
1773 reattachContext.resolvedStyle = newStyle.get(); 1773 // ComputedStyle will now be stored on Node and accessed in buildOwnLayo ut()
1774 bool layoutObjectWillChange = needsAttach() || layoutObject(); 1774 // using mutableComputedStyle()
sashab 2016/07/05 01:48:56 Nit: full stops at the end of each sentence :)
nainar 2016/07/05 01:57:23 Done.
1775 reattach(reattachContext); 1775 return buildOwnLayout(newStyle.get());
1776 if (layoutObjectWillChange || layoutObject())
1777 return Reattach;
1778 return ReattachNoLayoutObject;
1779 } 1776 }
1780 1777
1781 DCHECK(oldStyle); 1778 DCHECK(oldStyle);
1782 1779
1783 if (localChange != NoChange) 1780 if (localChange != NoChange)
1784 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 1781 updateCallbackSelectors(oldStyle.get(), newStyle.get());
1785 1782
1786 if (LayoutObject* layoutObject = this->layoutObject()) { 1783 if (LayoutObject* layoutObject = this->layoutObject()) {
1787 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) { 1784 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) {
1788 layoutObject->setStyle(newStyle.get()); 1785 layoutObject->setStyle(newStyle.get());
(...skipping 18 matching lines...) Expand all
1807 return Inherit; 1804 return Inherit;
1808 newStyle->copyChildDependentFlagsFrom(*oldStyle); 1805 newStyle->copyChildDependentFlagsFrom(*oldStyle);
1809 } 1806 }
1810 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ()) 1807 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ())
1811 return UpdatePseudoElements; 1808 return UpdatePseudoElements;
1812 } 1809 }
1813 1810
1814 return localChange; 1811 return localChange;
1815 } 1812 }
1816 1813
1814 StyleRecalcChange Element::buildOwnLayout(ComputedStyle* newStyle)
1815 {
1816 AttachContext reattachContext;
1817 reattachContext.resolvedStyle = newStyle;
1818 bool layoutObjectWillChange = needsAttach() || layoutObject();
1819 reattach(reattachContext);
1820 if (layoutObjectWillChange || layoutObject())
1821 return Reattach;
1822 return ReattachNoLayoutObject;
1823 }
1824
1817 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle) 1825 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle)
1818 { 1826 {
1819 Vector<String> emptyVector; 1827 Vector<String> emptyVector;
1820 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector; 1828 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector;
1821 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector; 1829 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector;
1822 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty()) 1830 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty())
1823 return; 1831 return;
1824 if (oldCallbackSelectors != newCallbackSelectors) 1832 if (oldCallbackSelectors != newCallbackSelectors)
1825 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors); 1833 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors);
1826 } 1834 }
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
3728 3736
3729 DEFINE_TRACE_WRAPPERS(Element) 3737 DEFINE_TRACE_WRAPPERS(Element)
3730 { 3738 {
3731 if (hasRareData()) { 3739 if (hasRareData()) {
3732 visitor->traceWrappers(elementRareData()); 3740 visitor->traceWrappers(elementRareData());
3733 } 3741 }
3734 ContainerNode::traceWrappers(visitor); 3742 ContainerNode::traceWrappers(visitor);
3735 } 3743 }
3736 3744
3737 } // namespace blink 3745 } // namespace blink
OLDNEW
« third_party/WebKit/Source/core/dom/Element.h ('K') | « 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