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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 { | 1336 { |
1337 const Element* element = state.element(); | 1337 const Element* element = state.element(); |
1338 ASSERT(element); | 1338 ASSERT(element); |
1339 | 1339 |
1340 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply, 1); | 1340 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyApply, 1); |
1341 | 1341 |
1342 unsigned cacheHash = matchResult.isCacheable() ? computeMatchedPropertiesHas
h(matchResult.matchedProperties().data(), matchResult.matchedProperties().size()
) : 0; | 1342 unsigned cacheHash = matchResult.isCacheable() ? computeMatchedPropertiesHas
h(matchResult.matchedProperties().data(), matchResult.matchedProperties().size()
) : 0; |
1343 bool applyInheritedOnly = false; | 1343 bool applyInheritedOnly = false; |
1344 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match
edPropertiesCache.find(cacheHash, state, matchResult.matchedProperties()) : 0; | 1344 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match
edPropertiesCache.find(cacheHash, state, matchResult.matchedProperties()) : 0; |
1345 | 1345 |
1346 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(element,
*state.style(), *state.parentStyle())) { | 1346 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(*state.st
yle(), *state.parentStyle())) { |
1347 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheHit, 1); | 1347 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheHit, 1); |
1348 // We can build up the style by copying non-inherited properties from an
earlier style object built using the same exact | 1348 // We can build up the style by copying non-inherited properties from an
earlier style object built using the same exact |
1349 // style declarations. We then only need to apply the inherited properti
es, if any, as their values can depend on the | 1349 // style declarations. We then only need to apply the inherited properti
es, if any, as their values can depend on the |
1350 // element context. This is fast and saves memory by reusing the style d
ata structures. | 1350 // element context. This is fast and saves memory by reusing the style d
ata structures. |
1351 state.style()->copyNonInheritedFromCached(*cachedMatchedProperties->comp
utedStyle); | 1351 state.style()->copyNonInheritedFromCached(*cachedMatchedProperties->comp
utedStyle); |
1352 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p
arentComputedStyle) && !isAtShadowBoundary(element) | 1352 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p
arentComputedStyle) && !isAtShadowBoundary(element) |
1353 && (!state.distributedToInsertionPoint() || state.style()->userModif
y() == READ_ONLY)) { | 1353 && (!state.distributedToInsertionPoint() || state.style()->userModif
y() == READ_ONLY)) { |
1354 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi
t, 1); | 1354 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi
t, 1); |
1355 | 1355 |
1356 EInsideLink linkStatus = state.style()->insideLink(); | 1356 EInsideLink linkStatus = state.style()->insideLink(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 // Check whether the final border and background differs from the cached
UA ones. | 1416 // Check whether the final border and background differs from the cached
UA ones. |
1417 // When there is a partial match in the MatchedPropertiesCache, these fl
ags will already be set correctly | 1417 // When there is a partial match in the MatchedPropertiesCache, these fl
ags will already be set correctly |
1418 // and the value stored in cacheUserAgentBorderAndBackground is incorrec
t, so doing this check again | 1418 // and the value stored in cacheUserAgentBorderAndBackground is incorrec
t, so doing this check again |
1419 // would give the wrong answer. | 1419 // would give the wrong answer. |
1420 state.style()->setHasAuthorBackground(hasAuthorBackground(state)); | 1420 state.style()->setHasAuthorBackground(hasAuthorBackground(state)); |
1421 state.style()->setHasAuthorBorder(hasAuthorBorder(state)); | 1421 state.style()->setHasAuthorBorder(hasAuthorBorder(state)); |
1422 } | 1422 } |
1423 | 1423 |
1424 loadPendingResources(state); | 1424 loadPendingResources(state); |
1425 | 1425 |
1426 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, *state.style(), *state.parentStyle())) { | 1426 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(*state.style(), *state.parentStyle())) { |
1427 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded, 1); | 1427 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded, 1); |
1428 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache
Hash, matchResult.matchedProperties()); | 1428 m_matchedPropertiesCache.add(*state.style(), *state.parentStyle(), cache
Hash, matchResult.matchedProperties()); |
1429 } | 1429 } |
1430 | 1430 |
1431 ASSERT(!state.fontBuilder().fontDirty()); | 1431 ASSERT(!state.fontBuilder().fontDirty()); |
1432 } | 1432 } |
1433 | 1433 |
1434 bool StyleResolver::hasAuthorBackground(const StyleResolverState& state) | 1434 bool StyleResolver::hasAuthorBackground(const StyleResolverState& state) |
1435 { | 1435 { |
1436 const CachedUAStyle* cachedUAStyle = state.cachedUAStyle(); | 1436 const CachedUAStyle* cachedUAStyle = state.cachedUAStyle(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 visitor->trace(m_watchedSelectorsRules); | 1537 visitor->trace(m_watchedSelectorsRules); |
1538 visitor->trace(m_treeBoundaryCrossingScopes); | 1538 visitor->trace(m_treeBoundaryCrossingScopes); |
1539 visitor->trace(m_styleResourceLoader); | 1539 visitor->trace(m_styleResourceLoader); |
1540 visitor->trace(m_styleSharingLists); | 1540 visitor->trace(m_styleSharingLists); |
1541 visitor->trace(m_pendingStyleSheets); | 1541 visitor->trace(m_pendingStyleSheets); |
1542 visitor->trace(m_document); | 1542 visitor->trace(m_document); |
1543 #endif | 1543 #endif |
1544 } | 1544 } |
1545 | 1545 |
1546 } // namespace blink | 1546 } // namespace blink |
OLD | NEW |