| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 bool hasRawText() const { return !rawText.isEmpty(); } | 97 bool hasRawText() const { return !rawText.isEmpty(); } |
| 98 | 98 |
| 99 void trace(Visitor* visitor) { visitor->trace(sourceData); } | 99 void trace(Visitor* visitor) { visitor->trace(sourceData); } |
| 100 | 100 |
| 101 CSSPropertySourceData sourceData; | 101 CSSPropertySourceData sourceData; |
| 102 bool hasSource; | 102 bool hasSource; |
| 103 String rawText; | 103 String rawText; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 class InspectorStyle FINAL : public RefCountedWillBeGarbageCollectedFinalized<In
spectorStyle> { | 106 class InspectorStyle final : public RefCountedWillBeGarbageCollectedFinalized<In
spectorStyle> { |
| 107 public: | 107 public: |
| 108 static PassRefPtrWillBeRawPtr<InspectorStyle> create(const InspectorCSSId&,
PassRefPtrWillBeRawPtr<CSSStyleDeclaration>, InspectorStyleSheetBase* parentStyl
eSheet); | 108 static PassRefPtrWillBeRawPtr<InspectorStyle> create(const InspectorCSSId&,
PassRefPtrWillBeRawPtr<CSSStyleDeclaration>, InspectorStyleSheetBase* parentStyl
eSheet); |
| 109 | 109 |
| 110 CSSStyleDeclaration* cssStyle() const { return m_style.get(); } | 110 CSSStyleDeclaration* cssStyle() const { return m_style.get(); } |
| 111 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const; | 111 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const; |
| 112 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >
buildArrayForComputedStyle() const; | 112 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >
buildArrayForComputedStyle() const; |
| 113 bool setPropertyText(unsigned index, const String& text, bool overwrite, Exc
eptionState&); | 113 bool setPropertyText(unsigned index, const String& text, bool overwrite, Exc
eptionState&); |
| 114 bool styleText(String* result) const; | 114 bool styleText(String* result) const; |
| 115 bool textForRange(const SourceRange&, String* result) const; | 115 bool textForRange(const SourceRange&, String* result) const; |
| 116 | 116 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 String m_id; | 185 String m_id; |
| 186 Listener* m_listener; | 186 Listener* m_listener; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 class InspectorStyleSheet : public InspectorStyleSheetBase { | 189 class InspectorStyleSheet : public InspectorStyleSheetBase { |
| 190 public: | 190 public: |
| 191 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorPageAgent
*, InspectorResourceAgent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleShe
et> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& docu
mentURL, Listener*); | 191 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorPageAgent
*, InspectorResourceAgent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleShe
et> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& docu
mentURL, Listener*); |
| 192 | 192 |
| 193 virtual ~InspectorStyleSheet(); | 193 virtual ~InspectorStyleSheet(); |
| 194 virtual void trace(Visitor*) OVERRIDE; | 194 virtual void trace(Visitor*) override; |
| 195 | 195 |
| 196 String finalURL() const; | 196 String finalURL() const; |
| 197 virtual Document* ownerDocument() const OVERRIDE; | 197 virtual Document* ownerDocument() const override; |
| 198 virtual bool setText(const String&, ExceptionState&) OVERRIDE; | 198 virtual bool setText(const String&, ExceptionState&) override; |
| 199 virtual bool getText(String* result) const OVERRIDE; | 199 virtual bool getText(String* result) const override; |
| 200 String ruleSelector(const InspectorCSSId&, ExceptionState&); | 200 String ruleSelector(const InspectorCSSId&, ExceptionState&); |
| 201 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio
nState&); | 201 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio
nState&); |
| 202 CSSStyleRule* addRule(const String& ruleText, const SourceRange& location, E
xceptionState&); | 202 CSSStyleRule* addRule(const String& ruleText, const SourceRange& location, E
xceptionState&); |
| 203 bool deleteRule(const InspectorCSSId&, const String& oldText, ExceptionState
&); | 203 bool deleteRule(const InspectorCSSId&, const String& oldText, ExceptionState
&); |
| 204 | 204 |
| 205 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } | 205 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } |
| 206 | 206 |
| 207 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; | 207 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; |
| 208 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); | 208 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); |
| 209 | 209 |
| 210 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); | 210 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); |
| 211 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(cons
t CSSRule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex); | 211 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(cons
t CSSRule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex); |
| 212 | 212 |
| 213 InspectorCSSId ruleId(CSSStyleRule*) const; | 213 InspectorCSSId ruleId(CSSStyleRule*) const; |
| 214 CSSStyleRule* ruleForId(const InspectorCSSId&) const; | 214 CSSStyleRule* ruleForId(const InspectorCSSId&) const; |
| 215 | 215 |
| 216 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const OVERRIDE; | 216 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const override; |
| 217 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const OVERRID
E; | 217 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const overrid
e; |
| 218 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; | 218 virtual bool setStyleText(const InspectorCSSId&, const String&) override; |
| 219 | 219 |
| 220 bool findRuleBySelectorRange(const SourceRange&, InspectorCSSId*); | 220 bool findRuleBySelectorRange(const SourceRange&, InspectorCSSId*); |
| 221 | 221 |
| 222 const CSSRuleVector& flatRules(); | 222 const CSSRuleVector& flatRules(); |
| 223 | 223 |
| 224 protected: | 224 protected: |
| 225 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins
pectorCSSId&) OVERRIDE; | 225 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins
pectorCSSId&) override; |
| 226 virtual unsigned ruleCount() OVERRIDE; | 226 virtual unsigned ruleCount() override; |
| 227 | 227 |
| 228 // Also accessed by friend class InspectorStyle. | 228 // Also accessed by friend class InspectorStyle. |
| 229 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const OVERRIDE; | 229 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const override; |
| 230 virtual bool ensureParsedDataReady() OVERRIDE; | 230 virtual bool ensureParsedDataReady() override; |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri
ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::
StyleSheetOrigin::Enum, const String& documentURL, Listener*); | 233 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri
ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::
StyleSheetOrigin::Enum, const String& documentURL, Listener*); |
| 234 unsigned ruleIndexBySourceRange(const CSSMediaRule* parentMediaRule, const S
ourceRange&); | 234 unsigned ruleIndexBySourceRange(const CSSMediaRule* parentMediaRule, const S
ourceRange&); |
| 235 CSSStyleRule* insertCSSOMRuleInStyleSheet(const SourceRange&, const String&
ruleText, ExceptionState&); | 235 CSSStyleRule* insertCSSOMRuleInStyleSheet(const SourceRange&, const String&
ruleText, ExceptionState&); |
| 236 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, const SourceRange&,
const String& ruleText, ExceptionState&); | 236 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, const SourceRange&,
const String& ruleText, ExceptionState&); |
| 237 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String&
ruleText, ExceptionState&); | 237 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String&
ruleText, ExceptionState&); |
| 238 bool verifyRuleText(const String& ruleText); | 238 bool verifyRuleText(const String& ruleText); |
| 239 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; | 239 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; |
| 240 String sourceMapURL() const; | 240 String sourceMapURL() const; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 257 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; | 257 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; |
| 258 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent; | 258 RawPtrWillBeMember<InspectorResourceAgent> m_resourceAgent; |
| 259 RefPtrWillBeMember<CSSStyleSheet> m_pageStyleSheet; | 259 RefPtrWillBeMember<CSSStyleSheet> m_pageStyleSheet; |
| 260 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; | 260 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; |
| 261 String m_documentURL; | 261 String m_documentURL; |
| 262 OwnPtr<ParsedStyleSheet> m_parsedStyleSheet; | 262 OwnPtr<ParsedStyleSheet> m_parsedStyleSheet; |
| 263 mutable CSSRuleVector m_flatRules; | 263 mutable CSSRuleVector m_flatRules; |
| 264 mutable String m_sourceURL; | 264 mutable String m_sourceURL; |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 class InspectorStyleSheetForInlineStyle FINAL : public InspectorStyleSheetBase { | 267 class InspectorStyleSheetForInlineStyle final : public InspectorStyleSheetBase { |
| 268 public: | 268 public: |
| 269 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons
t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*); | 269 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons
t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*); |
| 270 | 270 |
| 271 void didModifyElementAttribute(); | 271 void didModifyElementAttribute(); |
| 272 virtual Document* ownerDocument() const OVERRIDE; | 272 virtual Document* ownerDocument() const override; |
| 273 virtual bool setText(const String&, ExceptionState&) OVERRIDE; | 273 virtual bool setText(const String&, ExceptionState&) override; |
| 274 virtual bool getText(String* result) const OVERRIDE; | 274 virtual bool getText(String* result) const override; |
| 275 | 275 |
| 276 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(); } |
| 277 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE {
return InspectorCSSId(id(), 0); } | 277 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const override {
return InspectorCSSId(id(), 0); } |
| 278 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; | 278 virtual bool setStyleText(const InspectorCSSId&, const String&) override; |
| 279 | 279 |
| 280 virtual void trace(Visitor*) OVERRIDE; | 280 virtual void trace(Visitor*) override; |
| 281 | 281 |
| 282 protected: | 282 protected: |
| 283 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins
pectorCSSId&) OVERRIDE; | 283 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleForId(const Ins
pectorCSSId&) override; |
| 284 virtual unsigned ruleCount() OVERRIDE { return 1; } | 284 virtual unsigned ruleCount() override { return 1; } |
| 285 | 285 |
| 286 // Also accessed by friend class InspectorStyle. | 286 // Also accessed by friend class InspectorStyle. |
| 287 virtual bool ensureParsedDataReady() OVERRIDE; | 287 virtual bool ensureParsedDataReady() override; |
| 288 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; } |
| 289 | 289 |
| 290 private: | 290 private: |
| 291 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E
lement>, Listener*); | 291 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E
lement>, Listener*); |
| 292 CSSStyleDeclaration* inlineStyle() const; | 292 CSSStyleDeclaration* inlineStyle() const; |
| 293 const String& elementStyleText() const; | 293 const String& elementStyleText() const; |
| 294 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; | 294 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; |
| 295 | 295 |
| 296 RefPtrWillBeMember<Element> m_element; | 296 RefPtrWillBeMember<Element> m_element; |
| 297 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData; | 297 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData; |
| 298 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle; | 298 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle; |
| 299 | 299 |
| 300 // Contains "style" attribute value. | 300 // Contains "style" attribute value. |
| 301 mutable String m_styleText; | 301 mutable String m_styleText; |
| 302 mutable bool m_isStyleTextValid; | 302 mutable bool m_isStyleTextValid; |
| 303 }; | 303 }; |
| 304 | 304 |
| 305 | 305 |
| 306 } // namespace blink | 306 } // namespace blink |
| 307 | 307 |
| 308 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); | 308 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); |
| 309 | 309 |
| 310 #endif // !defined(InspectorStyleSheet_h) | 310 #endif // !defined(InspectorStyleSheet_h) |
| OLD | NEW |