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

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: 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 // TODO(nainar): Remove the style parameter being passed into buildOwnLa yout(). 1772 setComputedStyle(newStyle);
1773 // ComputedStyle will now be stored on Node and accessed in buildOwnLayo ut() 1773 return buildOwnLayout();
1774 // using mutableComputedStyle().
1775 return buildOwnLayout(newStyle.get());
1776 } 1774 }
1777 1775
1778 DCHECK(oldStyle); 1776 DCHECK(oldStyle);
1779 1777
1780 if (localChange != NoChange) 1778 if (localChange != NoChange)
1781 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 1779 updateCallbackSelectors(oldStyle.get(), newStyle.get());
1782 1780
1783 if (LayoutObject* layoutObject = this->layoutObject()) { 1781 if (LayoutObject* layoutObject = this->layoutObject()) {
1784 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) { 1782 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) {
1785 layoutObject->setStyle(newStyle.get()); 1783 layoutObject->setStyle(newStyle.get());
(...skipping 18 matching lines...) Expand all
1804 return Inherit; 1802 return Inherit;
1805 newStyle->copyChildDependentFlagsFrom(*oldStyle); 1803 newStyle->copyChildDependentFlagsFrom(*oldStyle);
1806 } 1804 }
1807 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ()) 1805 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle ())
1808 return UpdatePseudoElements; 1806 return UpdatePseudoElements;
1809 } 1807 }
1810 1808
1811 return localChange; 1809 return localChange;
1812 } 1810 }
1813 1811
1814 StyleRecalcChange Element::buildOwnLayout(const ComputedStyle* newStyle) 1812 StyleRecalcChange Element::buildOwnLayout()
1815 { 1813 {
1816 AttachContext reattachContext; 1814 AttachContext reattachContext;
1817 reattachContext.resolvedStyle = newStyle; 1815 reattachContext.resolvedStyle = mutableComputedStyle();
1818 bool layoutObjectWillChange = needsAttach() || layoutObject(); 1816 bool layoutObjectWillChange = needsAttach() || layoutObject();
1819 reattach(reattachContext); 1817 reattach(reattachContext);
1820 if (layoutObjectWillChange || layoutObject()) 1818 if (layoutObjectWillChange || layoutObject())
1821 return Reattach; 1819 return Reattach;
1822 return ReattachNoLayoutObject; 1820 return ReattachNoLayoutObject;
1823 } 1821 }
1824 1822
1825 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle) 1823 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const Compu tedStyle* newStyle)
1826 { 1824 {
1827 Vector<String> emptyVector; 1825 Vector<String> emptyVector;
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
3736 3734
3737 DEFINE_TRACE_WRAPPERS(Element) 3735 DEFINE_TRACE_WRAPPERS(Element)
3738 { 3736 {
3739 if (hasRareData()) { 3737 if (hasRareData()) {
3740 visitor->traceWrappers(elementRareData()); 3738 visitor->traceWrappers(elementRareData());
3741 } 3739 }
3742 ContainerNode::traceWrappers(visitor); 3740 ContainerNode::traceWrappers(visitor);
3743 } 3741 }
3744 3742
3745 } // namespace blink 3743 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698