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 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 nodeIds = TypeBuilder::Array<int>::create(); | 1084 nodeIds = TypeBuilder::Array<int>::create(); |
1085 for (int i = fromIndex; i < toIndex; ++i) | 1085 for (int i = fromIndex; i < toIndex; ++i) |
1086 nodeIds->addItem(pushNodePathToFrontend((it->value)[i].get())); | 1086 nodeIds->addItem(pushNodePathToFrontend((it->value)[i].get())); |
1087 } | 1087 } |
1088 | 1088 |
1089 void InspectorDOMAgent::discardSearchResults(ErrorString*, const String& searchI
d) | 1089 void InspectorDOMAgent::discardSearchResults(ErrorString*, const String& searchI
d) |
1090 { | 1090 { |
1091 m_searchResults.remove(searchId); | 1091 m_searchResults.remove(searchId); |
1092 } | 1092 } |
1093 | 1093 |
1094 | |
1095 void InspectorDOMAgent::inspect(Node* inspectedNode) | 1094 void InspectorDOMAgent::inspect(Node* inspectedNode) |
1096 { | 1095 { |
1097 if (!inspectedNode) | 1096 if (!inspectedNode) |
1098 return; | 1097 return; |
1099 | 1098 |
1100 Node* node = inspectedNode; | 1099 Node* node = inspectedNode; |
1101 while (node && !node->isElementNode() && !node->isDocumentNode() && !node->i
sDocumentFragment()) | 1100 while (node && !node->isElementNode() && !node->isDocumentNode() && !node->i
sDocumentFragment()) |
1102 node = node->parentOrShadowHostNode(); | 1101 node = node->parentOrShadowHostNode(); |
1103 if (!node) | 1102 if (!node) |
1104 return; | 1103 return; |
1105 | 1104 |
1106 int backendNodeId = DOMNodeIds::idForNode(node); | 1105 int backendNodeId = DOMNodeIds::idForNode(node); |
1107 if (!frontend() || !enabled()) { | 1106 if (!frontend() || !enabled()) { |
1108 m_backendNodeIdToInspect = backendNodeId; | 1107 m_backendNodeIdToInspect = backendNodeId; |
1109 return; | 1108 return; |
1110 } | 1109 } |
1111 | 1110 |
1112 frontend()->inspectNodeRequested(backendNodeId); | 1111 frontend()->inspectNodeRequested(backendNodeId); |
1113 } | 1112 } |
1114 | 1113 |
1115 | |
1116 void InspectorDOMAgent::setSearchingForNode(ErrorString* errorString, SearchMode
searchMode, JSONObject* highlightInspectorObject) | 1114 void InspectorDOMAgent::setSearchingForNode(ErrorString* errorString, SearchMode
searchMode, JSONObject* highlightInspectorObject) |
1117 { | 1115 { |
1118 if (m_client) | 1116 if (m_client) |
1119 m_client->setInspectMode(searchMode, searchMode != NotSearching ? highli
ghtConfigFromInspectorObject(errorString, highlightInspectorObject) : nullptr); | 1117 m_client->setInspectMode(searchMode, searchMode != NotSearching ? highli
ghtConfigFromInspectorObject(errorString, highlightInspectorObject) : nullptr); |
1120 } | 1118 } |
1121 | 1119 |
1122 PassOwnPtr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspe
ctorObject(ErrorString* errorString, JSONObject* highlightInspectorObject) | 1120 PassOwnPtr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspe
ctorObject(ErrorString* errorString, JSONObject* highlightInspectorObject) |
1123 { | 1121 { |
1124 if (!highlightInspectorObject) { | 1122 if (!highlightInspectorObject) { |
1125 *errorString = "Internal error: highlight configuration parameter is mis
sing"; | 1123 *errorString = "Internal error: highlight configuration parameter is mis
sing"; |
1126 return nullptr; | 1124 return nullptr; |
1127 } | 1125 } |
1128 | 1126 |
1129 OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHig
hlightConfig()); | 1127 OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHig
hlightConfig()); |
1130 bool showInfo = false; // Default: false (do not show a tooltip). | 1128 bool showInfo = false; // Default: false (do not show a tooltip). |
1131 highlightInspectorObject->getBoolean("showInfo", &showInfo); | 1129 highlightInspectorObject->getBoolean("showInfo", &showInfo); |
1132 highlightConfig->showInfo = showInfo; | 1130 highlightConfig->showInfo = showInfo; |
1133 bool showRulers = false; // Default: false (do not show rulers). | 1131 bool showRulers = false; // Default: false (do not show rulers). |
1134 highlightInspectorObject->getBoolean("showRulers", &showRulers); | 1132 highlightInspectorObject->getBoolean("showRulers", &showRulers); |
1135 highlightConfig->showRulers = showRulers; | 1133 highlightConfig->showRulers = showRulers; |
1136 bool showExtensionLines = false; // Default: false (do not show extension li
nes). | 1134 bool showExtensionLines = false; // Default: false (do not show extension li
nes). |
1137 highlightInspectorObject->getBoolean("showExtensionLines", &showExtensionLin
es); | 1135 highlightInspectorObject->getBoolean("showExtensionLines", &showExtensionLin
es); |
1138 highlightConfig->showExtensionLines = showExtensionLines; | 1136 highlightConfig->showExtensionLines = showExtensionLines; |
1139 bool showLayoutEditor = false; | |
1140 highlightInspectorObject->getBoolean("showLayoutEditor", &showLayoutEditor); | |
1141 highlightConfig->showLayoutEditor = showLayoutEditor; | |
1142 bool displayAsMaterial = false; | 1137 bool displayAsMaterial = false; |
1143 highlightInspectorObject->getBoolean("displayAsMaterial", &displayAsMaterial
); | 1138 highlightInspectorObject->getBoolean("displayAsMaterial", &displayAsMaterial
); |
1144 highlightConfig->displayAsMaterial = displayAsMaterial; | 1139 highlightConfig->displayAsMaterial = displayAsMaterial; |
1145 highlightConfig->content = parseConfigColor("contentColor", highlightInspect
orObject); | 1140 highlightConfig->content = parseConfigColor("contentColor", highlightInspect
orObject); |
1146 highlightConfig->contentOutline = parseConfigColor("contentOutlineColor", hi
ghlightInspectorObject); | 1141 highlightConfig->contentOutline = parseConfigColor("contentOutlineColor", hi
ghlightInspectorObject); |
1147 highlightConfig->padding = parseConfigColor("paddingColor", highlightInspect
orObject); | 1142 highlightConfig->padding = parseConfigColor("paddingColor", highlightInspect
orObject); |
1148 highlightConfig->border = parseConfigColor("borderColor", highlightInspector
Object); | 1143 highlightConfig->border = parseConfigColor("borderColor", highlightInspector
Object); |
1149 highlightConfig->margin = parseConfigColor("marginColor", highlightInspector
Object); | 1144 highlightConfig->margin = parseConfigColor("marginColor", highlightInspector
Object); |
1150 highlightConfig->eventTarget = parseConfigColor("eventTargetColor", highligh
tInspectorObject); | 1145 highlightConfig->eventTarget = parseConfigColor("eventTargetColor", highligh
tInspectorObject); |
1151 highlightConfig->shape = parseConfigColor("shapeColor", highlightInspectorOb
ject); | 1146 highlightConfig->shape = parseConfigColor("shapeColor", highlightInspectorOb
ject); |
1152 highlightConfig->shapeMargin = parseConfigColor("shapeMarginColor", highligh
tInspectorObject); | 1147 highlightConfig->shapeMargin = parseConfigColor("shapeMarginColor", highligh
tInspectorObject); |
1153 | 1148 |
1154 return highlightConfig.release(); | 1149 return highlightConfig.release(); |
1155 } | 1150 } |
1156 | 1151 |
1157 void InspectorDOMAgent::setInspectMode(ErrorString* errorString, const String& m
ode, const RefPtr<JSONObject>* highlightConfig) | 1152 void InspectorDOMAgent::setInspectMode(ErrorString* errorString, const String& m
ode, const RefPtr<JSONObject>* highlightConfig) |
1158 { | 1153 { |
1159 SearchMode searchMode; | 1154 SearchMode searchMode; |
1160 if (mode == TypeBuilder::getEnumConstantValue(TypeBuilder::DOM::InspectMode:
:SearchForNode)) { | 1155 if (mode == TypeBuilder::getEnumConstantValue(TypeBuilder::DOM::InspectMode:
:SearchForNode)) { |
1161 searchMode = SearchingForNormal; | 1156 searchMode = SearchingForNormal; |
1162 } else if (mode == TypeBuilder::getEnumConstantValue(TypeBuilder::DOM::Inspe
ctMode::SearchForUAShadowDOM)) { | 1157 } else if (mode == TypeBuilder::getEnumConstantValue(TypeBuilder::DOM::Inspe
ctMode::SearchForUAShadowDOM)) { |
1163 searchMode = SearchingForUAShadow; | 1158 searchMode = SearchingForUAShadow; |
1164 } else if (mode == TypeBuilder::getEnumConstantValue(TypeBuilder::DOM::Inspe
ctMode::None)) { | 1159 } else if (mode == TypeBuilder::getEnumConstantValue(TypeBuilder::DOM::Inspe
ctMode::None)) { |
1165 searchMode = NotSearching; | 1160 searchMode = NotSearching; |
| 1161 } else if (mode == TypeBuilder::getEnumConstantValue(TypeBuilder::DOM::Inspe
ctMode::ShowLayoutEditor)) { |
| 1162 searchMode = ShowLayoutEditor; |
1166 } else { | 1163 } else { |
1167 *errorString = "Unknown mode \"" + mode + "\" was provided."; | 1164 *errorString = "Unknown mode \"" + mode + "\" was provided."; |
1168 return; | 1165 return; |
1169 } | 1166 } |
1170 | 1167 |
1171 if (searchMode != NotSearching && !pushDocumentUponHandlelessOperation(error
String)) | 1168 if (searchMode != NotSearching && !pushDocumentUponHandlelessOperation(error
String)) |
1172 return; | 1169 return; |
1173 | 1170 |
1174 setSearchingForNode(errorString, searchMode, highlightConfig ? highlightConf
ig->get() : nullptr); | 1171 setSearchingForNode(errorString, searchMode, highlightConfig ? highlightConf
ig->get() : nullptr); |
1175 } | 1172 } |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 visitor->trace(m_document); | 2137 visitor->trace(m_document); |
2141 visitor->trace(m_revalidateTask); | 2138 visitor->trace(m_revalidateTask); |
2142 visitor->trace(m_searchResults); | 2139 visitor->trace(m_searchResults); |
2143 #endif | 2140 #endif |
2144 visitor->trace(m_history); | 2141 visitor->trace(m_history); |
2145 visitor->trace(m_domEditor); | 2142 visitor->trace(m_domEditor); |
2146 InspectorBaseAgent::trace(visitor); | 2143 InspectorBaseAgent::trace(visitor); |
2147 } | 2144 } |
2148 | 2145 |
2149 } // namespace blink | 2146 } // namespace blink |
OLD | NEW |