| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 class CharacterData; | 55 class CharacterData; |
| 56 class DOMEditor; | 56 class DOMEditor; |
| 57 class Document; | 57 class Document; |
| 58 class Element; | 58 class Element; |
| 59 class Event; | 59 class Event; |
| 60 class InspectorClient; | 60 class InspectorClient; |
| 61 class InspectorFrontend; | 61 class InspectorFrontend; |
| 62 class InspectorHistory; | 62 class InspectorHistory; |
| 63 class InspectorOverlay; | 63 class InspectorOverlay; |
| 64 class InspectorPageAgent; | 64 class InspectorPageAgent; |
| 65 class InspectorPageController; |
| 65 class HTMLElement; | 66 class HTMLElement; |
| 66 class InspectorState; | 67 class InspectorState; |
| 67 class InstrumentingAgents; | 68 class InstrumentingAgents; |
| 68 class NameNodeMap; | 69 class NameNodeMap; |
| 69 class Node; | 70 class Node; |
| 70 class PlatformTouchEvent; | 71 class PlatformTouchEvent; |
| 71 class RevalidateStyleAttributeTask; | 72 class RevalidateStyleAttributeTask; |
| 72 class ScriptValue; | 73 class ScriptValue; |
| 73 class ShadowRoot; | 74 class ShadowRoot; |
| 74 | 75 |
| 75 struct HighlightConfig; | 76 struct HighlightConfig; |
| 76 | 77 |
| 77 typedef String ErrorString; | 78 typedef String ErrorString; |
| 78 typedef int BackendNodeId; | 79 typedef int BackendNodeId; |
| 79 | 80 |
| 80 | 81 |
| 81 struct EventListenerInfo { | 82 struct EventListenerInfo { |
| 82 EventListenerInfo(Node* node, const AtomicString& eventType, const EventList
enerVector& eventListenerVector) | 83 EventListenerInfo(Node* node, const AtomicString& eventType, const EventList
enerVector& eventListenerVector) |
| 83 : node(node) | 84 : node(node) |
| 84 , eventType(eventType) | 85 , eventType(eventType) |
| 85 , eventListenerVector(eventListenerVector) | 86 , eventListenerVector(eventListenerVector) |
| 86 { | 87 { |
| 87 } | 88 } |
| 88 | 89 |
| 89 Node* node; | 90 Node* node; |
| 90 const AtomicString eventType; | 91 const AtomicString eventType; |
| 91 const EventListenerVector eventListenerVector; | 92 const EventListenerVector eventListenerVector; |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 class InspectorDOMAgent : public InspectorBaseAgent<InspectorDOMAgent>, public I
nspectorBackendDispatcher::DOMCommandHandler { | 95 class InspectorDOMAgent : public InspectorBaseAgent, public InspectorBackendDisp
atcher::DOMCommandHandler { |
| 95 WTF_MAKE_NONCOPYABLE(InspectorDOMAgent); | 96 WTF_MAKE_NONCOPYABLE(InspectorDOMAgent); |
| 96 public: | 97 public: |
| 97 struct DOMListener { | 98 struct DOMListener { |
| 98 virtual ~DOMListener() | 99 virtual ~DOMListener() |
| 99 { | 100 { |
| 100 } | 101 } |
| 101 virtual void didRemoveDocument(Document*) = 0; | 102 virtual void didRemoveDocument(Document*) = 0; |
| 102 virtual void didRemoveDOMNode(Node*) = 0; | 103 virtual void didRemoveDOMNode(Node*) = 0; |
| 103 virtual void didModifyDOMAttr(Element*) = 0; | 104 virtual void didModifyDOMAttr(Element*) = 0; |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumenti
ngAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* inspectorState
, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay, Inspe
ctorClient* client) | 107 static PassRefPtr<InspectorDOMAgent> create(InstrumentingAgents*, InspectorS
tate*, PassRefPtr<InspectorPageAgent>, InjectedScriptManager*, InspectorOverlay*
, InspectorClient*); |
| 107 { | |
| 108 return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, in
spectorState, injectedScriptManager, overlay, client)); | |
| 109 } | |
| 110 | 108 |
| 111 static String toErrorString(const ExceptionCode&); | 109 static String toErrorString(const ExceptionCode&); |
| 112 | 110 |
| 113 ~InspectorDOMAgent(); | 111 ~InspectorDOMAgent(); |
| 114 | 112 |
| 115 virtual void setFrontend(InspectorFrontend*); | 113 virtual void setFrontend(InspectorFrontend*); |
| 116 virtual void clearFrontend(); | 114 virtual void clearFrontend(); |
| 117 virtual void restore(); | 115 virtual void restore(); |
| 118 | 116 |
| 119 Vector<Document*> documents(); | 117 Vector<Document*> documents(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 static Node* innerNextSibling(Node*); | 197 static Node* innerNextSibling(Node*); |
| 200 static Node* innerPreviousSibling(Node*); | 198 static Node* innerPreviousSibling(Node*); |
| 201 static unsigned innerChildNodeCount(Node*); | 199 static unsigned innerChildNodeCount(Node*); |
| 202 static Node* innerParentNode(Node*); | 200 static Node* innerParentNode(Node*); |
| 203 static bool isWhitespace(Node*); | 201 static bool isWhitespace(Node*); |
| 204 | 202 |
| 205 Node* assertNode(ErrorString*, int nodeId); | 203 Node* assertNode(ErrorString*, int nodeId); |
| 206 Element* assertElement(ErrorString*, int nodeId); | 204 Element* assertElement(ErrorString*, int nodeId); |
| 207 Document* assertDocument(ErrorString*, int nodeId); | 205 Document* assertDocument(ErrorString*, int nodeId); |
| 208 | 206 |
| 209 // Methods called from other agents. | |
| 210 InspectorPageAgent* pageAgent() { return m_pageAgent; } | |
| 211 | |
| 212 private: | 207 private: |
| 213 InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorCompos
iteState*, InjectedScriptManager*, InspectorOverlay*, InspectorClient*); | 208 InspectorDOMAgent(InstrumentingAgents*, InspectorState*, PassRefPtr<Inspecto
rPageAgent>, InjectedScriptManager*, InspectorOverlay*, InspectorClient*); |
| 214 | 209 |
| 215 void setSearchingForNode(ErrorString*, bool enabled, InspectorObject* highli
ghtConfig); | 210 void setSearchingForNode(ErrorString*, bool enabled, InspectorObject* highli
ghtConfig); |
| 216 PassOwnPtr<HighlightConfig> highlightConfigFromInspectorObject(ErrorString*,
InspectorObject* highlightInspectorObject); | 211 PassOwnPtr<HighlightConfig> highlightConfigFromInspectorObject(ErrorString*,
InspectorObject* highlightInspectorObject); |
| 217 | 212 |
| 218 // Node-related methods. | 213 // Node-related methods. |
| 219 typedef HashMap<RefPtr<Node>, int> NodeToIdMap; | 214 typedef HashMap<RefPtr<Node>, int> NodeToIdMap; |
| 220 int bind(Node*, NodeToIdMap*); | 215 int bind(Node*, NodeToIdMap*); |
| 221 void unbind(Node*, NodeToIdMap*); | 216 void unbind(Node*, NodeToIdMap*); |
| 222 | 217 |
| 223 Node* assertEditableNode(ErrorString*, int nodeId); | 218 Node* assertEditableNode(ErrorString*, int nodeId); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 237 PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > buildArrayForContain
erChildren(Node* container, int depth, NodeToIdMap* nodesMap); | 232 PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > buildArrayForContain
erChildren(Node* container, int depth, NodeToIdMap* nodesMap); |
| 238 PassRefPtr<TypeBuilder::DOM::EventListener> buildObjectForEventListener(cons
t RegisteredEventListener&, const AtomicString& eventType, Node*, const String*
objectGroupId); | 233 PassRefPtr<TypeBuilder::DOM::EventListener> buildObjectForEventListener(cons
t RegisteredEventListener&, const AtomicString& eventType, Node*, const String*
objectGroupId); |
| 239 | 234 |
| 240 Node* nodeForPath(const String& path); | 235 Node* nodeForPath(const String& path); |
| 241 | 236 |
| 242 void discardBackendBindings(); | 237 void discardBackendBindings(); |
| 243 void discardFrontendBindings(); | 238 void discardFrontendBindings(); |
| 244 | 239 |
| 245 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<InspectorObject>
* color, const RefPtr<InspectorObject>* outlineColor); | 240 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<InspectorObject>
* color, const RefPtr<InspectorObject>* outlineColor); |
| 246 | 241 |
| 247 InspectorPageAgent* m_pageAgent; | 242 RefPtr<InspectorPageAgent> m_pageAgent; |
| 248 InjectedScriptManager* m_injectedScriptManager; | 243 InjectedScriptManager* m_injectedScriptManager; |
| 249 InspectorOverlay* m_overlay; | 244 InspectorOverlay* m_overlay; |
| 250 InspectorClient* m_client; | 245 InspectorClient* m_client; |
| 251 InspectorFrontend::DOM* m_frontend; | 246 InspectorFrontend::DOM* m_frontend; |
| 252 DOMListener* m_domListener; | 247 DOMListener* m_domListener; |
| 253 NodeToIdMap m_documentNodeToIdMap; | 248 NodeToIdMap m_documentNodeToIdMap; |
| 254 typedef HashMap<RefPtr<Node>, BackendNodeId> NodeToBackendIdMap; | 249 typedef HashMap<RefPtr<Node>, BackendNodeId> NodeToBackendIdMap; |
| 255 HashMap<String, NodeToBackendIdMap> m_nodeGroupToBackendIdMap; | 250 HashMap<String, NodeToBackendIdMap> m_nodeGroupToBackendIdMap; |
| 256 // Owns node mappings for dangling nodes. | 251 // Owns node mappings for dangling nodes. |
| 257 Vector<OwnPtr<NodeToIdMap> > m_danglingNodeToIdMaps; | 252 Vector<OwnPtr<NodeToIdMap> > m_danglingNodeToIdMaps; |
| 258 HashMap<int, Node*> m_idToNode; | 253 HashMap<int, Node*> m_idToNode; |
| 259 HashMap<int, NodeToIdMap*> m_idToNodesMap; | 254 HashMap<int, NodeToIdMap*> m_idToNodesMap; |
| 260 HashSet<int> m_childrenRequested; | 255 HashSet<int> m_childrenRequested; |
| 261 HashMap<BackendNodeId, std::pair<Node*, String> > m_backendIdToNode; | 256 HashMap<BackendNodeId, std::pair<Node*, String> > m_backendIdToNode; |
| 262 int m_lastNodeId; | 257 int m_lastNodeId; |
| 263 BackendNodeId m_lastBackendNodeId; | 258 BackendNodeId m_lastBackendNodeId; |
| 264 RefPtr<Document> m_document; | 259 RefPtr<Document> m_document; |
| 265 typedef HashMap<String, Vector<RefPtr<Node> > > SearchResults; | 260 typedef HashMap<String, Vector<RefPtr<Node> > > SearchResults; |
| 266 SearchResults m_searchResults; | 261 SearchResults m_searchResults; |
| 267 OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask; | 262 OwnPtr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask; |
| 268 bool m_searchingForNode; | 263 bool m_searchingForNode; |
| 269 OwnPtr<HighlightConfig> m_inspectModeHighlightConfig; | 264 OwnPtr<HighlightConfig> m_inspectModeHighlightConfig; |
| 270 OwnPtr<InspectorHistory> m_history; | 265 OwnPtr<InspectorHistory> m_history; |
| 271 OwnPtr<DOMEditor> m_domEditor; | 266 OwnPtr<DOMEditor> m_domEditor; |
| 272 bool m_suppressAttributeModifiedEvent; | 267 bool m_suppressAttributeModifiedEvent; |
| 273 }; | 268 }; |
| 274 | 269 |
| 275 | 270 |
| 271 class InspectorDOMController: public InspectorBaseController<InspectorDOMControl
ler, InspectorDOMAgent> { |
| 272 public: |
| 273 |
| 274 static PassOwnPtr<InspectorDOMController> create(InstrumentingAgents* instru
mentingAgents, InspectorCompositeState* compositeState, InspectorPageController*
pageController, InjectedScriptManager* injectedScriptManager, InspectorOverlay*
overlay, InspectorClient* client) |
| 275 { |
| 276 return adoptPtr(new InspectorDOMController(instrumentingAgents, composit
eState, pageController, injectedScriptManager, overlay, client)); |
| 277 } |
| 278 |
| 279 protected: |
| 280 InspectorDOMController(InstrumentingAgents*, InspectorCompositeState*, Inspe
ctorPageController*, InjectedScriptManager*, InspectorOverlay*, InspectorClient*
); |
| 281 }; |
| 282 |
| 276 } // namespace WebCore | 283 } // namespace WebCore |
| 277 | 284 |
| 278 #endif // !defined(InspectorDOMAgent_h) | 285 #endif // !defined(InspectorDOMAgent_h) |
| OLD | NEW |