Title: [156672] trunk/Source/WebInspectorUI
- Revision
- 156672
- Author
- grao...@apple.com
- Date
- 2013-09-30 13:06:06 -0700 (Mon, 30 Sep 2013)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (156671 => 156672)
--- trunk/Source/WebInspectorUI/ChangeLog 2013-09-30 19:51:43 UTC (rev 156671)
+++ trunk/Source/WebInspectorUI/ChangeLog 2013-09-30 20:06:06 UTC (rev 156672)
@@ -1,3 +1,25 @@
+2013-09-30 Antoine Quint <grao...@apple.com>
+
+ 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.
+
2013-09-26 Brian J. Burg <b...@cs.washington.edu>
Web Inspector: dissociate old content views that are spliced from back/forward list
Modified: trunk/Source/WebInspectorUI/UserInterface/DOMTreeOutline.js (156671 => 156672)
--- trunk/Source/WebInspectorUI/UserInterface/DOMTreeOutline.js 2013-09-30 19:51:43 UTC (rev 156671)
+++ trunk/Source/WebInspectorUI/UserInterface/DOMTreeOutline.js 2013-09-30 20:06:06 UTC (rev 156672)
@@ -46,7 +46,7 @@
this.element.addEventListener("drop", this._ondrop.bind(this), false);
this.element.addEventListener("dragend", this._ondragend.bind(this), false);
- this.element.classList.add("dom-tree-outline");
+ this.element.classList.add(WebInspector.DOMTreeOutline.StyleClassName);
this.element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
TreeOutline.call(this, this.element);
@@ -71,6 +71,8 @@
WebInspector.Object.addConstructorFunctions(WebInspector.DOMTreeOutline);
+WebInspector.DOMTreeOutline.StyleClassName = "dom-tree-outline";
+
WebInspector.DOMTreeOutline.Event = {
SelectedNodeChanged: "dom-tree-outline-selected-node-changed"
}
Modified: trunk/Source/WebInspectorUI/UserInterface/LogContentView.js (156671 => 156672)
--- trunk/Source/WebInspectorUI/UserInterface/LogContentView.js 2013-09-30 19:51:43 UTC (rev 156671)
+++ trunk/Source/WebInspectorUI/UserInterface/LogContentView.js 2013-09-30 20:06:06 UTC (rev 156672)
@@ -41,6 +41,7 @@
this.messagesElement.addEventListener("blur", this._didBlur.bind(this));
this.messagesElement.addEventListener("keydown", this._keyDown.bind(this));
this.messagesElement.addEventListener("click", this._click.bind(this), true);
+ this.messagesElement.addEventListener("dragstart", this._ondragstart.bind(this), true);
this.element.appendChild(this.messagesElement);
this.prompt = WebInspector.quickConsole.prompt;
@@ -433,6 +434,14 @@
delete this._mouseInteractionShouldPreventClickPropagation;
},
+ _ondragstart: function(event)
+ {
+ if (event.target.enclosingNodeOrSelfWithClass(WebInspector.DOMTreeOutline.StyleClassName)) {
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ },
+
handleEvent: function(event)
{
switch (event.type) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes