Title: [239766] trunk/Source/WebInspectorUI
Revision
239766
Author
nvasil...@apple.com
Date
2019-01-09 00:34:15 -0800 (Wed, 09 Jan 2019)

Log Message

Web Inspector: Styles: clicking on property that soon to be discarded shouldn't start selection
https://bugs.webkit.org/show_bug.cgi?id=193218
<rdar://problem/47098303>

Reviewed by Devin Rousso.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleMouseDown):
A style property may get removed on blur event, so propertyElement may get removed from the DOM right when mousedown event happens.

(WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleWindowClick):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleClick):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._stopSelection):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (239765 => 239766)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-01-09 06:35:49 UTC (rev 239765)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-01-09 08:34:15 UTC (rev 239766)
@@ -1,3 +1,19 @@
+2019-01-09  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Styles: clicking on property that soon to be discarded shouldn't start selection
+        https://bugs.webkit.org/show_bug.cgi?id=193218
+        <rdar://problem/47098303>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
+        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleMouseDown):
+        A style property may get removed on blur event, so propertyElement may get removed from the DOM right when mousedown event happens.
+
+        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleWindowClick):
+        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleClick):
+        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._stopSelection):
+
 2019-01-08  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Styles: Undo reverts all changes at once

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js (239765 => 239766)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js	2019-01-09 06:35:49 UTC (rev 239765)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js	2019-01-09 08:34:15 UTC (rev 239766)
@@ -407,8 +407,11 @@
         else
             this._propertiesEditor.deselectProperties();
 
-        this._mouseDownIndex = propertyIndex;
-        this._element.classList.add("selecting");
+        if (propertyElement.parentNode) {
+            this._mouseDownIndex = propertyIndex;
+            this._element.classList.add("selecting");
+        } else
+            this._stopSelection();
     }
 
     _handleWindowClick(event)
@@ -417,15 +420,13 @@
             // Don't start editing name/value if there's selection.
             event.stop();
         }
-
-        this._isMousePressed = false;
-        this._mouseDownIndex = NaN;
-
-        this._element.classList.remove("selecting");
+        this._stopSelection();
     }
 
     _handleClick(event)
     {
+        this._stopSelection();
+
         if (this._wasEditing || this._propertiesEditor.hasSelectedProperties())
             return;
 
@@ -451,6 +452,13 @@
         }
     }
 
+    _stopSelection()
+    {
+        this._isMousePressed = false;
+        this._mouseDownIndex = NaN;
+        this._element.classList.remove("selecting");
+    }
+
     _highlightNodesWithSelector()
     {
         if (!this._style.ownerRule) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to