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

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, 2 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/StyleEngine.h" 68 #include "core/dom/StyleEngine.h"
68 #include "core/dom/Text.h" 69 #include "core/dom/Text.h"
69 #include "core/dom/shadow/ElementShadow.h" 70 #include "core/dom/shadow/ElementShadow.h"
70 #include "core/dom/shadow/ShadowRoot.h" 71 #include "core/dom/shadow/ShadowRoot.h"
71 #include "core/html/HTMLIFrameElement.h" 72 #include "core/html/HTMLIFrameElement.h"
72 #include "core/inspector/InspectorInstrumentation.h" 73 #include "core/inspector/InspectorInstrumentation.h"
73 #include "core/page/Frame.h" 74 #include "core/page/Frame.h"
74 #include "core/page/FrameView.h" 75 #include "core/page/FrameView.h"
75 #include "core/rendering/RenderView.h" 76 #include "core/rendering/RenderView.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 131
131 if (root) 132 if (root)
132 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules); 133 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules);
133 134
134 if (m_rootDefaultStyle && view) 135 if (m_rootDefaultStyle && view)
135 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), &view->fr ame(), m_rootDefaultStyle.get())); 136 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), &view->fr ame(), m_rootDefaultStyle.get()));
136 137
137 m_styleTree.clear(); 138 m_styleTree.clear();
138 139
139 StyleEngine* styleSheetCollection = document.styleEngine(); 140 StyleEngine* styleSheetCollection = document.styleEngine();
140 m_ruleSets.initUserStyle(styleSheetCollection, *m_medium, *this); 141 m_ruleSets.initUserStyle(styleSheetCollection, CSSSelectorWatch::from(docume nt).watchedCallbackSelectors(), *m_medium, *this);
141 142
142 #if ENABLE(SVG_FONTS) 143 #if ENABLE(SVG_FONTS)
143 if (document.svgExtensions()) { 144 if (document.svgExtensions()) {
144 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx tensions()->svgFontFaceElements(); 145 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgEx tensions()->svgFontFaceElements();
145 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd(); 146 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd();
146 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it) 147 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it)
147 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); 148 fontSelector()->addFontFaceRule((*it)->fontFaceRule());
148 } 149 }
149 #endif 150 #endif
150 151
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 return property > lastHighPriorityProperty; 1328 return property > lastHighPriorityProperty;
1328 } 1329 }
1329 ASSERT_NOT_REACHED(); 1330 ASSERT_NOT_REACHED();
1330 return false; 1331 return false;
1331 } 1332 }
1332 1333
1333 template <StyleResolver::StyleApplicationPass pass> 1334 template <StyleResolver::StyleApplicationPass pass>
1334 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper tyWhitelistType propertyWhitelistType) 1335 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper tyWhitelistType propertyWhitelistType)
1335 { 1336 {
1336 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || state.regionFor Styling()); 1337 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || state.regionFor Styling());
1338 state.setCurrentRule(rule);
1337 1339
1338 unsigned propertyCount = properties->propertyCount(); 1340 unsigned propertyCount = properties->propertyCount();
1339 for (unsigned i = 0; i < propertyCount; ++i) { 1341 for (unsigned i = 0; i < propertyCount; ++i) {
1340 StylePropertySet::PropertyReference current = properties->propertyAt(i); 1342 StylePropertySet::PropertyReference current = properties->propertyAt(i);
1341 if (isImportant != current.isImportant()) 1343 if (isImportant != current.isImportant())
1342 continue; 1344 continue;
1343 if (inheritedOnly && !current.isInherited()) { 1345 if (inheritedOnly && !current.isInherited()) {
1344 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1346 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties
1345 // as they might override the value inherited here. For this reason we don't allow declarations with 1347 // as they might override the value inherited here. For this reason we don't allow declarations with
1346 // explicitly inherited properties to be cached. 1348 // explicitly inherited properties to be cached.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1607 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1606 1608
1607 fprintf(stderr, "Total:\n"); 1609 fprintf(stderr, "Total:\n");
1608 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1610 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1609 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1611 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1610 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1612 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1611 } 1613 }
1612 #endif 1614 #endif
1613 1615
1614 } // namespace WebCore 1616 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderCustom.cpp ('k') | Source/core/css/resolver/StyleResolverState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698