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 20 matching lines...) Expand all Loading... |
31 #define InspectorDOMAgent_h | 31 #define InspectorDOMAgent_h |
32 | 32 |
33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
34 #include "core/InspectorFrontend.h" | 34 #include "core/InspectorFrontend.h" |
35 #include "core/events/EventListenerMap.h" | 35 #include "core/events/EventListenerMap.h" |
36 #include "core/inspector/InjectedScript.h" | 36 #include "core/inspector/InjectedScript.h" |
37 #include "core/inspector/InjectedScriptManager.h" | 37 #include "core/inspector/InjectedScriptManager.h" |
38 #include "core/inspector/InspectorBaseAgent.h" | 38 #include "core/inspector/InspectorBaseAgent.h" |
39 #include "core/style/ComputedStyleConstants.h" | 39 #include "core/style/ComputedStyleConstants.h" |
40 #include "platform/JSONValues.h" | 40 #include "platform/JSONValues.h" |
| 41 #include "platform/geometry/FloatQuad.h" |
41 | 42 |
42 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
43 #include "wtf/HashSet.h" | 44 #include "wtf/HashSet.h" |
44 #include "wtf/OwnPtr.h" | 45 #include "wtf/OwnPtr.h" |
45 #include "wtf/PassOwnPtr.h" | 46 #include "wtf/PassOwnPtr.h" |
46 #include "wtf/RefPtr.h" | 47 #include "wtf/RefPtr.h" |
47 #include "wtf/Vector.h" | 48 #include "wtf/Vector.h" |
48 #include "wtf/text/AtomicString.h" | 49 #include "wtf/text/AtomicString.h" |
49 | 50 |
50 namespace blink { | 51 namespace blink { |
51 | 52 |
52 class CharacterData; | 53 class CharacterData; |
53 class DOMEditor; | 54 class DOMEditor; |
54 class Document; | 55 class Document; |
55 class DocumentLoader; | 56 class DocumentLoader; |
56 class Element; | 57 class Element; |
57 class EventTarget; | 58 class EventTarget; |
58 class ExceptionState; | 59 class ExceptionState; |
59 class FloatQuad; | 60 class FloatQuad; |
60 class InsertionPoint; | 61 class InsertionPoint; |
61 class InspectorFrontend; | 62 class InspectorFrontend; |
62 class InspectorHistory; | 63 class InspectorHistory; |
63 class InspectorOverlay; | |
64 class InspectorPageAgent; | 64 class InspectorPageAgent; |
65 class Node; | 65 class Node; |
66 class QualifiedName; | 66 class QualifiedName; |
67 class PseudoElement; | 67 class PseudoElement; |
68 class PlatformGestureEvent; | 68 class PlatformGestureEvent; |
69 class PlatformMouseEvent; | 69 class PlatformMouseEvent; |
70 class PlatformTouchEvent; | 70 class PlatformTouchEvent; |
71 class InspectorRevalidateDOMTask; | 71 class InspectorRevalidateDOMTask; |
72 class ShadowRoot; | 72 class ShadowRoot; |
73 | 73 |
74 struct InspectorHighlightConfig; | 74 struct InspectorHighlightConfig; |
75 | 75 |
76 typedef String ErrorString; | 76 typedef String ErrorString; |
77 | 77 |
78 class CORE_EXPORT InspectorDOMAgent final : public InspectorBaseAgent<InspectorD
OMAgent, InspectorFrontend::DOM>, public InspectorBackendDispatcher::DOMCommandH
andler { | 78 class CORE_EXPORT InspectorDOMAgent final : public InspectorBaseAgent<InspectorD
OMAgent, InspectorFrontend::DOM>, public InspectorBackendDispatcher::DOMCommandH
andler { |
79 WTF_MAKE_NONCOPYABLE(InspectorDOMAgent); | 79 WTF_MAKE_NONCOPYABLE(InspectorDOMAgent); |
80 public: | 80 public: |
81 struct CORE_EXPORT DOMListener : public WillBeGarbageCollectedMixin { | 81 struct CORE_EXPORT DOMListener : public WillBeGarbageCollectedMixin { |
82 virtual ~DOMListener() | 82 virtual ~DOMListener() |
83 { | 83 { |
84 } | 84 } |
85 virtual void didRemoveDocument(Document*) = 0; | 85 virtual void didRemoveDocument(Document*) = 0; |
86 virtual void didRemoveDOMNode(Node*) = 0; | 86 virtual void didRemoveDOMNode(Node*) = 0; |
87 virtual void didModifyDOMAttr(Element*) = 0; | 87 virtual void didModifyDOMAttr(Element*) = 0; |
88 }; | 88 }; |
89 | 89 |
90 static PassOwnPtrWillBeRawPtr<InspectorDOMAgent> create(InspectorPageAgent*
pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overl
ay) | 90 class Client { |
| 91 public: |
| 92 virtual ~Client() { } |
| 93 virtual void setInspectModeEnabled(bool) { } |
| 94 virtual void hideHighlight() { } |
| 95 virtual void highlightNode(Node*, Node* eventTarget, const InspectorHigh
lightConfig&, bool omitTooltip) { } |
| 96 virtual void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlig
htConfig&) { } |
| 97 }; |
| 98 |
| 99 static PassOwnPtrWillBeRawPtr<InspectorDOMAgent> create(InspectorPageAgent*
pageAgent, InjectedScriptManager* injectedScriptManager, Client* client) |
91 { | 100 { |
92 return adoptPtrWillBeNoop(new InspectorDOMAgent(pageAgent, injectedScrip
tManager, overlay)); | 101 return adoptPtrWillBeNoop(new InspectorDOMAgent(pageAgent, injectedScrip
tManager, client)); |
93 } | 102 } |
94 | 103 |
95 static String toErrorString(ExceptionState&); | 104 static String toErrorString(ExceptionState&); |
96 static bool getPseudoElementType(PseudoId, TypeBuilder::DOM::PseudoType::Enu
m*); | 105 static bool getPseudoElementType(PseudoId, TypeBuilder::DOM::PseudoType::Enu
m*); |
97 | 106 |
98 ~InspectorDOMAgent() override; | 107 ~InspectorDOMAgent() override; |
99 DECLARE_VIRTUAL_TRACE(); | 108 DECLARE_VIRTUAL_TRACE(); |
100 | 109 |
101 void disable(ErrorString*) override; | 110 void disable(ErrorString*) override; |
102 void restore() override; | 111 void restore() override; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 static Node* innerParentNode(Node*); | 200 static Node* innerParentNode(Node*); |
192 static bool isWhitespace(Node*); | 201 static bool isWhitespace(Node*); |
193 | 202 |
194 Node* assertNode(ErrorString*, int nodeId); | 203 Node* assertNode(ErrorString*, int nodeId); |
195 Element* assertElement(ErrorString*, int nodeId); | 204 Element* assertElement(ErrorString*, int nodeId); |
196 Document* assertDocument(ErrorString*, int nodeId); | 205 Document* assertDocument(ErrorString*, int nodeId); |
197 | 206 |
198 private: | 207 private: |
199 enum SearchMode { NotSearching, SearchingForNormal, SearchingForUAShadow }; | 208 enum SearchMode { NotSearching, SearchingForNormal, SearchingForUAShadow }; |
200 | 209 |
201 InspectorDOMAgent(InspectorPageAgent*, InjectedScriptManager*, InspectorOver
lay*); | 210 InspectorDOMAgent(InspectorPageAgent*, InjectedScriptManager*, Client*); |
202 | 211 |
203 void setDocument(Document*); | 212 void setDocument(Document*); |
204 void innerEnable(); | 213 void innerEnable(); |
205 | 214 |
206 void setSearchingForNode(ErrorString*, SearchMode, JSONObject* highlightConf
ig); | 215 void setSearchingForNode(ErrorString*, SearchMode, JSONObject* highlightConf
ig); |
207 PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(Erro
rString*, JSONObject* highlightInspectorObject); | 216 PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(Erro
rString*, JSONObject* highlightInspectorObject); |
208 | 217 |
209 // Node-related methods. | 218 // Node-related methods. |
210 typedef WillBeHeapHashMap<RefPtrWillBeMember<Node>, int> NodeToIdMap; | 219 typedef WillBeHeapHashMap<RefPtrWillBeMember<Node>, int> NodeToIdMap; |
211 int bind(Node*, NodeToIdMap*); | 220 int bind(Node*, NodeToIdMap*); |
(...skipping 21 matching lines...) Expand all Loading... |
233 void discardFrontendBindings(); | 242 void discardFrontendBindings(); |
234 | 243 |
235 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<JSONObject>* col
or, const RefPtr<JSONObject>* outlineColor); | 244 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<JSONObject>* col
or, const RefPtr<JSONObject>* outlineColor); |
236 | 245 |
237 bool pushDocumentUponHandlelessOperation(ErrorString*); | 246 bool pushDocumentUponHandlelessOperation(ErrorString*); |
238 | 247 |
239 RawPtrWillBeMember<InspectorRevalidateDOMTask> revalidateTask(); | 248 RawPtrWillBeMember<InspectorRevalidateDOMTask> revalidateTask(); |
240 | 249 |
241 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; | 250 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; |
242 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; | 251 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; |
243 RawPtrWillBeMember<InspectorOverlay> m_overlay; | 252 Client* m_client; |
244 RawPtrWillBeMember<DOMListener> m_domListener; | 253 RawPtrWillBeMember<DOMListener> m_domListener; |
245 OwnPtrWillBeMember<NodeToIdMap> m_documentNodeToIdMap; | 254 OwnPtrWillBeMember<NodeToIdMap> m_documentNodeToIdMap; |
246 // Owns node mappings for dangling nodes. | 255 // Owns node mappings for dangling nodes. |
247 WillBeHeapVector<OwnPtrWillBeMember<NodeToIdMap> > m_danglingNodeToIdMaps; | 256 WillBeHeapVector<OwnPtrWillBeMember<NodeToIdMap> > m_danglingNodeToIdMaps; |
248 WillBeHeapHashMap<int, RawPtrWillBeMember<Node> > m_idToNode; | 257 WillBeHeapHashMap<int, RawPtrWillBeMember<Node> > m_idToNode; |
249 WillBeHeapHashMap<int, RawPtrWillBeMember<NodeToIdMap> > m_idToNodesMap; | 258 WillBeHeapHashMap<int, RawPtrWillBeMember<NodeToIdMap> > m_idToNodesMap; |
250 HashSet<int> m_childrenRequested; | 259 HashSet<int> m_childrenRequested; |
251 HashSet<int> m_distributedNodesRequested; | 260 HashSet<int> m_distributedNodesRequested; |
252 HashMap<int, int> m_cachedChildCount; | 261 HashMap<int, int> m_cachedChildCount; |
253 int m_lastNodeId; | 262 int m_lastNodeId; |
254 RefPtrWillBeMember<Document> m_document; | 263 RefPtrWillBeMember<Document> m_document; |
255 typedef WillBeHeapHashMap<String, WillBeHeapVector<RefPtrWillBeMember<Node>
> > SearchResults; | 264 typedef WillBeHeapHashMap<String, WillBeHeapVector<RefPtrWillBeMember<Node>
> > SearchResults; |
256 SearchResults m_searchResults; | 265 SearchResults m_searchResults; |
257 OwnPtrWillBeMember<InspectorRevalidateDOMTask> m_revalidateTask; | 266 OwnPtrWillBeMember<InspectorRevalidateDOMTask> m_revalidateTask; |
258 SearchMode m_searchingForNode; | 267 SearchMode m_searchingForNode; |
259 OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; | 268 OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; |
260 RefPtrWillBeMember<Node> m_hoveredNodeForInspectMode; | 269 RefPtrWillBeMember<Node> m_hoveredNodeForInspectMode; |
261 OwnPtrWillBeMember<InspectorHistory> m_history; | 270 OwnPtrWillBeMember<InspectorHistory> m_history; |
262 OwnPtrWillBeMember<DOMEditor> m_domEditor; | 271 OwnPtrWillBeMember<DOMEditor> m_domEditor; |
263 bool m_suppressAttributeModifiedEvent; | 272 bool m_suppressAttributeModifiedEvent; |
264 int m_backendNodeIdToInspect; | 273 int m_backendNodeIdToInspect; |
265 }; | 274 }; |
266 | 275 |
267 | 276 |
268 } // namespace blink | 277 } // namespace blink |
269 | 278 |
270 #endif // !defined(InspectorDOMAgent_h) | 279 #endif // !defined(InspectorDOMAgent_h) |
OLD | NEW |