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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 StyleResolver(Document*, bool matchAuthorAndUserStyles); | 153 StyleResolver(Document*, bool matchAuthorAndUserStyles); |
154 ~StyleResolver(); | 154 ~StyleResolver(); |
155 | 155 |
156 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. | 156 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. |
157 void pushParentElement(Element*); | 157 void pushParentElement(Element*); |
158 void popParentElement(Element*); | 158 void popParentElement(Element*); |
159 void pushParentShadowRoot(const ShadowRoot*); | 159 void pushParentShadowRoot(const ShadowRoot*); |
160 void popParentShadowRoot(const ShadowRoot*); | 160 void popParentShadowRoot(const ShadowRoot*); |
161 | 161 |
162 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0, StyleSharingBehavior = AllowStyleSharing, | 162 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle =
0, StyleSharingBehavior = AllowStyleSharing, |
163 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0
); | 163 RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0
, int childIndex = 0); |
| 164 |
| 165 PassRefPtr<RenderStyle> styleForElement(Element* element, int childIndex) |
| 166 { |
| 167 return styleForElement(element, 0, AllowStyleSharing, MatchAllRules, 0,
childIndex); |
| 168 } |
164 | 169 |
165 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&)
; | 170 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&)
; |
166 | 171 |
167 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq
uest&, RenderStyle* parentStyle); | 172 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq
uest&, RenderStyle* parentStyle); |
168 | 173 |
169 PassRefPtr<RenderStyle> styleForPage(int pageIndex); | 174 PassRefPtr<RenderStyle> styleForPage(int pageIndex); |
170 PassRefPtr<RenderStyle> defaultStyleForElement(); | 175 PassRefPtr<RenderStyle> defaultStyleForElement(); |
171 PassRefPtr<RenderStyle> styleForText(Text*); | 176 PassRefPtr<RenderStyle> styleForText(Text*); |
172 | 177 |
173 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector*
= 0); | 178 static PassRefPtr<RenderStyle> styleForDocument(Document*, CSSFontSelector*
= 0); |
(...skipping 17 matching lines...) Expand all Loading... |
191 DocumentRuleSets& ruleSets() { return m_ruleSets; } | 196 DocumentRuleSets& ruleSets() { return m_ruleSets; } |
192 const DocumentRuleSets& ruleSets() const { return m_ruleSets; } | 197 const DocumentRuleSets& ruleSets() const { return m_ruleSets; } |
193 SelectorFilter& selectorFilter() { return m_selectorFilter; } | 198 SelectorFilter& selectorFilter() { return m_selectorFilter; } |
194 | 199 |
195 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) | 200 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scope) |
196 { | 201 { |
197 return m_styleTree.ensureScopedStyleResolver(scope ? scope : document())
; | 202 return m_styleTree.ensureScopedStyleResolver(scope ? scope : document())
; |
198 } | 203 } |
199 | 204 |
200 private: | 205 private: |
201 void initElement(Element*); | 206 void initElement(Element*, int childIndex = 0); |
202 RenderStyle* locateSharedStyle(); | 207 RenderStyle* locateSharedStyle(); |
203 bool styleSharingCandidateMatchesRuleSet(RuleSet*); | 208 bool styleSharingCandidateMatchesRuleSet(RuleSet*); |
204 Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const; | 209 Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const; |
205 StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const; | 210 StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const; |
206 bool canShareStyleWithElement(StyledElement*) const; | 211 bool canShareStyleWithElement(StyledElement*) const; |
207 | 212 |
208 PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyf
rame*, KeyframeValue&); | 213 PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const StyleKeyf
rame*, KeyframeValue&); |
209 | 214 |
210 public: | 215 public: |
211 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). | 216 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 PseudoId ignoreDynamicPseudo = NOPSEUDO; | 498 PseudoId ignoreDynamicPseudo = NOPSEUDO; |
494 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) | 499 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo,
DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) |
495 return true; | 500 return true; |
496 } | 501 } |
497 return false; | 502 return false; |
498 } | 503 } |
499 | 504 |
500 } // namespace WebCore | 505 } // namespace WebCore |
501 | 506 |
502 #endif // StyleResolver_h | 507 #endif // StyleResolver_h |
OLD | NEW |