Title: [206729] trunk/Source/WebInspectorUI
Revision
206729
Author
[email protected]
Date
2016-10-02 22:45:15 -0700 (Sun, 02 Oct 2016)

Log Message

Web Inspector: Clicking twice on the color swatch square should hide the color picker
https://bugs.webkit.org/show_bug.cgi?id=162759

Patch by Devin Rousso <[email protected]> on 2016-10-02
Reviewed by Matt Baker.

* UserInterface/Views/InlineSwatch.js:
(WebInspector.InlineSwatch):
(WebInspector.InlineSwatch.prototype.didDismissPopover):
(WebInspector.InlineSwatch.prototype._swatchElementClicked):
Remove the "click" event listener when a popover is presented to prevent improper
interaction.  Add the event listener back when the popover is dismissed.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (206728 => 206729)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-10-03 04:54:24 UTC (rev 206728)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-10-03 05:45:15 UTC (rev 206729)
@@ -1,3 +1,17 @@
+2016-10-02  Devin Rousso  <[email protected]>
+
+        Web Inspector: Clicking twice on the color swatch square should hide the color picker
+        https://bugs.webkit.org/show_bug.cgi?id=162759
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/InlineSwatch.js:
+        (WebInspector.InlineSwatch):
+        (WebInspector.InlineSwatch.prototype.didDismissPopover):
+        (WebInspector.InlineSwatch.prototype._swatchElementClicked):
+        Remove the "click" event listener when a popover is presented to prevent improper
+        interaction.  Add the event listener back when the popover is dismissed.
+
 2016-10-02  Matt Baker  <[email protected]>
 
         Web Inspector: Exception thrown when hovering network waterfall graphs during reload

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js (206728 => 206729)


--- trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js	2016-10-03 04:54:24 UTC (rev 206728)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js	2016-10-03 05:45:15 UTC (rev 206729)
@@ -51,8 +51,10 @@
             break;
         }
 
+        this._boundSwatchElementClicked = null;
         if (!readOnly) {
-            this._swatchElement.addEventListener("click", this._swatchElementClicked.bind(this));
+            this._boundSwatchElementClicked = this._swatchElementClicked.bind(this);
+            this._swatchElement.addEventListener("click", this._boundSwatchElementClicked);
             if (this._type === WebInspector.InlineSwatch.Type.Color)
                 this._swatchElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
         }
@@ -83,7 +85,7 @@
         this._updateSwatch(true);
     }
 
-    // Protected
+    // Popover delegate
 
     didDismissPopover(popover)
     {
@@ -93,6 +95,9 @@
         if (typeof this._valueEditor.removeListeners === "function")
             this._valueEditor.removeListeners();
 
+        if (this._boundSwatchElementClicked)
+            this._swatchElement.addEventListener("click", this._boundSwatchElementClicked);
+
         this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Deactivated);
     }
 
@@ -165,6 +170,9 @@
         popover.content = this._valueEditor.element;
         popover.present(bounds.pad(2), [WebInspector.RectEdge.MIN_X]);
 
+        if (this._boundSwatchElementClicked)
+            this._swatchElement.removeEventListener("click", this._boundSwatchElementClicked);
+
         this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Activated);
 
         let value = this._value || this._fallbackValue();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to