Changeset 156672 in webkit


Ignore:
Timestamp:
Sep 30, 2013 1:06:06 PM (11 years ago)
Author:
Antoine Quint
Message:

Web Inspector: nodes can be dragged from the console log
https://bugs.webkit.org/show_bug.cgi?id=122105

Reviewed by Darin Adler.

Catch "dragstart" events targeting nodes hosted in a DOMTreeOutline within the console
log view and prevent the default logic to trigger so that these nodes can't be dragged
off the console as it wouldn't make sense to.

  • UserInterface/DOMTreeOutline.js:

(WebInspector.DOMTreeOutline):
Create a class property to allow the CSS class name to be used in WebInspector.LogContentView.

  • UserInterface/LogContentView.js:

(WebInspector.LogContentView):
(WebInspector.LogContentView.prototype._ondragstart):
Track the "dragstart" events in their capture phase such that, if the event target is
a DOM node hosted in a DOMTreeOutline, we can prevent the event from propagating and
cancel its default behavior such that no dragging at all is performed.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r156520 r156672  
     12013-09-30  Antoine Quint  <graouts@apple.com>
     2
     3        Web Inspector: nodes can be dragged from the console log
     4        https://bugs.webkit.org/show_bug.cgi?id=122105
     5
     6        Reviewed by Darin Adler.
     7
     8        Catch "dragstart" events targeting nodes hosted in a DOMTreeOutline within the console
     9        log view and prevent the default logic to trigger so that these nodes can't be dragged
     10        off the console as it wouldn't make sense to.
     11
     12        * UserInterface/DOMTreeOutline.js:
     13        (WebInspector.DOMTreeOutline):
     14        Create a class property to allow the CSS class name to be used in WebInspector.LogContentView.
     15
     16        * UserInterface/LogContentView.js:
     17        (WebInspector.LogContentView):
     18        (WebInspector.LogContentView.prototype._ondragstart):
     19        Track the "dragstart" events in their capture phase such that, if the event target is
     20        a DOM node hosted in a DOMTreeOutline, we can prevent the event from propagating and
     21        cancel its default behavior such that no dragging at all is performed.
     22
    1232013-09-26  Brian J. Burg  <burg@cs.washington.edu>
    224
  • trunk/Source/WebInspectorUI/UserInterface/DOMTreeOutline.js

    r151453 r156672  
    4747    this.element.addEventListener("dragend", this._ondragend.bind(this), false);
    4848
    49     this.element.classList.add("dom-tree-outline");
     49    this.element.classList.add(WebInspector.DOMTreeOutline.StyleClassName);
    5050    this.element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
    5151
     
    7171
    7272WebInspector.Object.addConstructorFunctions(WebInspector.DOMTreeOutline);
     73
     74WebInspector.DOMTreeOutline.StyleClassName = "dom-tree-outline";
    7375
    7476WebInspector.DOMTreeOutline.Event = {
  • trunk/Source/WebInspectorUI/UserInterface/LogContentView.js

    r156198 r156672  
    4242    this.messagesElement.addEventListener("keydown", this._keyDown.bind(this));
    4343    this.messagesElement.addEventListener("click", this._click.bind(this), true);
     44    this.messagesElement.addEventListener("dragstart", this._ondragstart.bind(this), true);
    4445    this.element.appendChild(this.messagesElement);
    4546
     
    432433        event.stopPropagation();
    433434        delete this._mouseInteractionShouldPreventClickPropagation;
     435    },
     436
     437    _ondragstart: function(event)
     438    {
     439        if (event.target.enclosingNodeOrSelfWithClass(WebInspector.DOMTreeOutline.StyleClassName)) {
     440            event.stopPropagation();
     441            event.preventDefault();
     442        }
    434443    },
    435444
Note: See TracChangeset for help on using the changeset viewer.