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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 class Node; | 56 class Node; |
57 class NodeList; | 57 class NodeList; |
58 class PlatformFontUsage; | 58 class PlatformFontUsage; |
59 class RenderText; | 59 class RenderText; |
60 class StyleResolver; | 60 class StyleResolver; |
61 | 61 |
62 class InspectorCSSAgent FINAL | 62 class InspectorCSSAgent FINAL |
63 : public InspectorBaseAgent<InspectorCSSAgent> | 63 : public InspectorBaseAgent<InspectorCSSAgent> |
64 , public InspectorDOMAgent::DOMListener | 64 , public InspectorDOMAgent::DOMListener |
65 , public InspectorBackendDispatcher::CSSCommandHandler | 65 , public InspectorBackendDispatcher::CSSCommandHandler |
66 , public InspectorStyleSheet::Listener { | 66 , public InspectorStyleSheetBase::Listener { |
67 WTF_MAKE_NONCOPYABLE(InspectorCSSAgent); | 67 WTF_MAKE_NONCOPYABLE(InspectorCSSAgent); |
68 public: | 68 public: |
69 enum MediaListSource { | 69 enum MediaListSource { |
70 MediaListSourceLinkedSheet, | 70 MediaListSourceLinkedSheet, |
71 MediaListSourceInlineSheet, | 71 MediaListSourceInlineSheet, |
72 MediaListSourceMediaRule, | 72 MediaListSourceMediaRule, |
73 MediaListSourceImportRule | 73 MediaListSourceImportRule |
74 }; | 74 }; |
75 | 75 |
76 enum StyleSheetsUpdateType { | 76 enum StyleSheetsUpdateType { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 class StyleSheetAction; | 141 class StyleSheetAction; |
142 class SetStyleSheetTextAction; | 142 class SetStyleSheetTextAction; |
143 class SetPropertyTextAction; | 143 class SetPropertyTextAction; |
144 class SetRuleSelectorAction; | 144 class SetRuleSelectorAction; |
145 class AddRuleAction; | 145 class AddRuleAction; |
146 class EnableResourceClient; | 146 class EnableResourceClient; |
147 | 147 |
148 InspectorCSSAgent(InspectorDOMAgent*, InspectorPageAgent*, InspectorResource
Agent*); | 148 InspectorCSSAgent(InspectorDOMAgent*, InspectorPageAgent*, InspectorResource
Agent*); |
149 | 149 |
150 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee
t; | 150 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee
t; |
| 151 typedef HashMap<String, RefPtr<InspectorStyleSheetForInlineStyle> > IdToInsp
ectorStyleSheetForInlineStyle; |
151 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns
pectorStyleSheet; // bogus "stylesheets" with elements' inline styles | 152 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns
pectorStyleSheet; // bogus "stylesheets" with elements' inline styles |
152 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; | 153 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; |
153 | 154 |
154 void wasEnabled(PassRefPtr<EnableCallback>); | 155 void wasEnabled(PassRefPtr<EnableCallback>); |
155 void resetNonPersistentData(); | 156 void resetNonPersistentData(); |
156 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); | 157 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); |
157 Element* elementForId(ErrorString*, int nodeId); | 158 Element* elementForId(ErrorString*, int nodeId); |
158 void collectAllStyleSheets(Vector<InspectorStyleSheet*>&); | 159 void collectAllStyleSheets(Vector<InspectorStyleSheet*>&); |
159 void collectAllDocumentStyleSheets(Document*, Vector<CSSStyleSheet*>&); | 160 void collectAllDocumentStyleSheets(Document*, Vector<CSSStyleSheet*>&); |
160 void collectStyleSheets(CSSStyleSheet*, Vector<CSSStyleSheet*>&); | 161 void collectStyleSheets(CSSStyleSheet*, Vector<CSSStyleSheet*>&); |
161 | 162 |
162 void updateActiveStyleSheets(Document*, StyleSheetsUpdateType); | 163 void updateActiveStyleSheets(Document*, StyleSheetsUpdateType); |
163 void setActiveStyleSheets(Document*, const Vector<CSSStyleSheet*>&, StyleShe
etsUpdateType); | 164 void setActiveStyleSheets(Document*, const Vector<CSSStyleSheet*>&, StyleShe
etsUpdateType); |
164 | 165 |
165 void collectPlatformFontsForRenderer(RenderText*, HashCountedSet<String>*); | 166 void collectPlatformFontsForRenderer(RenderText*, HashCountedSet<String>*); |
166 | 167 |
167 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); | 168 InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); |
168 String unbindStyleSheet(InspectorStyleSheet*); | 169 String unbindStyleSheet(InspectorStyleSheet*); |
169 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); | 170 InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); |
170 InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&); | 171 InspectorStyleSheet* assertInspectorStyleSheetForId(ErrorString*, const Stri
ng&); |
| 172 InspectorStyleSheetBase* assertStyleSheetForId(ErrorString*, const String&); |
171 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty
leSheet, Document* ownerDocument); | 173 TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageSty
leSheet, Document* ownerDocument); |
172 bool styleSheetEditInProgress() const { return m_styleSheetsPendingMutation
|| m_styleDeclarationPendingMutation || m_isSettingStyleSheetText; } | 174 bool styleSheetEditInProgress() const { return m_styleSheetsPendingMutation
|| m_styleDeclarationPendingMutation || m_isSettingStyleSheetText; } |
173 | 175 |
174 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*); | 176 PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*); |
175 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > buildArrayForMa
tchedRuleList(CSSRuleList*, Element*); | 177 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > buildArrayForMa
tchedRuleList(CSSRuleList*, Element*); |
176 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element
*); | 178 PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element
*); |
177 | 179 |
178 // InspectorDOMAgent::DOMListener implementation | 180 // InspectorDOMAgent::DOMListener implementation |
179 virtual void didRemoveDocument(Document*) OVERRIDE; | 181 virtual void didRemoveDocument(Document*) OVERRIDE; |
180 virtual void didRemoveDOMNode(Node*) OVERRIDE; | 182 virtual void didRemoveDOMNode(Node*) OVERRIDE; |
181 virtual void didModifyDOMAttr(Element*) OVERRIDE; | 183 virtual void didModifyDOMAttr(Element*) OVERRIDE; |
182 | 184 |
183 // InspectorStyleSheet::Listener implementation | 185 // InspectorStyleSheet::Listener implementation |
184 virtual void styleSheetChanged(InspectorStyleSheet*) OVERRIDE; | 186 virtual void styleSheetChanged(InspectorStyleSheetBase*) OVERRIDE; |
185 virtual void willReparseStyleSheet() OVERRIDE; | 187 virtual void willReparseStyleSheet() OVERRIDE; |
186 virtual void didReparseStyleSheet() OVERRIDE; | 188 virtual void didReparseStyleSheet() OVERRIDE; |
187 | 189 |
188 void resetPseudoStates(); | 190 void resetPseudoStates(); |
189 | 191 |
190 InspectorFrontend::CSS* m_frontend; | 192 InspectorFrontend::CSS* m_frontend; |
191 InspectorDOMAgent* m_domAgent; | 193 InspectorDOMAgent* m_domAgent; |
192 InspectorPageAgent* m_pageAgent; | 194 InspectorPageAgent* m_pageAgent; |
193 InspectorResourceAgent* m_resourceAgent; | 195 InspectorResourceAgent* m_resourceAgent; |
194 | 196 |
195 IdToInspectorStyleSheet m_idToInspectorStyleSheet; | 197 IdToInspectorStyleSheet m_idToInspectorStyleSheet; |
| 198 IdToInspectorStyleSheetForInlineStyle m_idToInspectorStyleSheetForInlineStyl
e; |
196 HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > m_cssStyleSheetToInspe
ctorStyleSheet; | 199 HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > m_cssStyleSheetToInspe
ctorStyleSheet; |
197 typedef HashMap<Document*, OwnPtr<HashSet<CSSStyleSheet*> > > DocumentStyleS
heets; | 200 typedef HashMap<Document*, OwnPtr<HashSet<CSSStyleSheet*> > > DocumentStyleS
heets; |
198 DocumentStyleSheets m_documentToCSSStyleSheets; | 201 DocumentStyleSheets m_documentToCSSStyleSheets; |
199 HashSet<Document*> m_invalidatedDocuments; | 202 HashSet<Document*> m_invalidatedDocuments; |
200 | 203 |
201 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; | 204 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; |
202 HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > m_documentToViaInspe
ctorStyleSheet; // "via inspector" stylesheets | 205 HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > m_documentToViaInspe
ctorStyleSheet; // "via inspector" stylesheets |
203 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; | 206 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; |
204 | 207 |
205 RefPtrWillBePersistent<CSSStyleSheet> m_inspectorUserAgentStyleSheet; | 208 RefPtrWillBePersistent<CSSStyleSheet> m_inspectorUserAgentStyleSheet; |
206 | 209 |
207 int m_lastStyleSheetId; | 210 int m_lastStyleSheetId; |
208 int m_styleSheetsPendingMutation; | 211 int m_styleSheetsPendingMutation; |
209 bool m_styleDeclarationPendingMutation; | 212 bool m_styleDeclarationPendingMutation; |
210 bool m_creatingViaInspectorStyleSheet; | 213 bool m_creatingViaInspectorStyleSheet; |
211 bool m_isSettingStyleSheetText; | 214 bool m_isSettingStyleSheetText; |
212 | 215 |
213 friend class EnableResourceClient; | 216 friend class EnableResourceClient; |
214 friend class StyleSheetBinder; | 217 friend class StyleSheetBinder; |
215 }; | 218 }; |
216 | 219 |
217 | 220 |
218 } // namespace WebCore | 221 } // namespace WebCore |
219 | 222 |
220 #endif // !defined(InspectorCSSAgent_h) | 223 #endif // !defined(InspectorCSSAgent_h) |
OLD | NEW |