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

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

Issue 417953002: Oilpan: Prepare moving InspectorStyle 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
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 bool hasRawText() const { return !rawText.isEmpty(); } 105 bool hasRawText() const { return !rawText.isEmpty(); }
106 106
107 void trace(Visitor* visitor) { visitor->trace(sourceData); } 107 void trace(Visitor* visitor) { visitor->trace(sourceData); }
108 108
109 CSSPropertySourceData sourceData; 109 CSSPropertySourceData sourceData;
110 bool hasSource; 110 bool hasSource;
111 String rawText; 111 String rawText;
112 }; 112 };
113 113
114 class InspectorStyle FINAL : public RefCounted<InspectorStyle> { 114 class InspectorStyle FINAL : public RefCountedWillBeGarbageCollectedFinalized<In spectorStyle> {
115 public: 115 public:
116 static PassRefPtr<InspectorStyle> create(const InspectorCSSId&, PassRefPtrWi llBeRawPtr<CSSStyleDeclaration>, InspectorStyleSheetBase* parentStyleSheet); 116 static PassRefPtrWillBeRawPtr<InspectorStyle> create(const InspectorCSSId&, PassRefPtrWillBeRawPtr<CSSStyleDeclaration>, InspectorStyleSheetBase* parentStyl eSheet);
117 117
118 CSSStyleDeclaration* cssStyle() const { return m_style.get(); } 118 CSSStyleDeclaration* cssStyle() const { return m_style.get(); }
119 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const; 119 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const;
120 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > buildArrayForComputedStyle() const; 120 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > buildArrayForComputedStyle() const;
121 bool setPropertyText(unsigned index, const String& text, bool overwrite, Exc eptionState&); 121 bool setPropertyText(unsigned index, const String& text, bool overwrite, Exc eptionState&);
122 bool styleText(String* result) const; 122 bool styleText(String* result) const;
123 123
124 void trace(Visitor*);
125
124 private: 126 private:
125 InspectorStyle(const InspectorCSSId&, PassRefPtrWillBeRawPtr<CSSStyleDeclara tion>, InspectorStyleSheetBase* parentStyleSheet); 127 InspectorStyle(const InspectorCSSId&, PassRefPtrWillBeRawPtr<CSSStyleDeclara tion>, InspectorStyleSheetBase* parentStyleSheet);
126 128
127 bool verifyPropertyText(const String& propertyText, bool canOmitSemicolon); 129 bool verifyPropertyText(const String& propertyText, bool canOmitSemicolon);
128 void populateAllProperties(WillBeHeapVector<InspectorStyleProperty>& result) const; 130 void populateAllProperties(WillBeHeapVector<InspectorStyleProperty>& result) const;
129 PassRefPtr<TypeBuilder::CSS::CSSStyle> styleWithProperties() const; 131 PassRefPtr<TypeBuilder::CSS::CSSStyle> styleWithProperties() const;
130 PassRefPtrWillBeRawPtr<CSSRuleSourceData> extractSourceData() const; 132 PassRefPtrWillBeRawPtr<CSSRuleSourceData> extractSourceData() const;
131 bool applyStyleText(const String&); 133 bool applyStyleText(const String&);
132 String shorthandValue(const String& shorthandProperty) const; 134 String shorthandValue(const String& shorthandProperty) const;
133 NewLineAndWhitespace& newLineAndWhitespaceDelimiters() const; 135 NewLineAndWhitespace& newLineAndWhitespaceDelimiters() const;
134 inline Document* ownerDocument() const; 136 inline Document* ownerDocument() const;
135 137
136 InspectorCSSId m_styleId; 138 InspectorCSSId m_styleId;
137 RefPtrWillBePersistent<CSSStyleDeclaration> m_style; 139 RefPtrWillBeMember<CSSStyleDeclaration> m_style;
138 InspectorStyleSheetBase* m_parentStyleSheet; 140 RawPtrWillBeMember<InspectorStyleSheetBase> m_parentStyleSheet;
139 mutable std::pair<String, String> m_format; 141 mutable std::pair<String, String> m_format;
140 mutable bool m_formatAcquired; 142 mutable bool m_formatAcquired;
141 }; 143 };
142 144
143 class InspectorStyleSheetBase : public RefCountedWillBeGarbageCollectedFinalized <InspectorStyleSheetBase> { 145 class InspectorStyleSheetBase : public RefCountedWillBeGarbageCollectedFinalized <InspectorStyleSheetBase> {
144 public: 146 public:
145 class Listener { 147 class Listener {
146 public: 148 public:
147 Listener() { } 149 Listener() { }
148 virtual ~Listener() { } 150 virtual ~Listener() { }
(...skipping 21 matching lines...) Expand all
170 bool findPropertyByRange(const SourceRange&, InspectorCSSId*, unsigned* prop ertyIndex, bool* overwrite); 172 bool findPropertyByRange(const SourceRange&, InspectorCSSId*, unsigned* prop ertyIndex, bool* overwrite);
171 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber, unsigned* offset); 173 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber, unsigned* offset);
172 174
173 protected: 175 protected:
174 InspectorStyleSheetBase(const String& id, Listener*); 176 InspectorStyleSheetBase(const String& id, Listener*);
175 177
176 Listener* listener() const { return m_listener; } 178 Listener* listener() const { return m_listener; }
177 void fireStyleSheetChanged(); 179 void fireStyleSheetChanged();
178 PassOwnPtr<Vector<unsigned> > lineEndings(); 180 PassOwnPtr<Vector<unsigned> > lineEndings();
179 181
180 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId& ) = 0; 182 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins pectorCSSId&) = 0;
181 virtual unsigned ruleCount() = 0; 183 virtual unsigned ruleCount() = 0;
182 184
183 // Also accessed by friend class InspectorStyle. 185 // Also accessed by friend class InspectorStyle.
184 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const = 0; 186 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const = 0;
185 virtual bool ensureParsedDataReady() = 0; 187 virtual bool ensureParsedDataReady() = 0;
186 188
187 private: 189 private:
188 friend class InspectorStyle; 190 friend class InspectorStyle;
189 191
190 String m_id; 192 String m_id;
(...skipping 28 matching lines...) Expand all
219 221
220 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const OVERRIDE; 222 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const OVERRIDE;
221 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const OVERRID E; 223 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const OVERRID E;
222 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; 224 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE;
223 225
224 bool findRuleBySelectorRange(const SourceRange&, InspectorCSSId*); 226 bool findRuleBySelectorRange(const SourceRange&, InspectorCSSId*);
225 227
226 const CSSRuleVector& flatRules(); 228 const CSSRuleVector& flatRules();
227 229
228 protected: 230 protected:
229 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId& ) OVERRIDE; 231 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins pectorCSSId&) OVERRIDE;
230 virtual unsigned ruleCount() OVERRIDE; 232 virtual unsigned ruleCount() OVERRIDE;
231 233
232 // Also accessed by friend class InspectorStyle. 234 // Also accessed by friend class InspectorStyle.
233 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const OVERRIDE; 235 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const OVERRIDE;
234 virtual bool ensureParsedDataReady() OVERRIDE; 236 virtual bool ensureParsedDataReady() OVERRIDE;
235 237
236 private: 238 private:
237 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS:: StyleSheetOrigin::Enum, const String& documentURL, Listener*); 239 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS:: StyleSheetOrigin::Enum, const String& documentURL, Listener*);
238 240
239 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; 241 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 virtual bool setText(const String&, ExceptionState&) OVERRIDE; 275 virtual bool setText(const String&, ExceptionState&) OVERRIDE;
274 virtual bool getText(String* result) const OVERRIDE; 276 virtual bool getText(String* result) const OVERRIDE;
275 277
276 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } 278 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); }
277 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE { return InspectorCSSId(id(), 0); } 279 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE { return InspectorCSSId(id(), 0); }
278 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; 280 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE;
279 281
280 virtual void trace(Visitor*) OVERRIDE; 282 virtual void trace(Visitor*) OVERRIDE;
281 283
282 protected: 284 protected:
283 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId& ) OVERRIDE; 285 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins pectorCSSId&) OVERRIDE;
284 virtual unsigned ruleCount() OVERRIDE { return 1; } 286 virtual unsigned ruleCount() OVERRIDE { return 1; }
285 287
286 // Also accessed by friend class InspectorStyle. 288 // Also accessed by friend class InspectorStyle.
287 virtual bool ensureParsedDataReady() OVERRIDE; 289 virtual bool ensureParsedDataReady() OVERRIDE;
288 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned ruleIndex) const OVERRIDE { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS ourceData; } 290 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned ruleIndex) const OVERRIDE { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS ourceData; }
289 291
290 private: 292 private:
291 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*); 293 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E lement>, Listener*);
292 CSSStyleDeclaration* inlineStyle() const; 294 CSSStyleDeclaration* inlineStyle() const;
293 const String& elementStyleText() const; 295 const String& elementStyleText() const;
294 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; 296 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const;
295 297
296 RefPtrWillBeMember<Element> m_element; 298 RefPtrWillBeMember<Element> m_element;
297 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData; 299 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData;
298 RefPtr<InspectorStyle> m_inspectorStyle; 300 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle;
299 301
300 // Contains "style" attribute value. 302 // Contains "style" attribute value.
301 mutable String m_styleText; 303 mutable String m_styleText;
302 mutable bool m_isStyleTextValid; 304 mutable bool m_isStyleTextValid;
303 }; 305 };
304 306
305 307
306 } // namespace blink 308 } // namespace blink
307 309
308 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); 310 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty);
309 311
310 #endif // !defined(InspectorStyleSheet_h) 312 #endif // !defined(InspectorStyleSheet_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698