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

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: Add a test for watching dynamic attribute changes Created 7 years, 4 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/DocumentStyleSheetCollection.h" 67 #include "core/dom/DocumentStyleSheetCollection.h"
67 #include "core/dom/NodeRenderStyle.h" 68 #include "core/dom/NodeRenderStyle.h"
68 #include "core/dom/NodeRenderingContext.h" 69 #include "core/dom/NodeRenderingContext.h"
69 #include "core/dom/Text.h" 70 #include "core/dom/Text.h"
70 #include "core/dom/shadow/ContentDistributor.h" 71 #include "core/dom/shadow/ContentDistributor.h"
71 #include "core/dom/shadow/ElementShadow.h" 72 #include "core/dom/shadow/ElementShadow.h"
72 #include "core/dom/shadow/ShadowRoot.h" 73 #include "core/dom/shadow/ShadowRoot.h"
73 #include "core/html/HTMLIFrameElement.h" 74 #include "core/html/HTMLIFrameElement.h"
74 #include "core/inspector/InspectorInstrumentation.h" 75 #include "core/inspector/InspectorInstrumentation.h"
75 #include "core/page/Frame.h" 76 #include "core/page/Frame.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 133
133 if (root) 134 if (root)
134 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules); 135 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules);
135 136
136 if (m_rootDefaultStyle && view) 137 if (m_rootDefaultStyle && view)
137 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->fra me(), m_rootDefaultStyle.get())); 138 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->fra me(), m_rootDefaultStyle.get()));
138 139
139 m_styleTree.clear(); 140 m_styleTree.clear();
140 141
141 DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCol lection(); 142 DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCol lection();
142 m_ruleSets.initUserStyle(styleSheetCollection, *m_medium, *this); 143 m_ruleSets.initUserStyle(styleSheetCollection, CSSSelectorWatch::from(docume nt)->watchedCallbackSelectors(), *m_medium, *this);
143 144
144 #if ENABLE(SVG_FONTS) 145 #if ENABLE(SVG_FONTS)
145 if (document->svgExtensions()) { 146 if (document->svgExtensions()) {
146 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document->svgE xtensions()->svgFontFaceElements(); 147 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document->svgE xtensions()->svgFontFaceElements();
147 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd(); 148 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd();
148 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it) 149 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it)
149 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); 150 fontSelector()->addFontFaceRule((*it)->fontFaceRule());
150 } 151 }
151 #endif 152 #endif
152 m_styleTree.setBuildInDocumentOrder(!styleSheetCollection->hasScopedStyleShe et()); 153 m_styleTree.setBuildInDocumentOrder(!styleSheetCollection->hasScopedStyleShe et());
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 return property > lastHighPriorityProperty; 1261 return property > lastHighPriorityProperty;
1261 } 1262 }
1262 ASSERT_NOT_REACHED(); 1263 ASSERT_NOT_REACHED();
1263 return false; 1264 return false;
1264 } 1265 }
1265 1266
1266 template <StyleResolver::StyleApplicationPass pass> 1267 template <StyleResolver::StyleApplicationPass pass>
1267 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper tyWhitelistType propertyWhitelistType) 1268 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper tyWhitelistType propertyWhitelistType)
1268 { 1269 {
1269 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || state.regionFor Styling()); 1270 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || state.regionFor Styling());
1271 state.setCurrentRule(rule);
1270 1272
1271 unsigned propertyCount = properties->propertyCount(); 1273 unsigned propertyCount = properties->propertyCount();
1272 for (unsigned i = 0; i < propertyCount; ++i) { 1274 for (unsigned i = 0; i < propertyCount; ++i) {
1273 StylePropertySet::PropertyReference current = properties->propertyAt(i); 1275 StylePropertySet::PropertyReference current = properties->propertyAt(i);
1274 if (isImportant != current.isImportant()) 1276 if (isImportant != current.isImportant())
1275 continue; 1277 continue;
1276 if (inheritedOnly && !current.isInherited()) { 1278 if (inheritedOnly && !current.isInherited()) {
1277 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1279 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties
1278 // as they might override the value inherited here. For this reason we don't allow declarations with 1280 // as they might override the value inherited here. For this reason we don't allow declarations with
1279 // explicitly inherited properties to be cached. 1281 // explicitly inherited properties to be cached.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che); 1531 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa che);
1530 1532
1531 fprintf(stderr, "Total:\n"); 1533 fprintf(stderr, "Total:\n");
1532 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, 1534 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing,
1533 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache); 1535 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch edPropertiesEnteredIntoCache);
1534 fprintf(stderr, "----------------------------------------------------------- ---------------------\n"); 1536 fprintf(stderr, "----------------------------------------------------------- ---------------------\n");
1535 } 1537 }
1536 #endif 1538 #endif
1537 1539
1538 } // namespace WebCore 1540 } // 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