summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/front-end/ElementsTreeOutline.js
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/inspector/front-end/ElementsTreeOutline.js')
-rw-r--r--WebCore/inspector/front-end/ElementsTreeOutline.js63
1 files changed, 15 insertions, 48 deletions
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index 10131f4..e261234 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -93,27 +93,8 @@ WebInspector.ElementsTreeOutline.prototype = {
// and the select() call would change the focusedDOMNode and reenter this setter. So to
// avoid calling focusedNodeChanged() twice, first check if _focusedDOMNode is the same
// node as the one passed in.
- if (this._focusedDOMNode === x) {
+ if (this._focusedDOMNode === x)
this.focusedNodeChanged();
-
- if (x && !this.suppressSelectHighlight) {
- InspectorBackend.highlightDOMNode(x.id);
-
- if ("_restorePreviousHighlightNodeTimeout" in this)
- clearTimeout(this._restorePreviousHighlightNodeTimeout);
-
- function restoreHighlightToHoveredNode()
- {
- var hoveredNode = WebInspector.hoveredDOMNode;
- if (hoveredNode)
- InspectorBackend.highlightDOMNode(hoveredNode.id);
- else
- InspectorBackend.hideDOMNodeHighlight();
- }
-
- this._restorePreviousHighlightNodeTimeout = setTimeout(restoreHighlightToHoveredNode, 2000);
- }
- }
},
get editing()
@@ -260,7 +241,7 @@ WebInspector.ElementsTreeOutline.prototype = {
element._createTooltipForNode();
}
- WebInspector.hoveredDOMNode = (element ? element.representedObject : null);
+ WebInspector.highlightDOMNode(element ? element.representedObject.id : 0);
},
_onmouseout: function(event)
@@ -274,7 +255,7 @@ WebInspector.ElementsTreeOutline.prototype = {
delete this._previousHoveredElement;
}
- WebInspector.hoveredDOMNode = null;
+ WebInspector.highlightDOMNode(0);
},
_contextMenuEventFired: function(event)
@@ -285,12 +266,21 @@ WebInspector.ElementsTreeOutline.prototype = {
var contextMenu = new WebInspector.ContextMenu();
+ var href = event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link") || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
- if (tag && listItem.treeElement._populateTagContextMenu)
+ var needSeparator;
+ if (href)
+ needSeparator = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
+ if (tag && listItem.treeElement._populateTagContextMenu) {
+ if (needSeparator)
+ contextMenu.appendSeparator();
listItem.treeElement._populateTagContextMenu(contextMenu, event);
- else if (textNode && listItem.treeElement._populateTextContextMenu)
+ } else if (textNode && listItem.treeElement._populateTextContextMenu) {
+ if (needSeparator)
+ contextMenu.appendSeparator();
listItem.treeElement._populateTextContextMenu(contextMenu, textNode);
+ }
contextMenu.show(event);
}
}
@@ -1189,29 +1179,6 @@ WebInspector.ElementsTreeElement.prototype = {
this._highlightSearchResults();
},
- _rewriteAttrHref: function(node, hrefValue)
- {
- if (!hrefValue || hrefValue.indexOf("://") > 0)
- return hrefValue;
-
- for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
- if (frameOwnerCandidate.documentURL) {
- var result = WebInspector.completeURL(frameOwnerCandidate.documentURL, hrefValue);
- if (result)
- return result;
- break;
- }
- }
-
- // documentURL not found or has bad value
- for (var url in WebInspector.resourceURLMap) {
- var match = url.match(WebInspector.URLRegExp);
- if (match && match[4] === hrefValue)
- return url;
- }
- return hrefValue;
- },
-
_attributeHTML: function(name, value, node, linkify)
{
var hasText = (value.length > 0);
@@ -1221,7 +1188,7 @@ WebInspector.ElementsTreeElement.prototype = {
html += "=​\"";
if (linkify && (name === "src" || name === "href")) {
- var rewrittenHref = this._rewriteAttrHref(node, value);
+ var rewrittenHref = WebInspector.resourceURLForRelatedNode(node, value);
value = value.replace(/([\/;:\)\]\}])/g, "$1\u200B");
html += linkify(rewrittenHref, value, "webkit-html-attribute-value", node.nodeName.toLowerCase() === "a");
} else {