| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 public: | 174 public: |
| 175 StyleResolver(Document&, bool matchAuthorAndUserStyles); | 175 StyleResolver(Document&, bool matchAuthorAndUserStyles); |
| 176 ~StyleResolver(); | 176 ~StyleResolver(); |
| 177 | 177 |
| 178 // FIXME: StyleResolver should not be keeping tree-walk state. | 178 // FIXME: StyleResolver should not be keeping tree-walk state. |
| 179 // These should move to some global tree-walk state, or should be contained
in a | 179 // These should move to some global tree-walk state, or should be contained
in a |
| 180 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. | 180 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. |
| 181 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. | 181 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. |
| 182 void pushParentElement(Element*); | 182 void pushParentElement(Element*); |
| 183 void popParentElement(Element*); | 183 void popParentElement(Element*); |
| 184 void pushParentShadowRoot(const ShadowRoot*); | 184 void pushParentShadowRoot(const ShadowRoot&); |
| 185 void popParentShadowRoot(const ShadowRoot*); | 185 void popParentShadowRoot(const ShadowRoot&); |
| 186 | 186 |
| 187 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0, StyleSharingBehavior = AllowStyleSharing, | 187 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0, StyleSharingBehavior = AllowStyleSharing, |
| 188 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0
); | 188 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0
); |
| 189 | 189 |
| 190 // FIXME: The following logic related to animations and keyframes should be
factored out of StyleResolver | 190 // FIXME: The following logic related to animations and keyframes should be
factored out of StyleResolver |
| 191 // The body of calculateCSSAnimationUpdate can move to CSSAnimations.cpp and
take just const element, const style, | 191 // The body of calculateCSSAnimationUpdate can move to CSSAnimations.cpp and
take just const element, const style, |
| 192 // and const ScopedStyleTree | 192 // and const ScopedStyleTree |
| 193 void calculateCSSAnimationUpdate(StyleResolverState&); | 193 void calculateCSSAnimationUpdate(StyleResolverState&); |
| 194 void resolveKeyframes(const Element*, const RenderStyle*, const StringImpl*
animationName, KeyframeAnimationEffect::KeyframeVector&); | 194 void resolveKeyframes(const Element*, const RenderStyle*, const StringImpl*
animationName, KeyframeAnimationEffect::KeyframeVector&); |
| 195 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&)
; | 195 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&)
; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 217 | 217 |
| 218 DocumentRuleSets& ruleSets() { return m_ruleSets; } | 218 DocumentRuleSets& ruleSets() { return m_ruleSets; } |
| 219 const DocumentRuleSets& ruleSets() const { return m_ruleSets; } | 219 const DocumentRuleSets& ruleSets() const { return m_ruleSets; } |
| 220 SelectorFilter& selectorFilter() { return m_selectorFilter; } | 220 SelectorFilter& selectorFilter() { return m_selectorFilter; } |
| 221 | 221 |
| 222 void setBuildScopedStyleTreeInDocumentOrder(bool enabled) { m_styleTree.setB
uildInDocumentOrder(enabled); } | 222 void setBuildScopedStyleTreeInDocumentOrder(bool enabled) { m_styleTree.setB
uildInDocumentOrder(enabled); } |
| 223 bool buildScopedStyleTreeInDocumentOrder() const { return m_styleTree.buildI
nDocumentOrder(); } | 223 bool buildScopedStyleTreeInDocumentOrder() const { return m_styleTree.buildI
nDocumentOrder(); } |
| 224 | 224 |
| 225 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) | 225 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) |
| 226 { | 226 { |
| 227 return m_styleTree.ensureScopedStyleResolver(scope ? scope : &document()
); | 227 return m_styleTree.ensureScopedStyleResolver(scope ? *scope : document()
); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // FIXME: Used by SharingStyleFinder, but should be removed. | 230 // FIXME: Used by SharingStyleFinder, but should be removed. |
| 231 bool styleSharingCandidateMatchesRuleSet(const ElementResolveContext&, Rende
rStyle*, RuleSet*); | 231 bool styleSharingCandidateMatchesRuleSet(const ElementResolveContext&, Rende
rStyle*, RuleSet*); |
| 232 | 232 |
| 233 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). | 233 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). |
| 234 enum CSSRuleFilter { | 234 enum CSSRuleFilter { |
| 235 UAAndUserCSSRules = 1 << 1, | 235 UAAndUserCSSRules = 1 << 1, |
| 236 AuthorCSSRules = 1 << 2, | 236 AuthorCSSRules = 1 << 2, |
| 237 EmptyCSSRules = 1 << 3, | 237 EmptyCSSRules = 1 << 3, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 PseudoId ignoreDynamicPseudo = NOPSEUDO; | 370 PseudoId ignoreDynamicPseudo = NOPSEUDO; |
| 371 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) | 371 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) |
| 372 return true; | 372 return true; |
| 373 } | 373 } |
| 374 return false; | 374 return false; |
| 375 } | 375 } |
| 376 | 376 |
| 377 } // namespace WebCore | 377 } // namespace WebCore |
| 378 | 378 |
| 379 #endif // StyleResolver_h | 379 #endif // StyleResolver_h |
| OLD | NEW |