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