| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/css/RuleFeature.h" | 29 #include "core/css/RuleFeature.h" |
| 30 #include "core/css/RuleSet.h" | 30 #include "core/css/RuleSet.h" |
| 31 #include "core/css/SelectorChecker.h" | 31 #include "core/css/SelectorChecker.h" |
| 32 #include "core/css/SelectorFilter.h" | 32 #include "core/css/SelectorFilter.h" |
| 33 #include "core/css/SiblingTraversalStrategies.h" | 33 #include "core/css/SiblingTraversalStrategies.h" |
| 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/StyleBuilder.h" | 36 #include "core/css/resolver/StyleBuilder.h" |
| 37 #include "core/css/resolver/StyleResolverState.h" | 37 #include "core/css/resolver/StyleResolverState.h" |
| 38 #include "core/css/resolver/StyleResourceLoader.h" | 38 #include "core/css/resolver/StyleResourceLoader.h" |
| 39 #include "wtf/Deque.h" | |
| 40 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
| 41 #include "wtf/HashSet.h" | 40 #include "wtf/HashSet.h" |
| 42 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
| 43 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
| 44 | 43 |
| 45 namespace WebCore { | 44 namespace WebCore { |
| 46 | 45 |
| 47 class CSSAnimationUpdate; | 46 class CSSAnimationUpdate; |
| 48 class CSSFontSelector; | 47 class CSSFontSelector; |
| 49 class CSSRuleList; | 48 class CSSRuleList; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 79 | 78 |
| 80 // MatchOnlyUserAgentRules is used in media queries, where relative units | 79 // MatchOnlyUserAgentRules is used in media queries, where relative units |
| 81 // are interpreted according to the document root element style, and styled only | 80 // are interpreted according to the document root element style, and styled only |
| 82 // from the User Agent Stylesheet rules. | 81 // from the User Agent Stylesheet rules. |
| 83 enum RuleMatchingBehavior { | 82 enum RuleMatchingBehavior { |
| 84 MatchAllRules, | 83 MatchAllRules, |
| 85 MatchAllRulesExcludingSMIL, | 84 MatchAllRulesExcludingSMIL, |
| 86 MatchOnlyUserAgentRules, | 85 MatchOnlyUserAgentRules, |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 const unsigned styleSharingListSize = 20; | |
| 90 typedef WTF::Deque<Element*, styleSharingListSize> StyleSharingList; | |
| 91 | |
| 92 #undef STYLE_STATS | 88 #undef STYLE_STATS |
| 93 | 89 |
| 94 #ifdef STYLE_STATS | 90 #ifdef STYLE_STATS |
| 95 struct StyleSharingStats { | 91 struct StyleSharingStats { |
| 96 void addSearch() { ++m_searches; ++m_totalSearches; } | 92 void addSearch() { ++m_searches; ++m_totalSearches; } |
| 97 void addElementEligibleForSharing() { ++m_elementsEligibleForSharing; ++m_to
talElementsEligibleForSharing; } | 93 void addElementEligibleForSharing() { ++m_elementsEligibleForSharing; ++m_to
talElementsEligibleForSharing; } |
| 98 void addStyleShared() { ++m_stylesShared; ++m_totalStylesShared; } | 94 void addStyleShared() { ++m_stylesShared; ++m_totalStylesShared; } |
| 99 void addSearchFoundSiblingForSharing() { ++m_searchFoundSiblingForSharing; +
+m_totalSearchFoundSiblingForSharing; } | 95 void addSearchFoundSiblingForSharing() { ++m_searchFoundSiblingForSharing; +
+m_totalSearchFoundSiblingForSharing; } |
| 100 void addSearchMissedSharing() { ++m_searchesMissedSharing; ++m_totalSearches
MissedSharing; } | 96 void addSearchMissedSharing() { ++m_searchesMissedSharing; ++m_totalSearches
MissedSharing; } |
| 101 void addMatchedPropertiesSearch() { ++m_matchedPropertiesSearches; ++m_total
MatchedPropertiesSearches; } | 97 void addMatchedPropertiesSearch() { ++m_matchedPropertiesSearches; ++m_total
MatchedPropertiesSearches; } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 268 |
| 273 // FIXME: StyleResolver should not have this member or method. | 269 // FIXME: StyleResolver should not have this member or method. |
| 274 InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWr
appers; } | 270 InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWr
appers; } |
| 275 | 271 |
| 276 // Exposed for ScopedStyleResolver. | 272 // Exposed for ScopedStyleResolver. |
| 277 // FIXME: Likely belongs on viewportStyleResolver. | 273 // FIXME: Likely belongs on viewportStyleResolver. |
| 278 void collectViewportRules(RuleSet*); | 274 void collectViewportRules(RuleSet*); |
| 279 | 275 |
| 280 const RuleFeatureSet& ruleFeatureSet() const { return m_features; } | 276 const RuleFeatureSet& ruleFeatureSet() const { return m_features; } |
| 281 | 277 |
| 282 StyleSharingList& styleSharingList() { return m_styleSharingList; } | |
| 283 | |
| 284 void addToStyleSharingList(Element*); | |
| 285 void clearStyleSharingList(); | |
| 286 | |
| 287 #ifdef STYLE_STATS | 278 #ifdef STYLE_STATS |
| 288 ALWAYS_INLINE static StyleSharingStats& styleSharingStats() { return m_style
SharingStats; } | 279 ALWAYS_INLINE static StyleSharingStats& styleSharingStats() { return m_style
SharingStats; } |
| 289 #endif | 280 #endif |
| 290 private: | 281 private: |
| 291 // FIXME: This should probably go away, folded into FontBuilder. | 282 // FIXME: This should probably go away, folded into FontBuilder. |
| 292 void updateFont(StyleResolverState&); | 283 void updateFont(StyleResolverState&); |
| 293 | 284 |
| 294 void matchUARules(ElementRuleCollector&, RuleSet*); | 285 void matchUARules(ElementRuleCollector&, RuleSet*); |
| 295 void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRule
s); | 286 void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRule
s); |
| 296 void matchShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRul
es); | 287 void matchShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRul
es); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // FIXME: The entire logic of collecting features on StyleResolver, as well
astransferring them | 351 // FIXME: The entire logic of collecting features on StyleResolver, as well
astransferring them |
| 361 // between various parts of machinery smells wrong. This needs to be better
somehow. | 352 // between various parts of machinery smells wrong. This needs to be better
somehow. |
| 362 RuleFeatureSet m_features; | 353 RuleFeatureSet m_features; |
| 363 OwnPtr<RuleSet> m_siblingRuleSet; | 354 OwnPtr<RuleSet> m_siblingRuleSet; |
| 364 OwnPtr<RuleSet> m_uncommonAttributeRuleSet; | 355 OwnPtr<RuleSet> m_uncommonAttributeRuleSet; |
| 365 | 356 |
| 366 InspectorCSSOMWrappers m_inspectorCSSOMWrappers; | 357 InspectorCSSOMWrappers m_inspectorCSSOMWrappers; |
| 367 | 358 |
| 368 StyleResourceLoader m_styleResourceLoader; | 359 StyleResourceLoader m_styleResourceLoader; |
| 369 | 360 |
| 370 StyleSharingList m_styleSharingList; | |
| 371 | |
| 372 #ifdef STYLE_STATS | 361 #ifdef STYLE_STATS |
| 373 static StyleSharingStats m_styleSharingStats; | 362 static StyleSharingStats m_styleSharingStats; |
| 374 #endif | 363 #endif |
| 375 }; | 364 }; |
| 376 | 365 |
| 377 inline bool checkRegionSelector(const CSSSelector* regionSelector, Element* regi
onElement) | 366 inline bool checkRegionSelector(const CSSSelector* regionSelector, Element* regi
onElement) |
| 378 { | 367 { |
| 379 if (!regionSelector || !regionElement) | 368 if (!regionSelector || !regionElement) |
| 380 return false; | 369 return false; |
| 381 | 370 |
| 382 SelectorChecker selectorChecker(regionElement->document(), SelectorChecker::
QueryingRules); | 371 SelectorChecker selectorChecker(regionElement->document(), SelectorChecker::
QueryingRules); |
| 383 for (const CSSSelector* s = regionSelector; s; s = CSSSelectorList::next(s))
{ | 372 for (const CSSSelector* s = regionSelector; s; s = CSSSelectorList::next(s))
{ |
| 384 SelectorChecker::SelectorCheckingContext selectorCheckingContext(s, regi
onElement, SelectorChecker::VisitedMatchDisabled); | 373 SelectorChecker::SelectorCheckingContext selectorCheckingContext(s, regi
onElement, SelectorChecker::VisitedMatchDisabled); |
| 385 PseudoId ignoreDynamicPseudo = NOPSEUDO; | 374 PseudoId ignoreDynamicPseudo = NOPSEUDO; |
| 386 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) | 375 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) |
| 387 return true; | 376 return true; |
| 388 } | 377 } |
| 389 return false; | 378 return false; |
| 390 } | 379 } |
| 391 | 380 |
| 392 } // namespace WebCore | 381 } // namespace WebCore |
| 393 | 382 |
| 394 #endif // StyleResolver_h | 383 #endif // StyleResolver_h |
| OLD | NEW |