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 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "sky/engine/wtf/HashMap.h" | 35 #include "sky/engine/wtf/HashMap.h" |
36 #include "sky/engine/wtf/HashSet.h" | 36 #include "sky/engine/wtf/HashSet.h" |
37 #include "sky/engine/wtf/OwnPtr.h" | 37 #include "sky/engine/wtf/OwnPtr.h" |
38 #include "sky/engine/wtf/PassOwnPtr.h" | 38 #include "sky/engine/wtf/PassOwnPtr.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class CSSStyleSheet; | 42 class CSSStyleSheet; |
43 class ContainerNode; | 43 class ContainerNode; |
44 class HTMLStyleElement; | 44 class HTMLStyleElement; |
45 class RuleFeatureSet; | |
46 class StyleSheetContents; | 45 class StyleSheetContents; |
47 | 46 |
48 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 47 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
49 class ScopedStyleResolver final { | 48 class ScopedStyleResolver final { |
50 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); | 49 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
51 WTF_MAKE_FAST_ALLOCATED; | 50 WTF_MAKE_FAST_ALLOCATED; |
52 public: | 51 public: |
53 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) | 52 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) |
54 { | 53 { |
55 return adoptPtr(new ScopedStyleResolver(scope)); | 54 return adoptPtr(new ScopedStyleResolver(scope)); |
56 } | 55 } |
57 | 56 |
58 const TreeScope& treeScope() const { return m_scope; } | 57 const TreeScope& treeScope() const { return m_scope; } |
59 | 58 |
60 const StyleRuleKeyframes* keyframeStylesForAnimation(String animationName); | 59 const StyleRuleKeyframes* keyframeStylesForAnimation(String animationName); |
61 | 60 |
62 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore
CascadeOrder); | 61 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore
CascadeOrder); |
63 void collectMatchingHostRules(ElementRuleCollector&, CascadeOrder = ignoreCa
scadeOrder); | 62 void collectMatchingHostRules(ElementRuleCollector&, CascadeOrder = ignoreCa
scadeOrder); |
64 | 63 |
65 const RuleFeatureSet& features() const { return m_features; } | 64 bool hasSelectorForId(const AtomicString& id) const; |
| 65 bool hasSelectorForClass(const AtomicString& className) const; |
| 66 bool hasSelectorForAttribute(const AtomicString& attributeName) const; |
66 | 67 |
67 void updateActiveStyleSheets(); | 68 void updateActiveStyleSheets(); |
68 | 69 |
69 Vector<RefPtr<CSSStyleSheet>>& authorStyleSheets() { return m_authorStyleShe
ets; } | |
70 const Vector<RefPtr<CSSStyleSheet>>& authorStyleSheets() const { return m_au
thorStyleSheets; } | 70 const Vector<RefPtr<CSSStyleSheet>>& authorStyleSheets() const { return m_au
thorStyleSheets; } |
71 | 71 |
72 void addStyleSheetCandidateNode(HTMLStyleElement&); | 72 void addStyleSheetCandidateNode(HTMLStyleElement&); |
73 void removeStyleSheetCandidateNode(HTMLStyleElement&); | 73 void removeStyleSheetCandidateNode(HTMLStyleElement&); |
74 | 74 |
75 private: | 75 private: |
76 explicit ScopedStyleResolver(TreeScope&); | 76 explicit ScopedStyleResolver(TreeScope&); |
77 | 77 |
78 void appendStyleSheet(CSSStyleSheet&); | |
79 void collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& candidateSheets); | 78 void collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& candidateSheets); |
80 | 79 |
81 TreeScope& m_scope; | 80 TreeScope& m_scope; |
82 DocumentOrderedList m_styleSheetCandidateNodes; | 81 DocumentOrderedList m_styleSheetCandidateNodes; |
83 Vector<RefPtr<CSSStyleSheet>> m_authorStyleSheets; | 82 Vector<RefPtr<CSSStyleSheet>> m_authorStyleSheets; |
84 RuleFeatureSet m_features; | |
85 }; | 83 }; |
86 | 84 |
87 } // namespace blink | 85 } // namespace blink |
88 | 86 |
89 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ | 87 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ |
OLD | NEW |