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

Side by Side Diff: trunk/Source/core/dom/Element.cpp

Issue 948053002: Revert 190605 "Make RenderObject::style() return a const object" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « trunk/Source/core/dom/Element.h ('k') | trunk/Source/core/dom/FirstLetterPseudoElement.cpp » ('j') | 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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); 1627 reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
1628 } 1628 }
1629 1629
1630 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) 1630 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change)
1631 { 1631 {
1632 ASSERT(document().inStyleRecalc()); 1632 ASSERT(document().inStyleRecalc());
1633 ASSERT(!parentOrShadowHostNode()->needsStyleRecalc()); 1633 ASSERT(!parentOrShadowHostNode()->needsStyleRecalc());
1634 ASSERT(change >= Inherit || needsStyleRecalc()); 1634 ASSERT(change >= Inherit || needsStyleRecalc());
1635 ASSERT(parentLayoutStyle()); 1635 ASSERT(parentLayoutStyle());
1636 1636
1637 RefPtr<LayoutStyle> oldStyle = mutableLayoutStyle(); 1637 RefPtr<LayoutStyle> oldStyle = layoutStyle();
1638 RefPtr<LayoutStyle> newStyle = styleForRenderer(); 1638 RefPtr<LayoutStyle> newStyle = styleForRenderer();
1639 StyleRecalcChange localChange = LayoutStyle::stylePropagationDiff(oldStyle.g et(), newStyle.get()); 1639 StyleRecalcChange localChange = LayoutStyle::stylePropagationDiff(oldStyle.g et(), newStyle.get());
1640 1640
1641 ASSERT(newStyle); 1641 ASSERT(newStyle);
1642 1642
1643 if (localChange == Reattach) { 1643 if (localChange == Reattach) {
1644 AttachContext reattachContext; 1644 AttachContext reattachContext;
1645 reattachContext.resolvedStyle = newStyle.get(); 1645 reattachContext.resolvedStyle = newStyle.get();
1646 bool rendererWillChange = needsAttach() || renderer(); 1646 bool rendererWillChange = needsAttach() || renderer();
1647 reattach(reattachContext); 1647 reattach(reattachContext);
(...skipping 24 matching lines...) Expand all
1672 1672
1673 if (change > Inherit || localChange > Inherit) 1673 if (change > Inherit || localChange > Inherit)
1674 return max(localChange, change); 1674 return max(localChange, change);
1675 1675
1676 if (localChange < Inherit && (oldStyle->hasPseudoElementStyle() || newStyle- >hasPseudoElementStyle())) 1676 if (localChange < Inherit && (oldStyle->hasPseudoElementStyle() || newStyle- >hasPseudoElementStyle()))
1677 return UpdatePseudoElements; 1677 return UpdatePseudoElements;
1678 1678
1679 return localChange; 1679 return localChange;
1680 } 1680 }
1681 1681
1682 void Element::updateCallbackSelectors(const LayoutStyle* oldStyle, const LayoutS tyle* newStyle) 1682 void Element::updateCallbackSelectors(LayoutStyle* oldStyle, LayoutStyle* newSty le)
1683 { 1683 {
1684 Vector<String> emptyVector; 1684 Vector<String> emptyVector;
1685 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector; 1685 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector;
1686 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector; 1686 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector;
1687 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty()) 1687 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty())
1688 return; 1688 return;
1689 if (oldCallbackSelectors != newCallbackSelectors) 1689 if (oldCallbackSelectors != newCallbackSelectors)
1690 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors); 1690 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors);
1691 } 1691 }
1692 1692
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 case CDATA_SECTION_NODE: 1823 case CDATA_SECTION_NODE:
1824 return true; 1824 return true;
1825 default: 1825 default:
1826 break; 1826 break;
1827 } 1827 }
1828 return false; 1828 return false;
1829 } 1829 }
1830 1830
1831 void Element::checkForEmptyStyleChange() 1831 void Element::checkForEmptyStyleChange()
1832 { 1832 {
1833 const LayoutStyle* style = layoutStyle(); 1833 LayoutStyle* style = layoutStyle();
1834 1834
1835 if (!style && !styleAffectedByEmpty()) 1835 if (!style && !styleAffectedByEmpty())
1836 return; 1836 return;
1837 if (styleChangeType() >= SubtreeStyleChange) 1837 if (styleChangeType() >= SubtreeStyleChange)
1838 return; 1838 return;
1839 if (!inActiveDocument()) 1839 if (!inActiveDocument())
1840 return; 1840 return;
1841 if (!document().styleResolver()) 1841 if (!document().styleResolver())
1842 return; 1842 return;
1843 1843
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 2526
2527 if (!inActiveDocument()) { 2527 if (!inActiveDocument()) {
2528 // FIXME: Try to do better than this. Ensure that styleForElement() work s for elements that are not in the 2528 // FIXME: Try to do better than this. Ensure that styleForElement() work s for elements that are not in the
2529 // document tree and figure out when to destroy the computed style for s uch elements. 2529 // document tree and figure out when to destroy the computed style for s uch elements.
2530 return nullptr; 2530 return nullptr;
2531 } 2531 }
2532 2532
2533 // FIXME: Find and use the renderer from the pseudo element instead of the a ctual element so that the 'length' 2533 // FIXME: Find and use the renderer from the pseudo element instead of the a ctual element so that the 'length'
2534 // properties, which are only known by the renderer because it did the layou t, will be correct and so that the 2534 // properties, which are only known by the renderer because it did the layou t, will be correct and so that the
2535 // values returned for the ":selection" pseudo-element will be correct. 2535 // values returned for the ":selection" pseudo-element will be correct.
2536 LayoutStyle* elementStyle = mutableLayoutStyle(); 2536 LayoutStyle* elementStyle = layoutStyle();
2537 if (!elementStyle) { 2537 if (!elementStyle) {
2538 ElementRareData& rareData = ensureElementRareData(); 2538 ElementRareData& rareData = ensureElementRareData();
2539 if (!rareData.computedStyle()) 2539 if (!rareData.computedStyle())
2540 rareData.setComputedStyle(document().styleForElementIgnoringPendingS tylesheets(this)); 2540 rareData.setComputedStyle(document().styleForElementIgnoringPendingS tylesheets(this));
2541 elementStyle = rareData.computedStyle(); 2541 elementStyle = rareData.computedStyle();
2542 } 2542 }
2543 2543
2544 if (!pseudoElementSpecifier) 2544 if (!pseudoElementSpecifier)
2545 return elementStyle; 2545 return elementStyle;
2546 2546
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 ASSERT(!needsStyleRecalc()); 2609 ASSERT(!needsStyleRecalc());
2610 PseudoElement* element = pseudoElement(pseudoId); 2610 PseudoElement* element = pseudoElement(pseudoId);
2611 2611
2612 if (element && (change == UpdatePseudoElements || element->shouldCallRecalcS tyle(change))) { 2612 if (element && (change == UpdatePseudoElements || element->shouldCallRecalcS tyle(change))) {
2613 if (pseudoId == FIRST_LETTER && updateFirstLetter(element)) 2613 if (pseudoId == FIRST_LETTER && updateFirstLetter(element))
2614 return; 2614 return;
2615 2615
2616 // Need to clear the cached style if the PseudoElement wants a recalc so it 2616 // Need to clear the cached style if the PseudoElement wants a recalc so it
2617 // computes a new style. 2617 // computes a new style.
2618 if (element->needsStyleRecalc()) 2618 if (element->needsStyleRecalc())
2619 renderer()->mutableStyleRef().removeCachedPseudoStyle(pseudoId); 2619 renderer()->style()->removeCachedPseudoStyle(pseudoId);
2620 2620
2621 // PseudoElement styles hang off their parent element's style so if we n eeded 2621 // PseudoElement styles hang off their parent element's style so if we n eeded
2622 // a style recalc we should Force one on the pseudo. 2622 // a style recalc we should Force one on the pseudo.
2623 // FIXME: We should figure out the right text sibling to pass. 2623 // FIXME: We should figure out the right text sibling to pass.
2624 element->recalcStyle(change == UpdatePseudoElements ? Force : change); 2624 element->recalcStyle(change == UpdatePseudoElements ? Force : change);
2625 2625
2626 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed 2626 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed
2627 // is false, otherwise we could continuously create and destroy PseudoEl ements 2627 // is false, otherwise we could continuously create and destroy PseudoEl ements
2628 // when LayoutObject::isChildAllowed on our parent returns false for the 2628 // when LayoutObject::isChildAllowed on our parent returns false for the
2629 // PseudoElement's renderer for each style recalc. 2629 // PseudoElement's renderer for each style recalc.
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
3381 { 3381 {
3382 #if ENABLE(OILPAN) 3382 #if ENABLE(OILPAN)
3383 if (hasRareData()) 3383 if (hasRareData())
3384 visitor->trace(elementRareData()); 3384 visitor->trace(elementRareData());
3385 visitor->trace(m_elementData); 3385 visitor->trace(m_elementData);
3386 #endif 3386 #endif
3387 ContainerNode::trace(visitor); 3387 ContainerNode::trace(visitor);
3388 } 3388 }
3389 3389
3390 } // namespace blink 3390 } // namespace blink
OLDNEW
« no previous file with comments | « trunk/Source/core/dom/Element.h ('k') | trunk/Source/core/dom/FirstLetterPseudoElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698