Changeset 106552 in webkit


Ignore:
Timestamp:
Feb 2, 2012 6:28:39 AM (12 years ago)
Author:
pfeldman@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106551 r106552  
     12012-02-02  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: enable editing of selected rows on single click in elements panel.
     4        https://bugs.webkit.org/show_bug.cgi?id=77627
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        * inspector/front-end/ElementsTreeOutline.js:
     9        (WebInspector.ElementsTreeElement.prototype.onattach):
     10        (WebInspector.ElementsTreeElement.prototype.onselect):
     11        (WebInspector.ElementsTreeElement.prototype._mouseDown):
     12        * inspector/front-end/treeoutline.js:
     13        (TreeElement.prototype.selectOnMouseDown):
     14        (TreeElement.prototype.select):
     15
    1162012-02-02  Philip Rogers  <pdr@google.com>
    217
  • trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js

    r105628 r106552  
    722722        this._preventFollowingLinksOnDoubleClick();
    723723        this.listItemElement.draggable = true;
     724        this.listItemElement.addEventListener("click", this._mouseClick.bind(this));
     725        this.listItemElement.addEventListener("mousedown", this._mouseDown.bind(this));
    724726    },
    725727
     
    944946        this.updateSelection();
    945947        this.treeOutline.suppressRevealAndSelect = false;
     948        return true;
    946949    },
    947950
     
    993996        if (this.hasChildren && !this.expanded)
    994997            this.expand();
     998    },
     999
     1000    _mouseClick: function(event)
     1001    {
     1002        if (this._isSingleClickCandidate)
     1003            this._startEditingTarget(event.target);
     1004        this._isSingleClickCandidate = false;
     1005    },
     1006
     1007    _mouseDown: function(event)
     1008    {
     1009        if (event.handled || event.which !== 1 || this._editing || this._elementCloseTag || !this.selected)
     1010            return;
     1011        this._isSingleClickCandidate = true;
    9951012    },
    9961013
  • trunk/Source/WebCore/inspector/front-end/treeoutline.js

    r104553 r106552  
    998998TreeElement.prototype.selectOnMouseDown = function(event)
    999999{
    1000     this.select(false, true);
     1000    if (this.select(false, true)) {
     1001        event.stopPropagation();
     1002        event.preventDefault();
     1003        event.handled = true;
     1004    }
    10011005}
    10021006
     
    10041008 * @param {boolean=} omitFocus
    10051009 * @param {boolean=} selectedByUser
     1010 * @return {boolean}
    10061011 */
    10071012TreeElement.prototype.select = function(omitFocus, selectedByUser)
    10081013{
    10091014    if (!this.treeOutline || !this.selectable || this.selected)
    1010         return;
     1015        return false;
    10111016
    10121017    if (this.treeOutline.selectedTreeElement)
     
    10201025    // Focusing on another node may detach "this" from tree.
    10211026    if (!this.treeOutline)
    1022         return;
     1027        return false;
    10231028    this.treeOutline.selectedTreeElement = this;
    10241029    if (this._listItemNode)
     
    10261031
    10271032    if (this.onselect)
    1028         this.onselect(this, selectedByUser);
     1033        return this.onselect(this, selectedByUser);
     1034    return false;
    10291035}
    10301036
Note: See TracChangeset for help on using the changeset viewer.