| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/css/resolver/MatchedPropertiesCache.h" | 34 #include "core/css/resolver/MatchedPropertiesCache.h" |
| 35 #include "core/css/resolver/ScopedStyleResolver.h" | 35 #include "core/css/resolver/ScopedStyleResolver.h" |
| 36 #include "core/css/resolver/ScopedStyleTree.h" | 36 #include "core/css/resolver/ScopedStyleTree.h" |
| 37 #include "core/css/resolver/StyleBuilder.h" | 37 #include "core/css/resolver/StyleBuilder.h" |
| 38 #include "core/css/resolver/StyleResolverIncludes.h" | 38 #include "core/css/resolver/StyleResolverIncludes.h" |
| 39 #include "core/css/resolver/StyleResolverState.h" | 39 #include "core/css/resolver/StyleResolverState.h" |
| 40 #include "core/css/resolver/StyleResourceLoader.h" | 40 #include "core/css/resolver/StyleResourceLoader.h" |
| 41 #include "wtf/Deque.h" | 41 #include "wtf/Deque.h" |
| 42 #include "wtf/HashMap.h" | 42 #include "wtf/HashMap.h" |
| 43 #include "wtf/HashSet.h" | 43 #include "wtf/HashSet.h" |
| 44 #include "wtf/ListHashSet.h" |
| 44 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
| 45 #include "wtf/Vector.h" | 46 #include "wtf/Vector.h" |
| 46 | 47 |
| 47 namespace WebCore { | 48 namespace WebCore { |
| 48 | 49 |
| 49 class CSSAnimationUpdate; | 50 class CSSAnimationUpdate; |
| 50 class CSSFontSelector; | 51 class CSSFontSelector; |
| 51 class CSSRuleList; | 52 class CSSRuleList; |
| 52 class CSSSelector; | 53 class CSSSelector; |
| 53 class CSSStyleSheet; | 54 class CSSStyleSheet; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // https://bugs.webkit.org/show_bug.cgi?id=108890 | 141 // https://bugs.webkit.org/show_bug.cgi?id=108890 |
| 141 void appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyle
Sheet> >&); | 142 void appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyle
Sheet> >&); |
| 142 void resetAuthorStyle(const ContainerNode*); | 143 void resetAuthorStyle(const ContainerNode*); |
| 143 void resetAtHostRules(const ShadowRoot*); | 144 void resetAtHostRules(const ShadowRoot*); |
| 144 void finishAppendAuthorStyleSheets(); | 145 void finishAppendAuthorStyleSheets(); |
| 145 void resetFontSelector(); | 146 void resetFontSelector(); |
| 146 | 147 |
| 147 TreeBoundaryCrossingRules& treeBoundaryCrossingRules() { return m_treeBounda
ryCrossingRules; } | 148 TreeBoundaryCrossingRules& treeBoundaryCrossingRules() { return m_treeBounda
ryCrossingRules; } |
| 148 void processScopedRules(const RuleSet& authorRules, const KURL&, ContainerNo
de* scope = 0); | 149 void processScopedRules(const RuleSet& authorRules, const KURL&, ContainerNo
de* scope = 0); |
| 149 | 150 |
| 151 void lazyAppendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSS
tyleSheet> >&); |
| 152 void removePendingAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&); |
| 153 void appendPendingAuthorStyleSheets(); |
| 154 bool hasPendingAuthorStyleSheets() const { return m_pendingStyleSheets.size(
) > 0 || m_needCollectFeatures; } |
| 155 |
| 150 SelectorFilter& selectorFilter() { return m_selectorFilter; } | 156 SelectorFilter& selectorFilter() { return m_selectorFilter; } |
| 151 | 157 |
| 152 void setBuildScopedStyleTreeInDocumentOrder(bool enabled) { m_styleTree.setB
uildInDocumentOrder(enabled); } | 158 void setBuildScopedStyleTreeInDocumentOrder(bool enabled) { m_styleTree.setB
uildInDocumentOrder(enabled); } |
| 153 bool buildScopedStyleTreeInDocumentOrder() const { return m_styleTree.buildI
nDocumentOrder(); } | 159 bool buildScopedStyleTreeInDocumentOrder() const { return m_styleTree.buildI
nDocumentOrder(); } |
| 154 bool styleTreeHasOnlyScopedResolverForDocument() const { return m_styleTree.
hasOnlyScopedResolverForDocument(); } | 160 bool styleTreeHasOnlyScopedResolverForDocument() const { return m_styleTree.
hasOnlyScopedResolverForDocument(); } |
| 155 ScopedStyleResolver* styleTreeScopedStyleResolverForDocument() const { retur
n m_styleTree.scopedStyleResolverForDocument(); } | 161 ScopedStyleResolver* styleTreeScopedStyleResolverForDocument() const { retur
n m_styleTree.scopedStyleResolverForDocument(); } |
| 156 | 162 |
| 157 ScopedStyleResolver* ensureScopedStyleResolver(ContainerNode* scope) | 163 ScopedStyleResolver* ensureScopedStyleResolver(ContainerNode* scope) |
| 158 { | 164 { |
| 159 return m_styleTree.ensureScopedStyleResolver(scope ? *scope : document()
); | 165 return m_styleTree.ensureScopedStyleResolver(scope ? *scope : document()
); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 199 |
| 194 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something
. | 200 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something
. |
| 195 void invalidateMatchedPropertiesCache(); | 201 void invalidateMatchedPropertiesCache(); |
| 196 | 202 |
| 197 // Exposed for RenderStyle::isStyleAvilable(). | 203 // Exposed for RenderStyle::isStyleAvilable(). |
| 198 static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable;
} | 204 static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable;
} |
| 199 | 205 |
| 200 // FIXME: StyleResolver should not have this member or method. | 206 // FIXME: StyleResolver should not have this member or method. |
| 201 InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWr
appers; } | 207 InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWr
appers; } |
| 202 | 208 |
| 203 const RuleFeatureSet& ruleFeatureSet() const { return m_features; } | 209 const RuleFeatureSet& ensureRuleFeatureSet() |
| 210 { |
| 211 if (hasPendingAuthorStyleSheets()) |
| 212 appendPendingAuthorStyleSheets(); |
| 213 return m_features; |
| 214 } |
| 204 | 215 |
| 205 StyleSharingList& styleSharingList() { return m_styleSharingList; } | 216 StyleSharingList& styleSharingList() { return m_styleSharingList; } |
| 206 | 217 |
| 207 bool hasRulesForId(const AtomicString&) const; | 218 bool hasRulesForId(const AtomicString&) const; |
| 208 | 219 |
| 209 void addToStyleSharingList(Element&); | 220 void addToStyleSharingList(Element&); |
| 210 void clearStyleSharingList(); | 221 void clearStyleSharingList(); |
| 211 | 222 |
| 212 StyleResolverStats* stats() { return m_styleResolverStats.get(); } | 223 StyleResolverStats* stats() { return m_styleResolverStats.get(); } |
| 213 StyleResolverStats* statsTotals() { return m_styleResolverStatsTotals.get();
} | 224 StyleResolverStats* statsTotals() { return m_styleResolverStatsTotals.get();
} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 224 virtual void fontsNeedUpdate(FontSelector*); | 235 virtual void fontsNeedUpdate(FontSelector*); |
| 225 | 236 |
| 226 private: | 237 private: |
| 227 void initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& watchedSelec
tors); | 238 void initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& watchedSelec
tors); |
| 228 | 239 |
| 229 void addTreeBoundaryCrossingRules(const Vector<MinimalRuleData>&, ContainerN
ode* scope); | 240 void addTreeBoundaryCrossingRules(const Vector<MinimalRuleData>&, ContainerN
ode* scope); |
| 230 | 241 |
| 231 // FIXME: This should probably go away, folded into FontBuilder. | 242 // FIXME: This should probably go away, folded into FontBuilder. |
| 232 void updateFont(StyleResolverState&); | 243 void updateFont(StyleResolverState&); |
| 233 | 244 |
| 245 bool filterViewportRules(const Vector<RefPtr<StyleRuleBase> >& rules); |
| 246 bool filterViewportRulesFromSheet(StyleSheetContents*); |
| 247 bool filterViewportRulesFromAuthorStyleSheets(unsigned firstNew, const Vecto
r<RefPtr<CSSStyleSheet> >& styleSheets); |
| 248 |
| 234 void collectPseudoRulesForElement(Element*, ElementRuleCollector&, PseudoId,
unsigned rulesToInclude); | 249 void collectPseudoRulesForElement(Element*, ElementRuleCollector&, PseudoId,
unsigned rulesToInclude); |
| 235 void matchUARules(ElementRuleCollector&, RuleSet*); | 250 void matchUARules(ElementRuleCollector&, RuleSet*); |
| 236 void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRule
s); | 251 void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRule
s); |
| 237 void matchAuthorRulesForShadowHost(Element*, ElementRuleCollector&, bool inc
ludeEmptyRules, Vector<ScopedStyleResolver*, 8>& resolvers, Vector<ScopedStyleRe
solver*, 8>& resolversInShadowTree); | 252 void matchAuthorRulesForShadowHost(Element*, ElementRuleCollector&, bool inc
ludeEmptyRules, Vector<ScopedStyleResolver*, 8>& resolvers, Vector<ScopedStyleRe
solver*, 8>& resolversInShadowTree); |
| 238 void matchHostRules(Element*, ScopedStyleResolver*, ElementRuleCollector&, b
ool includeEmptyRules); | 253 void matchHostRules(Element*, ScopedStyleResolver*, ElementRuleCollector&, b
ool includeEmptyRules); |
| 239 void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool includeS
MILProperties); | 254 void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool includeS
MILProperties); |
| 240 void matchUARules(ElementRuleCollector&); | 255 void matchUARules(ElementRuleCollector&); |
| 241 // FIXME: watched selectors should be implemented using injected author styl
esheets: http://crbug.com/316960 | 256 // FIXME: watched selectors should be implemented using injected author styl
esheets: http://crbug.com/316960 |
| 242 void matchWatchSelectorRules(ElementRuleCollector&); | 257 void matchWatchSelectorRules(ElementRuleCollector&); |
| 243 void collectFeatures(); | 258 void collectFeatures(); |
| 244 void collectTreeBoundaryCrossingRules(Element*, ElementRuleCollector&, bool
includeEmptyRules); | 259 void collectTreeBoundaryCrossingRules(Element*, ElementRuleCollector&, bool
includeEmptyRules); |
| 260 void resetRuleFeatures(); |
| 245 | 261 |
| 246 bool fastRejectSelector(const RuleData&) const; | 262 bool fastRejectSelector(const RuleData&) const; |
| 247 | 263 |
| 248 void applyMatchedProperties(StyleResolverState&, const MatchResult&, Element
* animatingElement); | 264 void applyMatchedProperties(StyleResolverState&, const MatchResult&, Element
* animatingElement); |
| 249 void applyAnimatedProperties(StyleResolverState&, Element* animatingElement)
; | 265 void applyAnimatedProperties(StyleResolverState&, Element* animatingElement)
; |
| 250 | 266 |
| 251 enum StyleApplicationPass { | 267 enum StyleApplicationPass { |
| 252 VariableDefinitions, | 268 VariableDefinitions, |
| 253 AnimationProperties, | 269 AnimationProperties, |
| 254 HighPriorityProperties, | 270 HighPriorityProperties, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 303 |
| 288 RefPtr<RenderStyle> m_rootDefaultStyle; | 304 RefPtr<RenderStyle> m_rootDefaultStyle; |
| 289 | 305 |
| 290 Document& m_document; | 306 Document& m_document; |
| 291 SelectorFilter m_selectorFilter; | 307 SelectorFilter m_selectorFilter; |
| 292 | 308 |
| 293 RefPtr<CSSFontSelector> m_fontSelector; | 309 RefPtr<CSSFontSelector> m_fontSelector; |
| 294 | 310 |
| 295 RefPtr<ViewportStyleResolver> m_viewportStyleResolver; | 311 RefPtr<ViewportStyleResolver> m_viewportStyleResolver; |
| 296 | 312 |
| 313 ListHashSet<CSSStyleSheet*, 16> m_pendingStyleSheets; |
| 314 |
| 297 ScopedStyleTree m_styleTree; | 315 ScopedStyleTree m_styleTree; |
| 298 | 316 |
| 299 // FIXME: The entire logic of collecting features on StyleResolver, as well
astransferring them | 317 // FIXME: The entire logic of collecting features on StyleResolver, as well
astransferring them |
| 300 // between various parts of machinery smells wrong. This needs to be better
somehow. | 318 // between various parts of machinery smells wrong. This needs to be better
somehow. |
| 301 RuleFeatureSet m_features; | 319 RuleFeatureSet m_features; |
| 302 OwnPtr<RuleSet> m_siblingRuleSet; | 320 OwnPtr<RuleSet> m_siblingRuleSet; |
| 303 OwnPtr<RuleSet> m_uncommonAttributeRuleSet; | 321 OwnPtr<RuleSet> m_uncommonAttributeRuleSet; |
| 322 |
| 304 // FIXME: watched selectors should be implemented using injected author styl
esheets: http://crbug.com/316960 | 323 // FIXME: watched selectors should be implemented using injected author styl
esheets: http://crbug.com/316960 |
| 305 OwnPtr<RuleSet> m_watchedSelectorsRules; | 324 OwnPtr<RuleSet> m_watchedSelectorsRules; |
| 306 TreeBoundaryCrossingRules m_treeBoundaryCrossingRules; | 325 TreeBoundaryCrossingRules m_treeBoundaryCrossingRules; |
| 307 | 326 |
| 327 bool m_needCollectFeatures; |
| 328 |
| 308 InspectorCSSOMWrappers m_inspectorCSSOMWrappers; | 329 InspectorCSSOMWrappers m_inspectorCSSOMWrappers; |
| 309 | 330 |
| 310 StyleResourceLoader m_styleResourceLoader; | 331 StyleResourceLoader m_styleResourceLoader; |
| 311 | 332 |
| 312 StyleSharingList m_styleSharingList; | 333 StyleSharingList m_styleSharingList; |
| 313 | 334 |
| 314 OwnPtr<StyleResolverStats> m_styleResolverStats; | 335 OwnPtr<StyleResolverStats> m_styleResolverStats; |
| 315 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; | 336 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; |
| 316 unsigned m_styleResolverStatsSequence; | 337 unsigned m_styleResolverStatsSequence; |
| 317 | 338 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 329 PseudoId ignoreDynamicPseudo = NOPSEUDO; | 350 PseudoId ignoreDynamicPseudo = NOPSEUDO; |
| 330 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) | 351 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) |
| 331 return true; | 352 return true; |
| 332 } | 353 } |
| 333 return false; | 354 return false; |
| 334 } | 355 } |
| 335 | 356 |
| 336 } // namespace WebCore | 357 } // namespace WebCore |
| 337 | 358 |
| 338 #endif // StyleResolver_h | 359 #endif // StyleResolver_h |
| OLD | NEW |