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 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 highlightConfig->contentOutline = parseColor(outlineColor); | 1199 highlightConfig->contentOutline = parseColor(outlineColor); |
1200 m_overlay->highlightQuad(quad, *highlightConfig); | 1200 m_overlay->highlightQuad(quad, *highlightConfig); |
1201 } | 1201 } |
1202 | 1202 |
1203 void InspectorDOMAgent::highlightNode(ErrorString* errorString, const RefPtr<JSO
NObject>& highlightInspectorObject, const int* nodeId, const String* objectId) | 1203 void InspectorDOMAgent::highlightNode(ErrorString* errorString, const RefPtr<JSO
NObject>& highlightInspectorObject, const int* nodeId, const String* objectId) |
1204 { | 1204 { |
1205 Node* node = 0; | 1205 Node* node = 0; |
1206 if (nodeId) { | 1206 if (nodeId) { |
1207 node = assertNode(errorString, *nodeId); | 1207 node = assertNode(errorString, *nodeId); |
1208 } else if (objectId) { | 1208 } else if (objectId) { |
1209 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
orObjectId(*objectId); | 1209 InjectedScript& injectedScript = m_injectedScriptManager->injectedScript
ForObjectId(*objectId); |
1210 node = injectedScript.nodeForObjectId(*objectId); | 1210 node = injectedScript.nodeForObjectId(*objectId); |
1211 if (!node) | 1211 if (!node) |
1212 *errorString = "Node for given objectId not found"; | 1212 *errorString = "Node for given objectId not found"; |
1213 } else | 1213 } else |
1214 *errorString = "Either nodeId or objectId must be specified"; | 1214 *errorString = "Either nodeId or objectId must be specified"; |
1215 | 1215 |
1216 if (!node) | 1216 if (!node) |
1217 return; | 1217 return; |
1218 | 1218 |
1219 OwnPtr<HighlightConfig> highlightConfig = highlightConfigFromInspectorObject
(errorString, highlightInspectorObject.get()); | 1219 OwnPtr<HighlightConfig> highlightConfig = highlightConfigFromInspectorObject
(errorString, highlightInspectorObject.get()); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 { | 1405 { |
1406 Element* element = assertElement(errorString, nodeId); | 1406 Element* element = assertElement(errorString, nodeId); |
1407 if (!element) | 1407 if (!element) |
1408 return; | 1408 return; |
1409 | 1409 |
1410 result = buildArrayForElementAttributes(element); | 1410 result = buildArrayForElementAttributes(element); |
1411 } | 1411 } |
1412 | 1412 |
1413 void InspectorDOMAgent::requestNode(ErrorString*, const String& objectId, int* n
odeId) | 1413 void InspectorDOMAgent::requestNode(ErrorString*, const String& objectId, int* n
odeId) |
1414 { | 1414 { |
1415 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(objectId); | 1415 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO
bjectId(objectId); |
1416 Node* node = injectedScript.nodeForObjectId(objectId); | 1416 Node* node = injectedScript.nodeForObjectId(objectId); |
1417 if (node) | 1417 if (node) |
1418 *nodeId = pushNodePathToFrontend(node); | 1418 *nodeId = pushNodePathToFrontend(node); |
1419 else | 1419 else |
1420 *nodeId = 0; | 1420 *nodeId = 0; |
1421 } | 1421 } |
1422 | 1422 |
1423 // static | 1423 // static |
1424 String InspectorDOMAgent::documentURLString(Document* document) | 1424 String InspectorDOMAgent::documentURLString(Document* document) |
1425 { | 1425 { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 .setNodeId(pushNodePathToFrontend(node)) | 1623 .setNodeId(pushNodePathToFrontend(node)) |
1624 .setHandlerBody(eventListenerHandlerBody(&document, eventListener.get())
) | 1624 .setHandlerBody(eventListenerHandlerBody(&document, eventListener.get())
) |
1625 .setLocation(location); | 1625 .setLocation(location); |
1626 if (objectGroupId) { | 1626 if (objectGroupId) { |
1627 ScriptValue functionValue = eventListenerHandler(&document, eventListene
r.get()); | 1627 ScriptValue functionValue = eventListenerHandler(&document, eventListene
r.get()); |
1628 if (!functionValue.isEmpty()) { | 1628 if (!functionValue.isEmpty()) { |
1629 LocalFrame* frame = document.frame(); | 1629 LocalFrame* frame = document.frame(); |
1630 if (frame) { | 1630 if (frame) { |
1631 ScriptState* scriptState = eventListenerHandlerScriptState(frame
, eventListener.get()); | 1631 ScriptState* scriptState = eventListenerHandlerScriptState(frame
, eventListener.get()); |
1632 if (scriptState) { | 1632 if (scriptState) { |
1633 InjectedScript injectedScript = m_injectedScriptManager->inj
ectedScriptFor(scriptState); | 1633 InjectedScript& injectedScript = m_injectedScriptManager->in
jectedScriptFor(scriptState); |
1634 if (!injectedScript.isEmpty()) { | 1634 if (!injectedScript.isEmpty()) { |
1635 RefPtr<TypeBuilder::Runtime::RemoteObject> valueJson = i
njectedScript.wrapObject(functionValue, *objectGroupId); | 1635 RefPtr<TypeBuilder::Runtime::RemoteObject> valueJson = i
njectedScript.wrapObject(functionValue, *objectGroupId); |
1636 value->setHandler(valueJson); | 1636 value->setHandler(valueJson); |
1637 } | 1637 } |
1638 } | 1638 } |
1639 } | 1639 } |
1640 } | 1640 } |
1641 } | 1641 } |
1642 if (!sourceName.isEmpty()) | 1642 if (!sourceName.isEmpty()) |
1643 value->setSourceName(sourceName); | 1643 value->setSourceName(sourceName); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 *relayoutBoundaryNodeId = pushNodePathToFrontend(resultNode); | 2045 *relayoutBoundaryNodeId = pushNodePathToFrontend(resultNode); |
2046 } | 2046 } |
2047 | 2047 |
2048 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(No
de* node, const String& objectGroup) | 2048 PassRefPtr<TypeBuilder::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(No
de* node, const String& objectGroup) |
2049 { | 2049 { |
2050 Document* document = node->isDocumentNode() ? &node->document() : node->owne
rDocument(); | 2050 Document* document = node->isDocumentNode() ? &node->document() : node->owne
rDocument(); |
2051 LocalFrame* frame = document ? document->frame() : 0; | 2051 LocalFrame* frame = document ? document->frame() : 0; |
2052 if (!frame) | 2052 if (!frame) |
2053 return nullptr; | 2053 return nullptr; |
2054 | 2054 |
2055 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(V
8ScriptState::forMainWorld(frame)); | 2055 V8InjectedScript* injectedScript = static_cast<V8InjectedScript*>(&m_injecte
dScriptManager->injectedScriptFor(V8ScriptState::forMainWorld(frame))); |
2056 if (injectedScript.isEmpty()) | 2056 if (injectedScript->isEmpty()) |
2057 return nullptr; | 2057 return nullptr; |
2058 | 2058 |
2059 return injectedScript.wrapNode(node, objectGroup); | 2059 return injectedScript->wrapNode(node, objectGroup); |
2060 } | 2060 } |
2061 | 2061 |
2062 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt
ring) | 2062 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt
ring) |
2063 { | 2063 { |
2064 if (!m_documentNodeToIdMap.contains(m_document)) { | 2064 if (!m_documentNodeToIdMap.contains(m_document)) { |
2065 RefPtr<TypeBuilder::DOM::Node> root; | 2065 RefPtr<TypeBuilder::DOM::Node> root; |
2066 getDocument(errorString, root); | 2066 getDocument(errorString, root); |
2067 return errorString->isEmpty(); | 2067 return errorString->isEmpty(); |
2068 } | 2068 } |
2069 return true; | 2069 return true; |
2070 } | 2070 } |
2071 | 2071 |
2072 } // namespace WebCore | 2072 } // namespace WebCore |
2073 | 2073 |
OLD | NEW |