Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: sky/engine/core/css/resolver/ScopedStyleResolver.h

Issue 852703002: Merge StyleSheetCollection into ScopedStyleResolver. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/css/resolver/ScopedStyleResolver.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ 27 #ifndef SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_
28 #define SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ 28 #define SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_
29 29
30 #include "sky/engine/core/css/ElementRuleCollector.h" 30 #include "sky/engine/core/css/ElementRuleCollector.h"
31 #include "sky/engine/core/css/MediaQueryEvaluator.h"
31 #include "sky/engine/core/css/RuleSet.h" 32 #include "sky/engine/core/css/RuleSet.h"
33 #include "sky/engine/core/dom/DocumentOrderedList.h"
32 #include "sky/engine/core/dom/TreeScope.h" 34 #include "sky/engine/core/dom/TreeScope.h"
33 #include "sky/engine/wtf/HashMap.h" 35 #include "sky/engine/wtf/HashMap.h"
34 #include "sky/engine/wtf/HashSet.h" 36 #include "sky/engine/wtf/HashSet.h"
35 #include "sky/engine/wtf/OwnPtr.h" 37 #include "sky/engine/wtf/OwnPtr.h"
36 #include "sky/engine/wtf/PassOwnPtr.h" 38 #include "sky/engine/wtf/PassOwnPtr.h"
37 39
38 namespace blink { 40 namespace blink {
39 41
42 class CSSStyleSheet;
43 class ContainerNode;
44 class HTMLStyleElement;
45 class RuleFeatureSet;
40 class StyleSheetContents; 46 class StyleSheetContents;
41 class RuleFeatureSet;
42 47
43 // This class selects a RenderStyle for a given element based on a collection of stylesheets. 48 // This class selects a RenderStyle for a given element based on a collection of stylesheets.
44 class ScopedStyleResolver final { 49 class ScopedStyleResolver final {
45 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); 50 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver);
46 WTF_MAKE_FAST_ALLOCATED; 51 WTF_MAKE_FAST_ALLOCATED;
47 public: 52 public:
48 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) 53 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope)
49 { 54 {
50 return adoptPtr(new ScopedStyleResolver(scope)); 55 return adoptPtr(new ScopedStyleResolver(scope));
51 } 56 }
52 57
53 const TreeScope& treeScope() const { return *m_scope; } 58 const TreeScope& treeScope() const { return m_scope; }
54 59
55 const StyleRuleKeyframes* keyframeStylesForAnimation(String animationName); 60 const StyleRuleKeyframes* keyframeStylesForAnimation(String animationName);
56 61
57 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore CascadeOrder); 62 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore CascadeOrder);
58 void collectMatchingHostRules(ElementRuleCollector&, CascadeOrder = ignoreCa scadeOrder); 63 void collectMatchingHostRules(ElementRuleCollector&, CascadeOrder = ignoreCa scadeOrder);
59 64
60 void addRulesFromSheet(CSSStyleSheet*); 65 const RuleFeatureSet& features() const { return m_features; }
61 void resetAuthorStyle();
62 66
63 const RuleFeatureSet& features() const { return m_features; } 67 void updateActiveStyleSheets();
68
69 const MediaQueryResultList& viewportDependentMediaQueryResults() const;
70
71 Vector<RefPtr<CSSStyleSheet> >& authorStyleSheets() { return m_authorStyleSh eets; }
72 const Vector<RefPtr<CSSStyleSheet> >& authorStyleSheets() const { return m_a uthorStyleSheets; }
73
74 void addStyleSheetCandidateNode(HTMLStyleElement&);
75 void removeStyleSheetCandidateNode(HTMLStyleElement&);
64 76
65 private: 77 private:
66 explicit ScopedStyleResolver(TreeScope&); 78 explicit ScopedStyleResolver(TreeScope&);
67 79
68 RawPtr<TreeScope> m_scope; 80 void appendStyleSheet(CSSStyleSheet&);
69 Vector<RawPtr<CSSStyleSheet> > m_authorStyleSheets; 81 void collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& candidateSheets);
70 82
83 TreeScope& m_scope;
84 DocumentOrderedList m_styleSheetCandidateNodes;
85 Vector<RefPtr<CSSStyleSheet>> m_authorStyleSheets;
86 MediaQueryResultList m_viewportDependentMediaQueryResults;
71 RuleFeatureSet m_features; 87 RuleFeatureSet m_features;
72 }; 88 };
73 89
74 } // namespace blink 90 } // namespace blink
75 91
76 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_ 92 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_SCOPEDSTYLERESOLVER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/css/resolver/ScopedStyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698