Title: [279478] trunk/Source/WebCore
Revision
279478
Author
d...@apple.com
Date
2021-07-01 12:59:38 -0700 (Thu, 01 Jul 2021)

Log Message

Add a layoutTrait for an additional controls scale factor
https://bugs.webkit.org/show_bug.cgi?id=227561
<rdar://problem/79997951>

Reviewed by Anders Carlsson.

Allow controls with different layout traits to apply
a scale factor to their buttons.

No change in behaviour.

* Modules/modern-media-controls/controls/button.js:
(Button.prototype._updateImageMetrics):
(Button):
* Modules/modern-media-controls/controls/layout-traits.js:
(LayoutTraits.prototype.additionalControlScaleFactor):
(LayoutTraits):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279477 => 279478)


--- trunk/Source/WebCore/ChangeLog	2021-07-01 19:37:13 UTC (rev 279477)
+++ trunk/Source/WebCore/ChangeLog	2021-07-01 19:59:38 UTC (rev 279478)
@@ -1,3 +1,23 @@
+2021-07-01  Dean Jackson  <d...@apple.com>
+
+        Add a layoutTrait for an additional controls scale factor
+        https://bugs.webkit.org/show_bug.cgi?id=227561
+        <rdar://problem/79997951>
+
+        Reviewed by Anders Carlsson.
+
+        Allow controls with different layout traits to apply
+        a scale factor to their buttons.
+
+        No change in behaviour.
+
+        * Modules/modern-media-controls/controls/button.js:
+        (Button.prototype._updateImageMetrics):
+        (Button):
+        * Modules/modern-media-controls/controls/layout-traits.js:
+        (LayoutTraits.prototype.additionalControlScaleFactor):
+        (LayoutTraits):
+
 2021-07-01  Antoine Quint  <grao...@webkit.org>
 
         [Model] Restrict IPC calls to ARKit SPI availability and runtime flag

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/button.js (279477 => 279478)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/button.js	2021-07-01 19:37:13 UTC (rev 279477)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/button.js	2021-07-01 19:59:38 UTC (rev 279478)
@@ -202,8 +202,8 @@
 
     _updateImageMetrics()
     {
-        let width = this._imageSource.width * this._scaleFactor;
-        let height = this._imageSource.height * this._scaleFactor;
+        let width = this._imageSource.width * this._scaleFactor * this.layoutTraits.additionalControlScaleFactor();
+        let height = this._imageSource.height * this._scaleFactor * this.layoutTraits.additionalControlScaleFactor();
 
         if (this._iconName.type === "png" || this._iconName.type === "pdf") {
             width /= window.devicePixelRatio;

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-traits.js (279477 => 279478)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-traits.js	2021-07-01 19:37:13 UTC (rev 279477)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-traits.js	2021-07-01 19:59:38 UTC (rev 279478)
@@ -75,21 +75,26 @@
     {
         throw "Derived class must implement this function.";
     }
-    
+
     playPauseButtonScaleFactor()
     {
         throw "Derived class must implement this function.";
     }
-    
+
     controlsDependOnPageScaleFactor()
     {
         throw "Derived class must implement this function.";
     }
-    
+
     promoteSubMenusWhenShowingMediaControlsContextMenu()
     {
         throw "Derived class must implement this function.";
     }
+
+    additionalControlScaleFactor()
+    {
+        return 1;
+    }
 }
 
 LayoutTraits.Mode = {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to