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

Side by Side Diff: Source/core/inspector/InspectorStyleSheet.h

Issue 323043002: Oilpan: Prepare moving InspectorAgent related classes to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class CSSStyleDeclaration; 45 class CSSStyleDeclaration;
46 class CSSStyleRule; 46 class CSSStyleRule;
47 class CSSStyleSheet; 47 class CSSStyleSheet;
48 class Document; 48 class Document;
49 class Element; 49 class Element;
50 class ExceptionState; 50 class ExceptionState;
51 class InspectorPageAgent; 51 class InspectorPageAgent;
52 class InspectorResourceAgent; 52 class InspectorResourceAgent;
53 class InspectorStyleSheetBase; 53 class InspectorStyleSheetBase;
54 54
55 typedef WillBePersistentHeapVector<RefPtrWillBeMember<CSSRule> > CSSRuleVector; 55 typedef WillBeHeapVector<RefPtrWillBeMember<CSSRule> > CSSRuleVector;
56 typedef String ErrorString; 56 typedef String ErrorString;
57 57
58 class InspectorCSSId { 58 class InspectorCSSId {
59 public: 59 public:
60 InspectorCSSId() 60 InspectorCSSId()
61 : m_ordinal(0) 61 : m_ordinal(0)
62 { 62 {
63 } 63 }
64 64
65 InspectorCSSId(const String& styleSheetId, unsigned ordinal) 65 InspectorCSSId(const String& styleSheetId, unsigned ordinal)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 NewLineAndWhitespace& newLineAndWhitespaceDelimiters() const; 133 NewLineAndWhitespace& newLineAndWhitespaceDelimiters() const;
134 inline Document* ownerDocument() const; 134 inline Document* ownerDocument() const;
135 135
136 InspectorCSSId m_styleId; 136 InspectorCSSId m_styleId;
137 RefPtrWillBePersistent<CSSStyleDeclaration> m_style; 137 RefPtrWillBePersistent<CSSStyleDeclaration> m_style;
138 InspectorStyleSheetBase* m_parentStyleSheet; 138 InspectorStyleSheetBase* m_parentStyleSheet;
139 mutable std::pair<String, String> m_format; 139 mutable std::pair<String, String> m_format;
140 mutable bool m_formatAcquired; 140 mutable bool m_formatAcquired;
141 }; 141 };
142 142
143 class InspectorStyleSheetBase : public RefCounted<InspectorStyleSheetBase> { 143 class InspectorStyleSheetBase : public RefCountedWillBeGarbageCollectedFinalized <InspectorStyleSheetBase> {
144 public: 144 public:
145 class Listener { 145 class Listener {
haraken 2014/06/19 05:49:53 You can make this a GC-mixin and use a Member for
146 public: 146 public:
147 Listener() { } 147 Listener() { }
148 virtual ~Listener() { } 148 virtual ~Listener() { }
149 virtual void styleSheetChanged(InspectorStyleSheetBase*) = 0; 149 virtual void styleSheetChanged(InspectorStyleSheetBase*) = 0;
150 virtual void willReparseStyleSheet() = 0; 150 virtual void willReparseStyleSheet() = 0;
151 virtual void didReparseStyleSheet() = 0; 151 virtual void didReparseStyleSheet() = 0;
152 }; 152 };
153 virtual ~InspectorStyleSheetBase() { } 153 virtual ~InspectorStyleSheetBase() { }
154 virtual void trace(Visitor*) { }
154 155
155 String id() const { return m_id; } 156 String id() const { return m_id; }
156 157
157 virtual Document* ownerDocument() const = 0; 158 virtual Document* ownerDocument() const = 0;
158 virtual bool setText(const String&, ExceptionState&) = 0; 159 virtual bool setText(const String&, ExceptionState&) = 0;
159 virtual bool getText(String* result) const = 0; 160 virtual bool getText(String* result) const = 0;
160 bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const St ring& text, bool overwrite, ExceptionState&); 161 bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const St ring& text, bool overwrite, ExceptionState&);
161 162
162 virtual bool setStyleText(const InspectorCSSId&, const String&) = 0; 163 virtual bool setStyleText(const InspectorCSSId&, const String&) = 0;
163 bool getStyleText(const InspectorCSSId&, String*); 164 bool getStyleText(const InspectorCSSId&, String*);
(...skipping 21 matching lines...) Expand all
185 186
186 private: 187 private:
187 friend class InspectorStyle; 188 friend class InspectorStyle;
188 189
189 String m_id; 190 String m_id;
190 Listener* m_listener; 191 Listener* m_listener;
191 }; 192 };
192 193
193 class InspectorStyleSheet : public InspectorStyleSheetBase { 194 class InspectorStyleSheet : public InspectorStyleSheetBase {
194 public: 195 public:
195 static PassRefPtr<InspectorStyleSheet> create(InspectorPageAgent*, Inspector ResourceAgent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyl eSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& documentURL, Lis tener*); 196 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorPageAgent *, InspectorResourceAgent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleShe et> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& docu mentURL, Listener*);
196 197
197 virtual ~InspectorStyleSheet(); 198 virtual ~InspectorStyleSheet();
199 virtual void trace(Visitor*) OVERRIDE;
198 200
199 String finalURL() const; 201 String finalURL() const;
200 virtual Document* ownerDocument() const OVERRIDE; 202 virtual Document* ownerDocument() const OVERRIDE;
201 virtual bool setText(const String&, ExceptionState&) OVERRIDE; 203 virtual bool setText(const String&, ExceptionState&) OVERRIDE;
202 virtual bool getText(String* result) const OVERRIDE; 204 virtual bool getText(String* result) const OVERRIDE;
203 String ruleSelector(const InspectorCSSId&, ExceptionState&); 205 String ruleSelector(const InspectorCSSId&, ExceptionState&);
204 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio nState&); 206 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio nState&);
205 CSSStyleRule* addRule(const String& selector, ExceptionState&); 207 CSSStyleRule* addRule(const String& selector, ExceptionState&);
206 bool deleteRule(const InspectorCSSId&, ExceptionState&); 208 bool deleteRule(const InspectorCSSId&, ExceptionState&);
207 209
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS tyleText, String* result); 244 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS tyleText, String* result);
243 bool originalStyleSheetText(String* result) const; 245 bool originalStyleSheetText(String* result) const;
244 bool resourceStyleSheetText(String* result) const; 246 bool resourceStyleSheetText(String* result) const;
245 bool inlineStyleSheetText(String* result) const; 247 bool inlineStyleSheetText(String* result) const;
246 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou rce(const CSSRuleSourceData*, const String&); 248 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou rce(const CSSRuleSourceData*, const String&);
247 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty leRule*); 249 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty leRule*);
248 String url() const; 250 String url() const;
249 bool hasSourceURL() const; 251 bool hasSourceURL() const;
250 bool startsAtZero() const; 252 bool startsAtZero() const;
251 253
252 InspectorPageAgent* m_pageAgent; 254 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent;
253 InspectorResourceAgent* m_resourceAgent; 255 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent;
254 RefPtrWillBePersistent<CSSStyleSheet> m_pageStyleSheet; 256 RefPtrWillBeMember<CSSStyleSheet> m_pageStyleSheet;
255 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; 257 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin;
256 String m_documentURL; 258 String m_documentURL;
257 OwnPtr<ParsedStyleSheet> m_parsedStyleSheet; 259 OwnPtr<ParsedStyleSheet> m_parsedStyleSheet;
258 mutable CSSRuleVector m_flatRules; 260 mutable CSSRuleVector m_flatRules;
259 mutable String m_sourceURL; 261 mutable String m_sourceURL;
260 }; 262 };
261 263
262 class InspectorStyleSheetForInlineStyle FINAL : public InspectorStyleSheetBase { 264 class InspectorStyleSheetForInlineStyle FINAL : public InspectorStyleSheetBase {
263 public: 265 public:
264 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id , PassRefPtrWillBeRawPtr<Element>, Listener*); 266 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*);
265 267
266 void didModifyElementAttribute(); 268 void didModifyElementAttribute();
267 virtual Document* ownerDocument() const OVERRIDE; 269 virtual Document* ownerDocument() const OVERRIDE;
268 virtual bool setText(const String&, ExceptionState&) OVERRIDE; 270 virtual bool setText(const String&, ExceptionState&) OVERRIDE;
269 virtual bool getText(String* result) const OVERRIDE; 271 virtual bool getText(String* result) const OVERRIDE;
270 272
271 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } 273 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); }
272 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE { return InspectorCSSId(id(), 0); } 274 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE { return InspectorCSSId(id(), 0); }
273 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; 275 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE;
274 276
277 virtual void trace(Visitor*) OVERRIDE;
278
275 protected: 279 protected:
276 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId& ) OVERRIDE; 280 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId& ) OVERRIDE;
277 virtual unsigned ruleCount() OVERRIDE { return 1; } 281 virtual unsigned ruleCount() OVERRIDE { return 1; }
278 282
279 // Also accessed by friend class InspectorStyle. 283 // Also accessed by friend class InspectorStyle.
280 virtual bool ensureParsedDataReady() OVERRIDE; 284 virtual bool ensureParsedDataReady() OVERRIDE;
281 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned ruleIndex) const OVERRIDE { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS ourceData; } 285 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned ruleIndex) const OVERRIDE { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS ourceData; }
282 286
283 private: 287 private:
284 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*); 288 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*);
285 CSSStyleDeclaration* inlineStyle() const; 289 CSSStyleDeclaration* inlineStyle() const;
286 const String& elementStyleText() const; 290 const String& elementStyleText() const;
287 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; 291 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const;
288 292
289 RefPtrWillBePersistent<Element> m_element; 293 RefPtrWillBeMember<Element> m_element;
290 RefPtrWillBePersistent<CSSRuleSourceData> m_ruleSourceData; 294 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData;
291 RefPtr<InspectorStyle> m_inspectorStyle; 295 RefPtr<InspectorStyle> m_inspectorStyle;
292 296
293 // Contains "style" attribute value. 297 // Contains "style" attribute value.
294 mutable String m_styleText; 298 mutable String m_styleText;
295 mutable bool m_isStyleTextValid; 299 mutable bool m_isStyleTextValid;
296 }; 300 };
297 301
298 302
299 } // namespace WebCore 303 } // namespace WebCore
300 304
301 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(WebCore::InspectorStyleProperty); 305 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(WebCore::InspectorStyleProperty);
302 306
303 #endif // !defined(InspectorStyleSheet_h) 307 #endif // !defined(InspectorStyleSheet_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698