Changeset 136144 in webkit
- Timestamp:
- Nov 29, 2012, 11:59:14 AM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
-
ChangeLog (modified) (1 diff)
-
inspector/Inspector.json (modified) (1 diff)
-
inspector/InspectorDOMAgent.cpp (modified) (1 diff)
-
inspector/InspectorDOMAgent.h (modified) (1 diff)
-
inspector/front-end/ConsoleMessage.js (modified) (1 diff)
-
inspector/front-end/DOMAgent.js (modified) (2 diffs)
-
inspector/front-end/DOMPresentationUtils.js (modified) (1 diff)
-
inspector/front-end/ObjectPropertiesSection.js (modified) (3 diffs)
-
inspector/front-end/RemoteObject.js (modified) (1 diff)
-
inspector/front-end/TestController.js (modified) (1 diff)
-
inspector/front-end/externs.js (modified) (1 diff)
-
inspector/front-end/inspector.css (modified) (1 diff)
-
inspector/front-end/utilities.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r136142 r136144 1 2012-11-29 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: Console: hovering node wrappers in object tree should highlight them on the page 4 https://bugs.webkit.org/show_bug.cgi?id=101150 5 6 Reviewed by Vsevolod Vlasov. 7 8 - Introduced a way to highlight nodes by object id in addition to node id. 9 - Decorated nodes in the object tree outline and added on-hover highlighting. 10 11 * inspector/Inspector.json: 12 * inspector/InspectorDOMAgent.cpp: 13 (WebCore::InspectorDOMAgent::highlightNode): 14 * inspector/InspectorDOMAgent.h: 15 (InspectorDOMAgent): 16 * inspector/front-end/ConsoleMessage.js: 17 (WebInspector.ConsoleMessageImpl.prototype._appendPropertyPreview): 18 * inspector/front-end/DOMAgent.js: 19 (WebInspector.DOMAgent.prototype.highlightDOMNode): 20 * inspector/front-end/DOMPresentationUtils.js: 21 (WebInspector.DOMPresentationUtils.createSpansForNodeTitle): 22 * inspector/front-end/ObjectPropertiesSection.js: 23 (WebInspector.ObjectPropertyTreeElement.prototype.update): 24 (WebInspector.ObjectPropertyTreeElement.prototype._mouseMove): 25 (WebInspector.ObjectPropertyTreeElement.prototype._mouseOut): 26 * inspector/front-end/RemoteObject.js: 27 (WebInspector.RemoteObject.prototype.highlightAsDOMNode): 28 (WebInspector.RemoteObject.prototype.hideDOMNodeHighlight): 29 * inspector/front-end/TestController.js: 30 * inspector/front-end/externs.js: 31 * inspector/front-end/inspector.css: 32 (.console-formatted-node:hover): 33 * inspector/front-end/utilities.js: 34 1 35 2012-11-29 Dan Bernstein <mitz@apple.com> 2 36 -
trunk/Source/WebCore/inspector/Inspector.json
r135591 r136144 1859 1859 "name": "highlightNode", 1860 1860 "parameters": [ 1861 { "name": "nodeId", "$ref": "NodeId", "description": "Identifier of the node to highlight." }, 1861 { "name": "nodeId", "$ref": "NodeId", "optional": true, "description": "Identifier of the node to highlight." }, 1862 { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "optional": true, "description": "JavaScript object id of the node to be highlighted." }, 1862 1863 { "name": "highlightConfig", "$ref": "HighlightConfig", "description": "A descriptor for the highlight appearance." } 1863 1864 ], 1864 "description": "Highlights DOM node with given id ."1865 "description": "Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified." 1865 1866 }, 1866 1867 { -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r133885 r136144 1067 1067 } 1068 1068 1069 void InspectorDOMAgent::highlightNode( 1070 ErrorString* errorString, 1071 int nodeId, 1072 const RefPtr<InspectorObject>& highlightInspectorObject) 1073 { 1074 Node* node = nodeForId(nodeId); 1069 void InspectorDOMAgent::highlightNode(ErrorString* errorString, const int* nodeId, const String* objectId, const RefPtr<InspectorObject>& highlightInspectorObject) 1070 { 1071 Node* node = 0; 1072 if (nodeId) { 1073 node = assertNode(errorString, *nodeId); 1074 } else if (objectId) { 1075 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*objectId); 1076 node = injectedScript.nodeForObjectId(*objectId); 1077 if (!node) 1078 *errorString = "Node for given objectId not found"; 1079 } else 1080 *errorString = "Either nodeId or objectId must be specified"; 1081 1075 1082 if (!node) 1076 1083 return; -
trunk/Source/WebCore/inspector/InspectorDOMAgent.h
r131083 r136144 142 142 virtual void hideHighlight(ErrorString*); 143 143 virtual void highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); 144 virtual void highlightNode(ErrorString*, int nodeId, const RefPtr<InspectorObject>& highlightConfig);144 virtual void highlightNode(ErrorString*, const int* nodeId, const String* objectId, const RefPtr<InspectorObject>& highlightConfig); 145 145 virtual void highlightFrame(ErrorString*, const String& frameId, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); 146 146 virtual void moveTo(ErrorString*, int nodeId, int targetNodeId, const int* anchorNodeId, int* newNodeId); -
trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js
r135720 r136144 352 352 if (property.type === "object" && property.subtype === "node") { 353 353 span.addStyleClass("console-formatted-preview-node"); 354 var match = property.value.match(/([^#.]+)(#[^.]+)?(\..*)?/); 355 span.createChild("span", "webkit-html-tag-name").textContent = match[1]; 356 if (match[2]) 357 span.createChild("span", "webkit-html-attribute-value").textContent = match[2]; 358 if (match[3]) 359 span.createChild("span", "webkit-html-attribute-name").textContent = match[3]; 354 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(span, property.value); 360 355 return; 361 356 } -
trunk/Source/WebCore/inspector/front-end/DOMAgent.js
r134751 r136144 1199 1199 * @param {?number} nodeId 1200 1200 * @param {string=} mode 1201 */ 1202 highlightDOMNode: function(nodeId, mode) 1201 * @param {RuntimeAgent.RemoteObjectId=} objectId 1202 */ 1203 highlightDOMNode: function(nodeId, mode, objectId) 1203 1204 { 1204 1205 if (this._hideDOMNodeHighlightTimeout) { … … 1207 1208 } 1208 1209 1209 this._highlightedDOMNodeId = nodeId; 1210 if (nodeId) 1211 DOMAgent.highlightNode(nodeId, this._buildHighlightConfig(mode)); 1210 if (objectId || nodeId) 1211 DOMAgent.highlightNode(objectId ? undefined : nodeId, objectId, this._buildHighlightConfig(mode)); 1212 1212 else 1213 1213 DOMAgent.hideHighlight(); -
trunk/Source/WebCore/inspector/front-end/DOMPresentationUtils.js
r126579 r136144 77 77 } 78 78 79 /** 80 * @param {Element} container 81 * @param {string} nodeTitle 82 */ 83 WebInspector.DOMPresentationUtils.createSpansForNodeTitle = function(container, nodeTitle) 84 { 85 var match = nodeTitle.match(/([^#.]+)(#[^.]+)?(\..*)?/); 86 container.createChild("span", "webkit-html-tag-name").textContent = match[1]; 87 if (match[2]) 88 container.createChild("span", "webkit-html-attribute-value").textContent = match[2]; 89 if (match[3]) 90 container.createChild("span", "webkit-html-attribute-name").textContent = match[3]; 91 } 92 79 93 WebInspector.DOMPresentationUtils.linkifyNodeReference = function(node) 80 94 { -
trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
r135122 r136144 235 235 this.valueElement.textContent = /.*/.exec(description)[0].replace(/ +$/g, ""); 236 236 this.valueElement._originalTextContent = description; 237 } else 237 } else if (this.property.value.type !== "object" || this.property.value.subtype !== "node") 238 238 this.valueElement.textContent = description; 239 239 … … 246 246 247 247 this.valueElement.addEventListener("contextmenu", this._contextMenuFired.bind(this, this.property.value), false); 248 this.valueElement.title = description || ""; 248 if (this.property.value.type === "object" && this.property.value.subtype === "node") { 249 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(this.valueElement, this.property.value.description); 250 this.valueElement.addEventListener("mousemove", this._mouseMove.bind(this, this.property.value), false); 251 this.valueElement.addEventListener("mouseout", this._mouseOut.bind(this, this.property.value), false); 252 } else 253 this.valueElement.title = description || ""; 249 254 250 255 this.listItemElement.removeChildren(); … … 269 274 populateContextMenu: function(contextMenu) 270 275 { 276 }, 277 278 _mouseMove: function(event) 279 { 280 this.property.value.highlightAsDOMNode(); 281 }, 282 283 _mouseOut: function(event) 284 { 285 this.property.value.hideDOMNodeHighlight(); 271 286 }, 272 287 -
trunk/Source/WebCore/inspector/front-end/RemoteObject.js
r134914 r136144 289 289 }, 290 290 291 highlightAsDOMNode: function() 292 { 293 WebInspector.domAgent.highlightDOMNode(undefined, undefined, this._objectId); 294 }, 295 296 hideDOMNodeHighlight: function() 297 { 298 WebInspector.domAgent.hideDOMNodeHighlight(); 299 }, 300 291 301 /** 292 302 * @param {function(this:Object)} functionDeclaration -
trunk/Source/WebCore/inspector/front-end/TestController.js
r134745 r136144 46 46 WebInspector.evaluateForTestInFrontend = function(callId, script) 47 47 { 48 WebInspector.isUnderTest = true;48 window.isUnderTest = true; 49 49 function invokeMethod() 50 50 { -
trunk/Source/WebCore/inspector/front-end/externs.js
r135588 r136144 65 65 /** @type {*} */ 66 66 window.testRunner = null; 67 68 window.isUnderTest = false; 67 69 68 70 /** -
trunk/Source/WebCore/inspector/front-end/inspector.css
r136104 r136144 1142 1142 } 1143 1143 1144 .console-formatted-node:hover { 1145 background-color: rgba(56, 121, 217, 0.1); 1146 } 1147 1144 1148 .console-formatted-object .section, .console-formatted-node .section, .console-formatted-array .section { 1145 1149 position: static; -
trunk/Source/WebCore/inspector/front-end/utilities.js
r135681 r136144 862 862 } 863 863 864 window.isUnderTest = false; 864 865 865 866 /** … … 873 874 this._observer = new WebKitMutationObserver(handler); 874 875 NonLeakingMutationObserver._instances.push(this); 875 if (!window.testRunner && ! WebInspector.isUnderTest && !NonLeakingMutationObserver._unloadListener) {876 if (!window.testRunner && !window.isUnderTest && !NonLeakingMutationObserver._unloadListener) { 876 877 NonLeakingMutationObserver._unloadListener = function() { 877 878 while (NonLeakingMutationObserver._instances.length)
Note:
See TracChangeset
for help on using the changeset viewer.