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

Side by Side Diff: sky/engine/core/css/CSSRuleList.h

Issue 780483002: Remove the CSSOM. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/css/CSSRule.idl ('k') | sky/engine/core/css/CSSRuleList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2006, 2012 Apple Computer, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22 #ifndef SKY_ENGINE_CORE_CSS_CSSRULELIST_H_
23 #define SKY_ENGINE_CORE_CSS_CSSRULELIST_H_
24
25 #include "sky/engine/bindings/core/v8/ScriptWrappable.h"
26 #include "sky/engine/wtf/PassOwnPtr.h"
27 #include "sky/engine/wtf/PassRefPtr.h"
28 #include "sky/engine/wtf/RefPtr.h"
29 #include "sky/engine/wtf/Vector.h"
30
31 namespace blink {
32
33 class CSSRule;
34 class CSSStyleSheet;
35
36 class CSSRuleList : public ScriptWrappable {
37 DEFINE_WRAPPERTYPEINFO();
38 WTF_MAKE_FAST_ALLOCATED;
39 WTF_MAKE_NONCOPYABLE(CSSRuleList);
40 public:
41 virtual ~CSSRuleList();
42
43 #if !ENABLE(OILPAN)
44 virtual void ref() = 0;
45 virtual void deref() = 0;
46 #endif
47
48 virtual unsigned length() const = 0;
49 virtual CSSRule* item(unsigned index) const = 0;
50
51 virtual CSSStyleSheet* styleSheet() const = 0;
52
53 protected:
54 CSSRuleList();
55 };
56
57 class StaticCSSRuleList final : public CSSRuleList {
58 public:
59 static PassRefPtr<StaticCSSRuleList> create()
60 {
61 return adoptRef(new StaticCSSRuleList());
62 }
63
64 #if !ENABLE(OILPAN)
65 virtual void ref() override { ++m_refCount; }
66 virtual void deref() override;
67 #endif
68
69 Vector<RefPtr<CSSRule> >& rules() { return m_rules; }
70
71 virtual CSSStyleSheet* styleSheet() const override { return 0; }
72
73 private:
74 StaticCSSRuleList();
75 virtual ~StaticCSSRuleList();
76
77 virtual unsigned length() const override { return m_rules.size(); }
78 virtual CSSRule* item(unsigned index) const override { return index < m_rule s.size() ? m_rules[index].get() : 0; }
79
80 Vector<RefPtr<CSSRule> > m_rules;
81 #if !ENABLE(OILPAN)
82 unsigned m_refCount;
83 #endif
84 };
85
86 template <class Rule>
87 class LiveCSSRuleList final : public CSSRuleList {
88 public:
89 static PassOwnPtr<LiveCSSRuleList> create(Rule* rule)
90 {
91 return adoptPtr(new LiveCSSRuleList(rule));
92 }
93
94 #if !ENABLE(OILPAN)
95 virtual void ref() override { m_rule->ref(); }
96 virtual void deref() override { m_rule->deref(); }
97 #endif
98
99 private:
100 LiveCSSRuleList(Rule* rule) : m_rule(rule) { }
101
102 virtual unsigned length() const override { return m_rule->length(); }
103 virtual CSSRule* item(unsigned index) const override { return m_rule->item(i ndex); }
104 virtual CSSStyleSheet* styleSheet() const override { return m_rule->parentSt yleSheet(); }
105
106 RawPtr<Rule> m_rule;
107 };
108
109 } // namespace blink
110
111 #endif // SKY_ENGINE_CORE_CSS_CSSRULELIST_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSRule.idl ('k') | sky/engine/core/css/CSSRuleList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698