Title: [285215] trunk/Source/WebInspectorUI
Revision
285215
Author
nvasil...@apple.com
Date
2021-11-03 10:47:09 -0700 (Wed, 03 Nov 2021)

Log Message

Web Inspector: Display swatch popovers below the swatch by default, not on the left side
https://bugs.webkit.org/show_bug.cgi?id=232577

Reviewed by Devin Rousso.

The new defaults are: below, above, left.

Displaying the swatch popover on the left side covers the relevant property name.
Displaying it below or above doesn't have this problem; below is preferred because
it doesn't hide the CSS selector of the relevant rule.

* UserInterface/Views/InlineSwatch.js:
(WI.InlineSwatch.prototype._presentPopover):
Introduce a method to remove code duplication.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (285214 => 285215)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-11-03 17:28:39 UTC (rev 285214)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-11-03 17:47:09 UTC (rev 285215)
@@ -1,3 +1,20 @@
+2021-11-03  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Display swatch popovers below the swatch by default, not on the left side
+        https://bugs.webkit.org/show_bug.cgi?id=232577
+
+        Reviewed by Devin Rousso.
+
+        The new defaults are: below, above, left.
+
+        Displaying the swatch popover on the left side covers the relevant property name.
+        Displaying it below or above doesn't have this problem; below is preferred because
+        it doesn't hide the CSS selector of the relevant rule.
+
+        * UserInterface/Views/InlineSwatch.js:
+        (WI.InlineSwatch.prototype._presentPopover):
+        Introduce a method to remove code duplication.
+
 2021-10-29  David Kilzer  <ddkil...@apple.com>
 
         Web Inspector: Enable -Wformat=2 warnings

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js (285214 => 285215)


--- trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js	2021-11-03 17:28:39 UTC (rev 285214)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js	2021-11-03 17:47:09 UTC (rev 285215)
@@ -238,12 +238,10 @@
         if (!value)
             value = this._fallbackValue();
 
-        let bounds = WI.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
         let popover = new WI.Popover(this);
 
         popover.windowResizeHandler = () => {
-            let bounds = WI.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
-            popover.present(bounds.pad(2), [WI.RectEdge.MIN_X]);
+            this._presentPopover(popover);
         };
 
         this._valueEditor = null;
@@ -307,7 +305,7 @@
             return;
 
         popover.content = this._valueEditor.element;
-        popover.present(bounds.pad(2), [WI.RectEdge.MIN_X]);
+        this._presentPopover(popover);
 
         this.dispatchEventToListeners(WI.InlineSwatch.Event.Activated);
 
@@ -383,6 +381,12 @@
         this._updateSwatch();
     }
 
+    _presentPopover(popover)
+    {
+        let bounds = WI.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
+        popover.present(bounds.pad(2), [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MIN_X]);
+    }
+
     _handleContextMenuEvent(event)
     {
         let value = this.value;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to