| 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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 SearchMode searchMode; | 1129 SearchMode searchMode; |
| 1130 if (mode == protocol::DOM::InspectModeEnum::SearchForNode) { | 1130 if (mode == protocol::DOM::InspectModeEnum::SearchForNode) { |
| 1131 searchMode = SearchingForNormal; | 1131 searchMode = SearchingForNormal; |
| 1132 } else if (mode == protocol::DOM::InspectModeEnum::SearchForUAShadowDOM) { | 1132 } else if (mode == protocol::DOM::InspectModeEnum::SearchForUAShadowDOM) { |
| 1133 searchMode = SearchingForUAShadow; | 1133 searchMode = SearchingForUAShadow; |
| 1134 } else if (mode == protocol::DOM::InspectModeEnum::None) { | 1134 } else if (mode == protocol::DOM::InspectModeEnum::None) { |
| 1135 searchMode = NotSearching; | 1135 searchMode = NotSearching; |
| 1136 } else if (mode == protocol::DOM::InspectModeEnum::ShowLayoutEditor) { | 1136 } else if (mode == protocol::DOM::InspectModeEnum::ShowLayoutEditor) { |
| 1137 searchMode = ShowLayoutEditor; | 1137 searchMode = ShowLayoutEditor; |
| 1138 } else { | 1138 } else { |
| 1139 *errorString = "Unknown mode \"" + mode + "\" was provided."; | 1139 *errorString = String("Unknown mode \"" + mode + "\" was provided."); |
| 1140 return; | 1140 return; |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 if (searchMode != NotSearching && !pushDocumentUponHandlelessOperation(error
String)) | 1143 if (searchMode != NotSearching && !pushDocumentUponHandlelessOperation(error
String)) |
| 1144 return; | 1144 return; |
| 1145 | 1145 |
| 1146 setSearchingForNode(errorString, searchMode, highlightConfig); | 1146 setSearchingForNode(errorString, searchMode, highlightConfig); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int
height, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGB
A>& outlineColor) | 1149 void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int
height, const Maybe<protocol::DOM::RGBA>& color, const Maybe<protocol::DOM::RGB
A>& outlineColor) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 if (!V8Node::hasInstance(value, m_isolate)) { | 1182 if (!V8Node::hasInstance(value, m_isolate)) { |
| 1183 *errorString = "Object id doesn't reference a Node"; | 1183 *errorString = "Object id doesn't reference a Node"; |
| 1184 return nullptr; | 1184 return nullptr; |
| 1185 } | 1185 } |
| 1186 Node* node = V8Node::toImpl(v8::Local<v8::Object>::Cast(value)); | 1186 Node* node = V8Node::toImpl(v8::Local<v8::Object>::Cast(value)); |
| 1187 if (!node) | 1187 if (!node) |
| 1188 *errorString = "Couldn't convert object with given objectId to Node"; | 1188 *errorString = "Couldn't convert object with given objectId to Node"; |
| 1189 return node; | 1189 return node; |
| 1190 } | 1190 } |
| 1191 | 1191 |
| 1192 void InspectorDOMAgent::highlightNode(ErrorString* errorString, PassOwnPtr<proto
col::DOM::HighlightConfig> highlightInspectorObject, const Maybe<int>& nodeId, c
onst Maybe<int>& backendNodeId, const Maybe<String>& objectId) | 1192 void InspectorDOMAgent::highlightNode(ErrorString* errorString, PassOwnPtr<proto
col::DOM::HighlightConfig> highlightInspectorObject, const Maybe<int>& nodeId, c
onst Maybe<int>& backendNodeId, const Maybe<String16>& objectId) |
| 1193 { | 1193 { |
| 1194 Node* node = nullptr; | 1194 Node* node = nullptr; |
| 1195 if (nodeId.isJust()) { | 1195 if (nodeId.isJust()) { |
| 1196 node = assertNode(errorString, nodeId.fromJust()); | 1196 node = assertNode(errorString, nodeId.fromJust()); |
| 1197 } else if (backendNodeId.isJust()) { | 1197 } else if (backendNodeId.isJust()) { |
| 1198 node = DOMNodeIds::nodeForId(backendNodeId.fromJust()); | 1198 node = DOMNodeIds::nodeForId(backendNodeId.fromJust()); |
| 1199 } else if (objectId.isJust()) { | 1199 } else if (objectId.isJust()) { |
| 1200 node = nodeForRemoteId(errorString, objectId.fromJust()); | 1200 node = nodeForRemoteId(errorString, objectId.fromJust()); |
| 1201 } else | 1201 } else |
| 1202 *errorString = "Either nodeId or objectId must be specified"; | 1202 *errorString = "Either nodeId or objectId must be specified"; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 | 1389 |
| 1390 void InspectorDOMAgent::getAttributes(ErrorString* errorString, int nodeId, OwnP
tr<protocol::Array<String>>* result) | 1390 void InspectorDOMAgent::getAttributes(ErrorString* errorString, int nodeId, OwnP
tr<protocol::Array<String>>* result) |
| 1391 { | 1391 { |
| 1392 Element* element = assertElement(errorString, nodeId); | 1392 Element* element = assertElement(errorString, nodeId); |
| 1393 if (!element) | 1393 if (!element) |
| 1394 return; | 1394 return; |
| 1395 | 1395 |
| 1396 *result = buildArrayForElementAttributes(element); | 1396 *result = buildArrayForElementAttributes(element); |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 void InspectorDOMAgent::requestNode(ErrorString* errorString, const String& obje
ctId, int* nodeId) | 1399 void InspectorDOMAgent::requestNode(ErrorString* errorString, const String16& ob
jectId, int* nodeId) |
| 1400 { | 1400 { |
| 1401 Node* node = nodeForRemoteId(errorString, objectId); | 1401 Node* node = nodeForRemoteId(errorString, objectId); |
| 1402 if (node) | 1402 if (node) |
| 1403 *nodeId = pushNodePathToFrontend(node); | 1403 *nodeId = pushNodePathToFrontend(node); |
| 1404 else | 1404 else |
| 1405 *nodeId = 0; | 1405 *nodeId = 0; |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 // static | 1408 // static |
| 1409 String InspectorDOMAgent::documentURLString(Document* document) | 1409 String InspectorDOMAgent::documentURLString(Document* document) |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 | 2044 |
| 2045 void InspectorDOMAgent::getHighlightObjectForTest(ErrorString* errorString, int
nodeId, OwnPtr<protocol::DictionaryValue>* result) | 2045 void InspectorDOMAgent::getHighlightObjectForTest(ErrorString* errorString, int
nodeId, OwnPtr<protocol::DictionaryValue>* result) |
| 2046 { | 2046 { |
| 2047 Node* node = assertNode(errorString, nodeId); | 2047 Node* node = assertNode(errorString, nodeId); |
| 2048 if (!node) | 2048 if (!node) |
| 2049 return; | 2049 return; |
| 2050 InspectorHighlight highlight(node, InspectorHighlight::defaultConfig(), true
); | 2050 InspectorHighlight highlight(node, InspectorHighlight::defaultConfig(), true
); |
| 2051 *result = highlight.asProtocolValue(); | 2051 *result = highlight.asProtocolValue(); |
| 2052 } | 2052 } |
| 2053 | 2053 |
| 2054 PassOwnPtr<protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node*
node, const String& objectGroup) | 2054 PassOwnPtr<protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node*
node, const String16& objectGroup) |
| 2055 { | 2055 { |
| 2056 Document* document = node->isDocumentNode() ? &node->document() : node->owne
rDocument(); | 2056 Document* document = node->isDocumentNode() ? &node->document() : node->owne
rDocument(); |
| 2057 LocalFrame* frame = document ? document->frame() : nullptr; | 2057 LocalFrame* frame = document ? document->frame() : nullptr; |
| 2058 if (!frame) | 2058 if (!frame) |
| 2059 return nullptr; | 2059 return nullptr; |
| 2060 | 2060 |
| 2061 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 2061 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 2062 if (!scriptState) | 2062 if (!scriptState) |
| 2063 return nullptr; | 2063 return nullptr; |
| 2064 | 2064 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2088 visitor->trace(m_document); | 2088 visitor->trace(m_document); |
| 2089 visitor->trace(m_revalidateTask); | 2089 visitor->trace(m_revalidateTask); |
| 2090 visitor->trace(m_searchResults); | 2090 visitor->trace(m_searchResults); |
| 2091 #endif | 2091 #endif |
| 2092 visitor->trace(m_history); | 2092 visitor->trace(m_history); |
| 2093 visitor->trace(m_domEditor); | 2093 visitor->trace(m_domEditor); |
| 2094 InspectorBaseAgent::trace(visitor); | 2094 InspectorBaseAgent::trace(visitor); |
| 2095 } | 2095 } |
| 2096 | 2096 |
| 2097 } // namespace blink | 2097 } // namespace blink |
| OLD | NEW |