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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 enum SearchMode { NotSearching, SearchingForNormal, SearchingForUAShadow }; |
| 91 |
90 class Client { | 92 class Client { |
91 public: | 93 public: |
92 virtual ~Client() { } | 94 virtual ~Client() { } |
93 virtual void setInspectModeEnabled(bool) { } | |
94 virtual void hideHighlight() { } | 95 virtual void hideHighlight() { } |
95 virtual void highlightNode(Node*, Node* eventTarget, const InspectorHigh
lightConfig&, bool omitTooltip) { } | 96 virtual void highlightNode(Node*, const InspectorHighlightConfig&, bool
omitTooltip) { } |
96 virtual void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlig
htConfig&) { } | 97 virtual void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlig
htConfig&) { } |
| 98 virtual void setInspectMode(SearchMode searchMode, PassOwnPtr<InspectorH
ighlightConfig>) { } |
97 }; | 99 }; |
98 | 100 |
99 static PassOwnPtrWillBeRawPtr<InspectorDOMAgent> create(InspectorPageAgent*
pageAgent, InjectedScriptManager* injectedScriptManager, Client* client) | 101 static PassOwnPtrWillBeRawPtr<InspectorDOMAgent> create(InspectorPageAgent*
pageAgent, InjectedScriptManager* injectedScriptManager, Client* client) |
100 { | 102 { |
101 return adoptPtrWillBeNoop(new InspectorDOMAgent(pageAgent, injectedScrip
tManager, client)); | 103 return adoptPtrWillBeNoop(new InspectorDOMAgent(pageAgent, injectedScrip
tManager, client)); |
102 } | 104 } |
103 | 105 |
104 static String toErrorString(ExceptionState&); | 106 static String toErrorString(ExceptionState&); |
105 static bool getPseudoElementType(PseudoId, TypeBuilder::DOM::PseudoType::Enu
m*); | 107 static bool getPseudoElementType(PseudoId, TypeBuilder::DOM::PseudoType::Enu
m*); |
| 108 static ShadowRoot* userAgentShadowRoot(Node*); |
106 | 109 |
107 ~InspectorDOMAgent() override; | 110 ~InspectorDOMAgent() override; |
108 DECLARE_VIRTUAL_TRACE(); | 111 DECLARE_VIRTUAL_TRACE(); |
109 | 112 |
110 void disable(ErrorString*) override; | 113 void disable(ErrorString*) override; |
111 void restore() override; | 114 void restore() override; |
112 | 115 |
113 WillBeHeapVector<RawPtrWillBeMember<Document> > documents(); | 116 WillBeHeapVector<RawPtrWillBeMember<Document> > documents(); |
114 void reset(); | 117 void reset(); |
115 | 118 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void pseudoElementDestroyed(PseudoElement*); | 180 void pseudoElementDestroyed(PseudoElement*); |
178 | 181 |
179 Node* nodeForId(int nodeId); | 182 Node* nodeForId(int nodeId); |
180 int boundNodeId(Node*); | 183 int boundNodeId(Node*); |
181 void setDOMListener(DOMListener*); | 184 void setDOMListener(DOMListener*); |
182 void inspect(Node*); | 185 void inspect(Node*); |
183 | 186 |
184 static String documentURLString(Document*); | 187 static String documentURLString(Document*); |
185 | 188 |
186 PassRefPtr<TypeBuilder::Runtime::RemoteObject> resolveNode(Node*, const Stri
ng& objectGroup); | 189 PassRefPtr<TypeBuilder::Runtime::RemoteObject> resolveNode(Node*, const Stri
ng& objectGroup); |
187 bool handleMousePress(); | |
188 bool handleGestureEvent(LocalFrame*, const PlatformGestureEvent&); | |
189 bool handleTouchEvent(LocalFrame*, const PlatformTouchEvent&); | |
190 bool handleMouseMove(LocalFrame*, const PlatformMouseEvent&); | |
191 | 190 |
192 InspectorHistory* history() { return m_history.get(); } | 191 InspectorHistory* history() { return m_history.get(); } |
193 | 192 |
194 // We represent embedded doms as a part of the same hierarchy. Hence we trea
t children of frame owners differently. | 193 // We represent embedded doms as a part of the same hierarchy. Hence we trea
t children of frame owners differently. |
195 // We also skip whitespace text nodes conditionally. Following methods encap
sulate these specifics. | 194 // We also skip whitespace text nodes conditionally. Following methods encap
sulate these specifics. |
196 static Node* innerFirstChild(Node*); | 195 static Node* innerFirstChild(Node*); |
197 static Node* innerNextSibling(Node*); | 196 static Node* innerNextSibling(Node*); |
198 static Node* innerPreviousSibling(Node*); | 197 static Node* innerPreviousSibling(Node*); |
199 static unsigned innerChildNodeCount(Node*); | 198 static unsigned innerChildNodeCount(Node*); |
200 static Node* innerParentNode(Node*); | 199 static Node* innerParentNode(Node*); |
201 static bool isWhitespace(Node*); | 200 static bool isWhitespace(Node*); |
202 | 201 |
203 Node* assertNode(ErrorString*, int nodeId); | 202 Node* assertNode(ErrorString*, int nodeId); |
204 Element* assertElement(ErrorString*, int nodeId); | 203 Element* assertElement(ErrorString*, int nodeId); |
205 Document* assertDocument(ErrorString*, int nodeId); | 204 Document* assertDocument(ErrorString*, int nodeId); |
206 | 205 |
207 private: | 206 private: |
208 enum SearchMode { NotSearching, SearchingForNormal, SearchingForUAShadow }; | |
209 | |
210 InspectorDOMAgent(InspectorPageAgent*, InjectedScriptManager*, Client*); | 207 InspectorDOMAgent(InspectorPageAgent*, InjectedScriptManager*, Client*); |
211 | 208 |
212 void setDocument(Document*); | 209 void setDocument(Document*); |
213 void innerEnable(); | 210 void innerEnable(); |
214 | 211 |
215 void setSearchingForNode(ErrorString*, SearchMode, JSONObject* highlightConf
ig); | 212 void setSearchingForNode(ErrorString*, SearchMode, JSONObject* highlightConf
ig); |
216 PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(Erro
rString*, JSONObject* highlightInspectorObject); | 213 PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(Erro
rString*, JSONObject* highlightInspectorObject); |
217 | 214 |
218 // Node-related methods. | 215 // Node-related methods. |
219 typedef WillBeHeapHashMap<RefPtrWillBeMember<Node>, int> NodeToIdMap; | 216 typedef WillBeHeapHashMap<RefPtrWillBeMember<Node>, int> NodeToIdMap; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 WillBeHeapHashMap<int, RawPtrWillBeMember<Node> > m_idToNode; | 254 WillBeHeapHashMap<int, RawPtrWillBeMember<Node> > m_idToNode; |
258 WillBeHeapHashMap<int, RawPtrWillBeMember<NodeToIdMap> > m_idToNodesMap; | 255 WillBeHeapHashMap<int, RawPtrWillBeMember<NodeToIdMap> > m_idToNodesMap; |
259 HashSet<int> m_childrenRequested; | 256 HashSet<int> m_childrenRequested; |
260 HashSet<int> m_distributedNodesRequested; | 257 HashSet<int> m_distributedNodesRequested; |
261 HashMap<int, int> m_cachedChildCount; | 258 HashMap<int, int> m_cachedChildCount; |
262 int m_lastNodeId; | 259 int m_lastNodeId; |
263 RefPtrWillBeMember<Document> m_document; | 260 RefPtrWillBeMember<Document> m_document; |
264 typedef WillBeHeapHashMap<String, WillBeHeapVector<RefPtrWillBeMember<Node>
> > SearchResults; | 261 typedef WillBeHeapHashMap<String, WillBeHeapVector<RefPtrWillBeMember<Node>
> > SearchResults; |
265 SearchResults m_searchResults; | 262 SearchResults m_searchResults; |
266 OwnPtrWillBeMember<InspectorRevalidateDOMTask> m_revalidateTask; | 263 OwnPtrWillBeMember<InspectorRevalidateDOMTask> m_revalidateTask; |
267 SearchMode m_searchingForNode; | |
268 OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; | |
269 RefPtrWillBeMember<Node> m_hoveredNodeForInspectMode; | |
270 OwnPtrWillBeMember<InspectorHistory> m_history; | 264 OwnPtrWillBeMember<InspectorHistory> m_history; |
271 OwnPtrWillBeMember<DOMEditor> m_domEditor; | 265 OwnPtrWillBeMember<DOMEditor> m_domEditor; |
272 bool m_suppressAttributeModifiedEvent; | 266 bool m_suppressAttributeModifiedEvent; |
273 int m_backendNodeIdToInspect; | 267 int m_backendNodeIdToInspect; |
274 }; | 268 }; |
275 | 269 |
276 | 270 |
277 } // namespace blink | 271 } // namespace blink |
278 | 272 |
279 #endif // !defined(InspectorDOMAgent_h) | 273 #endif // !defined(InspectorDOMAgent_h) |
OLD | NEW |