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

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

Issue 18371008: Add a WebDocument::watchCssSelectors(selectors) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Sync Created 7 years, 3 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "core/css/PageRuleCollector.h" 56 #include "core/css/PageRuleCollector.h"
57 #include "core/css/RuleSet.h" 57 #include "core/css/RuleSet.h"
58 #include "core/css/StylePropertySet.h" 58 #include "core/css/StylePropertySet.h"
59 #include "core/css/resolver/AnimatedStyleBuilder.h" 59 #include "core/css/resolver/AnimatedStyleBuilder.h"
60 #include "core/css/resolver/MatchResult.h" 60 #include "core/css/resolver/MatchResult.h"
61 #include "core/css/resolver/MediaQueryResult.h" 61 #include "core/css/resolver/MediaQueryResult.h"
62 #include "core/css/resolver/SharedStyleFinder.h" 62 #include "core/css/resolver/SharedStyleFinder.h"
63 #include "core/css/resolver/StyleAdjuster.h" 63 #include "core/css/resolver/StyleAdjuster.h"
64 #include "core/css/resolver/StyleBuilder.h" 64 #include "core/css/resolver/StyleBuilder.h"
65 #include "core/css/resolver/ViewportStyleResolver.h" 65 #include "core/css/resolver/ViewportStyleResolver.h"
66 #include "core/dom/CSSSelectorWatch.h"
66 #include "core/dom/NodeRenderStyle.h" 67 #include "core/dom/NodeRenderStyle.h"
67 #include "core/dom/NodeRenderingContext.h" 68 #include "core/dom/NodeRenderingContext.h"
68 #include "core/dom/StyleSheetCollections.h" 69 #include "core/dom/StyleSheetCollections.h"
69 #include "core/dom/Text.h" 70 #include "core/dom/Text.h"
70 #include "core/dom/shadow/ElementShadow.h" 71 #include "core/dom/shadow/ElementShadow.h"
71 #include "core/dom/shadow/ShadowRoot.h" 72 #include "core/dom/shadow/ShadowRoot.h"
72 #include "core/html/HTMLIFrameElement.h" 73 #include "core/html/HTMLIFrameElement.h"
73 #include "core/inspector/InspectorInstrumentation.h" 74 #include "core/inspector/InspectorInstrumentation.h"
74 #include "core/page/Frame.h" 75 #include "core/page/Frame.h"
75 #include "core/page/FrameView.h" 76 #include "core/page/FrameView.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 132
132 if (root) 133 if (root)
133 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules); 134 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules);
134 135
135 if (m_rootDefaultStyle && view) 136 if (m_rootDefaultStyle && view)
136 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->fra me(), m_rootDefaultStyle.get())); 137 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->fra me(), m_rootDefaultStyle.get()));
137 138
138 m_styleTree.clear(); 139 m_styleTree.clear();
139 140
140 StyleSheetCollections* styleSheetCollection = document->styleSheetCollection s(); 141 StyleSheetCollections* styleSheetCollection = document->styleSheetCollection s();
141 m_ruleSets.initUserStyle(styleSheetCollection, *m_medium, *this); 142 m_ruleSets.initUserStyle(styleSheetCollection, CSSSelectorWatch::from(docume nt)->watchedCallbackSelectors(), *m_medium, *this);
142 143
143 #if ENABLE(SVG_FONTS) 144 #if ENABLE(SVG_FONTS)
144 if (document->svgExtensions()) { 145 if (document->svgExtensions()) {
145 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document->svgE xtensions()->svgFontFaceElements(); 146 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document->svgE xtensions()->svgFontFaceElements();
146 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd(); 147 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd();
147 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it) 148 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it)
148 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); 149 fontSelector()->addFontFaceRule((*it)->fontFaceRule());
149 } 150 }
150 #endif 151 #endif
151 152
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 return property > lastHighPriorityProperty; 1273 return property > lastHighPriorityProperty;
1273 } 1274 }
1274 ASSERT_NOT_REACHED(); 1275 ASSERT_NOT_REACHED();
1275 return false; 1276 return false;
1276 } 1277 }
1277 1278
1278 template <StyleResolver::StyleApplicationPass pass> 1279 template <StyleResolver::StyleApplicationPass pass>
1279 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper tyWhitelistType propertyWhitelistType) 1280 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper tyWhitelistType propertyWhitelistType)
1280 { 1281 {
1281 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || state.regionFor Styling()); 1282 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || state.regionFor Styling());
1283 state.setCurrentRule(rule);
1282 1284
1283 unsigned propertyCount = properties->propertyCount(); 1285 unsigned propertyCount = properties->propertyCount();
1284 for (unsigned i = 0; i < propertyCount; ++i) { 1286 for (unsigned i = 0; i < propertyCount; ++i) {
1285 StylePropertySet::PropertyReference current = properties->propertyAt(i); 1287 StylePropertySet::PropertyReference current = properties->propertyAt(i);
1286 if (isImportant != current.isImportant()) 1288 if (isImportant != current.isImportant())
1287 continue; 1289 continue;
1288 if (inheritedOnly && !current.isInherited()) { 1290 if (inheritedOnly && !current.isInherited()) {
1289 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1291 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties
1290 // as they might override the value inherited here. For this reason we don't allow declarations with 1292 // as they might override the value inherited here. For this reason we don't allow declarations with
1291 // explicitly inherited properties to be cached. 1293 // explicitly inherited properties to be cached.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1552 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1551 1553
1552 fprintf(stderr, "Total:\n"); 1554 fprintf(stderr, "Total:\n");
1553 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1555 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1554 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1556 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1555 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1557 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1556 } 1558 }
1557 #endif 1559 #endif
1558 1560
1559 } // namespace WebCore 1561 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698