OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class Element; | 49 class Element; |
50 class ExceptionState; | 50 class ExceptionState; |
51 class InspectorCSSAgent; | 51 class InspectorCSSAgent; |
52 class InspectorResourceAgent; | 52 class InspectorResourceAgent; |
53 class InspectorStyleSheetBase; | 53 class InspectorStyleSheetBase; |
54 | 54 |
55 typedef WillBeHeapVector<RefPtrWillBeMember<CSSRule> > CSSRuleVector; | 55 typedef WillBeHeapVector<RefPtrWillBeMember<CSSRule> > CSSRuleVector; |
56 typedef String ErrorString; | 56 typedef String ErrorString; |
57 typedef Vector<unsigned> LineEndings; | 57 typedef Vector<unsigned> LineEndings; |
58 | 58 |
59 class InspectorCSSId { | |
60 public: | |
61 InspectorCSSId() | |
62 : m_ordinal(0) | |
63 { | |
64 } | |
65 | |
66 InspectorCSSId(const String& styleSheetId, unsigned ordinal) | |
67 : m_styleSheetId(styleSheetId) | |
68 , m_ordinal(ordinal) | |
69 { | |
70 } | |
71 | |
72 bool isEmpty() const { return m_styleSheetId.isEmpty(); } | |
73 | |
74 const String& styleSheetId() const { return m_styleSheetId; } | |
75 unsigned ordinal() const { return m_ordinal; } | |
76 | |
77 private: | |
78 String m_styleSheetId; | |
79 unsigned m_ordinal; | |
80 }; | |
81 | |
82 struct InspectorStyleProperty { | 59 struct InspectorStyleProperty { |
83 ALLOW_ONLY_INLINE_ALLOCATION(); | 60 ALLOW_ONLY_INLINE_ALLOCATION(); |
84 public: | 61 public: |
85 explicit InspectorStyleProperty(CSSPropertySourceData sourceData) | 62 explicit InspectorStyleProperty(CSSPropertySourceData sourceData) |
86 : sourceData(sourceData) | 63 : sourceData(sourceData) |
87 , hasSource(true) | 64 , hasSource(true) |
88 { | 65 { |
89 } | 66 } |
90 | 67 |
91 InspectorStyleProperty(CSSPropertySourceData sourceData, bool hasSource) | 68 InspectorStyleProperty(CSSPropertySourceData sourceData, bool hasSource) |
92 : sourceData(sourceData) | 69 : sourceData(sourceData) |
93 , hasSource(hasSource) | 70 , hasSource(hasSource) |
94 { | 71 { |
95 } | 72 } |
96 | 73 |
97 bool hasRawText() const { return !rawText.isEmpty(); } | 74 bool hasRawText() const { return !rawText.isEmpty(); } |
98 | 75 |
99 DEFINE_INLINE_TRACE() { visitor->trace(sourceData); } | 76 DEFINE_INLINE_TRACE() { visitor->trace(sourceData); } |
100 | 77 |
101 CSSPropertySourceData sourceData; | 78 CSSPropertySourceData sourceData; |
102 bool hasSource; | 79 bool hasSource; |
103 String rawText; | 80 String rawText; |
104 }; | 81 }; |
105 | 82 |
106 class InspectorStyle final : public RefCountedWillBeGarbageCollectedFinalized<In
spectorStyle> { | 83 class InspectorStyle final : public RefCountedWillBeGarbageCollectedFinalized<In
spectorStyle> { |
107 public: | 84 public: |
108 static PassRefPtrWillBeRawPtr<InspectorStyle> create(const InspectorCSSId&,
PassRefPtrWillBeRawPtr<CSSStyleDeclaration>, InspectorStyleSheetBase* parentStyl
eSheet); | 85 static PassRefPtrWillBeRawPtr<InspectorStyle> create(unsigned ruleIndex, Pas
sRefPtrWillBeRawPtr<CSSStyleDeclaration>, InspectorStyleSheetBase* parentStyleSh
eet); |
109 | 86 |
110 CSSStyleDeclaration* cssStyle() const { return m_style.get(); } | 87 CSSStyleDeclaration* cssStyle() const { return m_style.get(); } |
111 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const; | 88 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const; |
112 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >
buildArrayForComputedStyle() const; | 89 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >
buildArrayForComputedStyle() const; |
113 bool setPropertyText(unsigned index, const String& text, bool overwrite, Exc
eptionState&); | 90 bool setPropertyText(unsigned index, const String& text, bool overwrite, Exc
eptionState&); |
114 bool styleText(String* result) const; | 91 bool styleText(String* result) const; |
115 bool textForRange(const SourceRange&, String* result) const; | 92 bool textForRange(const SourceRange&, String* result) const; |
116 | 93 |
117 DECLARE_TRACE(); | 94 DECLARE_TRACE(); |
118 | 95 |
119 private: | 96 private: |
120 InspectorStyle(const InspectorCSSId&, PassRefPtrWillBeRawPtr<CSSStyleDeclara
tion>, InspectorStyleSheetBase* parentStyleSheet); | 97 InspectorStyle(unsigned ruleIndex, PassRefPtrWillBeRawPtr<CSSStyleDeclaratio
n>, InspectorStyleSheetBase* parentStyleSheet); |
121 | 98 |
122 bool verifyPropertyText(const String& propertyText, bool canOmitSemicolon); | 99 bool verifyPropertyText(const String& propertyText, bool canOmitSemicolon); |
123 void populateAllProperties(WillBeHeapVector<InspectorStyleProperty>& result)
const; | 100 void populateAllProperties(WillBeHeapVector<InspectorStyleProperty>& result)
const; |
124 PassRefPtr<TypeBuilder::CSS::CSSStyle> styleWithProperties() const; | 101 PassRefPtr<TypeBuilder::CSS::CSSStyle> styleWithProperties() const; |
125 PassRefPtrWillBeRawPtr<CSSRuleSourceData> extractSourceData() const; | 102 PassRefPtrWillBeRawPtr<CSSRuleSourceData> extractSourceData() const; |
126 bool applyStyleText(const String&); | 103 bool applyStyleText(const String&); |
127 String shorthandValue(const String& shorthandProperty) const; | 104 String shorthandValue(const String& shorthandProperty) const; |
128 NewLineAndWhitespace& newLineAndWhitespaceDelimiters() const; | 105 NewLineAndWhitespace& newLineAndWhitespaceDelimiters() const; |
129 inline Document* ownerDocument() const; | 106 inline Document* ownerDocument() const; |
130 | 107 |
131 InspectorCSSId m_styleId; | 108 unsigned m_ruleIndex; |
132 RefPtrWillBeMember<CSSStyleDeclaration> m_style; | 109 RefPtrWillBeMember<CSSStyleDeclaration> m_style; |
133 RawPtrWillBeMember<InspectorStyleSheetBase> m_parentStyleSheet; | 110 RawPtrWillBeMember<InspectorStyleSheetBase> m_parentStyleSheet; |
134 mutable std::pair<String, String> m_format; | 111 mutable std::pair<String, String> m_format; |
135 mutable bool m_formatAcquired; | 112 mutable bool m_formatAcquired; |
136 }; | 113 }; |
137 | 114 |
138 class InspectorStyleSheetBase : public RefCountedWillBeGarbageCollectedFinalized
<InspectorStyleSheetBase> { | 115 class InspectorStyleSheetBase : public RefCountedWillBeGarbageCollectedFinalized
<InspectorStyleSheetBase> { |
139 public: | 116 public: |
140 class CORE_EXPORT Listener { | 117 class CORE_EXPORT Listener { |
141 public: | 118 public: |
142 Listener() { } | 119 Listener() { } |
143 virtual ~Listener() { } | 120 virtual ~Listener() { } |
144 virtual void styleSheetChanged(InspectorStyleSheetBase*) = 0; | 121 virtual void styleSheetChanged(InspectorStyleSheetBase*) = 0; |
145 virtual void willReparseStyleSheet() = 0; | 122 virtual void willReparseStyleSheet() = 0; |
146 virtual void didReparseStyleSheet() = 0; | 123 virtual void didReparseStyleSheet() = 0; |
147 }; | 124 }; |
148 virtual ~InspectorStyleSheetBase() { } | 125 virtual ~InspectorStyleSheetBase() { } |
149 DEFINE_INLINE_VIRTUAL_TRACE() { } | 126 DEFINE_INLINE_VIRTUAL_TRACE() { } |
150 | 127 |
151 String id() const { return m_id; } | 128 String id() const { return m_id; } |
152 | 129 |
153 virtual Document* ownerDocument() const = 0; | 130 virtual Document* ownerDocument() const = 0; |
154 virtual bool setText(const String&, ExceptionState&) = 0; | 131 virtual bool setText(const String&, ExceptionState&) = 0; |
155 virtual bool getText(String* result) const = 0; | 132 virtual bool getText(String* result) const = 0; |
156 bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const St
ring& text, bool overwrite, ExceptionState&); | 133 bool setPropertyText(unsigned ruleIndex, unsigned propertyIndex, const Strin
g& text, bool overwrite, ExceptionState&); |
157 | 134 |
158 virtual bool setStyleText(const InspectorCSSId&, const String&) = 0; | 135 virtual bool setStyleText(unsigned ruleIndex, const String&) = 0; |
159 bool getStyleText(const InspectorCSSId&, String*); | 136 bool getStyleText(unsigned ruleIndex, String*); |
160 | 137 |
161 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const = 0; | 138 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const = 0; |
162 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const = 0; | 139 virtual unsigned indexOf(CSSStyleDeclaration*) const = 0; |
163 | 140 |
164 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); | 141 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); |
165 bool findPropertyByRange(const SourceRange&, InspectorCSSId*, unsigned* prop
ertyIndex, bool* overwrite); | 142 bool findPropertyByRange(const SourceRange&, unsigned* ruleIndex, unsigned*
propertyIndex, bool* overwrite); |
166 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber,
unsigned* offset); | 143 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber,
unsigned* offset); |
167 | 144 |
168 protected: | 145 protected: |
169 InspectorStyleSheetBase(const String& id, Listener*); | 146 InspectorStyleSheetBase(const String& id, Listener*); |
170 | 147 |
171 Listener* listener() const { return m_listener; } | 148 Listener* listener() const { return m_listener; } |
172 void onStyleSheetTextChanged(); | 149 void onStyleSheetTextChanged(); |
173 const LineEndings* lineEndings(); | 150 const LineEndings* lineEndings(); |
174 | 151 |
175 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins
pectorCSSId&) = 0; | 152 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) = 0; |
176 virtual unsigned ruleCount() = 0; | 153 virtual unsigned ruleCount() = 0; |
177 | 154 |
178 // Also accessed by friend class InspectorStyle. | 155 // Also accessed by friend class InspectorStyle. |
179 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const = 0; | 156 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const = 0; |
180 virtual bool ensureParsedDataReady() = 0; | 157 virtual bool ensureParsedDataReady() = 0; |
181 | 158 |
182 private: | 159 private: |
183 friend class InspectorStyle; | 160 friend class InspectorStyle; |
184 | 161 |
185 String m_id; | 162 String m_id; |
186 Listener* m_listener; | 163 Listener* m_listener; |
187 OwnPtr<LineEndings> m_lineEndings; | 164 OwnPtr<LineEndings> m_lineEndings; |
188 }; | 165 }; |
189 | 166 |
190 class InspectorStyleSheet : public InspectorStyleSheetBase { | 167 class InspectorStyleSheet : public InspectorStyleSheetBase { |
191 public: | 168 public: |
192 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorResourceA
gent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, T
ypeBuilder::CSS::StyleSheetOrigin::Enum, const String& documentURL, InspectorCSS
Agent*); | 169 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorResourceA
gent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, T
ypeBuilder::CSS::StyleSheetOrigin::Enum, const String& documentURL, InspectorCSS
Agent*); |
193 | 170 |
194 virtual ~InspectorStyleSheet(); | 171 virtual ~InspectorStyleSheet(); |
195 DECLARE_VIRTUAL_TRACE(); | 172 DECLARE_VIRTUAL_TRACE(); |
196 | 173 |
197 String finalURL() const; | 174 String finalURL() const; |
198 virtual Document* ownerDocument() const override; | 175 virtual Document* ownerDocument() const override; |
199 virtual bool setText(const String&, ExceptionState&) override; | 176 virtual bool setText(const String&, ExceptionState&) override; |
200 virtual bool getText(String* result) const override; | 177 virtual bool getText(String* result) const override; |
201 String ruleSelector(const InspectorCSSId&, ExceptionState&); | 178 String ruleSelector(unsigned ruleIndex, ExceptionState&); |
202 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio
nState&); | 179 bool setRuleSelector(unsigned ruleIndex, const String& selector, ExceptionSt
ate&); |
203 String mediaRuleText(const InspectorCSSId&, ExceptionState&); | 180 String mediaRuleText(unsigned ruleIndex, ExceptionState&); |
204 bool setMediaRuleText(const InspectorCSSId&, const String& text, ExceptionSt
ate&); | 181 bool setMediaRuleText(unsigned ruleIndex, const String& text, ExceptionState
&); |
205 CSSStyleRule* addRule(const String& ruleText, const SourceRange& location, E
xceptionState&); | 182 CSSStyleRule* addRule(const String& ruleText, const SourceRange& location, E
xceptionState&); |
206 bool deleteRule(const InspectorCSSId&, const String& oldText, ExceptionState
&); | 183 bool deleteRule(unsigned ruleIndex, const String& oldText, ExceptionState&); |
207 | 184 |
208 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } | 185 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } |
209 | 186 |
210 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; | 187 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; |
211 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); | 188 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); |
212 | 189 |
213 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); | 190 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); |
214 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(cons
t CSSRule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex); | 191 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(cons
t CSSRule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex); |
215 | 192 |
216 InspectorCSSId ruleId(CSSStyleRule*) const; | 193 unsigned indexOf(CSSStyleRule*) const; |
217 CSSStyleRule* ruleForId(const InspectorCSSId&) const; | 194 CSSStyleRule* ruleAt(unsigned ruleIndex) const; |
218 CSSMediaRule* mediaRuleForId(const InspectorCSSId&) const; | 195 CSSMediaRule* mediaRuleAt(unsigned ruleIndex) const; |
219 | 196 |
220 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const override; | 197 virtual unsigned indexOf(CSSStyleDeclaration*) const override; |
221 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const overrid
e; | 198 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const override; |
222 virtual bool setStyleText(const InspectorCSSId&, const String&) override; | 199 virtual bool setStyleText(unsigned ruleIndex, const String&) override; |
223 | 200 |
224 bool findRuleBySelectorRange(const SourceRange&, InspectorCSSId*); | 201 bool findRuleBySelectorRange(const SourceRange&, unsigned* ruleIndex); |
225 bool findMediaRuleByRange(const SourceRange&, InspectorCSSId*); | 202 bool findMediaRuleByRange(const SourceRange&, unsigned* ruleIndex); |
226 | 203 |
227 const CSSRuleVector& flatRules(); | 204 const CSSRuleVector& flatRules(); |
228 | 205 |
229 protected: | 206 protected: |
230 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins
pectorCSSId&) override; | 207 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) override; |
231 virtual unsigned ruleCount() override; | 208 virtual unsigned ruleCount() override; |
232 | 209 |
233 // Also accessed by friend class InspectorStyle. | 210 // Also accessed by friend class InspectorStyle. |
234 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const override; | 211 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const override; |
235 virtual bool ensureParsedDataReady() override; | 212 virtual bool ensureParsedDataReady() override; |
236 | 213 |
237 private: | 214 private: |
238 InspectorStyleSheet(InspectorResourceAgent*, const String& id, PassRefPtrWil
lBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enu
m, const String& documentURL, InspectorCSSAgent*); | 215 InspectorStyleSheet(InspectorResourceAgent*, const String& id, PassRefPtrWil
lBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enu
m, const String& documentURL, InspectorCSSAgent*); |
239 unsigned ruleIndexBySourceRange(const CSSMediaRule* parentMediaRule, const S
ourceRange&); | 216 unsigned ruleIndexBySourceRange(const CSSMediaRule* parentMediaRule, const S
ourceRange&); |
240 CSSStyleRule* insertCSSOMRuleInStyleSheet(const SourceRange&, const String&
ruleText, ExceptionState&); | 217 CSSStyleRule* insertCSSOMRuleInStyleSheet(const SourceRange&, const String&
ruleText, ExceptionState&); |
241 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, const SourceRange&,
const String& ruleText, ExceptionState&); | 218 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, const SourceRange&,
const String& ruleText, ExceptionState&); |
242 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String&
ruleText, ExceptionState&); | 219 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String&
ruleText, ExceptionState&); |
243 bool verifyRuleText(const String& ruleText); | 220 bool verifyRuleText(const String& ruleText); |
244 bool verifySelectorText(const String& selectorText); | 221 bool verifySelectorText(const String& selectorText); |
245 bool verifyMediaText(const String& mediaText); | 222 bool verifyMediaText(const String& mediaText); |
246 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; | |
247 String sourceMapURL() const; | 223 String sourceMapURL() const; |
248 String sourceURL() const; | 224 String sourceURL() const; |
249 bool ensureText() const; | 225 bool ensureText() const; |
250 void ensureFlatRules() const; | 226 void ensureFlatRules() const; |
251 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS
tyleText, String* result); | 227 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS
tyleText, String* result); |
252 bool originalStyleSheetText(String* result) const; | 228 bool originalStyleSheetText(String* result) const; |
253 bool resourceStyleSheetText(String* result) const; | 229 bool resourceStyleSheetText(String* result) const; |
254 bool inlineStyleSheetText(String* result) const; | 230 bool inlineStyleSheetText(String* result) const; |
255 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou
rce(const CSSRuleSourceData*, const String&); | 231 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou
rce(const CSSRuleSourceData*, const String&); |
256 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); | 232 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); |
(...skipping 16 matching lines...) Expand all Loading... |
273 | 249 |
274 class InspectorStyleSheetForInlineStyle final : public InspectorStyleSheetBase { | 250 class InspectorStyleSheetForInlineStyle final : public InspectorStyleSheetBase { |
275 public: | 251 public: |
276 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons
t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*); | 252 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons
t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*); |
277 | 253 |
278 void didModifyElementAttribute(); | 254 void didModifyElementAttribute(); |
279 virtual Document* ownerDocument() const override; | 255 virtual Document* ownerDocument() const override; |
280 virtual bool setText(const String&, ExceptionState&) override; | 256 virtual bool setText(const String&, ExceptionState&) override; |
281 virtual bool getText(String* result) const override; | 257 virtual bool getText(String* result) const override; |
282 | 258 |
283 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const over
ride { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } | 259 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const override { AS
SERT_UNUSED(ruleIndex, !ruleIndex); return inlineStyle(); } |
284 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const override {
return InspectorCSSId(id(), 0); } | 260 virtual unsigned indexOf(CSSStyleDeclaration* style) const override { return
0; } |
285 virtual bool setStyleText(const InspectorCSSId&, const String&) override; | 261 virtual bool setStyleText(unsigned ruleIndex, const String&) override; |
286 | 262 |
287 DECLARE_VIRTUAL_TRACE(); | 263 DECLARE_VIRTUAL_TRACE(); |
288 | 264 |
289 protected: | 265 protected: |
290 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins
pectorCSSId&) override; | 266 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) override; |
291 virtual unsigned ruleCount() override { return 1; } | 267 virtual unsigned ruleCount() override { return 1; } |
292 | 268 |
293 // Also accessed by friend class InspectorStyle. | 269 // Also accessed by friend class InspectorStyle. |
294 virtual bool ensureParsedDataReady() override; | 270 virtual bool ensureParsedDataReady() override; |
295 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned
ruleIndex) const override { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS
ourceData; } | 271 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned
ruleIndex) const override { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS
ourceData; } |
296 | 272 |
297 private: | 273 private: |
298 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E
lement>, Listener*); | 274 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E
lement>, Listener*); |
299 CSSStyleDeclaration* inlineStyle() const; | 275 CSSStyleDeclaration* inlineStyle() const; |
300 const String& elementStyleText() const; | 276 const String& elementStyleText() const; |
301 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; | 277 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; |
302 | 278 |
303 RefPtrWillBeMember<Element> m_element; | 279 RefPtrWillBeMember<Element> m_element; |
304 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData; | 280 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData; |
305 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle; | 281 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle; |
306 | 282 |
307 // Contains "style" attribute value. | 283 // Contains "style" attribute value. |
308 mutable String m_styleText; | 284 mutable String m_styleText; |
309 mutable bool m_isStyleTextValid; | 285 mutable bool m_isStyleTextValid; |
310 }; | 286 }; |
311 | 287 |
312 | 288 |
313 } // namespace blink | 289 } // namespace blink |
314 | 290 |
315 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); | 291 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); |
316 | 292 |
317 #endif // !defined(InspectorStyleSheet_h) | 293 #endif // !defined(InspectorStyleSheet_h) |
OLD | NEW |