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

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: Created 6 years, 4 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
« no previous file with comments | « Source/core/inspector/InspectorState.cpp ('k') | Source/core/inspector/InspectorStyleSheet.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) 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 {
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void updateText(const String& newText); 254 void updateText(const String& newText);
253 Element* ownerStyleElement() const; 255 Element* ownerStyleElement() const;
254 256
255 InspectorPageAgent* m_pageAgent; 257 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent;
256 InspectorResourceAgent* m_resourceAgent; 258 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent;
257 RefPtrWillBePersistent<CSSStyleSheet> m_pageStyleSheet; 259 RefPtrWillBeMember<CSSStyleSheet> m_pageStyleSheet;
258 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; 260 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin;
259 String m_documentURL; 261 String m_documentURL;
260 OwnPtr<ParsedStyleSheet> m_parsedStyleSheet; 262 OwnPtr<ParsedStyleSheet> m_parsedStyleSheet;
261 mutable CSSRuleVector m_flatRules; 263 mutable CSSRuleVector m_flatRules;
262 mutable String m_sourceURL; 264 mutable String m_sourceURL;
263 }; 265 };
264 266
265 class InspectorStyleSheetForInlineStyle FINAL : public InspectorStyleSheetBase { 267 class InspectorStyleSheetForInlineStyle FINAL : public InspectorStyleSheetBase {
266 public: 268 public:
267 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id , PassRefPtrWillBeRawPtr<Element>, Listener*); 269 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*);
268 270
269 void didModifyElementAttribute(); 271 void didModifyElementAttribute();
270 virtual Document* ownerDocument() const OVERRIDE; 272 virtual Document* ownerDocument() const OVERRIDE;
271 virtual bool setText(const String&, ExceptionState&) OVERRIDE; 273 virtual bool setText(const String&, ExceptionState&) OVERRIDE;
272 virtual bool getText(String* result) const OVERRIDE; 274 virtual bool getText(String* result) const OVERRIDE;
273 275
274 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } 276 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); }
275 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE { return InspectorCSSId(id(), 0); } 277 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE { return InspectorCSSId(id(), 0); }
276 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; 278 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE;
277 279
280 virtual void trace(Visitor*) OVERRIDE;
281
278 protected: 282 protected:
279 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId& ) OVERRIDE; 283 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId& ) OVERRIDE;
280 virtual unsigned ruleCount() OVERRIDE { return 1; } 284 virtual unsigned ruleCount() OVERRIDE { return 1; }
281 285
282 // Also accessed by friend class InspectorStyle. 286 // Also accessed by friend class InspectorStyle.
283 virtual bool ensureParsedDataReady() OVERRIDE; 287 virtual bool ensureParsedDataReady() OVERRIDE;
284 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned ruleIndex) const OVERRIDE { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS ourceData; } 288 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned ruleIndex) const OVERRIDE { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS ourceData; }
285 289
286 private: 290 private:
287 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*); 291 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*);
288 CSSStyleDeclaration* inlineStyle() const; 292 CSSStyleDeclaration* inlineStyle() const;
289 const String& elementStyleText() const; 293 const String& elementStyleText() const;
290 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; 294 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const;
291 295
292 RefPtrWillBePersistent<Element> m_element; 296 RefPtrWillBeMember<Element> m_element;
293 RefPtrWillBePersistent<CSSRuleSourceData> m_ruleSourceData; 297 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData;
294 RefPtr<InspectorStyle> m_inspectorStyle; 298 RefPtr<InspectorStyle> m_inspectorStyle;
295 299
296 // Contains "style" attribute value. 300 // Contains "style" attribute value.
297 mutable String m_styleText; 301 mutable String m_styleText;
298 mutable bool m_isStyleTextValid; 302 mutable bool m_isStyleTextValid;
299 }; 303 };
300 304
301 305
302 } // namespace blink 306 } // namespace blink
303 307
304 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); 308 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty);
305 309
306 #endif // !defined(InspectorStyleSheet_h) 310 #endif // !defined(InspectorStyleSheet_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorState.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698