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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 921843004: Stop explicit inheritance if LayoutStyle doesn't change. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Corrected and documented flag copying/comparisons 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
OLDNEW
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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 1365
1366 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash( matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0; 1366 unsigned cacheHash = matchResult.isCacheable ? computeMatchedPropertiesHash( matchResult.matchedProperties.data(), matchResult.matchedProperties.size()) : 0;
1367 bool applyInheritedOnly = false; 1367 bool applyInheritedOnly = false;
1368 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match edPropertiesCache.find(cacheHash, state, matchResult) : 0; 1368 const CachedMatchedProperties* cachedMatchedProperties = cacheHash ? m_match edPropertiesCache.find(cacheHash, state, matchResult) : 0;
1369 1369
1370 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(element, *state.style(), *state.parentStyle())) { 1370 if (cachedMatchedProperties && MatchedPropertiesCache::isCacheable(element, *state.style(), *state.parentStyle())) {
1371 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheHit); 1371 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheHit);
1372 // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact 1372 // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact
1373 // style declarations. We then only need to apply the inherited properti es, if any, as their values can depend on the 1373 // style declarations. We then only need to apply the inherited properti es, if any, as their values can depend on the
1374 // element context. This is fast and saves memory by reusing the style d ata structures. 1374 // element context. This is fast and saves memory by reusing the style d ata structures.
1375 state.style()->copyNonInheritedFrom(*cachedMatchedProperties->layoutStyl e); 1375 state.style()->copyNonInheritedFromCached(*cachedMatchedProperties->layo utStyle);
1376 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p arentLayoutStyle) && !isAtShadowBoundary(element) 1376 if (state.parentStyle()->inheritedDataShared(*cachedMatchedProperties->p arentLayoutStyle) && !isAtShadowBoundary(element)
1377 && (!state.distributedToInsertionPoint() || state.style()->userModif y() == READ_ONLY)) { 1377 && (!state.distributedToInsertionPoint() || state.style()->userModif y() == READ_ONLY)) {
1378 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi t); 1378 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheInheritedHi t);
1379 1379
1380 EInsideLink linkStatus = state.style()->insideLink(); 1380 EInsideLink linkStatus = state.style()->insideLink();
1381 // If the cache item parent style has identical inherited properties to the current parent style then the 1381 // If the cache item parent style has identical inherited properties to the current parent style then the
1382 // resulting style will be identical too. We copy the inherited prop erties over from the cache and are done. 1382 // resulting style will be identical too. We copy the inherited prop erties over from the cache and are done.
1383 state.style()->inheritFrom(*cachedMatchedProperties->layoutStyle); 1383 state.style()->inheritFrom(*cachedMatchedProperties->layoutStyle);
1384 1384
1385 // Unfortunately the link status is treated like an inherited proper ty. We need to explicitly restore it. 1385 // Unfortunately the link status is treated like an inherited proper ty. We need to explicitly restore it.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 visitor->trace(m_uncommonAttributeRuleSet); 1547 visitor->trace(m_uncommonAttributeRuleSet);
1548 visitor->trace(m_watchedSelectorsRules); 1548 visitor->trace(m_watchedSelectorsRules);
1549 visitor->trace(m_treeBoundaryCrossingRules); 1549 visitor->trace(m_treeBoundaryCrossingRules);
1550 visitor->trace(m_styleSharingLists); 1550 visitor->trace(m_styleSharingLists);
1551 visitor->trace(m_pendingStyleSheets); 1551 visitor->trace(m_pendingStyleSheets);
1552 visitor->trace(m_document); 1552 visitor->trace(m_document);
1553 #endif 1553 #endif
1554 } 1554 }
1555 1555
1556 } // namespace blink 1556 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698