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

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

Issue 132803013: DevTools: [CSS] setStyleSheetText to work with inline stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address @apavlov comments Created 6 years, 10 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 static String styleSheetURL(CSSStyleSheet* pageStyleSheet); 176 static String styleSheetURL(CSSStyleSheet* pageStyleSheet);
177 static void collectFlatRules(PassRefPtr<CSSRuleList>, CSSRuleVector* result) ; 177 static void collectFlatRules(PassRefPtr<CSSRuleList>, CSSRuleVector* result) ;
178 178
179 virtual ~InspectorStyleSheet(); 179 virtual ~InspectorStyleSheet();
180 180
181 String id() const { return m_id; } 181 String id() const { return m_id; }
182 String finalURL() const; 182 String finalURL() const;
183 virtual Document* ownerDocument() const; 183 virtual Document* ownerDocument() const;
184 bool canBind() const { return m_origin != TypeBuilder::CSS::StyleSheetOrigin ::User_agent && m_origin != TypeBuilder::CSS::StyleSheetOrigin::User; } 184 bool canBind() const { return m_origin != TypeBuilder::CSS::StyleSheetOrigin ::User_agent && m_origin != TypeBuilder::CSS::StyleSheetOrigin::User; }
185 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } 185 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); }
186 void reparseStyleSheet(const String&); 186 virtual void reparseStyleSheet(const String&);
187 bool setText(const String&, ExceptionState&); 187 virtual bool setText(const String&, ExceptionState&);
188 String ruleSelector(const InspectorCSSId&, ExceptionState&); 188 String ruleSelector(const InspectorCSSId&, ExceptionState&);
189 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio nState&); 189 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio nState&);
190 CSSStyleRule* addRule(const String& selector, ExceptionState&); 190 CSSStyleRule* addRule(const String& selector, ExceptionState&);
191 bool deleteRule(const InspectorCSSId&, ExceptionState&); 191 bool deleteRule(const InspectorCSSId&, ExceptionState&);
192 CSSStyleRule* ruleForId(const InspectorCSSId&) const; 192 CSSStyleRule* ruleForId(const InspectorCSSId&) const;
193 bool fillObjectForStyleSheet(PassRefPtr<TypeBuilder::CSS::CSSStyleSheetBody> ); 193 bool fillObjectForStyleSheet(PassRefPtr<TypeBuilder::CSS::CSSStyleSheetBody> );
194 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn fo() const; 194 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn fo() const;
195 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); 195 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >);
196 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati on*); 196 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati on*);
197 bool setStyleText(const InspectorCSSId&, const String& text, String* oldText , ExceptionState&); 197 bool setStyleText(const InspectorCSSId&, const String& text, String* oldText , ExceptionState&);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 mutable CSSRuleVector m_flatRules; 251 mutable CSSRuleVector m_flatRules;
252 Listener* m_listener; 252 Listener* m_listener;
253 mutable String m_sourceURL; 253 mutable String m_sourceURL;
254 }; 254 };
255 255
256 class InspectorStyleSheetForInlineStyle FINAL : public InspectorStyleSheet { 256 class InspectorStyleSheetForInlineStyle FINAL : public InspectorStyleSheet {
257 public: 257 public:
258 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(InspectorPageAge nt*, InspectorResourceAgent*, const String& id, PassRefPtr<Element>, TypeBuilder ::CSS::StyleSheetOrigin::Enum, Listener*); 258 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(InspectorPageAge nt*, InspectorResourceAgent*, const String& id, PassRefPtr<Element>, TypeBuilder ::CSS::StyleSheetOrigin::Enum, Listener*);
259 259
260 void didModifyElementAttribute(); 260 void didModifyElementAttribute();
261 virtual void reparseStyleSheet(const String&) OVERRIDE;
262 virtual bool setText(const String&, ExceptionState&) OVERRIDE;
261 virtual bool getText(String* result) const OVERRIDE; 263 virtual bool getText(String* result) const OVERRIDE;
262 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } 264 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); }
263 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const OVERRIDE { r eturn TypeBuilder::CSS::StyleSheetOrigin::Regular; } 265 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const OVERRIDE { r eturn TypeBuilder::CSS::StyleSheetOrigin::Regular; }
264 266
265 protected: 267 protected:
266 InspectorStyleSheetForInlineStyle(InspectorPageAgent*, InspectorResourceAgen t*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::E num, Listener*); 268 InspectorStyleSheetForInlineStyle(InspectorPageAgent*, InspectorResourceAgen t*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::E num, Listener*);
267 269
268 virtual Document* ownerDocument() const OVERRIDE; 270 virtual Document* ownerDocument() const OVERRIDE;
269 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration* style) const OVERRIDE { ASSERT_UNUSED(style, style == inlineStyle()); return m_ ruleSourceData; } 271 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration* style) const OVERRIDE { ASSERT_UNUSED(style, style == inlineStyle()); return m_ ruleSourceData; }
270 virtual unsigned ruleIndexByStyle(CSSStyleDeclaration*) const OVERRIDE { ret urn 0; } 272 virtual unsigned ruleIndexByStyle(CSSStyleDeclaration*) const OVERRIDE { ret urn 0; }
(...skipping 17 matching lines...) Expand all
288 290
289 // Contains "style" attribute value. 291 // Contains "style" attribute value.
290 mutable String m_styleText; 292 mutable String m_styleText;
291 mutable bool m_isStyleTextValid; 293 mutable bool m_isStyleTextValid;
292 }; 294 };
293 295
294 296
295 } // namespace WebCore 297 } // namespace WebCore
296 298
297 #endif // !defined(InspectorStyleSheet_h) 299 #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