[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 13:33:14 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit fd9fe4752dc0dd6e833a693dc538dd680f9978a9
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Sep 20 11:42:18 2010 +0000
2010-09-20 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: highlight DOM node when hover on link element or DOM breakpoint
https://bugs.webkit.org/show_bug.cgi?id=45897
* inspector/front-end/BreakpointsSidebarPane.js:
(WebInspector.BreakpointItem):
(WebInspector.JSBreakpointItem):
(WebInspector.DOMBreakpointItem):
(WebInspector.DOMBreakpointItem.prototype.compareTo):
(WebInspector.DOMBreakpointItem.prototype._breakpointClicked):
* inspector/front-end/ElementsPanel.js:
(WebInspector.ElementsPanel.prototype.hide):
(WebInspector.ElementsPanel.prototype.reset):
(WebInspector.ElementsPanel.prototype.setDocument.selectNode):
(WebInspector.ElementsPanel.prototype._mouseMovedInCrumbs):
(WebInspector.ElementsPanel.prototype._mouseMovedOutOfCrumbs):
(WebInspector.ElementsPanel.prototype.linkifyNodeReference):
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeOutline.prototype.set focusedDOMNode):
(WebInspector.ElementsTreeOutline.prototype._onmousemove):
(WebInspector.ElementsTreeOutline.prototype._onmouseout):
* inspector/front-end/inspector.js:
(WebInspector.highlightDOMNode):
(WebInspector.highlightDOMNodeForTwoSeconds):
(WebInspector.wireElementWithDOMNode):
(WebInspector._updateFocusedNode):
(WebInspector.reset):
(WebInspector.updateFocusedNode):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index acff675..895afb3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-09-20 Pavel Podivilov <podivilov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: highlight DOM node when hover on link element or DOM breakpoint
+ https://bugs.webkit.org/show_bug.cgi?id=45897
+
+ * inspector/front-end/BreakpointsSidebarPane.js:
+ (WebInspector.BreakpointItem):
+ (WebInspector.JSBreakpointItem):
+ (WebInspector.DOMBreakpointItem):
+ (WebInspector.DOMBreakpointItem.prototype.compareTo):
+ (WebInspector.DOMBreakpointItem.prototype._breakpointClicked):
+ * inspector/front-end/ElementsPanel.js:
+ (WebInspector.ElementsPanel.prototype.hide):
+ (WebInspector.ElementsPanel.prototype.reset):
+ (WebInspector.ElementsPanel.prototype.setDocument.selectNode):
+ (WebInspector.ElementsPanel.prototype._mouseMovedInCrumbs):
+ (WebInspector.ElementsPanel.prototype._mouseMovedOutOfCrumbs):
+ (WebInspector.ElementsPanel.prototype.linkifyNodeReference):
+ * inspector/front-end/ElementsTreeOutline.js:
+ (WebInspector.ElementsTreeOutline.prototype.set focusedDOMNode):
+ (WebInspector.ElementsTreeOutline.prototype._onmousemove):
+ (WebInspector.ElementsTreeOutline.prototype._onmouseout):
+ * inspector/front-end/inspector.js:
+ (WebInspector.highlightDOMNode):
+ (WebInspector.highlightDOMNodeForTwoSeconds):
+ (WebInspector.wireElementWithDOMNode):
+ (WebInspector._updateFocusedNode):
+ (WebInspector.reset):
+ (WebInspector.updateFocusedNode):
+
2010-09-19 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r67749.
diff --git a/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
index cda72fb..9688f3e 100644
--- a/WebCore/inspector/front-end/BreakpointsSidebarPane.js
+++ b/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -97,6 +97,7 @@ WebInspector.BreakpointItem = function(breakpoint)
this._breakpoint = breakpoint;
this._element = document.createElement("li");
+ this._element.addEventListener("click", this._breakpointClicked.bind(this), false);
var checkboxElement = document.createElement("input");
checkboxElement.className = "checkbox-elem";
@@ -141,8 +142,6 @@ WebInspector.JSBreakpointItem = function(breakpoint)
{
WebInspector.BreakpointItem.call(this, breakpoint);
- this._element.addEventListener("click", this._breakpointClicked.bind(this), false);
-
var displayName = this._breakpoint.url ? WebInspector.displayNameForURL(this._breakpoint.url) : WebInspector.UIString("(program)");
var labelElement = document.createTextNode(displayName + ":" + this._breakpoint.line);
this._element.appendChild(labelElement);
@@ -183,8 +182,7 @@ WebInspector.DOMBreakpointItem = function(breakpoint)
{
WebInspector.BreakpointItem.call(this, breakpoint);
- var node = WebInspector.domAgent.nodeForId(this._breakpoint.nodeId);
- var link = WebInspector.panels.elements.linkifyNodeReference(node);
+ var link = WebInspector.panels.elements.linkifyNodeById(this._breakpoint.nodeId);
this._element.appendChild(link);
var type = WebInspector.DOMBreakpoint.labelForType(this._breakpoint.type);
@@ -198,6 +196,11 @@ WebInspector.DOMBreakpointItem.prototype = {
if (this._breakpoint.type != other._breakpoint.type)
return this._breakpoint.type < other._breakpoint.type ? -1 : 1;
return 0;
+ },
+
+ _breakpointClicked: function()
+ {
+ WebInspector.updateFocusedNode(this._breakpoint.nodeId);
}
}
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index 9cff3a7..72b23e1 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -147,7 +147,7 @@ WebInspector.ElementsPanel.prototype = {
{
WebInspector.Panel.prototype.hide.call(this);
- WebInspector.hoveredDOMNode = null;
+ WebInspector.highlightDOMNode(0);
InspectorBackend.disableSearchingForNode();
},
@@ -165,7 +165,7 @@ WebInspector.ElementsPanel.prototype = {
this.rootDOMNode = null;
this.focusedDOMNode = null;
- WebInspector.hoveredDOMNode = null;
+ WebInspector.highlightDOMNode(0);
this.recentlyModifiedNodes = [];
@@ -187,9 +187,7 @@ WebInspector.ElementsPanel.prototype = {
inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this));
inspectedRootDocument.addEventListener("DOMAttrModified", this._attributesUpdated.bind(this));
- this.treeOutline.suppressSelectHighlight = true;
this.rootDOMNode = inspectedRootDocument;
- this.treeOutline.suppressSelectHighlight = false;
function selectNode(candidateFocusNode)
{
@@ -199,11 +197,9 @@ WebInspector.ElementsPanel.prototype = {
if (!candidateFocusNode)
return;
- this.treeOutline.suppressSelectHighlight = true;
this.focusedDOMNode = candidateFocusNode;
if (this.treeOutline.selectedTreeElement)
this.treeOutline.selectedTreeElement.expand();
- this.treeOutline.suppressSelectHighlight = false;
}
function selectLastSelectedNode(nodeId)
@@ -578,7 +574,7 @@ WebInspector.ElementsPanel.prototype = {
var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
var crumbElement = nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb");
- WebInspector.hoveredDOMNode = (crumbElement ? crumbElement.representedObject : null);
+ WebInspector.highlightDOMNode(crumbElement ? crumbElement.representedObject.id : 0);
if ("_mouseOutOfCrumbsTimeout" in this) {
clearTimeout(this._mouseOutOfCrumbsTimeout);
@@ -592,7 +588,7 @@ WebInspector.ElementsPanel.prototype = {
if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.crumbsElement))
return;
- WebInspector.hoveredDOMNode = null;
+ WebInspector.highlightDOMNode(0);
this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bind(this), 1000);
},
@@ -778,8 +774,8 @@ WebInspector.ElementsPanel.prototype = {
{
var link = document.createElement("span");
link.className = "node-link";
- link.addEventListener("click", WebInspector.updateFocusedNode.bind(WebInspector, node.id), false);
this.decorateNodeLabel(node, link);
+ WebInspector.wireElementWithDOMNode(link, node.id);
return link;
},
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index 1888a17..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)
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index ac3f3fc..aee9258 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -403,45 +403,44 @@ var WebInspector = {
}
},
- get hoveredDOMNode()
+ highlightDOMNode: function(nodeId)
{
- return this._hoveredDOMNode;
- },
+ if ("_hideDOMNodeHighlightTimeout" in this) {
+ clearTimeout(this._hideDOMNodeHighlightTimeout);
+ delete this._hideDOMNodeHighlightTimeout;
+ }
- set hoveredDOMNode(x)
- {
- if (this._hoveredDOMNode === x)
+ if (this._highlightedDOMNodeId === nodeId)
return;
- this._hoveredDOMNode = x;
-
- if (this._hoveredDOMNode)
- this._updateHoverHighlightSoon(this.showingDOMNodeHighlight ? 50 : 500);
+ this._highlightedDOMNodeId = nodeId;
+ if (nodeId)
+ InspectorBackend.highlightDOMNode(nodeId);
else
- this._updateHoverHighlight();
+ InspectorBackend.hideDOMNodeHighlight();
},
- _updateHoverHighlightSoon: function(delay)
+ highlightDOMNodeForTwoSeconds: function(nodeId)
{
- if ("_updateHoverHighlightTimeout" in this)
- clearTimeout(this._updateHoverHighlightTimeout);
- this._updateHoverHighlightTimeout = setTimeout(this._updateHoverHighlight.bind(this), delay);
+ this.highlightDOMNode(nodeId);
+ this._hideDOMNodeHighlightTimeout = setTimeout(this.highlightDOMNode.bind(this, 0), 2000);
},
- _updateHoverHighlight: function()
+ wireElementWithDOMNode: function(element, nodeId)
{
- if ("_updateHoverHighlightTimeout" in this) {
- clearTimeout(this._updateHoverHighlightTimeout);
- delete this._updateHoverHighlightTimeout;
- }
+ element.addEventListener("click", this._updateFocusedNode.bind(this, nodeId), false);
+ element.addEventListener("mouseover", this.highlightDOMNode.bind(this, nodeId), false);
+ element.addEventListener("mouseout", this.highlightDOMNode.bind(this, 0), false);
+ },
- if (this._hoveredDOMNode) {
- InspectorBackend.highlightDOMNode(this._hoveredDOMNode.id);
- this.showingDOMNodeHighlight = true;
- } else {
- InspectorBackend.hideDOMNodeHighlight();
- this.showingDOMNodeHighlight = false;
- }
+ _updateFocusedNode: function(nodeId)
+ {
+ var node = WebInspector.domAgent.nodeForId(nodeId);
+ if (!node)
+ return;
+
+ this.currentPanel = this.panels.elements;
+ this.panels.elements.focusedDOMNode = node;
}
}
@@ -1457,7 +1456,7 @@ WebInspector.reset = function()
this.resourceURLMap = {};
this.cookieDomains = {};
this.applicationCacheDomains = {};
- this.hoveredDOMNode = null;
+ this.highlightDOMNode(0);
delete this.mainResource;
@@ -1666,13 +1665,8 @@ WebInspector.drawLoadingPieChart = function(canvas, percent) {
WebInspector.updateFocusedNode = function(nodeId)
{
- var node = WebInspector.domAgent.nodeForId(nodeId);
- if (!node)
- // FIXME: Should we deselect if null is passed in?
- return;
-
- this.currentPanel = this.panels.elements;
- this.panels.elements.focusedDOMNode = node;
+ this._updateFocusedNode(nodeId);
+ this.highlightDOMNodeForTwoSeconds(nodeId);
}
WebInspector.displayNameForURL = function(url)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list