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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSStyleSheet.h

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 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 30 matching lines...) Expand all
41 class StyleSheetContents; 41 class StyleSheetContents;
42 42
43 enum StyleSheetUpdateType { 43 enum StyleSheetUpdateType {
44 PartialRuleUpdate, 44 PartialRuleUpdate,
45 EntireStyleSheetUpdate 45 EntireStyleSheetUpdate
46 }; 46 };
47 47
48 class CORE_EXPORT CSSStyleSheet final : public StyleSheet { 48 class CORE_EXPORT CSSStyleSheet final : public StyleSheet {
49 DEFINE_WRAPPERTYPEINFO(); 49 DEFINE_WRAPPERTYPEINFO();
50 public: 50 public:
51 static PassRefPtrWillBeRawPtr<CSSStyleSheet> create(PassRefPtrWillBeRawPtr<S tyleSheetContents>, CSSImportRule* ownerRule = 0); 51 static RawPtr<CSSStyleSheet> create(RawPtr<StyleSheetContents>, CSSImportRul e* ownerRule = 0);
52 static PassRefPtrWillBeRawPtr<CSSStyleSheet> create(PassRefPtrWillBeRawPtr<S tyleSheetContents>, Node* ownerNode); 52 static RawPtr<CSSStyleSheet> create(RawPtr<StyleSheetContents>, Node* ownerN ode);
53 static PassRefPtrWillBeRawPtr<CSSStyleSheet> createInline(Node*, const KURL& , const TextPosition& startPosition = TextPosition::minimumPosition(), const Str ing& encoding = String()); 53 static RawPtr<CSSStyleSheet> createInline(Node*, const KURL&, const TextPosi tion& startPosition = TextPosition::minimumPosition(), const String& encoding = String());
54 static PassRefPtrWillBeRawPtr<CSSStyleSheet> createInline(PassRefPtrWillBeRa wPtr<StyleSheetContents>, Node* ownerNode, const TextPosition& startPosition = T extPosition::minimumPosition()); 54 static RawPtr<CSSStyleSheet> createInline(RawPtr<StyleSheetContents>, Node* ownerNode, const TextPosition& startPosition = TextPosition::minimumPosition());
55 55
56 ~CSSStyleSheet() override; 56 ~CSSStyleSheet() override;
57 57
58 CSSStyleSheet* parentStyleSheet() const override; 58 CSSStyleSheet* parentStyleSheet() const override;
59 Node* ownerNode() const override { return m_ownerNode; } 59 Node* ownerNode() const override { return m_ownerNode; }
60 MediaList* media() const override; 60 MediaList* media() const override;
61 String href() const override; 61 String href() const override;
62 String title() const override { return m_title; } 62 String title() const override { return m_title; }
63 bool disabled() const override { return m_isDisabled; } 63 bool disabled() const override { return m_isDisabled; }
64 void setDisabled(bool) override; 64 void setDisabled(bool) override;
65 65
66 PassRefPtrWillBeRawPtr<CSSRuleList> cssRules(); 66 RawPtr<CSSRuleList> cssRules();
67 unsigned insertRule(const String& rule, unsigned index, ExceptionState&); 67 unsigned insertRule(const String& rule, unsigned index, ExceptionState&);
68 unsigned insertRule(const String& rule, ExceptionState&); // Deprecated. 68 unsigned insertRule(const String& rule, ExceptionState&); // Deprecated.
69 void deleteRule(unsigned index, ExceptionState&); 69 void deleteRule(unsigned index, ExceptionState&);
70 70
71 // IE Extensions 71 // IE Extensions
72 PassRefPtrWillBeRawPtr<CSSRuleList> rules(); 72 RawPtr<CSSRuleList> rules();
73 int addRule(const String& selector, const String& style, int index, Exceptio nState&); 73 int addRule(const String& selector, const String& style, int index, Exceptio nState&);
74 int addRule(const String& selector, const String& style, ExceptionState&); 74 int addRule(const String& selector, const String& style, ExceptionState&);
75 void removeRule(unsigned index, ExceptionState& exceptionState) { deleteRule (index, exceptionState); } 75 void removeRule(unsigned index, ExceptionState& exceptionState) { deleteRule (index, exceptionState); }
76 76
77 // For CSSRuleList. 77 // For CSSRuleList.
78 unsigned length() const; 78 unsigned length() const;
79 CSSRule* item(unsigned index); 79 CSSRule* item(unsigned index);
80 80
81 void clearOwnerNode() override; 81 void clearOwnerNode() override;
82 82
83 CSSRule* ownerRule() const override { return m_ownerRule; } 83 CSSRule* ownerRule() const override { return m_ownerRule; }
84 KURL baseURL() const override; 84 KURL baseURL() const override;
85 bool isLoading() const override; 85 bool isLoading() const override;
86 86
87 void clearOwnerRule() { m_ownerRule = nullptr; } 87 void clearOwnerRule() { m_ownerRule = nullptr; }
88 Document* ownerDocument() const; 88 Document* ownerDocument() const;
89 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } 89 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
90 void setMediaQueries(PassRefPtrWillBeRawPtr<MediaQuerySet>); 90 void setMediaQueries(RawPtr<MediaQuerySet>);
91 void setTitle(const String& title) { m_title = title; } 91 void setTitle(const String& title) { m_title = title; }
92 // Set by LinkStyle iff CORS-enabled fetch of stylesheet succeeded from this origin. 92 // Set by LinkStyle iff CORS-enabled fetch of stylesheet succeeded from this origin.
93 void setAllowRuleAccessFromOrigin(PassRefPtr<SecurityOrigin> allowedOrigin); 93 void setAllowRuleAccessFromOrigin(PassRefPtr<SecurityOrigin> allowedOrigin);
94 94
95 class RuleMutationScope { 95 class RuleMutationScope {
96 WTF_MAKE_NONCOPYABLE(RuleMutationScope); 96 WTF_MAKE_NONCOPYABLE(RuleMutationScope);
97 STACK_ALLOCATED(); 97 STACK_ALLOCATED();
98 public: 98 public:
99 explicit RuleMutationScope(CSSStyleSheet*); 99 explicit RuleMutationScope(CSSStyleSheet*);
100 explicit RuleMutationScope(CSSRule*); 100 explicit RuleMutationScope(CSSRule*);
101 ~RuleMutationScope(); 101 ~RuleMutationScope();
102 102
103 private: 103 private:
104 RawPtrWillBeMember<CSSStyleSheet> m_styleSheet; 104 Member<CSSStyleSheet> m_styleSheet;
105 }; 105 };
106 106
107 void willMutateRules(); 107 void willMutateRules();
108 void didMutateRules(); 108 void didMutateRules();
109 void didMutate(StyleSheetUpdateType = PartialRuleUpdate); 109 void didMutate(StyleSheetUpdateType = PartialRuleUpdate);
110 110
111 void clearChildRuleCSSOMWrappers(); 111 void clearChildRuleCSSOMWrappers();
112 112
113 StyleSheetContents* contents() const { return m_contents.get(); } 113 StyleSheetContents* contents() const { return m_contents.get(); }
114 114
115 bool isInline() const { return m_isInlineStylesheet; } 115 bool isInline() const { return m_isInlineStylesheet; }
116 TextPosition startPositionInSource() const { return m_startPosition; } 116 TextPosition startPositionInSource() const { return m_startPosition; }
117 117
118 bool sheetLoaded(); 118 bool sheetLoaded();
119 bool loadCompleted() const { return m_loadCompleted; } 119 bool loadCompleted() const { return m_loadCompleted; }
120 void startLoadingDynamicSheet(); 120 void startLoadingDynamicSheet();
121 121
122 DECLARE_VIRTUAL_TRACE(); 122 DECLARE_VIRTUAL_TRACE();
123 123
124 private: 124 private:
125 CSSStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>, CSSImportRule* own erRule); 125 CSSStyleSheet(RawPtr<StyleSheetContents>, CSSImportRule* ownerRule);
126 CSSStyleSheet(PassRefPtrWillBeRawPtr<StyleSheetContents>, Node* ownerNode, b ool isInlineStylesheet, const TextPosition& startPosition); 126 CSSStyleSheet(RawPtr<StyleSheetContents>, Node* ownerNode, bool isInlineStyl esheet, const TextPosition& startPosition);
127 127
128 bool isCSSStyleSheet() const override { return true; } 128 bool isCSSStyleSheet() const override { return true; }
129 String type() const override { return "text/css"; } 129 String type() const override { return "text/css"; }
130 130
131 void reattachChildRuleCSSOMWrappers(); 131 void reattachChildRuleCSSOMWrappers();
132 132
133 bool canAccessRules() const; 133 bool canAccessRules() const;
134 134
135 void setLoadCompleted(bool); 135 void setLoadCompleted(bool);
136 136
137 RefPtrWillBeMember<StyleSheetContents> m_contents; 137 Member<StyleSheetContents> m_contents;
138 bool m_isInlineStylesheet; 138 bool m_isInlineStylesheet;
139 bool m_isDisabled; 139 bool m_isDisabled;
140 String m_title; 140 String m_title;
141 RefPtrWillBeMember<MediaQuerySet> m_mediaQueries; 141 Member<MediaQuerySet> m_mediaQueries;
142 142
143 RefPtr<SecurityOrigin> m_allowRuleAccessFromOrigin; 143 RefPtr<SecurityOrigin> m_allowRuleAccessFromOrigin;
144 144
145 RawPtrWillBeMember<Node> m_ownerNode; 145 Member<Node> m_ownerNode;
146 RawPtrWillBeMember<CSSRule> m_ownerRule; 146 Member<CSSRule> m_ownerRule;
147 147
148 TextPosition m_startPosition; 148 TextPosition m_startPosition;
149 bool m_loadCompleted; 149 bool m_loadCompleted;
150 mutable RefPtrWillBeMember<MediaList> m_mediaCSSOMWrapper; 150 mutable Member<MediaList> m_mediaCSSOMWrapper;
151 mutable WillBeHeapVector<RefPtrWillBeMember<CSSRule>> m_childRuleCSSOMWrappe rs; 151 mutable HeapVector<Member<CSSRule>> m_childRuleCSSOMWrappers;
152 mutable OwnPtrWillBeMember<CSSRuleList> m_ruleListCSSOMWrapper; 152 mutable Member<CSSRuleList> m_ruleListCSSOMWrapper;
153 }; 153 };
154 154
155 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet) 155 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet)
156 : m_styleSheet(sheet) 156 : m_styleSheet(sheet)
157 { 157 {
158 if (m_styleSheet) 158 if (m_styleSheet)
159 m_styleSheet->willMutateRules(); 159 m_styleSheet->willMutateRules();
160 } 160 }
161 161
162 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule) 162 inline CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule)
163 : m_styleSheet(rule ? rule->parentStyleSheet() : 0) 163 : m_styleSheet(rule ? rule->parentStyleSheet() : 0)
164 { 164 {
165 if (m_styleSheet) 165 if (m_styleSheet)
166 m_styleSheet->willMutateRules(); 166 m_styleSheet->willMutateRules();
167 } 167 }
168 168
169 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope() 169 inline CSSStyleSheet::RuleMutationScope::~RuleMutationScope()
170 { 170 {
171 if (m_styleSheet) 171 if (m_styleSheet)
172 m_styleSheet->didMutateRules(); 172 m_styleSheet->didMutateRules();
173 } 173 }
174 174
175 DEFINE_TYPE_CASTS(CSSStyleSheet, StyleSheet, sheet, sheet->isCSSStyleSheet(), sh eet.isCSSStyleSheet()); 175 DEFINE_TYPE_CASTS(CSSStyleSheet, StyleSheet, sheet, sheet->isCSSStyleSheet(), sh eet.isCSSStyleSheet());
176 176
177 } // namespace blink 177 } // namespace blink
178 178
179 #endif 179 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698