<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206008] trunk/Source/WebInspectorUI</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206008">206008</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-09-15 17:56:14 -0700 (Thu, 15 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: support drag and drop of CSS classes and ids onto DOM nodes
https://bugs.webkit.org/show_bug.cgi?id=16529

Patch by Devin Rousso &lt;dcrousso+webkit@gmail.com&gt; on 2016-09-15
Reviewed by Joseph Pecoraro.

* UserInterface/Models/DOMNode.js:
(WebInspector.DOMNode.prototype.toggleClass.resolvedNode.inspectedPage_node_toggleClass):
(WebInspector.DOMNode.prototype.toggleClass.resolvedNode):
(WebInspector.DOMNode.prototype.toggleClass):
Moved from WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass.

* UserInterface/Views/CSSStyleDetailsSidebarPanel.css:
(.sidebar &gt; .panel.details.css-style &gt; .content ~ :matches(.options-container, .class-list-container)):
Added z-index to fix overlapping with selector origin.

* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WebInspector.CSSStyleDetailsSidebarPanel):
(WebInspector.CSSStyleDetailsSidebarPanel.prototype.computedStyleDetailsPanelShowProperty):
(WebInspector.CSSStyleDetailsSidebarPanel.prototype.initialLayout):
(WebInspector.CSSStyleDetailsSidebarPanel.prototype._switchPanels):
(WebInspector.CSSStyleDetailsSidebarPanel.prototype._classToggleButtonClicked):
(WebInspector.CSSStyleDetailsSidebarPanel.prototype._addClassInputBlur):
Added a setting for auto-expanding the Classes toggle list based on the previous state.
Also renamed the existing _lastSelectedSectionSetting to _lastSelectedPanelSetting since the
setting doesn't have anything to do with the last selected section.

(WebInspector.CSSStyleDetailsSidebarPanel.prototype._createToggleForClassName):
(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType):
Added functionality to allow dragging of a className toggle's text (not the checkbox) by
using a custom type, preventing the value from being dropped anywhere except the DOM tree.

(WebInspector.CSSStyleDetailsSidebarPanel.prototype._createToggleForClassName.classNameToggleChanged):
Restructured to use arrow function to avoid function binding.

(WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass.resolvedNode.toggleClass): Deleted.
(WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass.resolvedNode): Deleted.
(WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass): Deleted.

* UserInterface/Views/DOMTreeOutline.js:
(WebInspector.DOMTreeOutline.prototype._ondragover):
(WebInspector.DOMTreeOutline.prototype._ondrop.callback):
(WebInspector.DOMTreeOutline.prototype._ondrop):
Allow dragging when the dataTransfer object contains the type specified by
WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType.  The value for that type
will be added to the dropped element's classList.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsDOMNodejs">trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDetailsSidebarPanelcss">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDetailsSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsDOMTreeOutlinejs">trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (206007 => 206008)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-09-16 00:33:45 UTC (rev 206007)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-09-16 00:56:14 UTC (rev 206008)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2016-09-15  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
+
+        Web Inspector: support drag and drop of CSS classes and ids onto DOM nodes
+        https://bugs.webkit.org/show_bug.cgi?id=16529
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Models/DOMNode.js:
+        (WebInspector.DOMNode.prototype.toggleClass.resolvedNode.inspectedPage_node_toggleClass):
+        (WebInspector.DOMNode.prototype.toggleClass.resolvedNode):
+        (WebInspector.DOMNode.prototype.toggleClass):
+        Moved from WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass.
+
+        * UserInterface/Views/CSSStyleDetailsSidebarPanel.css:
+        (.sidebar &gt; .panel.details.css-style &gt; .content ~ :matches(.options-container, .class-list-container)):
+        Added z-index to fix overlapping with selector origin.
+
+        * UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
+        (WebInspector.CSSStyleDetailsSidebarPanel):
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype.computedStyleDetailsPanelShowProperty):
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype.initialLayout):
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._switchPanels):
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._classToggleButtonClicked):
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._addClassInputBlur):
+        Added a setting for auto-expanding the Classes toggle list based on the previous state.
+        Also renamed the existing _lastSelectedSectionSetting to _lastSelectedPanelSetting since the
+        setting doesn't have anything to do with the last selected section.
+
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._createToggleForClassName):
+        (WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType):
+        Added functionality to allow dragging of a className toggle's text (not the checkbox) by
+        using a custom type, preventing the value from being dropped anywhere except the DOM tree.
+
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._createToggleForClassName.classNameToggleChanged):
+        Restructured to use arrow function to avoid function binding.
+
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass.resolvedNode.toggleClass): Deleted.
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass.resolvedNode): Deleted.
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype._toggleClass): Deleted.
+
+        * UserInterface/Views/DOMTreeOutline.js:
+        (WebInspector.DOMTreeOutline.prototype._ondragover):
+        (WebInspector.DOMTreeOutline.prototype._ondrop.callback):
+        (WebInspector.DOMTreeOutline.prototype._ondrop):
+        Allow dragging when the dataTransfer object contains the type specified by
+        WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType.  The value for that type
+        will be added to the dropped element's classList.
+
</ins><span class="cx"> 2016-09-15  Matt Baker  &lt;mattbaker@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Use more global color variables in TreeOutline and DataGrid
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsDOMNodejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js (206007 => 206008)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js        2016-09-16 00:33:45 UTC (rev 206007)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js        2016-09-16 00:56:14 UTC (rev 206008)
</span><span class="lines">@@ -410,6 +410,36 @@
</span><span class="cx">         DOMAgent.removeAttribute(this.id, name, mycallback.bind(this));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    toggleClass(className, flag)
+    {
+        if (!className || !className.length)
+            return;
+
+        if (this.isPseudoElement()) {
+            this.parentNode.toggleClass(className, flag);
+            return;
+        }
+
+        if (this.nodeType() !== Node.ELEMENT_NODE)
+            return;
+
+        function resolvedNode(object)
+        {
+            if (!object)
+                return;
+
+            function inspectedPage_node_toggleClass(className, flag)
+            {
+                this.classList.toggle(className, flag);
+            }
+
+            object.callFunction(inspectedPage_node_toggleClass, [className, flag]);
+            object.release();
+        }
+
+        WebInspector.RemoteObject.resolveNode(this, &quot;&quot;, resolvedNode);
+    }
+
</ins><span class="cx">     getChildNodes(callback)
</span><span class="cx">     {
</span><span class="cx">         if (this.children) {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDetailsSidebarPanelcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.css (206007 => 206008)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.css        2016-09-16 00:33:45 UTC (rev 206007)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.css        2016-09-16 00:56:14 UTC (rev 206008)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx">     display: flex;
</span><span class="cx">     align-items: center;
</span><span class="cx">     position: absolute;
</span><ins>+    z-index: 1;
</ins><span class="cx">     width: 100%;
</span><span class="cx">     background-color: white;
</span><span class="cx">     border-top: 1px solid var(--border-color);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDetailsSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js (206007 => 206008)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js        2016-09-16 00:33:45 UTC (rev 206007)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js        2016-09-16 00:56:14 UTC (rev 206008)
</span><span class="lines">@@ -37,9 +37,10 @@
</span><span class="cx">         this._panels = [this._computedStyleDetailsPanel, this._rulesStyleDetailsPanel, this._visualStyleDetailsPanel];
</span><span class="cx">         this._panelNavigationInfo = [this._computedStyleDetailsPanel.navigationInfo, this._rulesStyleDetailsPanel.navigationInfo, this._visualStyleDetailsPanel.navigationInfo];
</span><span class="cx"> 
</span><del>-        this._lastSelectedSectionSetting = new WebInspector.Setting(&quot;last-selected-style-details-panel&quot;, this._rulesStyleDetailsPanel.navigationInfo.identifier);
</del><ins>+        this._lastSelectedPanelSetting = new WebInspector.Setting(&quot;last-selected-style-details-panel&quot;, this._rulesStyleDetailsPanel.navigationInfo.identifier);
+        this._classListContainerToggledSetting = new WebInspector.Setting(&quot;class-list-container-toggled&quot;, false);
</ins><span class="cx"> 
</span><del>-        this._initiallySelectedPanel = this._panelMatchingIdentifier(this._lastSelectedSectionSetting.value) || this._rulesStyleDetailsPanel;
</del><ins>+        this._initiallySelectedPanel = this._panelMatchingIdentifier(this._lastSelectedPanelSetting.value) || this._rulesStyleDetailsPanel;
</ins><span class="cx"> 
</span><span class="cx">         this._navigationItem = new WebInspector.ScopeRadioButtonNavigationItem(this.identifier, this.displayName, this._panelNavigationInfo, this._initiallySelectedPanel.navigationInfo);
</span><span class="cx">         this._navigationItem.addEventListener(WebInspector.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged, this._handleSelectedItemChanged, this);
</span><span class="lines">@@ -77,7 +78,7 @@
</span><span class="cx">         this._rulesStyleDetailsPanel.scrollToSectionAndHighlightProperty(property);
</span><span class="cx">         this._switchPanels(this._rulesStyleDetailsPanel);
</span><span class="cx"> 
</span><del>-        this._navigationItem.selectedItemIdentifier = this._lastSelectedSectionSetting.value;
</del><ins>+        this._navigationItem.selectedItemIdentifier = this._lastSelectedPanelSetting.value;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Protected
</span><span class="lines">@@ -201,6 +202,9 @@
</span><span class="cx"> 
</span><span class="cx">         WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded, this._styleSheetAddedOrRemoved, this);
</span><span class="cx">         WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetRemoved, this._styleSheetAddedOrRemoved, this);
</span><ins>+
+        if (this._classListContainerToggledSetting.value)
+            this._classToggleButtonClicked();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     sizeDidChange()
</span><span class="lines">@@ -278,7 +282,7 @@
</span><span class="cx">         this.contentView.element.classList.toggle(&quot;supports-new-rule&quot;, typeof this._selectedPanel.newRuleButtonClicked === &quot;function&quot;);
</span><span class="cx">         this._selectedPanel.shown();
</span><span class="cx"> 
</span><del>-        this._lastSelectedSectionSetting.value = selectedPanel.navigationInfo.identifier;
</del><ins>+        this._lastSelectedPanelSetting.value = selectedPanel.navigationInfo.identifier;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _forcedPseudoClassCheckboxChanged(pseudoClass, event)
</span><span class="lines">@@ -329,6 +333,7 @@
</span><span class="cx">     {
</span><span class="cx">         this._classToggleButton.classList.toggle(&quot;selected&quot;);
</span><span class="cx">         this._classListContainer.hidden = !this._classListContainer.hidden;
</span><ins>+        this._classListContainerToggledSetting.value = !this._classListContainer.hidden;
</ins><span class="cx">         if (this._classListContainer.hidden)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="lines">@@ -351,7 +356,7 @@
</span><span class="cx"> 
</span><span class="cx">     _addClassInputBlur(event)
</span><span class="cx">     {
</span><del>-        this._toggleClass.call(this, this._addClassInput.value, true);
</del><ins>+        this.domNode.toggleClass(this._addClassInput.value, true);
</ins><span class="cx">         this._addClassContainer.classList.remove(&quot;active&quot;);
</span><span class="cx">         this._addClassInput.value = null;
</span><span class="cx">     }
</span><span class="lines">@@ -405,54 +410,26 @@
</span><span class="cx"> 
</span><span class="cx">         let classNameTitle = classNameContainer.createChild(&quot;span&quot;);
</span><span class="cx">         classNameTitle.textContent = className;
</span><ins>+        classNameTitle.draggable = true;
+        classNameTitle.addEventListener(&quot;dragstart&quot;, (event) =&gt; {
+            event.dataTransfer.setData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType, className);
+            event.dataTransfer.effectAllowed = &quot;copy&quot;;
+        });
</ins><span class="cx"> 
</span><del>-        function classNameToggleChanged(event) {
-            this._toggleClass.call(this, className, classNameToggle.checked);
</del><ins>+        let classNameToggleChanged = (event) =&gt; {
+            this.domNode.toggleClass(className, classNameToggle.checked);
</ins><span class="cx">             classToggledMap.set(className, classNameToggle.checked);
</span><del>-        }
</del><ins>+        };
</ins><span class="cx"> 
</span><del>-        classNameToggle.addEventListener(&quot;click&quot;, classNameToggleChanged.bind(this));
</del><ins>+        classNameToggle.addEventListener(&quot;click&quot;, classNameToggleChanged);
</ins><span class="cx">         classNameTitle.addEventListener(&quot;click&quot;, (event) =&gt; {
</span><span class="cx">             classNameToggle.checked = !classNameToggle.checked;
</span><del>-            classNameToggleChanged.call(this);
</del><ins>+            classNameToggleChanged();
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         this._classListContainer.appendChild(classNameContainer);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _toggleClass(className, flag)
-    {
-        if (!className || !className.length)
-            return;
-
-        let effectiveNode = this.domNode;
-        if (effectiveNode &amp;&amp; effectiveNode.isPseudoElement())
-            effectiveNode = effectiveNode.parentNode;
-
-        console.assert(effectiveNode);
-        if (!effectiveNode)
-            return;
-
-        if (effectiveNode.nodeType() !== Node.ELEMENT_NODE)
-            return;
-
-        function resolvedNode(object)
-        {
-            if (!object)
-                return;
-
-            function toggleClass(className, flag)
-            {
-                this.classList.toggle(className, flag);
-            }
-
-            object.callFunction(toggleClass, [className, flag]);
-            object.release();
-        }
-
-        WebInspector.RemoteObject.resolveNode(effectiveNode, &quot;&quot;, resolvedNode);
-    }
-
</del><span class="cx">     _filterDidChange()
</span><span class="cx">     {
</span><span class="cx">         this.contentView.element.classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName, this._filterBar.hasActiveFilters());
</span><span class="lines">@@ -474,3 +451,4 @@
</span><span class="cx"> WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName = &quot;filter-property-non-matching&quot;;
</span><span class="cx"> 
</span><span class="cx"> WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol = Symbol(&quot;css-style-details-sidebar-panel-toggled-classes-symbol&quot;);
</span><ins>+WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType = &quot;text/classname&quot;;
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsDOMTreeOutlinejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js (206007 => 206008)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js        2016-09-16 00:33:45 UTC (rev 206007)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js        2016-09-16 00:56:14 UTC (rev 206008)
</span><span class="lines">@@ -387,14 +387,20 @@
</span><span class="cx"> 
</span><span class="cx">     _ondragover(event)
</span><span class="cx">     {
</span><ins>+        if (event.dataTransfer.types.includes(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType)) {
+            event.preventDefault();
+            event.dataTransfer.dropEffect = &quot;copy&quot;;
+            return false;
+        }
+
</ins><span class="cx">         if (!this._nodeBeingDragged)
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><del>-        var treeElement = this._treeElementFromEvent(event);
</del><ins>+        let treeElement = this._treeElementFromEvent(event);
</ins><span class="cx">         if (!this._isValidDragSourceOrTarget(treeElement))
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><del>-        var node = treeElement.representedObject;
</del><ins>+        let node = treeElement.representedObject;
</ins><span class="cx">         while (node) {
</span><span class="cx">             if (node === this._nodeBeingDragged)
</span><span class="cx">                 return false;
</span><span class="lines">@@ -447,21 +453,25 @@
</span><span class="cx">                 this.selectDOMNode(newNode, true);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        var treeElement = this._treeElementFromEvent(event);
</del><ins>+        let treeElement = this._treeElementFromEvent(event);
</ins><span class="cx">         if (this._nodeBeingDragged &amp;&amp; treeElement) {
</span><del>-            var parentNode;
-            var anchorNode;
</del><ins>+            let parentNode = null;
+            let anchorNode = null;
</ins><span class="cx"> 
</span><span class="cx">             if (treeElement._elementCloseTag) {
</span><span class="cx">                 // Drop onto closing tag -&gt; insert as last child.
</span><span class="cx">                 parentNode = treeElement.representedObject;
</span><span class="cx">             } else {
</span><del>-                var dragTargetNode = treeElement.representedObject;
</del><ins>+                let dragTargetNode = treeElement.representedObject;
</ins><span class="cx">                 parentNode = dragTargetNode.parentNode;
</span><span class="cx">                 anchorNode = dragTargetNode;
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             this._nodeBeingDragged.moveTo(parentNode, anchorNode, callback.bind(this));
</span><ins>+        } else {
+            let className = event.dataTransfer.getData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType);
+            if (className &amp;&amp; treeElement)
+                treeElement.representedObject.toggleClass(className, true);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         delete this._nodeBeingDragged;
</span></span></pre>
</div>
</div>

</body>
</html>