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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 virtual void didModifyDOMAttr(Element*) = 0; | 87 virtual void didModifyDOMAttr(Element*) = 0; |
88 }; | 88 }; |
89 | 89 |
90 class Client { | 90 class Client { |
91 public: | 91 public: |
92 virtual ~Client() { } | 92 virtual ~Client() { } |
93 virtual void setInspectModeEnabled(bool) { } | 93 virtual void setInspectModeEnabled(bool) { } |
94 virtual void hideHighlight() { } | 94 virtual void hideHighlight() { } |
95 virtual void highlightNode(Node*, Node* eventTarget, const InspectorHigh
lightConfig&, bool omitTooltip) { } | 95 virtual void highlightNode(Node*, Node* eventTarget, const InspectorHigh
lightConfig&, bool omitTooltip) { } |
96 virtual void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlig
htConfig&) { } | 96 virtual void highlightQuad(PassOwnPtr<FloatQuad>, const InspectorHighlig
htConfig&) { } |
| 97 virtual void showLayoutEditorForNode(Node*, const InspectorHighlightConf
ig&) { } |
97 }; | 98 }; |
98 | 99 |
99 static PassOwnPtrWillBeRawPtr<InspectorDOMAgent> create(InspectorPageAgent*
pageAgent, InjectedScriptManager* injectedScriptManager, Client* client) | 100 static PassOwnPtrWillBeRawPtr<InspectorDOMAgent> create(InspectorPageAgent*
pageAgent, InjectedScriptManager* injectedScriptManager, Client* client) |
100 { | 101 { |
101 return adoptPtrWillBeNoop(new InspectorDOMAgent(pageAgent, injectedScrip
tManager, client)); | 102 return adoptPtrWillBeNoop(new InspectorDOMAgent(pageAgent, injectedScrip
tManager, client)); |
102 } | 103 } |
103 | 104 |
104 static String toErrorString(ExceptionState&); | 105 static String toErrorString(ExceptionState&); |
105 static bool getPseudoElementType(PseudoId, TypeBuilder::DOM::PseudoType::Enu
m*); | 106 static bool getPseudoElementType(PseudoId, TypeBuilder::DOM::PseudoType::Enu
m*); |
106 | 107 |
(...skipping 18 matching lines...) Expand all Loading... |
125 void removeNode(ErrorString*, int nodeId) override; | 126 void removeNode(ErrorString*, int nodeId) override; |
126 void setNodeName(ErrorString*, int nodeId, const String& name, int* newId) o
verride; | 127 void setNodeName(ErrorString*, int nodeId, const String& name, int* newId) o
verride; |
127 void getOuterHTML(ErrorString*, int nodeId, WTF::String* outerHTML) override
; | 128 void getOuterHTML(ErrorString*, int nodeId, WTF::String* outerHTML) override
; |
128 void setOuterHTML(ErrorString*, int nodeId, const String& outerHTML) overrid
e; | 129 void setOuterHTML(ErrorString*, int nodeId, const String& outerHTML) overrid
e; |
129 void setNodeValue(ErrorString*, int nodeId, const String& value) override; | 130 void setNodeValue(ErrorString*, int nodeId, const String& value) override; |
130 void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, const
bool* includeUserAgentShadowDOM, String* searchId, int* resultCount) override; | 131 void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, const
bool* includeUserAgentShadowDOM, String* searchId, int* resultCount) override; |
131 void getSearchResults(ErrorString*, const String& searchId, int fromIndex, i
nt toIndex, RefPtr<TypeBuilder::Array<int>>&) override; | 132 void getSearchResults(ErrorString*, const String& searchId, int fromIndex, i
nt toIndex, RefPtr<TypeBuilder::Array<int>>&) override; |
132 void discardSearchResults(ErrorString*, const String& searchId) override; | 133 void discardSearchResults(ErrorString*, const String& searchId) override; |
133 void resolveNode(ErrorString*, int nodeId, const String* objectGroup, RefPtr
<TypeBuilder::Runtime::RemoteObject>& result) override; | 134 void resolveNode(ErrorString*, int nodeId, const String* objectGroup, RefPtr
<TypeBuilder::Runtime::RemoteObject>& result) override; |
134 void getAttributes(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<Strin
g>>& result) override; | 135 void getAttributes(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<Strin
g>>& result) override; |
135 void setInspectModeEnabled(ErrorString*, bool enabled, const bool* inspectUA
ShadowDOM, const RefPtr<JSONObject>* highlightConfig) override; | 136 void setInspectModeEnabled(ErrorString*, bool enabled, const String* mode, c
onst RefPtr<JSONObject>* highlightConfig) override; |
136 void requestNode(ErrorString*, const String& objectId, int* nodeId) override
; | 137 void requestNode(ErrorString*, const String& objectId, int* nodeId) override
; |
137 void pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId)
override; | 138 void pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId)
override; |
138 void pushNodesByBackendIdsToFrontend(ErrorString*, const RefPtr<JSONArray>&
nodeIds, RefPtr<TypeBuilder::Array<int>>&) override; | 139 void pushNodesByBackendIdsToFrontend(ErrorString*, const RefPtr<JSONArray>&
nodeIds, RefPtr<TypeBuilder::Array<int>>&) override; |
139 void setInspectedNode(ErrorString*, int nodeId) override; | 140 void setInspectedNode(ErrorString*, int nodeId) override; |
140 void hideHighlight(ErrorString*) override; | 141 void hideHighlight(ErrorString*) override; |
141 void highlightRect(ErrorString*, int x, int y, int width, int height, const
RefPtr<JSONObject>* color, const RefPtr<JSONObject>* outlineColor) override; | 142 void highlightRect(ErrorString*, int x, int y, int width, int height, const
RefPtr<JSONObject>* color, const RefPtr<JSONObject>* outlineColor) override; |
142 void highlightQuad(ErrorString*, const RefPtr<JSONArray>& quad, const RefPtr
<JSONObject>* color, const RefPtr<JSONObject>* outlineColor) override; | 143 void highlightQuad(ErrorString*, const RefPtr<JSONArray>& quad, const RefPtr
<JSONObject>* color, const RefPtr<JSONObject>* outlineColor) override; |
143 void highlightNode(ErrorString*, const RefPtr<JSONObject>& highlightConfig,
const int* nodeId, const int* backendNodeId, const String* objectId) override; | 144 void highlightNode(ErrorString*, const RefPtr<JSONObject>& highlightConfig,
const int* nodeId, const int* backendNodeId, const String* objectId) override; |
144 void highlightFrame(ErrorString*, const String& frameId, const RefPtr<JSONOb
ject>* color, const RefPtr<JSONObject>* outlineColor) override; | 145 void highlightFrame(ErrorString*, const String& frameId, const RefPtr<JSONOb
ject>* color, const RefPtr<JSONObject>* outlineColor) override; |
145 | 146 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 static String documentURLString(Document*); | 185 static String documentURLString(Document*); |
185 | 186 |
186 PassRefPtr<TypeBuilder::Runtime::RemoteObject> resolveNode(Node*, const Stri
ng& objectGroup); | 187 PassRefPtr<TypeBuilder::Runtime::RemoteObject> resolveNode(Node*, const Stri
ng& objectGroup); |
187 bool handleMousePress(); | 188 bool handleMousePress(); |
188 bool handleGestureEvent(LocalFrame*, const PlatformGestureEvent&); | 189 bool handleGestureEvent(LocalFrame*, const PlatformGestureEvent&); |
189 bool handleTouchEvent(LocalFrame*, const PlatformTouchEvent&); | 190 bool handleTouchEvent(LocalFrame*, const PlatformTouchEvent&); |
190 bool handleMouseMove(LocalFrame*, const PlatformMouseEvent&); | 191 bool handleMouseMove(LocalFrame*, const PlatformMouseEvent&); |
191 | 192 |
192 InspectorHistory* history() { return m_history.get(); } | 193 InspectorHistory* history() { return m_history.get(); } |
193 | 194 |
| 195 void resumeSearchingForNode(Node*); |
| 196 |
194 // We represent embedded doms as a part of the same hierarchy. Hence we trea
t children of frame owners differently. | 197 // 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. | 198 // We also skip whitespace text nodes conditionally. Following methods encap
sulate these specifics. |
196 static Node* innerFirstChild(Node*); | 199 static Node* innerFirstChild(Node*); |
197 static Node* innerNextSibling(Node*); | 200 static Node* innerNextSibling(Node*); |
198 static Node* innerPreviousSibling(Node*); | 201 static Node* innerPreviousSibling(Node*); |
199 static unsigned innerChildNodeCount(Node*); | 202 static unsigned innerChildNodeCount(Node*); |
200 static Node* innerParentNode(Node*); | 203 static Node* innerParentNode(Node*); |
201 static bool isWhitespace(Node*); | 204 static bool isWhitespace(Node*); |
202 | 205 |
203 Node* assertNode(ErrorString*, int nodeId); | 206 Node* assertNode(ErrorString*, int nodeId); |
204 Element* assertElement(ErrorString*, int nodeId); | 207 Element* assertElement(ErrorString*, int nodeId); |
205 Document* assertDocument(ErrorString*, int nodeId); | 208 Document* assertDocument(ErrorString*, int nodeId); |
206 | 209 |
207 private: | 210 private: |
208 enum SearchMode { NotSearching, SearchingForNormal, SearchingForUAShadow }; | 211 enum SearchMode { NotSearching, SearchingForNormal, SearchingForUAShadow, Se
archingInLayoutEditor }; |
209 | 212 |
210 InspectorDOMAgent(InspectorPageAgent*, InjectedScriptManager*, Client*); | 213 InspectorDOMAgent(InspectorPageAgent*, InjectedScriptManager*, Client*); |
211 | 214 |
212 void setDocument(Document*); | 215 void setDocument(Document*); |
213 void innerEnable(); | 216 void innerEnable(); |
214 | 217 |
215 void setSearchingForNode(ErrorString*, SearchMode, JSONObject* highlightConf
ig); | 218 void setSearchingForNode(ErrorString*, SearchMode, JSONObject* highlightConf
ig); |
216 PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(Erro
rString*, JSONObject* highlightInspectorObject); | 219 PassOwnPtr<InspectorHighlightConfig> highlightConfigFromInspectorObject(Erro
rString*, JSONObject* highlightInspectorObject); |
217 | 220 |
218 // Node-related methods. | 221 // Node-related methods. |
(...skipping 20 matching lines...) Expand all Loading... |
239 Node* nodeForPath(const String& path); | 242 Node* nodeForPath(const String& path); |
240 Node* nodeForRemoteId(ErrorString*, const String& id); | 243 Node* nodeForRemoteId(ErrorString*, const String& id); |
241 | 244 |
242 void discardFrontendBindings(); | 245 void discardFrontendBindings(); |
243 | 246 |
244 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<JSONObject>* col
or, const RefPtr<JSONObject>* outlineColor); | 247 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<JSONObject>* col
or, const RefPtr<JSONObject>* outlineColor); |
245 | 248 |
246 bool pushDocumentUponHandlelessOperation(ErrorString*); | 249 bool pushDocumentUponHandlelessOperation(ErrorString*); |
247 | 250 |
248 RawPtrWillBeMember<InspectorRevalidateDOMTask> revalidateTask(); | 251 RawPtrWillBeMember<InspectorRevalidateDOMTask> revalidateTask(); |
| 252 bool shouldHandleInputEvents(); |
249 | 253 |
250 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; | 254 RawPtrWillBeMember<InspectorPageAgent> m_pageAgent; |
251 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; | 255 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; |
252 Client* m_client; | 256 Client* m_client; |
253 RawPtrWillBeMember<DOMListener> m_domListener; | 257 RawPtrWillBeMember<DOMListener> m_domListener; |
254 OwnPtrWillBeMember<NodeToIdMap> m_documentNodeToIdMap; | 258 OwnPtrWillBeMember<NodeToIdMap> m_documentNodeToIdMap; |
255 // Owns node mappings for dangling nodes. | 259 // Owns node mappings for dangling nodes. |
256 WillBeHeapVector<OwnPtrWillBeMember<NodeToIdMap> > m_danglingNodeToIdMaps; | 260 WillBeHeapVector<OwnPtrWillBeMember<NodeToIdMap> > m_danglingNodeToIdMaps; |
257 WillBeHeapHashMap<int, RawPtrWillBeMember<Node> > m_idToNode; | 261 WillBeHeapHashMap<int, RawPtrWillBeMember<Node> > m_idToNode; |
258 WillBeHeapHashMap<int, RawPtrWillBeMember<NodeToIdMap> > m_idToNodesMap; | 262 WillBeHeapHashMap<int, RawPtrWillBeMember<NodeToIdMap> > m_idToNodesMap; |
259 HashSet<int> m_childrenRequested; | 263 HashSet<int> m_childrenRequested; |
260 HashSet<int> m_distributedNodesRequested; | 264 HashSet<int> m_distributedNodesRequested; |
261 HashMap<int, int> m_cachedChildCount; | 265 HashMap<int, int> m_cachedChildCount; |
262 int m_lastNodeId; | 266 int m_lastNodeId; |
263 RefPtrWillBeMember<Document> m_document; | 267 RefPtrWillBeMember<Document> m_document; |
264 typedef WillBeHeapHashMap<String, WillBeHeapVector<RefPtrWillBeMember<Node>
> > SearchResults; | 268 typedef WillBeHeapHashMap<String, WillBeHeapVector<RefPtrWillBeMember<Node>
> > SearchResults; |
265 SearchResults m_searchResults; | 269 SearchResults m_searchResults; |
266 OwnPtrWillBeMember<InspectorRevalidateDOMTask> m_revalidateTask; | 270 OwnPtrWillBeMember<InspectorRevalidateDOMTask> m_revalidateTask; |
267 SearchMode m_searchingForNode; | 271 SearchMode m_searchingForNode; |
268 OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; | 272 OwnPtr<InspectorHighlightConfig> m_inspectModeHighlightConfig; |
269 RefPtrWillBeMember<Node> m_hoveredNodeForInspectMode; | 273 RefPtrWillBeMember<Node> m_hoveredNodeForInspectMode; |
270 OwnPtrWillBeMember<InspectorHistory> m_history; | 274 OwnPtrWillBeMember<InspectorHistory> m_history; |
271 OwnPtrWillBeMember<DOMEditor> m_domEditor; | 275 OwnPtrWillBeMember<DOMEditor> m_domEditor; |
272 bool m_suppressAttributeModifiedEvent; | 276 bool m_suppressAttributeModifiedEvent; |
273 int m_backendNodeIdToInspect; | 277 int m_backendNodeIdToInspect; |
| 278 bool m_layoutEditorEnabled; |
274 }; | 279 }; |
275 | 280 |
276 | 281 |
277 } // namespace blink | 282 } // namespace blink |
278 | 283 |
279 #endif // !defined(InspectorDOMAgent_h) | 284 #endif // !defined(InspectorDOMAgent_h) |
OLD | NEW |