| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 String rawText; | 130 String rawText; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 class InspectorStyle FINAL : public RefCounted<InspectorStyle> { | 133 class InspectorStyle FINAL : public RefCounted<InspectorStyle> { |
| 134 public: | 134 public: |
| 135 static PassRefPtr<InspectorStyle> create(const InspectorCSSId&, PassRefPtr<C
SSStyleDeclaration>, InspectorStyleSheetBase* parentStyleSheet); | 135 static PassRefPtr<InspectorStyle> create(const InspectorCSSId&, PassRefPtr<C
SSStyleDeclaration>, InspectorStyleSheetBase* parentStyleSheet); |
| 136 | 136 |
| 137 CSSStyleDeclaration* cssStyle() const { return m_style.get(); } | 137 CSSStyleDeclaration* cssStyle() const { return m_style.get(); } |
| 138 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const; | 138 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const; |
| 139 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >
buildArrayForComputedStyle() const; | 139 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >
buildArrayForComputedStyle() const; |
| 140 bool setPropertyText(unsigned index, const String& text, bool overwrite, Str
ing* oldText, ExceptionState&); | 140 bool setPropertyText(unsigned index, const String& text, bool overwrite, Exc
eptionState&); |
| 141 bool styleText(String* result) const; | 141 bool styleText(String* result) const; |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 InspectorStyle(const InspectorCSSId&, PassRefPtr<CSSStyleDeclaration>, Inspe
ctorStyleSheetBase* parentStyleSheet); | 144 InspectorStyle(const InspectorCSSId&, PassRefPtr<CSSStyleDeclaration>, Inspe
ctorStyleSheetBase* parentStyleSheet); |
| 145 | 145 |
| 146 bool verifyPropertyText(const String& propertyText, bool canOmitSemicolon); | 146 bool verifyPropertyText(const String& propertyText, bool canOmitSemicolon); |
| 147 void populateAllProperties(Vector<InspectorStyleProperty>& result) const; | 147 void populateAllProperties(Vector<InspectorStyleProperty>& result) const; |
| 148 PassRefPtr<TypeBuilder::CSS::CSSStyle> styleWithProperties() const; | 148 PassRefPtr<TypeBuilder::CSS::CSSStyle> styleWithProperties() const; |
| 149 PassRefPtr<CSSRuleSourceData> extractSourceData() const; | 149 PassRefPtr<CSSRuleSourceData> extractSourceData() const; |
| 150 bool applyStyleText(const String&); | 150 bool applyStyleText(const String&); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 169 virtual void willReparseStyleSheet() = 0; | 169 virtual void willReparseStyleSheet() = 0; |
| 170 virtual void didReparseStyleSheet() = 0; | 170 virtual void didReparseStyleSheet() = 0; |
| 171 }; | 171 }; |
| 172 virtual ~InspectorStyleSheetBase() { } | 172 virtual ~InspectorStyleSheetBase() { } |
| 173 | 173 |
| 174 String id() const { return m_id; } | 174 String id() const { return m_id; } |
| 175 | 175 |
| 176 virtual Document* ownerDocument() const = 0; | 176 virtual Document* ownerDocument() const = 0; |
| 177 virtual bool setText(const String&, ExceptionState&) = 0; | 177 virtual bool setText(const String&, ExceptionState&) = 0; |
| 178 virtual bool getText(String* result) const = 0; | 178 virtual bool getText(String* result) const = 0; |
| 179 bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const St
ring& text, bool overwrite, String* oldPropertyText, ExceptionState&); | 179 bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const St
ring& text, bool overwrite, ExceptionState&); |
| 180 |
| 181 virtual bool setStyleText(const InspectorCSSId&, const String&) = 0; |
| 182 bool getStyleText(const InspectorCSSId&, String*); |
| 180 | 183 |
| 181 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const = 0; | 184 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const = 0; |
| 182 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const = 0; | 185 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const = 0; |
| 183 | 186 |
| 184 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); | 187 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); |
| 185 | 188 |
| 186 protected: | 189 protected: |
| 187 InspectorStyleSheetBase(const String& id, Listener*); | 190 InspectorStyleSheetBase(const String& id, Listener*); |
| 188 | 191 |
| 189 Listener* listener() const { return m_listener; } | 192 Listener* listener() const { return m_listener; } |
| 190 void fireStyleSheetChanged(); | 193 void fireStyleSheetChanged(); |
| 191 PassOwnPtr<Vector<unsigned> > lineEndings(); | 194 PassOwnPtr<Vector<unsigned> > lineEndings(); |
| 192 | 195 |
| 193 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
) = 0; | 196 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
) = 0; |
| 194 | 197 |
| 195 // Also accessed by friend class InspectorStyle. | 198 // Also accessed by friend class InspectorStyle. |
| 196 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
) const = 0; | 199 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
) const = 0; |
| 197 virtual bool setStyleText(CSSStyleDeclaration*, const String&) = 0; | |
| 198 virtual bool ensureParsedDataReady() = 0; | 200 virtual bool ensureParsedDataReady() = 0; |
| 199 | 201 |
| 200 private: | 202 private: |
| 201 friend class InspectorStyle; | 203 friend class InspectorStyle; |
| 202 | 204 |
| 203 String m_id; | 205 String m_id; |
| 204 Listener* m_listener; | 206 Listener* m_listener; |
| 205 }; | 207 }; |
| 206 | 208 |
| 207 class InspectorStyleSheet : public InspectorStyleSheetBase { | 209 class InspectorStyleSheet : public InspectorStyleSheetBase { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 224 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; | 226 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; |
| 225 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); | 227 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); |
| 226 | 228 |
| 227 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); | 229 PassRefPtr<TypeBuilder::CSS::SourceRange> ruleHeaderSourceRange(const CSSRul
e*); |
| 228 | 230 |
| 229 InspectorCSSId ruleId(CSSStyleRule*) const; | 231 InspectorCSSId ruleId(CSSStyleRule*) const; |
| 230 CSSStyleRule* ruleForId(const InspectorCSSId&) const; | 232 CSSStyleRule* ruleForId(const InspectorCSSId&) const; |
| 231 | 233 |
| 232 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const OVERRIDE; | 234 virtual InspectorCSSId styleId(CSSStyleDeclaration*) const OVERRIDE; |
| 233 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const OVERRID
E; | 235 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const OVERRID
E; |
| 236 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; |
| 234 | 237 |
| 235 protected: | 238 protected: |
| 236 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
) OVERRIDE; | 239 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
) OVERRIDE; |
| 237 | 240 |
| 238 // Also accessed by friend class InspectorStyle. | 241 // Also accessed by friend class InspectorStyle. |
| 239 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
) const OVERRIDE; | 242 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
) const OVERRIDE; |
| 240 virtual bool setStyleText(CSSStyleDeclaration*, const String&) OVERRIDE; | |
| 241 virtual bool ensureParsedDataReady() OVERRIDE; | 243 virtual bool ensureParsedDataReady() OVERRIDE; |
| 242 | 244 |
| 243 private: | 245 private: |
| 244 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri
ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::
StyleSheetOrigin::Enum, const String& documentURL, Listener*); | 246 InspectorStyleSheet(InspectorPageAgent*, InspectorResourceAgent*, const Stri
ng& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::
StyleSheetOrigin::Enum, const String& documentURL, Listener*); |
| 245 | 247 |
| 246 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; | 248 unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; |
| 247 String sourceMapURL() const; | 249 String sourceMapURL() const; |
| 248 String sourceURL() const; | 250 String sourceURL() const; |
| 249 bool ensureText() const; | 251 bool ensureText() const; |
| 250 void ensureFlatRules() const; | 252 void ensureFlatRules() const; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 272 public: | 274 public: |
| 273 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id
, PassRefPtr<Element>, Listener*); | 275 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id
, PassRefPtr<Element>, Listener*); |
| 274 | 276 |
| 275 void didModifyElementAttribute(); | 277 void didModifyElementAttribute(); |
| 276 virtual Document* ownerDocument() const OVERRIDE; | 278 virtual Document* ownerDocument() const OVERRIDE; |
| 277 virtual bool setText(const String&, ExceptionState&) OVERRIDE; | 279 virtual bool setText(const String&, ExceptionState&) OVERRIDE; |
| 278 virtual bool getText(String* result) const OVERRIDE; | 280 virtual bool getText(String* result) const OVERRIDE; |
| 279 | 281 |
| 280 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER
RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } | 282 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const OVER
RIDE { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } |
| 281 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE {
return InspectorCSSId(id(), 0); } | 283 virtual InspectorCSSId styleId(CSSStyleDeclaration* style) const OVERRIDE {
return InspectorCSSId(id(), 0); } |
| 284 virtual bool setStyleText(const InspectorCSSId&, const String&) OVERRIDE; |
| 282 | 285 |
| 283 protected: | 286 protected: |
| 284 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
) OVERRIDE; | 287 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
) OVERRIDE; |
| 285 | 288 |
| 286 // Also accessed by friend class InspectorStyle. | 289 // Also accessed by friend class InspectorStyle. |
| 287 virtual bool ensureParsedDataReady() OVERRIDE; | 290 virtual bool ensureParsedDataReady() OVERRIDE; |
| 288 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
style) const OVERRIDE { ASSERT_UNUSED(style, style == inlineStyle()); return m_
ruleSourceData; } | 291 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
style) const OVERRIDE { ASSERT_UNUSED(style, style == inlineStyle()); return m_
ruleSourceData; } |
| 289 virtual bool setStyleText(CSSStyleDeclaration*, const String&) OVERRIDE; | |
| 290 | 292 |
| 291 private: | 293 private: |
| 292 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element>, Lis
tener*); | 294 InspectorStyleSheetForInlineStyle(const String& id, PassRefPtr<Element>, Lis
tener*); |
| 293 CSSStyleDeclaration* inlineStyle() const; | 295 CSSStyleDeclaration* inlineStyle() const; |
| 294 const String& elementStyleText() const; | 296 const String& elementStyleText() const; |
| 295 PassRefPtr<CSSRuleSourceData> getStyleAttributeData() const; | 297 PassRefPtr<CSSRuleSourceData> getStyleAttributeData() const; |
| 296 | 298 |
| 297 RefPtr<Element> m_element; | 299 RefPtr<Element> m_element; |
| 298 RefPtr<CSSRuleSourceData> m_ruleSourceData; | 300 RefPtr<CSSRuleSourceData> m_ruleSourceData; |
| 299 RefPtr<InspectorStyle> m_inspectorStyle; | 301 RefPtr<InspectorStyle> m_inspectorStyle; |
| 300 | 302 |
| 301 // Contains "style" attribute value. | 303 // Contains "style" attribute value. |
| 302 mutable String m_styleText; | 304 mutable String m_styleText; |
| 303 mutable bool m_isStyleTextValid; | 305 mutable bool m_isStyleTextValid; |
| 304 }; | 306 }; |
| 305 | 307 |
| 306 | 308 |
| 307 } // namespace WebCore | 309 } // namespace WebCore |
| 308 | 310 |
| 309 #endif // !defined(InspectorStyleSheet_h) | 311 #endif // !defined(InspectorStyleSheet_h) |
| OLD | NEW |