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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class ParsedStyleSheet; | 42 class ParsedStyleSheet; |
43 | 43 |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 class CSSRuleList; | 46 class CSSRuleList; |
47 class CSSStyleDeclaration; | 47 class CSSStyleDeclaration; |
48 class CSSStyleRule; | 48 class CSSStyleRule; |
49 class CSSStyleSheet; | 49 class CSSStyleSheet; |
50 class Document; | 50 class Document; |
51 class Element; | 51 class Element; |
52 class InspectorPageAgent; | 52 class InspectorCSSAgent; |
53 class InspectorStyleSheet; | 53 class InspectorStyleSheet; |
54 class Node; | 54 class Node; |
55 | 55 |
56 | 56 |
57 typedef String ErrorString; | 57 typedef String ErrorString; |
58 | 58 |
59 class InspectorCSSId { | 59 class InspectorCSSId { |
60 public: | 60 public: |
61 InspectorCSSId() | 61 InspectorCSSId() |
62 : m_ordinal(0) | 62 : m_ordinal(0) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 class InspectorStyleSheet : public RefCounted<InspectorStyleSheet> { | 166 class InspectorStyleSheet : public RefCounted<InspectorStyleSheet> { |
167 public: | 167 public: |
168 class Listener { | 168 class Listener { |
169 public: | 169 public: |
170 Listener() { } | 170 Listener() { } |
171 virtual ~Listener() { } | 171 virtual ~Listener() { } |
172 virtual void styleSheetChanged(InspectorStyleSheet*) = 0; | 172 virtual void styleSheetChanged(InspectorStyleSheet*) = 0; |
173 }; | 173 }; |
174 | 174 |
175 typedef HashMap<CSSStyleDeclaration*, RefPtr<InspectorStyle> > InspectorStyl
eMap; | 175 typedef HashMap<CSSStyleDeclaration*, RefPtr<InspectorStyle> > InspectorStyl
eMap; |
176 static PassRefPtr<InspectorStyleSheet> create(InspectorPageAgent*, const Str
ing& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetO
rigin::Enum, const String& documentURL, Listener*); | 176 static PassRefPtr<InspectorStyleSheet> create(InspectorCSSAgent*, const Stri
ng& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOr
igin::Enum, const String& documentURL, Listener*); |
177 static String styleSheetURL(CSSStyleSheet* pageStyleSheet); | 177 static String styleSheetURL(CSSStyleSheet* pageStyleSheet); |
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 bool canBind() const { return m_origin != TypeBuilder::CSS::StyleSheetOrigin
::User_agent && m_origin != TypeBuilder::CSS::StyleSheetOrigin::User; } | 183 bool canBind() const { return m_origin != TypeBuilder::CSS::StyleSheetOrigin
::User_agent && m_origin != TypeBuilder::CSS::StyleSheetOrigin::User; } |
184 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } | 184 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } |
185 bool isReparsing() const { return m_isReparsing; } | 185 bool isReparsing() const { return m_isReparsing; } |
186 void reparseStyleSheet(const String&); | 186 void reparseStyleSheet(const String&); |
(...skipping 13 matching lines...) Expand all Loading... |
200 | 200 |
201 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const { return m_o
rigin; } | 201 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const { return m_o
rigin; } |
202 virtual bool getText(String* result) const; | 202 virtual bool getText(String* result) const; |
203 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const; | 203 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const; |
204 void fireStyleSheetChanged(); | 204 void fireStyleSheetChanged(); |
205 | 205 |
206 InspectorCSSId ruleId(CSSStyleRule*) const; | 206 InspectorCSSId ruleId(CSSStyleRule*) const; |
207 InspectorCSSId styleId(CSSStyleDeclaration* style) const { return ruleOrStyl
eId(style); } | 207 InspectorCSSId styleId(CSSStyleDeclaration* style) const { return ruleOrStyl
eId(style); } |
208 | 208 |
209 protected: | 209 protected: |
210 InspectorStyleSheet(InspectorPageAgent*, const String& id, PassRefPtr<CSSSty
leSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String&
documentURL, Listener*); | 210 InspectorStyleSheet(InspectorCSSAgent*, const String& id, PassRefPtr<CSSStyl
eSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String&
documentURL, Listener*); |
211 | 211 |
212 InspectorCSSId ruleOrStyleId(CSSStyleDeclaration* style) const; | 212 InspectorCSSId ruleOrStyleId(CSSStyleDeclaration* style) const; |
213 virtual Document* ownerDocument() const; | 213 virtual Document* ownerDocument() const; |
214 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
style) const; | 214 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
style) const; |
215 virtual unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; | 215 virtual unsigned ruleIndexByStyle(CSSStyleDeclaration*) const; |
216 virtual bool ensureParsedDataReady(); | 216 virtual bool ensureParsedDataReady(); |
217 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
); | 217 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
); |
218 virtual String sourceMapURL() const; | 218 virtual String sourceMapURL() const; |
219 virtual String sourceURL() const; | 219 virtual String sourceURL() const; |
220 | 220 |
(...skipping 14 matching lines...) Expand all Loading... |
235 void revalidateStyle(CSSStyleDeclaration*); | 235 void revalidateStyle(CSSStyleDeclaration*); |
236 bool originalStyleSheetText(String* result) const; | 236 bool originalStyleSheetText(String* result) const; |
237 bool resourceStyleSheetText(String* result) const; | 237 bool resourceStyleSheetText(String* result) const; |
238 bool inlineStyleSheetText(String* result) const; | 238 bool inlineStyleSheetText(String* result) const; |
239 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRule
List(CSSRuleList*); | 239 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRule
List(CSSRuleList*); |
240 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); | 240 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); |
241 String url() const; | 241 String url() const; |
242 bool hasSourceURL() const; | 242 bool hasSourceURL() const; |
243 bool startsAtZero() const; | 243 bool startsAtZero() const; |
244 | 244 |
245 InspectorPageAgent* m_pageAgent; | 245 InspectorCSSAgent* m_cssAgent; |
246 String m_id; | 246 String m_id; |
247 RefPtr<CSSStyleSheet> m_pageStyleSheet; | 247 RefPtr<CSSStyleSheet> m_pageStyleSheet; |
248 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; | 248 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; |
249 String m_documentURL; | 249 String m_documentURL; |
250 bool m_isRevalidating; | 250 bool m_isRevalidating; |
251 bool m_isReparsing; | 251 bool m_isReparsing; |
252 ParsedStyleSheet* m_parsedStyleSheet; | 252 ParsedStyleSheet* m_parsedStyleSheet; |
253 mutable CSSStyleRuleVector m_flatRules; | 253 mutable CSSStyleRuleVector m_flatRules; |
254 Listener* m_listener; | 254 Listener* m_listener; |
255 mutable String m_sourceURL; | 255 mutable String m_sourceURL; |
256 }; | 256 }; |
257 | 257 |
258 class InspectorStyleSheetForInlineStyle : public InspectorStyleSheet { | 258 class InspectorStyleSheetForInlineStyle : public InspectorStyleSheet { |
259 public: | 259 public: |
260 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(InspectorPageAge
nt*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::
Enum, Listener*); | 260 static PassRefPtr<InspectorStyleSheetForInlineStyle> create(InspectorCSSAgen
t*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::E
num, Listener*); |
261 | 261 |
262 void didModifyElementAttribute(); | 262 void didModifyElementAttribute(); |
263 virtual bool getText(String* result) const; | 263 virtual bool getText(String* result) const; |
264 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const { AS
SERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } | 264 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const { AS
SERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } |
265 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const { return Typ
eBuilder::CSS::StyleSheetOrigin::Regular; } | 265 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const { return Typ
eBuilder::CSS::StyleSheetOrigin::Regular; } |
266 | 266 |
267 protected: | 267 protected: |
268 InspectorStyleSheetForInlineStyle(InspectorPageAgent*, const String& id, Pas
sRefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::Enum, Listener*); | 268 InspectorStyleSheetForInlineStyle(InspectorCSSAgent*, const String& id, Pass
RefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::Enum, Listener*); |
269 | 269 |
270 virtual Document* ownerDocument() const; | 270 virtual Document* ownerDocument() const; |
271 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
style) const { ASSERT_UNUSED(style, style == inlineStyle()); return m_ruleSourc
eData; } | 271 virtual PassRefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration*
style) const { ASSERT_UNUSED(style, style == inlineStyle()); return m_ruleSourc
eData; } |
272 virtual unsigned ruleIndexByStyle(CSSStyleDeclaration*) const { return 0; } | 272 virtual unsigned ruleIndexByStyle(CSSStyleDeclaration*) const { return 0; } |
273 virtual bool ensureParsedDataReady(); | 273 virtual bool ensureParsedDataReady(); |
274 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
); | 274 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
); |
275 virtual String sourceMapURL() const OVERRIDE { return String(); } | 275 virtual String sourceMapURL() const OVERRIDE { return String(); } |
276 virtual String sourceURL() const OVERRIDE { return String(); } | 276 virtual String sourceURL() const OVERRIDE { return String(); } |
277 | 277 |
278 // Also accessed by friend class InspectorStyle. | 278 // Also accessed by friend class InspectorStyle. |
(...skipping 11 matching lines...) Expand all Loading... |
290 | 290 |
291 // Contains "style" attribute value. | 291 // Contains "style" attribute value. |
292 mutable String m_styleText; | 292 mutable String m_styleText; |
293 mutable bool m_isStyleTextValid; | 293 mutable bool m_isStyleTextValid; |
294 }; | 294 }; |
295 | 295 |
296 | 296 |
297 } // namespace WebCore | 297 } // namespace WebCore |
298 | 298 |
299 #endif // !defined(InspectorStyleSheet_h) | 299 #endif // !defined(InspectorStyleSheet_h) |
OLD | NEW |