Title: [238120] trunk/Source/WebInspectorUI
Revision
238120
Author
nvasil...@apple.com
Date
2018-11-12 20:43:41 -0800 (Mon, 12 Nov 2018)

Log Message

Web Inspector: Styles: inline swatches don't work when Multiple Properties Selection is enabled
https://bugs.webkit.org/show_bug.cgi?id=191165
<rdar://problem/45737972>

Reviewed by Devin Rousso.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._createInlineSwatch):
* UserInterface/Views/SpreadsheetTextField.js:
(WI.SpreadsheetTextField):
`click` is fired after `mouseup` and inline swatches are activated by `click` event.
Changing this to `click` allows swatches to activate before editing starts.

(WI.SpreadsheetTextField.prototype._handleMouseDown):
Clicking on the field that is being edited should't restart editing. It should move the text caret.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (238119 => 238120)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-11-13 02:38:06 UTC (rev 238119)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-11-13 04:43:41 UTC (rev 238120)
@@ -1,3 +1,21 @@
+2018-11-12  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Styles: inline swatches don't work when Multiple Properties Selection is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=191165
+        <rdar://problem/45737972>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/SpreadsheetStyleProperty.js:
+        (WI.SpreadsheetStyleProperty.prototype._createInlineSwatch):
+        * UserInterface/Views/SpreadsheetTextField.js:
+        (WI.SpreadsheetTextField):
+        `click` is fired after `mouseup` and inline swatches are activated by `click` event.
+        Changing this to `click` allows swatches to activate before editing starts.
+
+        (WI.SpreadsheetTextField.prototype._handleMouseDown):
+        Clicking on the field that is being edited should't restart editing. It should move the text caret.
+
 2018-11-12  Don Olmstead  <don.olmst...@sony.com>
 
         Shipped PNGs include bad profiles: iCCP: known incorrect sRGB profile

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (238119 => 238120)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js	2018-11-13 02:38:06 UTC (rev 238119)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js	2018-11-13 04:43:41 UTC (rev 238120)
@@ -452,6 +452,7 @@
 
         if (typeof this._delegate.stylePropertyInlineSwatchActivated === "function") {
             swatch.addEventListener(WI.InlineSwatch.Event.Activated, () => {
+                this._swatchActive = true;
                 this._delegate.stylePropertyInlineSwatchActivated();
             });
         }
@@ -458,6 +459,7 @@
 
         if (typeof this._delegate.stylePropertyInlineSwatchDeactivated === "function") {
             swatch.addEventListener(WI.InlineSwatch.Event.Deactivated, () => {
+                this._swatchActive = false;
                 this._delegate.stylePropertyInlineSwatchDeactivated();
             });
         }
@@ -465,7 +467,13 @@
         tokenElement.append(swatch.element, innerElement);
 
         // Prevent the value from editing when clicking on the swatch.
-        swatch.element.addEventListener("mousedown", (event) => { event.stop(); });
+        if (WI.settings.experimentalEnableMultiplePropertiesSelection.value) {
+            swatch.element.addEventListener("click", (event) => {
+                if (this._swatchActive)
+                    event.stop();
+            });
+        } else
+            swatch.element.addEventListener("mousedown", (event) => { event.stop(); });
 
         return tokenElement;
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js (238119 => 238120)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js	2018-11-13 02:38:06 UTC (rev 238119)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js	2018-11-13 04:43:41 UTC (rev 238120)
@@ -40,9 +40,10 @@
 
         this._element.classList.add("spreadsheet-text-field");
 
-        if (WI.settings.experimentalEnableMultiplePropertiesSelection.value)
-            this._element.addEventListener("mouseup", this._handleMouseUp.bind(this));
-        else
+        if (WI.settings.experimentalEnableMultiplePropertiesSelection.value) {
+            this._element.addEventListener("mousedown", this._handleMouseDown.bind(this), true);
+            this._element.addEventListener("click", this._handleClick.bind(this));
+        } else
             this._element.addEventListener("focus", this._handleFocus.bind(this));
 
         this._element.addEventListener("blur", this._handleBlur.bind(this));
@@ -201,11 +202,17 @@
         }
     }
 
-    _handleMouseUp(event)
+    _handleClick(event)
     {
         this.startEditing();
     }
 
+    _handleMouseDown(event)
+    {
+        if (this._editing)
+            event.stopPropagation();
+    }
+
     _handleFocus(event)
     {
         this.startEditing();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to