| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 virtual bool setStyleText(unsigned ruleIndex, const String&) = 0; | 135 virtual bool setStyleText(unsigned ruleIndex, const String&) = 0; |
| 136 bool getStyleText(unsigned ruleIndex, String*); | 136 bool getStyleText(unsigned ruleIndex, String*); |
| 137 | 137 |
| 138 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const = 0; | 138 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const = 0; |
| 139 virtual unsigned indexOf(CSSStyleDeclaration*) const = 0; | 139 virtual unsigned indexOf(CSSStyleDeclaration*) const = 0; |
| 140 | 140 |
| 141 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); | 141 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); |
| 142 bool findPropertyByRange(const SourceRange&, unsigned* ruleIndex, unsigned*
propertyIndex, bool* overwrite); | 142 bool findPropertyByRange(const SourceRange&, unsigned* ruleIndex, unsigned*
propertyIndex, bool* overwrite); |
| 143 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber,
unsigned* offset); | 143 bool lineNumberAndColumnToOffset(unsigned lineNumber, unsigned columnNumber,
unsigned* offset); |
| 144 virtual bool isInlineStyle() = 0; |
| 144 | 145 |
| 145 protected: | 146 protected: |
| 146 InspectorStyleSheetBase(const String& id, Listener*); | 147 InspectorStyleSheetBase(const String& id, Listener*); |
| 147 | 148 |
| 148 Listener* listener() const { return m_listener; } | 149 Listener* listener() const { return m_listener; } |
| 149 void onStyleSheetTextChanged(); | 150 void onStyleSheetTextChanged(); |
| 150 const LineEndings* lineEndings(); | 151 const LineEndings* lineEndings(); |
| 151 | 152 |
| 152 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) = 0; | 153 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) = 0; |
| 153 virtual unsigned ruleCount() = 0; | 154 virtual unsigned ruleCount() = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 168 public: | 169 public: |
| 169 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorResourceA
gent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, T
ypeBuilder::CSS::StyleSheetOrigin::Enum, const String& documentURL, InspectorCSS
Agent*); | 170 static PassRefPtrWillBeRawPtr<InspectorStyleSheet> create(InspectorResourceA
gent*, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, T
ypeBuilder::CSS::StyleSheetOrigin::Enum, const String& documentURL, InspectorCSS
Agent*); |
| 170 | 171 |
| 171 virtual ~InspectorStyleSheet(); | 172 virtual ~InspectorStyleSheet(); |
| 172 DECLARE_VIRTUAL_TRACE(); | 173 DECLARE_VIRTUAL_TRACE(); |
| 173 | 174 |
| 174 String finalURL() const; | 175 String finalURL() const; |
| 175 virtual Document* ownerDocument() const override; | 176 virtual Document* ownerDocument() const override; |
| 176 virtual bool setText(const String&, ExceptionState&) override; | 177 virtual bool setText(const String&, ExceptionState&) override; |
| 177 virtual bool getText(String* result) const override; | 178 virtual bool getText(String* result) const override; |
| 178 CSSStyleRule* setRuleSelector(const SourceRange&, const String& selector, So
urceRange* newRange, String* oldSelector, ExceptionState&); | 179 RefPtrWillBeRawPtr<CSSStyleRule> setRuleSelector(const SourceRange&, const
String& selector, SourceRange* newRange, String* oldSelector, ExceptionState&); |
| 179 CSSMediaRule* setMediaRuleText(const SourceRange&, const String& selector, S
ourceRange* newRange, String* oldSelector, ExceptionState&); | 180 RefPtrWillBeRawPtr<CSSStyleRule> setStyleText(const SourceRange&, const Str
ing& text, SourceRange* newRange, String* oldSelector, ExceptionState&); |
| 180 CSSStyleRule* addRule(const String& ruleText, const SourceRange& location, S
ourceRange* addedRange, ExceptionState&); | 181 RefPtrWillBeRawPtr<CSSMediaRule> setMediaRuleText(const SourceRange&, const
String& selector, SourceRange* newRange, String* oldSelector, ExceptionState&); |
| 182 RefPtrWillBeRawPtr<CSSStyleRule> addRule(const String& ruleText, const Sour
ceRange& location, SourceRange* addedRange, ExceptionState&); |
| 181 bool deleteRule(const SourceRange&, ExceptionState&); | 183 bool deleteRule(const SourceRange&, ExceptionState&); |
| 182 | 184 |
| 183 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } | 185 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } |
| 184 | 186 |
| 185 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; | 187 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; |
| 186 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); | 188 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); |
| 187 | 189 |
| 188 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); | 190 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); |
| 189 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(cons
t CSSRule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex); | 191 PassRefPtr<TypeBuilder::CSS::SourceRange> mediaQueryExpValueSourceRange(cons
t CSSRule*, size_t mediaQueryIndex, size_t mediaQueryExpIndex); |
| 190 | 192 |
| 191 unsigned indexOf(CSSStyleRule*) const; | 193 unsigned indexOf(CSSStyleRule*) const; |
| 192 CSSStyleRule* ruleAt(unsigned ruleIndex) const; | 194 CSSStyleRule* ruleAt(unsigned ruleIndex) const; |
| 193 CSSMediaRule* mediaRuleAt(unsigned ruleIndex) const; | 195 CSSMediaRule* mediaRuleAt(unsigned ruleIndex) const; |
| 194 | 196 |
| 195 virtual unsigned indexOf(CSSStyleDeclaration*) const override; | 197 virtual unsigned indexOf(CSSStyleDeclaration*) const override; |
| 196 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const override; | 198 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const override; |
| 197 virtual bool setStyleText(unsigned ruleIndex, const String&) override; | 199 virtual bool setStyleText(unsigned ruleIndex, const String&) override; |
| 198 | 200 bool isInlineStyle() override { return false; } |
| 199 const CSSRuleVector& flatRules(); | 201 const CSSRuleVector& flatRules(); |
| 200 | 202 |
| 201 protected: | 203 protected: |
| 202 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) override; | 204 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) override; |
| 203 virtual unsigned ruleCount() override; | 205 virtual unsigned ruleCount() override; |
| 204 | 206 |
| 205 // Also accessed by friend class InspectorStyle. | 207 // Also accessed by friend class InspectorStyle. |
| 206 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const override; | 208 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned)
const override; |
| 207 virtual bool ensureParsedDataReady() override; | 209 virtual bool ensureParsedDataReady() override; |
| 208 | 210 |
| 209 private: | 211 private: |
| 210 InspectorStyleSheet(InspectorResourceAgent*, const String& id, PassRefPtrWil
lBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enu
m, const String& documentURL, InspectorCSSAgent*); | 212 InspectorStyleSheet(InspectorResourceAgent*, const String& id, PassRefPtrWil
lBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enu
m, const String& documentURL, InspectorCSSAgent*); |
| 211 unsigned ruleIndexBySourceRange(const CSSMediaRule* parentMediaRule, const S
ourceRange&); | 213 unsigned ruleIndexBySourceRange(const CSSMediaRule* parentMediaRule, const S
ourceRange&); |
| 212 bool findRuleByHeaderRange(const SourceRange&, CSSRule**, CSSRuleSourceData*
*); | 214 bool findRuleByHeaderRange(const SourceRange&, CSSRule**, CSSRuleSourceData*
*); |
| 215 bool findRuleByBodyRange(const SourceRange&, CSSRule**, CSSRuleSourceData**)
; |
| 213 CSSStyleRule* insertCSSOMRuleInStyleSheet(const SourceRange&, const String&
ruleText, ExceptionState&); | 216 CSSStyleRule* insertCSSOMRuleInStyleSheet(const SourceRange&, const String&
ruleText, ExceptionState&); |
| 214 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, const SourceRange&,
const String& ruleText, ExceptionState&); | 217 CSSStyleRule* insertCSSOMRuleInMediaRule(CSSMediaRule*, const SourceRange&,
const String& ruleText, ExceptionState&); |
| 215 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String&
ruleText, ExceptionState&); | 218 CSSStyleRule* insertCSSOMRuleBySourceRange(const SourceRange&, const String&
ruleText, ExceptionState&); |
| 216 bool verifyRuleText(const String& ruleText); | |
| 217 bool verifySelectorText(const String& selectorText); | |
| 218 bool verifyMediaText(const String& mediaText); | |
| 219 String sourceMapURL() const; | 219 String sourceMapURL() const; |
| 220 String sourceURL() const; | 220 String sourceURL() const; |
| 221 bool ensureText() const; | 221 bool ensureText() const; |
| 222 void ensureFlatRules() const; | 222 void ensureFlatRules() const; |
| 223 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS
tyleText, String* result); | 223 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS
tyleText, String* result); |
| 224 bool originalStyleSheetText(String* result) const; | 224 bool originalStyleSheetText(String* result) const; |
| 225 bool resourceStyleSheetText(String* result) const; | 225 bool resourceStyleSheetText(String* result) const; |
| 226 bool inlineStyleSheetText(String* result) const; | 226 bool inlineStyleSheetText(String* result) const; |
| 227 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou
rce(const CSSRuleSourceData*, const String&); | 227 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectorsFromSou
rce(const CSSRuleSourceData*, const String&); |
| 228 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); | 228 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 249 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons
t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*); | 249 static PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> create(cons
t String& id, PassRefPtrWillBeRawPtr<Element>, Listener*); |
| 250 | 250 |
| 251 void didModifyElementAttribute(); | 251 void didModifyElementAttribute(); |
| 252 virtual Document* ownerDocument() const override; | 252 virtual Document* ownerDocument() const override; |
| 253 virtual bool setText(const String&, ExceptionState&) override; | 253 virtual bool setText(const String&, ExceptionState&) override; |
| 254 virtual bool getText(String* result) const override; | 254 virtual bool getText(String* result) const override; |
| 255 | 255 |
| 256 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const override { AS
SERT_UNUSED(ruleIndex, !ruleIndex); return inlineStyle(); } | 256 virtual CSSStyleDeclaration* styleAt(unsigned ruleIndex) const override { AS
SERT_UNUSED(ruleIndex, !ruleIndex); return inlineStyle(); } |
| 257 virtual unsigned indexOf(CSSStyleDeclaration* style) const override { return
0; } | 257 virtual unsigned indexOf(CSSStyleDeclaration* style) const override { return
0; } |
| 258 virtual bool setStyleText(unsigned ruleIndex, const String&) override; | 258 virtual bool setStyleText(unsigned ruleIndex, const String&) override; |
| 259 CSSStyleDeclaration* inlineStyle() const; |
| 259 | 260 |
| 260 DECLARE_VIRTUAL_TRACE(); | 261 DECLARE_VIRTUAL_TRACE(); |
| 261 | 262 |
| 262 protected: | 263 protected: |
| 263 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) override; | 264 virtual PassRefPtrWillBeRawPtr<InspectorStyle> inspectorStyleAt(unsigned rul
eIndex) override; |
| 264 virtual unsigned ruleCount() override { return 1; } | 265 virtual unsigned ruleCount() override { return 1; } |
| 265 | 266 |
| 266 // Also accessed by friend class InspectorStyle. | 267 // Also accessed by friend class InspectorStyle. |
| 267 virtual bool ensureParsedDataReady() override; | 268 virtual bool ensureParsedDataReady() override; |
| 268 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned
ruleIndex) const override { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS
ourceData; } | 269 virtual PassRefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceDataAt(unsigned
ruleIndex) const override { ASSERT_UNUSED(ruleIndex, !ruleIndex); return m_ruleS
ourceData; } |
| 270 bool isInlineStyle() override { return true; } |
| 269 | 271 |
| 270 private: | 272 private: |
| 271 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E
lement>, Listener*); | 273 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtrWillBeRawPtr<E
lement>, Listener*); |
| 272 CSSStyleDeclaration* inlineStyle() const; | |
| 273 const String& elementStyleText() const; | 274 const String& elementStyleText() const; |
| 274 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; | 275 PassRefPtrWillBeRawPtr<CSSRuleSourceData> getStyleAttributeData() const; |
| 275 | 276 |
| 276 RefPtrWillBeMember<Element> m_element; | 277 RefPtrWillBeMember<Element> m_element; |
| 277 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData; | 278 RefPtrWillBeMember<CSSRuleSourceData> m_ruleSourceData; |
| 278 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle; | 279 RefPtrWillBeMember<InspectorStyle> m_inspectorStyle; |
| 279 | 280 |
| 280 // Contains "style" attribute value. | 281 // Contains "style" attribute value. |
| 281 mutable String m_styleText; | 282 mutable String m_styleText; |
| 282 mutable bool m_isStyleTextValid; | 283 mutable bool m_isStyleTextValid; |
| 283 }; | 284 }; |
| 284 | 285 |
| 285 | 286 |
| 287 |
| 286 } // namespace blink | 288 } // namespace blink |
| 287 | 289 |
| 288 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); | 290 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::InspectorStyleProperty); |
| 289 | 291 |
| 290 #endif // !defined(InspectorStyleSheet_h) | 292 #endif // !defined(InspectorStyleSheet_h) |
| OLD | NEW |