Title: [106552] trunk/Source/WebCore
Revision
106552
Author
[email protected]
Date
2012-02-02 06:28:39 -0800 (Thu, 02 Feb 2012)

Log Message

Web Inspector: enable editing of selected rows on single click in elements panel.
https://bugs.webkit.org/show_bug.cgi?id=77627

Reviewed by Vsevolod Vlasov.

* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeElement.prototype.onattach):
(WebInspector.ElementsTreeElement.prototype.onselect):
(WebInspector.ElementsTreeElement.prototype._mouseDown):
* inspector/front-end/treeoutline.js:
(TreeElement.prototype.selectOnMouseDown):
(TreeElement.prototype.select):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106551 => 106552)


--- trunk/Source/WebCore/ChangeLog	2012-02-02 14:27:10 UTC (rev 106551)
+++ trunk/Source/WebCore/ChangeLog	2012-02-02 14:28:39 UTC (rev 106552)
@@ -1,3 +1,18 @@
+2012-02-02  Pavel Feldman  <[email protected]>
+
+        Web Inspector: enable editing of selected rows on single click in elements panel.
+        https://bugs.webkit.org/show_bug.cgi?id=77627
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype.onattach):
+        (WebInspector.ElementsTreeElement.prototype.onselect):
+        (WebInspector.ElementsTreeElement.prototype._mouseDown):
+        * inspector/front-end/treeoutline.js:
+        (TreeElement.prototype.selectOnMouseDown):
+        (TreeElement.prototype.select):
+
 2012-02-02  Philip Rogers  <[email protected]>
 
         Fix mirroring with SVG fonts

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (106551 => 106552)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-02-02 14:27:10 UTC (rev 106551)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2012-02-02 14:28:39 UTC (rev 106552)
@@ -721,6 +721,8 @@
         this.updateTitle();
         this._preventFollowingLinksOnDoubleClick();
         this.listItemElement.draggable = true;
+        this.listItemElement.addEventListener("click", this._mouseClick.bind(this));
+        this.listItemElement.addEventListener("mousedown", this._mouseDown.bind(this));
     },
 
     _preventFollowingLinksOnDoubleClick: function()
@@ -943,6 +945,7 @@
             WebInspector.domAgent.highlightDOMNode(this.representedObject.id);
         this.updateSelection();
         this.treeOutline.suppressRevealAndSelect = false;
+        return true;
     },
 
     ondelete: function()
@@ -994,6 +997,20 @@
             this.expand();
     },
 
+    _mouseClick: function(event)
+    {
+        if (this._isSingleClickCandidate)
+            this._startEditingTarget(event.target);
+        this._isSingleClickCandidate = false;
+    },
+
+    _mouseDown: function(event)
+    {
+        if (event.handled || event.which !== 1 || this._editing || this._elementCloseTag || !this.selected)
+            return;
+        this._isSingleClickCandidate = true;
+    },
+
     _insertInLastAttributePosition: function(tag, node)
     {
         if (tag.getElementsByClassName("webkit-html-attribute").length > 0)

Modified: trunk/Source/WebCore/inspector/front-end/treeoutline.js (106551 => 106552)


--- trunk/Source/WebCore/inspector/front-end/treeoutline.js	2012-02-02 14:27:10 UTC (rev 106551)
+++ trunk/Source/WebCore/inspector/front-end/treeoutline.js	2012-02-02 14:28:39 UTC (rev 106552)
@@ -997,17 +997,22 @@
 
 TreeElement.prototype.selectOnMouseDown = function(event)
 {
-    this.select(false, true);
+    if (this.select(false, true)) {
+        event.stopPropagation();
+        event.preventDefault();
+        event.handled = true;
+    }
 }
 
 /**
  * @param {boolean=} omitFocus
  * @param {boolean=} selectedByUser
+ * @return {boolean}
  */
 TreeElement.prototype.select = function(omitFocus, selectedByUser)
 {
     if (!this.treeOutline || !this.selectable || this.selected)
-        return;
+        return false;
 
     if (this.treeOutline.selectedTreeElement)
         this.treeOutline.selectedTreeElement.deselect();
@@ -1019,13 +1024,14 @@
 
     // Focusing on another node may detach "this" from tree.
     if (!this.treeOutline)
-        return;
+        return false;
     this.treeOutline.selectedTreeElement = this;
     if (this._listItemNode)
         this._listItemNode.classList.add("selected");
 
     if (this.onselect)
-        this.onselect(this, selectedByUser);
+        return this.onselect(this, selectedByUser);
+    return false;
 }
 
 /**
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to