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

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

Issue 441873010: DevTools: [SSP] Implement adding new rule in user stylesheet (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix compilation error 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 23 matching lines...) Expand all
34 #include "wtf/HashMap.h" 34 #include "wtf/HashMap.h"
35 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
37 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
38 #include "wtf/text/WTFString.h" 38 #include "wtf/text/WTFString.h"
39 39
40 class ParsedStyleSheet; 40 class ParsedStyleSheet;
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class CSSMediaRule;
44 class CSSRuleList; 45 class CSSRuleList;
45 class CSSStyleDeclaration; 46 class CSSStyleDeclaration;
46 class CSSStyleRule; 47 class CSSStyleRule;
47 class CSSStyleSheet; 48 class CSSStyleSheet;
48 class Document; 49 class Document;
49 class Element; 50 class Element;
50 class ExceptionState; 51 class ExceptionState;
51 class InspectorPageAgent; 52 class InspectorPageAgent;
52 class InspectorResourceAgent; 53 class InspectorResourceAgent;
53 class InspectorStyleSheetBase; 54 class InspectorStyleSheetBase;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 200
200 virtual ~InspectorStyleSheet(); 201 virtual ~InspectorStyleSheet();
201 virtual void trace(Visitor*) OVERRIDE; 202 virtual void trace(Visitor*) OVERRIDE;
202 203
203 String finalURL() const; 204 String finalURL() const;
204 virtual Document* ownerDocument() const OVERRIDE; 205 virtual Document* ownerDocument() const OVERRIDE;
205 virtual bool setText(const String&, ExceptionState&) OVERRIDE; 206 virtual bool setText(const String&, ExceptionState&) OVERRIDE;
206 virtual bool getText(String* result) const OVERRIDE; 207 virtual bool getText(String* result) const OVERRIDE;
207 String ruleSelector(const InspectorCSSId&, ExceptionState&); 208 String ruleSelector(const InspectorCSSId&, ExceptionState&);
208 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio nState&); 209 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio nState&);
209 CSSStyleRule* addRule(const String& selector, ExceptionState&); 210 CSSStyleRule* addRule(const String& ruleText, const SourceRange& location, E xceptionState&);
210 bool deleteRule(const InspectorCSSId&, ExceptionState&); 211 bool deleteRule(const InspectorCSSId&, const String& oldText, ExceptionState &);
211 212
212 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } 213 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); }
213 214
214 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn fo() const; 215 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn fo() const;
215 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); 216 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >);
216 217
217 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul e*); 218 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul e*);
218 219
219 InspectorCSSId ruleId(CSSStyleRule*) const; 220 InspectorCSSId ruleId(CSSStyleRule*) const;
220 CSSStyleRule* ruleForId(const InspectorCSSId&) const; 221 CSSStyleRule* ruleForId(const InspectorCSSId&) const;
221 222
222 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const OVERRIDE; 223 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const OVERRIDE;
223 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const OVERRID E; 224 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const OVERRID E;
224 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; 225 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE;
225 226
226 bool findRuleBySelectorRange(const SourceRange&, InspectorCSSId*); 227 bool findRuleBySelectorRange(const SourceRange&, InspectorCSSId*);
227 228
228 const CSSRuleVector& flatRules(); 229 const CSSRuleVector& flatRules();
229 230
230 protected: 231 protected:
231 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins pectorCSSId&) OVERRIDE; 232 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins pectorCSSId&) OVERRIDE;
232 virtual unsigned ruleCount() OVERRIDE; 233 virtual unsigned ruleCount() OVERRIDE;
233 234
234 // Also accessed by friend class InspectorStyle. 235 // Also accessed by friend class InspectorStyle.
235 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const OVERRIDE; 236 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned) const OVERRIDE;
236 virtual bool ensureParsedDataReady() OVERRIDE; 237 virtual bool ensureParsedDataReady() OVERRIDE;
237 238
238 private: 239 private:
239 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS:: StyleSheetOrigin::Enum, const String& documentURL, Listener*); 240 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS:: StyleSheetOrigin::Enum, const String& documentURL, Listener*);
240 241 unsigned ruleIndexBySourceRange(const CSSMediaRule* parentMediaRule, const S ourceRange&);
242 CSSStyleRule* insertCSSOMRuleInStyleSheet(const SourceRange&, const String& ruleText, ExceptionState&);
243 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, const SourceRange&, const String& ruleText, ExceptionState&);
244 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String& ruleText, ExceptionState&);
245 bool verifyRuleText(const String& ruleText);
241 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; 246 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const;
242 String sourceMapURL() const; 247 String sourceMapURL() const;
243 String sourceURL() const; 248 String sourceURL() const;
244 bool ensureText() const; 249 bool ensureText() const;
245 void ensureFlatRules() const; 250 void ensureFlatRules() const;
246 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS tyleText, String* result); 251 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS tyleText, String* result);
247 bool originalStyleSheetText(String* result) const; 252 bool originalStyleSheetText(String* result) const;
248 bool resourceStyleSheetText(String* result) const; 253 bool resourceStyleSheetText(String* result) const;
249 bool inlineStyleSheetText(String* result) const; 254 bool inlineStyleSheetText(String* result) const;
250 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou rce(const CSSRuleSourceData*, const String&); 255 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou rce(const CSSRuleSourceData*, const String&);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 mutable String m_styleText; 308 mutable String m_styleText;
304 mutable bool m_isStyleTextValid; 309 mutable bool m_isStyleTextValid;
305 }; 310 };
306 311
307 312
308 } // namespace blink 313 } // namespace blink
309 314
310 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); 315 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty);
311 316
312 #endif // !defined(InspectorStyleSheet_h) 317 #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