| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 StyleResolver(Document*, bool matchAuthorAndUserStyles); | 141 StyleResolver(Document*, bool matchAuthorAndUserStyles); |
| 142 ~StyleResolver(); | 142 ~StyleResolver(); |
| 143 | 143 |
| 144 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. | 144 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. |
| 145 void pushParentElement(Element*); | 145 void pushParentElement(Element*); |
| 146 void popParentElement(Element*); | 146 void popParentElement(Element*); |
| 147 void pushParentShadowRoot(const ShadowRoot*); | 147 void pushParentShadowRoot(const ShadowRoot*); |
| 148 void popParentShadowRoot(const ShadowRoot*); | 148 void popParentShadowRoot(const ShadowRoot*); |
| 149 | 149 |
| 150 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0, StyleSharingBehavior = AllowStyleSharing, | 150 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0, StyleSharingBehavior = AllowStyleSharing, |
| 151 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0
, int childIndex = 0); | 151 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0
); |
| 152 | |
| 153 // childIndex's origin is 1, and avoids unnecessary tree walks to resolve nt
h/nth-last selectors. | |
| 154 PassRefPtr<RenderStyle> styleForElement(Element* element, int childIndex) | |
| 155 { | |
| 156 return styleForElement(element, 0, AllowStyleSharing, MatchAllRules, 0,
childIndex); | |
| 157 } | |
| 158 | 152 |
| 159 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&)
; | 153 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&)
; |
| 160 | 154 |
| 161 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq
uest&, RenderStyle* parentStyle); | 155 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq
uest&, RenderStyle* parentStyle); |
| 162 | 156 |
| 163 PassRefPtr<RenderStyle> styleForPage(int pageIndex); | 157 PassRefPtr<RenderStyle> styleForPage(int pageIndex); |
| 164 PassRefPtr<RenderStyle> defaultStyleForElement(); | 158 PassRefPtr<RenderStyle> defaultStyleForElement(); |
| 165 PassRefPtr<RenderStyle> styleForText(Text*); | 159 PassRefPtr<RenderStyle> styleForText(Text*); |
| 166 | 160 |
| 167 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector*
= 0); | 161 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector*
= 0); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 185 DocumentRuleSets& ruleSets() { return m_ruleSets; } | 179 DocumentRuleSets& ruleSets() { return m_ruleSets; } |
| 186 const DocumentRuleSets& ruleSets() const { return m_ruleSets; } | 180 const DocumentRuleSets& ruleSets() const { return m_ruleSets; } |
| 187 SelectorFilter& selectorFilter() { return m_selectorFilter; } | 181 SelectorFilter& selectorFilter() { return m_selectorFilter; } |
| 188 | 182 |
| 189 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) | 183 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) |
| 190 { | 184 { |
| 191 return m_styleTree.ensureScopedStyleResolver(scope ? scope : document())
; | 185 return m_styleTree.ensureScopedStyleResolver(scope ? scope : document())
; |
| 192 } | 186 } |
| 193 | 187 |
| 194 private: | 188 private: |
| 195 void initElement(Element*, int childIndex = 0); | 189 void initElement(Element*); |
| 196 RenderStyle* locateSharedStyle(); | 190 RenderStyle* locateSharedStyle(); |
| 197 bool styleSharingCandidateMatchesRuleSet(RuleSet*); | 191 bool styleSharingCandidateMatchesRuleSet(RuleSet*); |
| 198 Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const; | 192 Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const; |
| 199 StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const; | 193 StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const; |
| 200 bool canShareStyleWithElement(StyledElement*) const; | 194 bool canShareStyleWithElement(StyledElement*) const; |
| 201 | 195 |
| 202 PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyf
rame*, KeyframeValue&); | 196 PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyf
rame*, KeyframeValue&); |
| 203 | 197 |
| 204 public: | 198 public: |
| 205 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). | 199 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 PseudoId ignoreDynamicPseudo = NOPSEUDO; | 471 PseudoId ignoreDynamicPseudo = NOPSEUDO; |
| 478 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) | 472 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) |
| 479 return true; | 473 return true; |
| 480 } | 474 } |
| 481 return false; | 475 return false; |
| 482 } | 476 } |
| 483 | 477 |
| 484 } // namespace WebCore | 478 } // namespace WebCore |
| 485 | 479 |
| 486 #endif // StyleResolver_h | 480 #endif // StyleResolver_h |
| OLD | NEW |