Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1331 const AtomicString Element::imageSourceURL() const | 1331 const AtomicString Element::imageSourceURL() const |
| 1332 { | 1332 { |
| 1333 return getAttribute(srcAttr); | 1333 return getAttribute(srcAttr); |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 bool Element::rendererIsNeeded(const RenderStyle& style) | 1336 bool Element::rendererIsNeeded(const RenderStyle& style) |
| 1337 { | 1337 { |
| 1338 return style.display() != NONE; | 1338 return style.display() != NONE; |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 RenderObject* Element::createRenderer(RenderStyle* style) | 1341 RenderObject* Element::createRenderer(const RenderStyle* style) |
| 1342 { | 1342 { |
| 1343 return RenderObject::createObject(this, style); | 1343 return RenderObject::createObject(this, style); |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio nPoint) | 1346 Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio nPoint) |
| 1347 { | 1347 { |
| 1348 // need to do superclass processing first so inDocument() is true | 1348 // need to do superclass processing first so inDocument() is true |
| 1349 // by the time we reach updateId | 1349 // by the time we reach updateId |
| 1350 ContainerNode::insertedInto(insertionPoint); | 1350 ContainerNode::insertedInto(insertionPoint); |
| 1351 | 1351 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1643 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); | 1643 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) | 1646 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) |
| 1647 { | 1647 { |
| 1648 ASSERT(document().inStyleRecalc()); | 1648 ASSERT(document().inStyleRecalc()); |
| 1649 ASSERT(!parentOrShadowHostNode()->needsStyleRecalc()); | 1649 ASSERT(!parentOrShadowHostNode()->needsStyleRecalc()); |
| 1650 ASSERT(change >= Inherit || needsStyleRecalc()); | 1650 ASSERT(change >= Inherit || needsStyleRecalc()); |
| 1651 ASSERT(parentRenderStyle()); | 1651 ASSERT(parentRenderStyle()); |
| 1652 | 1652 |
| 1653 RefPtr<RenderStyle> oldStyle = renderStyle(); | 1653 RefPtr<RenderStyle> oldStyle = mutableRenderStyle(); |
|
rune
2015/01/29 23:16:32
All use of oldStyle below looks const to me.
Julien - ping for review
2015/02/10 07:33:19
RefPtr modifies |oldStyle| so it's not const at al
| |
| 1654 RefPtr<RenderStyle> newStyle = styleForRenderer(); | 1654 RefPtr<RenderStyle> newStyle = styleForRenderer(); |
| 1655 StyleRecalcChange localChange = RenderStyle::stylePropagationDiff(oldStyle.g et(), newStyle.get()); | 1655 StyleRecalcChange localChange = RenderStyle::stylePropagationDiff(oldStyle.g et(), newStyle.get()); |
| 1656 | 1656 |
| 1657 ASSERT(newStyle); | 1657 ASSERT(newStyle); |
| 1658 | 1658 |
| 1659 if (localChange == Reattach) { | 1659 if (localChange == Reattach) { |
| 1660 AttachContext reattachContext; | 1660 AttachContext reattachContext; |
| 1661 reattachContext.resolvedStyle = newStyle.get(); | 1661 reattachContext.resolvedStyle = newStyle.get(); |
| 1662 bool rendererWillChange = needsAttach() || renderer(); | 1662 bool rendererWillChange = needsAttach() || renderer(); |
| 1663 reattach(reattachContext); | 1663 reattach(reattachContext); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1688 | 1688 |
| 1689 if (change > Inherit || localChange > Inherit) | 1689 if (change > Inherit || localChange > Inherit) |
| 1690 return max(localChange, change); | 1690 return max(localChange, change); |
| 1691 | 1691 |
| 1692 if (localChange < Inherit && (oldStyle->hasPseudoElementStyle() || newStyle- >hasPseudoElementStyle())) | 1692 if (localChange < Inherit && (oldStyle->hasPseudoElementStyle() || newStyle- >hasPseudoElementStyle())) |
| 1693 return UpdatePseudoElements; | 1693 return UpdatePseudoElements; |
| 1694 | 1694 |
| 1695 return localChange; | 1695 return localChange; |
| 1696 } | 1696 } |
| 1697 | 1697 |
| 1698 void Element::updateCallbackSelectors(RenderStyle* oldStyle, RenderStyle* newSty le) | 1698 void Element::updateCallbackSelectors(const RenderStyle* oldStyle, const RenderS tyle* newStyle) |
| 1699 { | 1699 { |
| 1700 Vector<String> emptyVector; | 1700 Vector<String> emptyVector; |
| 1701 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector; | 1701 const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSe lectors() : emptyVector; |
| 1702 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector; | 1702 const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSe lectors() : emptyVector; |
| 1703 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty()) | 1703 if (oldCallbackSelectors.isEmpty() && newCallbackSelectors.isEmpty()) |
| 1704 return; | 1704 return; |
| 1705 if (oldCallbackSelectors != newCallbackSelectors) | 1705 if (oldCallbackSelectors != newCallbackSelectors) |
| 1706 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors); | 1706 CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSele ctors, newCallbackSelectors); |
| 1707 } | 1707 } |
| 1708 | 1708 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1839 case CDATA_SECTION_NODE: | 1839 case CDATA_SECTION_NODE: |
| 1840 return true; | 1840 return true; |
| 1841 default: | 1841 default: |
| 1842 break; | 1842 break; |
| 1843 } | 1843 } |
| 1844 return false; | 1844 return false; |
| 1845 } | 1845 } |
| 1846 | 1846 |
| 1847 void Element::checkForEmptyStyleChange() | 1847 void Element::checkForEmptyStyleChange() |
| 1848 { | 1848 { |
| 1849 RenderStyle* style = renderStyle(); | 1849 const RenderStyle* style = renderStyle(); |
| 1850 | 1850 |
| 1851 if (!style && !styleAffectedByEmpty()) | 1851 if (!style && !styleAffectedByEmpty()) |
| 1852 return; | 1852 return; |
| 1853 if (styleChangeType() >= SubtreeStyleChange) | 1853 if (styleChangeType() >= SubtreeStyleChange) |
| 1854 return; | 1854 return; |
| 1855 if (!inActiveDocument()) | 1855 if (!inActiveDocument()) |
| 1856 return; | 1856 return; |
| 1857 if (!document().styleResolver()) | 1857 if (!document().styleResolver()) |
| 1858 return; | 1858 return; |
| 1859 | 1859 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2531 | 2531 |
| 2532 if (!inActiveDocument()) { | 2532 if (!inActiveDocument()) { |
| 2533 // FIXME: Try to do better than this. Ensure that styleForElement() work s for elements that are not in the | 2533 // FIXME: Try to do better than this. Ensure that styleForElement() work s for elements that are not in the |
| 2534 // document tree and figure out when to destroy the computed style for s uch elements. | 2534 // document tree and figure out when to destroy the computed style for s uch elements. |
| 2535 return nullptr; | 2535 return nullptr; |
| 2536 } | 2536 } |
| 2537 | 2537 |
| 2538 // FIXME: Find and use the renderer from the pseudo element instead of the a ctual element so that the 'length' | 2538 // FIXME: Find and use the renderer from the pseudo element instead of the a ctual element so that the 'length' |
| 2539 // properties, which are only known by the renderer because it did the layou t, will be correct and so that the | 2539 // properties, which are only known by the renderer because it did the layou t, will be correct and so that the |
| 2540 // values returned for the ":selection" pseudo-element will be correct. | 2540 // values returned for the ":selection" pseudo-element will be correct. |
| 2541 RenderStyle* elementStyle = renderStyle(); | 2541 RenderStyle* elementStyle = mutableRenderStyle(); |
| 2542 if (!elementStyle) { | 2542 if (!elementStyle) { |
| 2543 ElementRareData& rareData = ensureElementRareData(); | 2543 ElementRareData& rareData = ensureElementRareData(); |
| 2544 if (!rareData.computedStyle()) | 2544 if (!rareData.computedStyle()) |
| 2545 rareData.setComputedStyle(document().styleForElementIgnoringPendingS tylesheets(this)); | 2545 rareData.setComputedStyle(document().styleForElementIgnoringPendingS tylesheets(this)); |
| 2546 elementStyle = rareData.computedStyle(); | 2546 elementStyle = rareData.computedStyle(); |
| 2547 } | 2547 } |
| 2548 | 2548 |
| 2549 if (!pseudoElementSpecifier) | 2549 if (!pseudoElementSpecifier) |
| 2550 return elementStyle; | 2550 return elementStyle; |
| 2551 | 2551 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2614 ASSERT(!needsStyleRecalc()); | 2614 ASSERT(!needsStyleRecalc()); |
| 2615 PseudoElement* element = pseudoElement(pseudoId); | 2615 PseudoElement* element = pseudoElement(pseudoId); |
| 2616 | 2616 |
| 2617 if (element && (change == UpdatePseudoElements || element->shouldCallRecalcS tyle(change))) { | 2617 if (element && (change == UpdatePseudoElements || element->shouldCallRecalcS tyle(change))) { |
| 2618 if (pseudoId == FIRST_LETTER && updateFirstLetter(element)) | 2618 if (pseudoId == FIRST_LETTER && updateFirstLetter(element)) |
| 2619 return; | 2619 return; |
| 2620 | 2620 |
| 2621 // Need to clear the cached style if the PseudoElement wants a recalc so it | 2621 // Need to clear the cached style if the PseudoElement wants a recalc so it |
| 2622 // computes a new style. | 2622 // computes a new style. |
| 2623 if (element->needsStyleRecalc()) | 2623 if (element->needsStyleRecalc()) |
| 2624 renderer()->style()->removeCachedPseudoStyle(pseudoId); | 2624 renderer()->deprecatedMutableStyle()->removeCachedPseudoStyle(pseudo Id); |
| 2625 | 2625 |
| 2626 // PseudoElement styles hang off their parent element's style so if we n eeded | 2626 // PseudoElement styles hang off their parent element's style so if we n eeded |
| 2627 // a style recalc we should Force one on the pseudo. | 2627 // a style recalc we should Force one on the pseudo. |
| 2628 // FIXME: We should figure out the right text sibling to pass. | 2628 // FIXME: We should figure out the right text sibling to pass. |
| 2629 element->recalcStyle(change == UpdatePseudoElements ? Force : change); | 2629 element->recalcStyle(change == UpdatePseudoElements ? Force : change); |
| 2630 | 2630 |
| 2631 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed | 2631 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed |
| 2632 // is false, otherwise we could continuously create and destroy PseudoEl ements | 2632 // is false, otherwise we could continuously create and destroy PseudoEl ements |
| 2633 // when RenderObject::isChildAllowed on our parent returns false for the | 2633 // when RenderObject::isChildAllowed on our parent returns false for the |
| 2634 // PseudoElement's renderer for each style recalc. | 2634 // PseudoElement's renderer for each style recalc. |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3386 { | 3386 { |
| 3387 #if ENABLE(OILPAN) | 3387 #if ENABLE(OILPAN) |
| 3388 if (hasRareData()) | 3388 if (hasRareData()) |
| 3389 visitor->trace(elementRareData()); | 3389 visitor->trace(elementRareData()); |
| 3390 visitor->trace(m_elementData); | 3390 visitor->trace(m_elementData); |
| 3391 #endif | 3391 #endif |
| 3392 ContainerNode::trace(visitor); | 3392 ContainerNode::trace(visitor); |
| 3393 } | 3393 } |
| 3394 | 3394 |
| 3395 } // namespace blink | 3395 } // namespace blink |
| OLD | NEW |