| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/css/resolver/StyleBuilder.h" | 35 #include "core/css/resolver/StyleBuilder.h" |
| 36 #include "core/css/resolver/StyleResolverState.h" | 36 #include "core/css/resolver/StyleResolverState.h" |
| 37 #include "core/css/resolver/StyleResourceLoader.h" | 37 #include "core/css/resolver/StyleResourceLoader.h" |
| 38 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 39 #include "wtf/HashSet.h" | 39 #include "wtf/HashSet.h" |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 class CSSAnimationUpdate; |
| 45 class CSSFontSelector; | 46 class CSSFontSelector; |
| 46 class CSSRuleList; | 47 class CSSRuleList; |
| 47 class CSSSelector; | 48 class CSSSelector; |
| 48 class CSSStyleSheet; | 49 class CSSStyleSheet; |
| 49 class CSSValue; | 50 class CSSValue; |
| 50 class ContainerNode; | 51 class ContainerNode; |
| 51 class Document; | 52 class Document; |
| 52 class DocumentTimeline; | 53 class DocumentTimeline; |
| 53 class Element; | 54 class Element; |
| 54 class ElementRuleCollector; | 55 class ElementRuleCollector; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 bool buildScopedStyleTreeInDocumentOrder() const { return m_styleTree.buildI
nDocumentOrder(); } | 216 bool buildScopedStyleTreeInDocumentOrder() const { return m_styleTree.buildI
nDocumentOrder(); } |
| 216 | 217 |
| 217 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) | 218 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) |
| 218 { | 219 { |
| 219 return m_styleTree.ensureScopedStyleResolver(scope ? scope : document())
; | 220 return m_styleTree.ensureScopedStyleResolver(scope ? scope : document())
; |
| 220 } | 221 } |
| 221 | 222 |
| 222 // FIXME: Used by SharingStyleFinder, but should be removed. | 223 // FIXME: Used by SharingStyleFinder, but should be removed. |
| 223 bool styleSharingCandidateMatchesRuleSet(const ElementResolveContext&, Rende
rStyle*, RuleSet*); | 224 bool styleSharingCandidateMatchesRuleSet(const ElementResolveContext&, Rende
rStyle*, RuleSet*); |
| 224 | 225 |
| 225 const StyleRuleKeyframes* matchScopedKeyframesRule(Element*, const StringImp
l* animationName); | 226 const StyleRuleKeyframes* matchScopedKeyframesRule(const Element*, const Str
ingImpl* animationName); |
| 226 PassRefPtr<RenderStyle> styleForKeyframe(Element*, const RenderStyle*, const
StyleKeyframe*, KeyframeValue&); | 227 PassRefPtr<RenderStyle> styleForKeyframe(Element*, const RenderStyle*, const
StyleKeyframe*, KeyframeValue&); |
| 227 | 228 |
| 228 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). | 229 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). |
| 229 enum CSSRuleFilter { | 230 enum CSSRuleFilter { |
| 230 UAAndUserCSSRules = 1 << 1, | 231 UAAndUserCSSRules = 1 << 1, |
| 231 AuthorCSSRules = 1 << 2, | 232 AuthorCSSRules = 1 << 2, |
| 232 EmptyCSSRules = 1 << 3, | 233 EmptyCSSRules = 1 << 3, |
| 233 CrossOriginCSSRules = 1 << 4, | 234 CrossOriginCSSRules = 1 << 4, |
| 234 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS
SRules, | 235 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS
SRules, |
| 235 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, | 236 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 void matchShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRul
es); | 282 void matchShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRul
es); |
| 282 void matchHostRules(Element*, ScopedStyleResolver*, ElementRuleCollector&, b
ool includeEmptyRules); | 283 void matchHostRules(Element*, ScopedStyleResolver*, ElementRuleCollector&, b
ool includeEmptyRules); |
| 283 void matchScopedAuthorRules(Element*, ElementRuleCollector&, bool includeEmp
tyRules); | 284 void matchScopedAuthorRules(Element*, ElementRuleCollector&, bool includeEmp
tyRules); |
| 284 void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool matchAut
horAndUserStyles, bool includeSMILProperties); | 285 void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool matchAut
horAndUserStyles, bool includeSMILProperties); |
| 285 void matchUARules(ElementRuleCollector&); | 286 void matchUARules(ElementRuleCollector&); |
| 286 void matchUserRules(ElementRuleCollector&, bool includeEmptyRules); | 287 void matchUserRules(ElementRuleCollector&, bool includeEmptyRules); |
| 287 void collectFeatures(); | 288 void collectFeatures(); |
| 288 | 289 |
| 289 bool fastRejectSelector(const RuleData&) const; | 290 bool fastRejectSelector(const RuleData&) const; |
| 290 | 291 |
| 292 PassOwnPtr<CSSAnimationUpdate> calculateCSSAnimationUpdate(StyleResolverStat
e&); |
| 291 void applyMatchedProperties(StyleResolverState&, const MatchResult&); | 293 void applyMatchedProperties(StyleResolverState&, const MatchResult&); |
| 292 | 294 |
| 293 enum StyleApplicationPass { | 295 enum StyleApplicationPass { |
| 294 VariableDefinitions, | 296 VariableDefinitions, |
| 295 AnimationProperties, | 297 AnimationProperties, |
| 296 HighPriorityProperties, | 298 HighPriorityProperties, |
| 297 LowPriorityProperties | 299 LowPriorityProperties |
| 298 }; | 300 }; |
| 299 template <StyleResolver::StyleApplicationPass pass> | 301 template <StyleResolver::StyleApplicationPass pass> |
| 300 static inline bool isPropertyForPass(CSSPropertyID); | 302 static inline bool isPropertyForPass(CSSPropertyID); |
| 301 template <StyleApplicationPass pass> | 303 template <StyleApplicationPass pass> |
| 302 void applyMatchedProperties(StyleResolverState&, const MatchResult&, bool im
portant, int startIndex, int endIndex, bool inheritedOnly); | 304 void applyMatchedProperties(StyleResolverState&, const MatchResult&, bool im
portant, int startIndex, int endIndex, bool inheritedOnly); |
| 303 template <StyleApplicationPass pass> | 305 template <StyleApplicationPass pass> |
| 304 void applyProperties(StyleResolverState&, const StylePropertySet* properties
, StyleRule*, bool isImportant, bool inheritedOnly, PropertyWhitelistType = Prop
ertyWhitelistNone); | 306 void applyProperties(StyleResolverState&, const StylePropertySet* properties
, StyleRule*, bool isImportant, bool inheritedOnly, PropertyWhitelistType = Prop
ertyWhitelistNone); |
| 305 template <StyleApplicationPass pass> | 307 template <StyleApplicationPass pass> |
| 306 void applyAnimatedProperties(StyleResolverState&, const Element*, const Docu
mentTimeline*); | 308 void applyAnimatedProperties(StyleResolverState&, const Element*, const Docu
mentTimeline*, const CSSAnimationUpdate*); |
| 307 void resolveVariables(StyleResolverState&, CSSPropertyID, CSSValue*, Vector<
std::pair<CSSPropertyID, String> >& knownExpressions); | 309 void resolveVariables(StyleResolverState&, CSSPropertyID, CSSValue*, Vector<
std::pair<CSSPropertyID, String> >& knownExpressions); |
| 308 void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPag
e, const String& pageName); | 310 void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPag
e, const String& pageName); |
| 309 void matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vecto
r<StyleRulePage*>&, bool isLeftPage, bool isFirstPage, const String& pageName); | 311 void matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vecto
r<StyleRulePage*>&, bool isLeftPage, bool isFirstPage, const String& pageName); |
| 310 void collectViewportRules(); | 312 void collectViewportRules(); |
| 311 Settings* documentSettings() { return m_document->settings(); } | 313 Settings* documentSettings() { return m_document->settings(); } |
| 312 | 314 |
| 313 bool isLeftPage(int pageIndex) const; | 315 bool isLeftPage(int pageIndex) const; |
| 314 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); } | 316 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); } |
| 315 bool isFirstPage(int pageIndex) const; | 317 bool isFirstPage(int pageIndex) const; |
| 316 String pageName(int pageIndex) const; | 318 String pageName(int pageIndex) const; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 PseudoId ignoreDynamicPseudo = NOPSEUDO; | 373 PseudoId ignoreDynamicPseudo = NOPSEUDO; |
| 372 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) | 374 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) |
| 373 return true; | 375 return true; |
| 374 } | 376 } |
| 375 return false; | 377 return false; |
| 376 } | 378 } |
| 377 | 379 |
| 378 } // namespace WebCore | 380 } // namespace WebCore |
| 379 | 381 |
| 380 #endif // StyleResolver_h | 382 #endif // StyleResolver_h |
| OLD | NEW |