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

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

Issue 1473363003: Invalidate first line display item clients when first line style changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Invalidate the whole first line Created 5 years 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 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 } 1616 }
1617 1617
1618 document().styleEngine().styleInvalidator().clearInvalidation(*this); 1618 document().styleEngine().styleInvalidator().clearInvalidation(*this);
1619 1619
1620 if (svgFilterNeedsLayerUpdate()) 1620 if (svgFilterNeedsLayerUpdate())
1621 document().unscheduleSVGFilterLayerUpdateHack(*this); 1621 document().unscheduleSVGFilterLayerUpdateHack(*this);
1622 1622
1623 ASSERT(needsAttach()); 1623 ASSERT(needsAttach());
1624 } 1624 }
1625 1625
1626 bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, Compu tedStyle* newStyle) 1626 bool Element::updatePseudoStyleCache(const ComputedStyle* currentStyle, Computed Style* newStyle)
1627 { 1627 {
1628 ASSERT(currentStyle == computedStyle()); 1628 ASSERT(currentStyle == computedStyle());
1629 ASSERT(layoutObject()); 1629 ASSERT(layoutObject());
1630 1630
1631 if (!currentStyle) 1631 if (!currentStyle)
1632 return false; 1632 return false;
1633 1633
1634 const PseudoStyleCache* pseudoStyleCache = currentStyle->cachedPseudoStyles( ); 1634 const PseudoStyleCache* pseudoStyleCache = currentStyle->cachedPseudoStyles( );
1635 if (!pseudoStyleCache) 1635 if (!pseudoStyleCache)
1636 return false; 1636 return false;
1637 1637
1638 size_t cacheSize = pseudoStyleCache->size(); 1638 size_t cacheSize = pseudoStyleCache->size();
1639 bool result = false;
1639 for (size_t i = 0; i < cacheSize; ++i) { 1640 for (size_t i = 0; i < cacheSize; ++i) {
1640 RefPtr<ComputedStyle> newPseudoStyle; 1641 RefPtr<ComputedStyle> newPseudoStyle;
1641 RefPtr<ComputedStyle> oldPseudoStyle = pseudoStyleCache->at(i); 1642 RefPtr<ComputedStyle> oldPseudoStyle = pseudoStyleCache->at(i);
1642 PseudoId pseudoId = oldPseudoStyle->styleType(); 1643 PseudoId pseudoId = oldPseudoStyle->styleType();
1643 if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) 1644 if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
1644 newPseudoStyle = layoutObject()->uncachedFirstLineStyle(newStyle); 1645 newPseudoStyle = layoutObject()->uncachedFirstLineStyle(newStyle);
1645 else 1646 else
1646 newPseudoStyle = layoutObject()->getUncachedPseudoStyle(PseudoStyleR equest(pseudoId), newStyle, newStyle); 1647 newPseudoStyle = layoutObject()->getUncachedPseudoStyle(PseudoStyleR equest(pseudoId), newStyle, newStyle);
1647 if (!newPseudoStyle) 1648 if (!newPseudoStyle) {
1648 return true; 1649 result = true;
1650 continue;
1651 }
1649 if (*oldPseudoStyle != *newPseudoStyle || oldPseudoStyle->font().loading CustomFonts() != newPseudoStyle->font().loadingCustomFonts()) { 1652 if (*oldPseudoStyle != *newPseudoStyle || oldPseudoStyle->font().loading CustomFonts() != newPseudoStyle->font().loadingCustomFonts()) {
1650 if (pseudoId < FIRST_INTERNAL_PSEUDOID) 1653 if (pseudoId < FIRST_INTERNAL_PSEUDOID)
1651 newStyle->setHasPseudoStyle(pseudoId); 1654 newStyle->setHasPseudoStyle(pseudoId);
1652 newStyle->addCachedPseudoStyle(newPseudoStyle); 1655 newStyle->addCachedPseudoStyle(newPseudoStyle);
1653 if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) 1656 if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED)
1654 layoutObject()->firstLineStyleDidChange(*oldPseudoStyle, *newPse udoStyle); 1657 layoutObject()->firstLineStyleDidChange(*oldPseudoStyle, *newPse udoStyle);
1655 return true; 1658 result = true;
1656 } 1659 }
1657 } 1660 }
1658 return false; 1661 return false;
1659 } 1662 }
1660 1663
1661 PassRefPtr<ComputedStyle> Element::styleForLayoutObject() 1664 PassRefPtr<ComputedStyle> Element::styleForLayoutObject()
1662 { 1665 {
1663 ASSERT(document().inStyleRecalc()); 1666 ASSERT(document().inStyleRecalc());
1664 1667
1665 RefPtr<ComputedStyle> style; 1668 RefPtr<ComputedStyle> style;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 return Reattach; 1787 return Reattach;
1785 return ReattachNoLayoutObject; 1788 return ReattachNoLayoutObject;
1786 } 1789 }
1787 1790
1788 ASSERT(oldStyle); 1791 ASSERT(oldStyle);
1789 1792
1790 if (localChange != NoChange) 1793 if (localChange != NoChange)
1791 updateCallbackSelectors(oldStyle.get(), newStyle.get()); 1794 updateCallbackSelectors(oldStyle.get(), newStyle.get());
1792 1795
1793 if (LayoutObject* layoutObject = this->layoutObject()) { 1796 if (LayoutObject* layoutObject = this->layoutObject()) {
1794 if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) { 1797 bool pseudoStyleCacheUpdated = updatePseudoStyleCache(oldStyle.get(), ne wStyle.get());
1798 if (localChange != NoChange || pseudoStyleCacheUpdated || svgFilterNeeds LayerUpdate()) {
1795 layoutObject->setStyle(newStyle.get()); 1799 layoutObject->setStyle(newStyle.get());
1796 } else { 1800 } else {
1797 // Although no change occurred, we use the new style so that the cou sin style sharing code won't get 1801 // Although no change occurred, we use the new style so that the cou sin style sharing code won't get
1798 // fooled into believing this style is the same. 1802 // fooled into believing this style is the same.
1799 // FIXME: We may be able to remove this hack, see discussion in 1803 // FIXME: We may be able to remove this hack, see discussion in
1800 // https://codereview.chromium.org/30453002/ 1804 // https://codereview.chromium.org/30453002/
1801 layoutObject->setStyleInternal(newStyle.get()); 1805 layoutObject->setStyleInternal(newStyle.get());
1802 } 1806 }
1803 } 1807 }
1804 1808
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 { 3571 {
3568 #if ENABLE(OILPAN) 3572 #if ENABLE(OILPAN)
3569 if (hasRareData()) 3573 if (hasRareData())
3570 visitor->trace(elementRareData()); 3574 visitor->trace(elementRareData());
3571 visitor->trace(m_elementData); 3575 visitor->trace(m_elementData);
3572 #endif 3576 #endif
3573 ContainerNode::trace(visitor); 3577 ContainerNode::trace(visitor);
3574 } 3578 }
3575 3579
3576 } // namespace blink 3580 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698