OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. |
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1526 { | 1526 { |
1527 const Element* element = state.element(); | 1527 const Element* element = state.element(); |
1528 ASSERT(element); | 1528 ASSERT(element); |
1529 | 1529 |
1530 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyApply , 1); | 1530 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyApply , 1); |
1531 | 1531 |
1532 unsigned cacheHash = RuntimeEnabledFeatures::styleMatchedPropertiesCacheEnab led() && matchResult.isCacheable() ? computeMatchedPropertiesHash(matchResult.ma tchedProperties().data(), matchResult.matchedProperties().size()) : 0; | 1532 unsigned cacheHash = RuntimeEnabledFeatures::styleMatchedPropertiesCacheEnab led() && matchResult.isCacheable() ? computeMatchedPropertiesHash(matchResult.ma tchedProperties().data(), matchResult.matchedProperties().size()) : 0; |
1533 bool applyInheritedOnly = false; | 1533 bool applyInheritedOnly = false; |
1534 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match edPropertiesCache.find(cacheHash, state, matchResult.matchedProperties()) : null ptr; | 1534 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match edPropertiesCache.find(cacheHash, state, matchResult.matchedProperties()) : null ptr; |
1535 | 1535 |
1536 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(*state.st yle(), *state.parentStyle())) { | 1536 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(*state.st yle(), *state.parentStyle(), state.parentNode())) { |
hayato
2016/08/30 02:01:05
Could you explain briefly what parentStyle means i
esprehn
2016/08/30 21:37:10
Can we just pass State into isCacheable? Passing a
| |
1537 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyC acheHit, 1); | 1537 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyC acheHit, 1); |
1538 // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact | 1538 // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact |
1539 // style declarations. We then only need to apply the inherited properti es, if any, as their values can depend on the | 1539 // style declarations. We then only need to apply the inherited properti es, if any, as their values can depend on the |
1540 // element context. This is fast and saves memory by reusing the style d ata structures. | 1540 // element context. This is fast and saves memory by reusing the style d ata structures. |
1541 state.style()->copyNonInheritedFromCached(*cachedMatchedProperties->comp utedStyle); | 1541 state.style()->copyNonInheritedFromCached(*cachedMatchedProperties->comp utedStyle); |
1542 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p arentComputedStyle) && !isAtShadowBoundary(element) | 1542 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p arentComputedStyle) && !isAtShadowBoundary(element) |
1543 && (!state.distributedToInsertionPoint() || state.style()->userModif y() == READ_ONLY)) { | 1543 && (!state.distributedToInsertionPoint() || state.style()->userModif y() == READ_ONLY)) { |
1544 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPrope rtyCacheInheritedHit, 1); | 1544 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPrope rtyCacheInheritedHit, 1); |
1545 | 1545 |
1546 EInsideLink linkStatus = state.style()->insideLink(); | 1546 EInsideLink linkStatus = state.style()->insideLink(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1620 // Check whether the final border and background differs from the cached UA ones. | 1620 // Check whether the final border and background differs from the cached UA ones. |
1621 // When there is a partial match in the MatchedPropertiesCache, these fl ags will already be set correctly | 1621 // When there is a partial match in the MatchedPropertiesCache, these fl ags will already be set correctly |
1622 // and the value stored in cacheUserAgentBorderAndBackground is incorrec t, so doing this check again | 1622 // and the value stored in cacheUserAgentBorderAndBackground is incorrec t, so doing this check again |
1623 // would give the wrong answer. | 1623 // would give the wrong answer. |
1624 state.style()->setHasAuthorBackground(hasAuthorBackground(state)); | 1624 state.style()->setHasAuthorBackground(hasAuthorBackground(state)); |
1625 state.style()->setHasAuthorBorder(hasAuthorBorder(state)); | 1625 state.style()->setHasAuthorBorder(hasAuthorBorder(state)); |
1626 } | 1626 } |
1627 | 1627 |
1628 loadPendingResources(state); | 1628 loadPendingResources(state); |
1629 | 1629 |
1630 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache able(*state.style(), *state.parentStyle())) { | 1630 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache able(*state.style(), *state.parentStyle(), state.parentNode())) { |
1631 ASSERT(RuntimeEnabledFeatures::styleMatchedPropertiesCacheEnabled()); | 1631 ASSERT(RuntimeEnabledFeatures::styleMatchedPropertiesCacheEnabled()); |
1632 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyC acheAdded, 1); | 1632 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), matchedPropertyC acheAdded, 1); |
1633 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache Hash, matchResult.matchedProperties()); | 1633 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache Hash, matchResult.matchedProperties()); |
1634 } | 1634 } |
1635 | 1635 |
1636 ASSERT(!state.fontBuilder().fontDirty()); | 1636 ASSERT(!state.fontBuilder().fontDirty()); |
1637 } | 1637 } |
1638 | 1638 |
1639 bool StyleResolver::hasAuthorBackground(const StyleResolverState& state) | 1639 bool StyleResolver::hasAuthorBackground(const StyleResolverState& state) |
1640 { | 1640 { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1744 visitor->trace(m_siblingRuleSet); | 1744 visitor->trace(m_siblingRuleSet); |
1745 visitor->trace(m_uncommonAttributeRuleSet); | 1745 visitor->trace(m_uncommonAttributeRuleSet); |
1746 visitor->trace(m_watchedSelectorsRules); | 1746 visitor->trace(m_watchedSelectorsRules); |
1747 visitor->trace(m_treeBoundaryCrossingScopes); | 1747 visitor->trace(m_treeBoundaryCrossingScopes); |
1748 visitor->trace(m_styleSharingLists); | 1748 visitor->trace(m_styleSharingLists); |
1749 visitor->trace(m_pendingStyleSheets); | 1749 visitor->trace(m_pendingStyleSheets); |
1750 visitor->trace(m_document); | 1750 visitor->trace(m_document); |
1751 } | 1751 } |
1752 | 1752 |
1753 } // namespace blink | 1753 } // namespace blink |
OLD | NEW |