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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 Node* node = result.innerPossiblyPseudoNode(); | 1357 Node* node = result.innerPossiblyPseudoNode(); |
1358 while (node && node->getNodeType() == Node::TEXT_NODE) | 1358 while (node && node->getNodeType() == Node::TEXT_NODE) |
1359 node = node->parentNode(); | 1359 node = node->parentNode(); |
1360 if (!node) { | 1360 if (!node) { |
1361 *errorString = "No node found at given location"; | 1361 *errorString = "No node found at given location"; |
1362 return; | 1362 return; |
1363 } | 1363 } |
1364 *nodeId = pushNodePathToFrontend(node); | 1364 *nodeId = pushNodePathToFrontend(node); |
1365 } | 1365 } |
1366 | 1366 |
1367 void InspectorDOMAgent::resolveNode(ErrorString* errorString, int nodeId, const
Maybe<String>& objectGroup, std::unique_ptr<protocol::Runtime::RemoteObject>* re
sult) | 1367 void InspectorDOMAgent::resolveNode(ErrorString* errorString, int nodeId, const
Maybe<String>& objectGroup, std::unique_ptr<protocol::Runtime::API::RemoteObject
>* result) |
1368 { | 1368 { |
1369 String objectGroupName = objectGroup.fromMaybe(""); | 1369 String objectGroupName = objectGroup.fromMaybe(""); |
1370 Node* node = nodeForId(nodeId); | 1370 Node* node = nodeForId(nodeId); |
1371 if (!node) { | 1371 if (!node) { |
1372 *errorString = "No node with given id found"; | 1372 *errorString = "No node with given id found"; |
1373 return; | 1373 return; |
1374 } | 1374 } |
1375 *result = resolveNode(node, objectGroupName); | 1375 *result = resolveNode(node, objectGroupName); |
1376 if (!*result) | 1376 if (!*result) |
1377 *errorString = "Node with given id does not belong to the document"; | 1377 *errorString = "Node with given id does not belong to the document"; |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 | 2034 |
2035 void InspectorDOMAgent::getHighlightObjectForTest(ErrorString* errorString, int
nodeId, std::unique_ptr<protocol::DictionaryValue>* result) | 2035 void InspectorDOMAgent::getHighlightObjectForTest(ErrorString* errorString, int
nodeId, std::unique_ptr<protocol::DictionaryValue>* result) |
2036 { | 2036 { |
2037 Node* node = assertNode(errorString, nodeId); | 2037 Node* node = assertNode(errorString, nodeId); |
2038 if (!node) | 2038 if (!node) |
2039 return; | 2039 return; |
2040 InspectorHighlight highlight(node, InspectorHighlight::defaultConfig(), true
); | 2040 InspectorHighlight highlight(node, InspectorHighlight::defaultConfig(), true
); |
2041 *result = highlight.asProtocolValue(); | 2041 *result = highlight.asProtocolValue(); |
2042 } | 2042 } |
2043 | 2043 |
2044 std::unique_ptr<protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(
Node* node, const String& objectGroup) | 2044 std::unique_ptr<protocol::Runtime::API::RemoteObject> InspectorDOMAgent::resolve
Node(Node* node, const String& objectGroup) |
2045 { | 2045 { |
2046 Document* document = node->isDocumentNode() ? &node->document() : node->owne
rDocument(); | 2046 Document* document = node->isDocumentNode() ? &node->document() : node->owne
rDocument(); |
2047 LocalFrame* frame = document ? document->frame() : nullptr; | 2047 LocalFrame* frame = document ? document->frame() : nullptr; |
2048 if (!frame) | 2048 if (!frame) |
2049 return nullptr; | 2049 return nullptr; |
2050 | 2050 |
2051 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 2051 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
2052 if (!scriptState) | 2052 if (!scriptState) |
2053 return nullptr; | 2053 return nullptr; |
2054 | 2054 |
2055 ScriptState::Scope scope(scriptState); | 2055 ScriptState::Scope scope(scriptState); |
2056 return m_v8Session->wrapObject(scriptState->context(), nodeV8Value(scriptSta
te->context(), node), objectGroup, false); | 2056 return m_v8Session->wrapObject(scriptState->context(), nodeV8Value(scriptSta
te->context(), node), objectGroup); |
2057 } | 2057 } |
2058 | 2058 |
2059 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt
ring) | 2059 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt
ring) |
2060 { | 2060 { |
2061 if (!m_documentNodeToIdMap->contains(m_document)) { | 2061 if (!m_documentNodeToIdMap->contains(m_document)) { |
2062 std::unique_ptr<protocol::DOM::Node> root; | 2062 std::unique_ptr<protocol::DOM::Node> root; |
2063 getDocument(errorString, &root); | 2063 getDocument(errorString, &root); |
2064 return errorString->isEmpty(); | 2064 return errorString->isEmpty(); |
2065 } | 2065 } |
2066 return true; | 2066 return true; |
2067 } | 2067 } |
2068 | 2068 |
2069 DEFINE_TRACE(InspectorDOMAgent) | 2069 DEFINE_TRACE(InspectorDOMAgent) |
2070 { | 2070 { |
2071 visitor->trace(m_domListener); | 2071 visitor->trace(m_domListener); |
2072 visitor->trace(m_inspectedFrames); | 2072 visitor->trace(m_inspectedFrames); |
2073 visitor->trace(m_documentNodeToIdMap); | 2073 visitor->trace(m_documentNodeToIdMap); |
2074 visitor->trace(m_danglingNodeToIdMaps); | 2074 visitor->trace(m_danglingNodeToIdMaps); |
2075 visitor->trace(m_idToNode); | 2075 visitor->trace(m_idToNode); |
2076 visitor->trace(m_idToNodesMap); | 2076 visitor->trace(m_idToNodesMap); |
2077 visitor->trace(m_document); | 2077 visitor->trace(m_document); |
2078 visitor->trace(m_revalidateTask); | 2078 visitor->trace(m_revalidateTask); |
2079 visitor->trace(m_searchResults); | 2079 visitor->trace(m_searchResults); |
2080 visitor->trace(m_history); | 2080 visitor->trace(m_history); |
2081 visitor->trace(m_domEditor); | 2081 visitor->trace(m_domEditor); |
2082 InspectorBaseAgent::trace(visitor); | 2082 InspectorBaseAgent::trace(visitor); |
2083 } | 2083 } |
2084 | 2084 |
2085 } // namespace blink | 2085 } // namespace blink |
OLD | NEW |