WebKit Bugzilla
Attachment 368414 Details for
Bug 197330
: Web Inspector: DOM: dragging a node to the console should log the node
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197330-20190427164457.patch (text/plain), 7.37 KB, created by
Devin Rousso
on 2019-04-27 16:44:58 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-04-27 16:44:58 PDT
Size:
7.37 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index bc81271021b98c587296f27d7477a5519ec7dc0a..464934008abfb55f687e1eb7f065fa1617887a58 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,24 @@ >+2019-04-27 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: DOM: dragging a node to the console should log the node >+ https://bugs.webkit.org/show_bug.cgi?id=197330 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Views/DOMTreeOutline.js: >+ (WI.DOMTreeOutline.prototype._ondragstart): >+ * UserInterface/Views/LogContentView.js: >+ (WI.LogContentView): >+ (WI.LogContentView.prototype._handleDragOver): Added. >+ (WI.LogContentView.prototype._handleDrop): Added. >+ * UserInterface/Views/QuickConsole.js: >+ (WI.QuickConsole): >+ (WI.QuickConsole.prototype._handleDragOver): Added. >+ (WI.QuickConsole.prototype._handleDrop): Added. >+ >+ * UserInterface/Views/GeneralStyleDetailsSidebarPanel.js: >+ Drive-by: update the format to be more unique. >+ > 2019-04-26 Jessie Berlin <jberlin@webkit.org> > > Add new mac target numbers >diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js >index 7a091390cc38eb1f7691f070c0269ad4ae6c38ce..668f8eaaa59cecfca0b0124784755a0ddaa337dd 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js >+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js >@@ -485,6 +485,9 @@ WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline > if (!treeElement) > return false; > >+ event.dataTransfer.effectAllowed = "copyMove"; >+ event.dataTransfer.setData(DOMTreeOutline.DOMNodeIdDragType, treeElement.representedObject.id); >+ > if (!this._isValidDragSourceOrTarget(treeElement)) > return false; > >@@ -492,7 +495,6 @@ WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline > return false; > > event.dataTransfer.setData("text/plain", treeElement.listItemElement.textContent); >- event.dataTransfer.effectAllowed = "copyMove"; > this._nodeBeingDragged = treeElement.representedObject; > > WI.domManager.hideDOMNodeHighlight(); >@@ -648,3 +650,5 @@ WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline > WI.DOMTreeOutline.Event = { > SelectedNodeChanged: "dom-tree-outline-selected-node-changed" > }; >+ >+WI.DOMTreeOutline.DOMNodeIdDragType = "web-inspector/dom-node-id"; >diff --git a/Source/WebInspectorUI/UserInterface/Views/GeneralStyleDetailsSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/GeneralStyleDetailsSidebarPanel.js >index f09a95c0497c40e7ff30c1fb3faf201275bc0b7c..a10004512a9dd1eaa498481ca78eea1a08dfdf0e 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/GeneralStyleDetailsSidebarPanel.js >+++ b/Source/WebInspectorUI/UserInterface/Views/GeneralStyleDetailsSidebarPanel.js >@@ -463,4 +463,4 @@ WI.GeneralStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName = "filter-sec > WI.GeneralStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName = "filter-property-non-matching"; > > WI.GeneralStyleDetailsSidebarPanel.ToggledClassesSymbol = Symbol("css-style-details-sidebar-panel-toggled-classes-symbol"); >-WI.GeneralStyleDetailsSidebarPanel.ToggledClassesDragType = "text/classname"; >+WI.GeneralStyleDetailsSidebarPanel.ToggledClassesDragType = "web-inspector/css-class"; >diff --git a/Source/WebInspectorUI/UserInterface/Views/LogContentView.js b/Source/WebInspectorUI/UserInterface/Views/LogContentView.js >index feebd4bbc2038cb350822ac138bfa03c37f0ca31..120ad0c512fd1fc3eabc3060cb20c116c3963957 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/LogContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/LogContentView.js >@@ -47,6 +47,8 @@ WI.LogContentView = class LogContentView extends WI.ContentView > this.messagesElement.addEventListener("keydown", this._keyDown.bind(this)); > this.messagesElement.addEventListener("keypress", this._keyPress.bind(this)); > this.messagesElement.addEventListener("dragstart", this._ondragstart.bind(this), true); >+ this.messagesElement.addEventListener("dragover", this._handleDragOver.bind(this)); >+ this.messagesElement.addEventListener("drop", this._handleDrop.bind(this)); > this.element.appendChild(this.messagesElement); > > this.prompt = WI.quickConsole.prompt; >@@ -618,6 +620,26 @@ WI.LogContentView = class LogContentView extends WI.ContentView > } > } > >+ _handleDragOver(event) >+ { >+ if (event.dataTransfer.types.includes(WI.DOMTreeOutline.DOMNodeIdDragType)) >+ event.dataTransfer.dropEffect = "copy"; >+ } >+ >+ _handleDrop(event) >+ { >+ let domNodeId = event.dataTransfer.getData(WI.DOMTreeOutline.DOMNodeIdDragType); >+ if (domNodeId) { >+ let domNode = WI.domManager.nodeForId(domNodeId); >+ WI.RemoteObject.resolveNode(domNode, WI.RuntimeManager.ConsoleObjectGroup) >+ .then((remoteObject) => { >+ let text = domNode.nodeType() === Node.ELEMENT_NODE ? WI.UIString("Selected Element") : WI.UIString("Selected Node"); >+ const addSpecialUserLogClass = true; >+ WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass); >+ }); >+ } >+ } >+ > handleEvent(event) > { > switch (event.type) { >diff --git a/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js b/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js >index 5187b3074c16223c904891c69350f6568cb34568..6fa19fcad4cb0b6bbb3818695fded9808f1679a9 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js >+++ b/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js >@@ -46,6 +46,8 @@ WI.QuickConsole = class QuickConsole extends WI.View > > this.element.classList.add("quick-console"); > this.element.addEventListener("mousedown", this._handleMouseDown.bind(this)); >+ this.element.addEventListener("dragover", this._handleDragOver.bind(this)); >+ this.element.addEventListener("drop", this._handleDrop.bind(this)); > > this.prompt = new WI.ConsolePrompt(null, "text/javascript"); > this.addSubview(this.prompt); >@@ -171,6 +173,26 @@ WI.QuickConsole = class QuickConsole extends WI.View > this.prompt.focus(); > } > >+ _handleDragOver(event) >+ { >+ if (event.dataTransfer.types.includes(WI.DOMTreeOutline.DOMNodeIdDragType)) >+ event.dataTransfer.dropEffect = "copy"; >+ } >+ >+ _handleDrop(event) >+ { >+ let domNodeId = event.dataTransfer.getData(WI.DOMTreeOutline.DOMNodeIdDragType); >+ if (domNodeId) { >+ let domNode = WI.domManager.nodeForId(domNodeId); >+ WI.RemoteObject.resolveNode(domNode, WI.RuntimeManager.ConsoleObjectGroup) >+ .then((remoteObject) => { >+ let text = domNode.nodeType() === Node.ELEMENT_NODE ? WI.UIString("Selected Element") : WI.UIString("Selected Node"); >+ const addSpecialUserLogClass = true; >+ WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass); >+ }); >+ } >+ } >+ > _executionContextPathComponentsToDisplay() > { > // If we are in the debugger the console will use the active call frame, don't show the selector.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197330
:
368414
|
369035