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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 #include "core/html/HTMLLinkElement.h" | 57 #include "core/html/HTMLLinkElement.h" |
58 #include "core/html/HTMLTemplateElement.h" | 58 #include "core/html/HTMLTemplateElement.h" |
59 #include "core/html/imports/HTMLImportChild.h" | 59 #include "core/html/imports/HTMLImportChild.h" |
60 #include "core/html/imports/HTMLImportLoader.h" | 60 #include "core/html/imports/HTMLImportLoader.h" |
61 #include "core/inspector/DOMEditor.h" | 61 #include "core/inspector/DOMEditor.h" |
62 #include "core/inspector/DOMPatchSupport.h" | 62 #include "core/inspector/DOMPatchSupport.h" |
63 #include "core/inspector/IdentifiersFactory.h" | 63 #include "core/inspector/IdentifiersFactory.h" |
64 #include "core/inspector/InspectedFrames.h" | 64 #include "core/inspector/InspectedFrames.h" |
65 #include "core/inspector/InspectorHighlight.h" | 65 #include "core/inspector/InspectorHighlight.h" |
66 #include "core/inspector/InspectorHistory.h" | 66 #include "core/inspector/InspectorHistory.h" |
67 #include "core/inspector/V8InspectorString.h" | |
67 #include "core/layout/HitTestResult.h" | 68 #include "core/layout/HitTestResult.h" |
68 #include "core/layout/api/LayoutViewItem.h" | 69 #include "core/layout/api/LayoutViewItem.h" |
69 #include "core/loader/DocumentLoader.h" | 70 #include "core/loader/DocumentLoader.h" |
70 #include "core/page/FrameTree.h" | 71 #include "core/page/FrameTree.h" |
71 #include "core/page/Page.h" | 72 #include "core/page/Page.h" |
72 #include "core/xml/DocumentXPathEvaluator.h" | 73 #include "core/xml/DocumentXPathEvaluator.h" |
73 #include "core/xml/XPathResult.h" | 74 #include "core/xml/XPathResult.h" |
74 #include "platform/PlatformGestureEvent.h" | 75 #include "platform/PlatformGestureEvent.h" |
75 #include "platform/PlatformMouseEvent.h" | 76 #include "platform/PlatformMouseEvent.h" |
76 #include "platform/PlatformTouchEvent.h" | 77 #include "platform/PlatformTouchEvent.h" |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr) ); | 1159 highlightConfig->contentOutline = parseColor(outlineColor.fromMaybe(nullptr) ); |
1159 if (m_client) | 1160 if (m_client) |
1160 m_client->highlightQuad(std::move(quad), *highlightConfig); | 1161 m_client->highlightQuad(std::move(quad), *highlightConfig); |
1161 } | 1162 } |
1162 | 1163 |
1163 Node* InspectorDOMAgent::nodeForRemoteId(ErrorString* errorString, const String& objectId) | 1164 Node* InspectorDOMAgent::nodeForRemoteId(ErrorString* errorString, const String& objectId) |
1164 { | 1165 { |
1165 v8::HandleScope handles(m_isolate); | 1166 v8::HandleScope handles(m_isolate); |
1166 v8::Local<v8::Value> value; | 1167 v8::Local<v8::Value> value; |
1167 v8::Local<v8::Context> context; | 1168 v8::Local<v8::Context> context; |
1168 String16 objectGroup; | 1169 std::unique_ptr<v8_inspector::StringBuffer> objectGroup; |
1169 if (!m_v8Session->unwrapObject(errorString, objectId, &value, &context, &obj ectGroup)) | 1170 if (!m_v8Session->unwrapObject(errorString, toV8InspectorStringView(objectId ), &value, &context, &objectGroup)) |
caseq
2016/08/22 23:46:10
Can we make objectGroup parameter in unwrapObject
dgozman
2016/08/24 00:45:00
Done.
| |
1170 return nullptr; | 1171 return nullptr; |
1171 if (!V8Node::hasInstance(value, m_isolate)) { | 1172 if (!V8Node::hasInstance(value, m_isolate)) { |
1172 *errorString = "Object id doesn't reference a Node"; | 1173 *errorString = "Object id doesn't reference a Node"; |
1173 return nullptr; | 1174 return nullptr; |
1174 } | 1175 } |
1175 Node* node = V8Node::toImpl(v8::Local<v8::Object>::Cast(value)); | 1176 Node* node = V8Node::toImpl(v8::Local<v8::Object>::Cast(value)); |
1176 if (!node) | 1177 if (!node) |
1177 *errorString = "Couldn't convert object with given objectId to Node"; | 1178 *errorString = "Couldn't convert object with given objectId to Node"; |
1178 return node; | 1179 return node; |
1179 } | 1180 } |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2045 Document* document = node->isDocumentNode() ? &node->document() : node->owne rDocument(); | 2046 Document* document = node->isDocumentNode() ? &node->document() : node->owne rDocument(); |
2046 LocalFrame* frame = document ? document->frame() : nullptr; | 2047 LocalFrame* frame = document ? document->frame() : nullptr; |
2047 if (!frame) | 2048 if (!frame) |
2048 return nullptr; | 2049 return nullptr; |
2049 | 2050 |
2050 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 2051 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
2051 if (!scriptState) | 2052 if (!scriptState) |
2052 return nullptr; | 2053 return nullptr; |
2053 | 2054 |
2054 ScriptState::Scope scope(scriptState); | 2055 ScriptState::Scope scope(scriptState); |
2055 return m_v8Session->wrapObject(scriptState->context(), nodeV8Value(scriptSta te->context(), node), objectGroup); | 2056 return m_v8Session->wrapObject(scriptState->context(), nodeV8Value(scriptSta te->context(), node), toV8InspectorStringView(objectGroup)); |
2056 } | 2057 } |
2057 | 2058 |
2058 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt ring) | 2059 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt ring) |
2059 { | 2060 { |
2060 if (!m_documentNodeToIdMap->contains(m_document)) { | 2061 if (!m_documentNodeToIdMap->contains(m_document)) { |
2061 std::unique_ptr<protocol::DOM::Node> root; | 2062 std::unique_ptr<protocol::DOM::Node> root; |
2062 getDocument(errorString, &root); | 2063 getDocument(errorString, &root); |
2063 return errorString->isEmpty(); | 2064 return errorString->isEmpty(); |
2064 } | 2065 } |
2065 return true; | 2066 return true; |
2066 } | 2067 } |
2067 | 2068 |
2068 DEFINE_TRACE(InspectorDOMAgent) | 2069 DEFINE_TRACE(InspectorDOMAgent) |
2069 { | 2070 { |
2070 visitor->trace(m_domListener); | 2071 visitor->trace(m_domListener); |
2071 visitor->trace(m_inspectedFrames); | 2072 visitor->trace(m_inspectedFrames); |
2072 visitor->trace(m_documentNodeToIdMap); | 2073 visitor->trace(m_documentNodeToIdMap); |
2073 visitor->trace(m_danglingNodeToIdMaps); | 2074 visitor->trace(m_danglingNodeToIdMaps); |
2074 visitor->trace(m_idToNode); | 2075 visitor->trace(m_idToNode); |
2075 visitor->trace(m_idToNodesMap); | 2076 visitor->trace(m_idToNodesMap); |
2076 visitor->trace(m_document); | 2077 visitor->trace(m_document); |
2077 visitor->trace(m_revalidateTask); | 2078 visitor->trace(m_revalidateTask); |
2078 visitor->trace(m_searchResults); | 2079 visitor->trace(m_searchResults); |
2079 visitor->trace(m_history); | 2080 visitor->trace(m_history); |
2080 visitor->trace(m_domEditor); | 2081 visitor->trace(m_domEditor); |
2081 InspectorBaseAgent::trace(visitor); | 2082 InspectorBaseAgent::trace(visitor); |
2082 } | 2083 } |
2083 | 2084 |
2084 } // namespace blink | 2085 } // namespace blink |
OLD | NEW |