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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 InspectorPageAgent; |
53 class InspectorStyleSheet; | 53 class InspectorStyleSheet; |
54 class Node; | 54 class Node; |
55 | 55 |
56 | 56 typedef Vector<RefPtr<CSSStyleRule> > CSSStyleRuleVector; |
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) |
63 { | 63 { |
64 } | 64 } |
65 | 65 |
66 explicit InspectorCSSId(RefPtr<InspectorObject> value) | 66 explicit InspectorCSSId(RefPtr<InspectorObject> value) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(InspectorPageAgent*, const Str
ing& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetO
rigin::Enum, const String& documentURL, Listener*); |
177 static String styleSheetURL(CSSStyleSheet* pageStyleSheet); | 177 static String styleSheetURL(CSSStyleSheet* pageStyleSheet); |
| 178 static void collectFlatRules(PassRefPtr<CSSRuleList>, CSSStyleRuleVector* re
sult); |
178 | 179 |
179 virtual ~InspectorStyleSheet(); | 180 virtual ~InspectorStyleSheet(); |
180 | 181 |
181 String id() const { return m_id; } | 182 String id() const { return m_id; } |
182 String finalURL() const; | 183 String finalURL() const; |
183 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; } |
184 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } | 185 CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); } |
185 bool isReparsing() const { return m_isReparsing; } | 186 bool isReparsing() const { return m_isReparsing; } |
186 void reparseStyleSheet(const String&); | 187 void reparseStyleSheet(const String&); |
187 bool setText(const String&, ExceptionCode&); | 188 bool setText(const String&, ExceptionCode&); |
188 String ruleSelector(const InspectorCSSId&, ExceptionCode&); | 189 String ruleSelector(const InspectorCSSId&, ExceptionCode&); |
189 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio
nCode&); | 190 bool setRuleSelector(const InspectorCSSId&, const String& selector, Exceptio
nCode&); |
190 CSSStyleRule* addRule(const String& selector, ExceptionCode&); | 191 CSSStyleRule* addRule(const String& selector, ExceptionCode&); |
191 bool deleteRule(const InspectorCSSId&, ExceptionCode&); | 192 bool deleteRule(const InspectorCSSId&, ExceptionCode&); |
192 CSSStyleRule* ruleForId(const InspectorCSSId&) const; | 193 CSSStyleRule* ruleForId(const InspectorCSSId&) const; |
193 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetBody> buildObjectForStyleSheet(); | 194 bool fillObjectForStyleSheet(PassRefPtr<TypeBuilder::CSS::CSSStyleSheetBody>
); |
194 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; | 195 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetIn
fo() const; |
195 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*); | 196 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, Pass
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >); |
196 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); | 197 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclarati
on*); |
197 bool setStyleText(const InspectorCSSId&, const String& text, String* oldText
, ExceptionCode&); | 198 bool setStyleText(const InspectorCSSId&, const String& text, String* oldText
, ExceptionCode&); |
198 bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const St
ring& text, bool overwrite, String* oldPropertyText, ExceptionCode&); | 199 bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const St
ring& text, bool overwrite, String* oldPropertyText, ExceptionCode&); |
199 bool toggleProperty(const InspectorCSSId&, unsigned propertyIndex, bool disa
ble, ExceptionCode&); | 200 bool toggleProperty(const InspectorCSSId&, unsigned propertyIndex, bool disa
ble, ExceptionCode&); |
200 | 201 |
201 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const { return m_o
rigin; } | 202 virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const { return m_o
rigin; } |
202 virtual bool getText(String* result) const; | 203 virtual bool getText(String* result) const; |
203 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const; | 204 virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const; |
204 void fireStyleSheetChanged(); | 205 void fireStyleSheetChanged(); |
205 | 206 |
(...skipping 10 matching lines...) Expand all Loading... |
216 virtual bool ensureParsedDataReady(); | 217 virtual bool ensureParsedDataReady(); |
217 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
); | 218 virtual PassRefPtr<InspectorStyle> inspectorStyleForId(const InspectorCSSId&
); |
218 virtual String sourceMapURL() const; | 219 virtual String sourceMapURL() const; |
219 virtual String sourceURL() const; | 220 virtual String sourceURL() const; |
220 | 221 |
221 // Also accessed by friend class InspectorStyle. | 222 // Also accessed by friend class InspectorStyle. |
222 virtual bool setStyleText(CSSStyleDeclaration*, const String&); | 223 virtual bool setStyleText(CSSStyleDeclaration*, const String&); |
223 virtual PassOwnPtr<Vector<size_t> > lineEndings() const; | 224 virtual PassOwnPtr<Vector<size_t> > lineEndings() const; |
224 | 225 |
225 private: | 226 private: |
226 typedef Vector<RefPtr<CSSStyleRule> > CSSStyleRuleVector; | |
227 friend class InspectorStyle; | 227 friend class InspectorStyle; |
228 | 228 |
229 static void collectFlatRules(PassRefPtr<CSSRuleList>, CSSStyleRuleVector* re
sult); | |
230 bool checkPageStyleSheet(ExceptionCode&) const; | 229 bool checkPageStyleSheet(ExceptionCode&) const; |
231 bool ensureText() const; | 230 bool ensureText() const; |
232 bool ensureSourceData(); | 231 bool ensureSourceData(); |
233 void ensureFlatRules() const; | 232 void ensureFlatRules() const; |
234 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS
tyleText, String* result); | 233 bool styleSheetTextWithChangedStyle(CSSStyleDeclaration*, const String& newS
tyleText, String* result); |
235 void revalidateStyle(CSSStyleDeclaration*); | 234 void revalidateStyle(CSSStyleDeclaration*); |
236 bool originalStyleSheetText(String* result) const; | 235 bool originalStyleSheetText(String* result) const; |
237 bool resourceStyleSheetText(String* result) const; | 236 bool resourceStyleSheetText(String* result) const; |
238 bool inlineStyleSheetText(String* result) const; | 237 bool inlineStyleSheetText(String* result) const; |
239 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRule
List(CSSRuleList*); | |
240 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); | 238 PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSSty
leRule*); |
241 String url() const; | 239 String url() const; |
242 bool hasSourceURL() const; | 240 bool hasSourceURL() const; |
243 bool startsAtZero() const; | 241 bool startsAtZero() const; |
244 | 242 |
245 InspectorPageAgent* m_pageAgent; | 243 InspectorPageAgent* m_pageAgent; |
246 String m_id; | 244 String m_id; |
247 RefPtr<CSSStyleSheet> m_pageStyleSheet; | 245 RefPtr<CSSStyleSheet> m_pageStyleSheet; |
248 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; | 246 TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; |
249 String m_documentURL; | 247 String m_documentURL; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 288 |
291 // Contains "style" attribute value. | 289 // Contains "style" attribute value. |
292 mutable String m_styleText; | 290 mutable String m_styleText; |
293 mutable bool m_isStyleTextValid; | 291 mutable bool m_isStyleTextValid; |
294 }; | 292 }; |
295 | 293 |
296 | 294 |
297 } // namespace WebCore | 295 } // namespace WebCore |
298 | 296 |
299 #endif // !defined(InspectorStyleSheet_h) | 297 #endif // !defined(InspectorStyleSheet_h) |
OLD | NEW |