Title: [280534] trunk/Source/WebCore
Revision
280534
Author
wei...@apple.com
Date
2021-08-02 09:38:30 -0700 (Mon, 02 Aug 2021)

Log Message

[Modern Media Controls] Address additional feedback on LayoutTraits refactor
https://bugs.webkit.org/show_bug.cgi?id=227489
<rdar://problem/80215569>

Reviewed by Devin Rousso.

Splitting up larger change to land pieces incrementally.

Part 1:
- Replaces eval() based lexical lookup with an explicit `window.layoutTraitsClasses`
  registry map.

* Modules/modern-media-controls/controls/ios-layout-traits.js:
* Modules/modern-media-controls/controls/layout-traits.js:
* Modules/modern-media-controls/controls/macos-layout-traits.js:
* Modules/modern-media-controls/controls/watchos-layout-traits.js:
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.get layoutTraits):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280533 => 280534)


--- trunk/Source/WebCore/ChangeLog	2021-08-02 16:08:10 UTC (rev 280533)
+++ trunk/Source/WebCore/ChangeLog	2021-08-02 16:38:30 UTC (rev 280534)
@@ -1,3 +1,24 @@
+2021-08-02  Sam Weinig  <wei...@apple.com>
+
+        [Modern Media Controls] Address additional feedback on LayoutTraits refactor
+        https://bugs.webkit.org/show_bug.cgi?id=227489
+        <rdar://problem/80215569>
+
+        Reviewed by Devin Rousso.
+
+        Splitting up larger change to land pieces incrementally.
+
+        Part 1:
+        - Replaces eval() based lexical lookup with an explicit `window.layoutTraitsClasses`
+          registry map.
+
+        * Modules/modern-media-controls/controls/ios-layout-traits.js:
+        * Modules/modern-media-controls/controls/layout-traits.js:
+        * Modules/modern-media-controls/controls/macos-layout-traits.js:
+        * Modules/modern-media-controls/controls/watchos-layout-traits.js:
+        * Modules/modern-media-controls/media/media-controller.js:
+        (MediaController.prototype.get layoutTraits):
+
 2021-08-02  Jer Noble  <jer.no...@apple.com>
 
         [Cocoa] Remove support for AVAssetImageGenerator

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/ios-layout-traits.js (280533 => 280534)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/ios-layout-traits.js	2021-08-02 16:08:10 UTC (rev 280533)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/ios-layout-traits.js	2021-08-02 16:38:30 UTC (rev 280534)
@@ -85,3 +85,5 @@
         return `[IOSLayoutTraits]`;
     }
 }
+
+window.layoutTraitsClasses["IOSLayoutTraits"] = IOSLayoutTraits;

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


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-traits.js	2021-08-02 16:08:10 UTC (rev 280533)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-traits.js	2021-08-02 16:38:30 UTC (rev 280534)
@@ -101,3 +101,6 @@
     Inline     : 0,
     Fullscreen : 1
 };
+
+// LayoutTraits subclasses should "register" themselves by adding themselves to this map.
+window.layoutTraitsClasses = { };

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-layout-traits.js (280533 => 280534)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-layout-traits.js	2021-08-02 16:08:10 UTC (rev 280533)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-layout-traits.js	2021-08-02 16:38:30 UTC (rev 280534)
@@ -88,3 +88,5 @@
         return `[MacOSLayoutTraits ${mode}]`;
     }
 }
+
+window.layoutTraitsClasses["MacOSLayoutTraits"] = MacOSLayoutTraits;

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/watchos-layout-traits.js (280533 => 280534)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/watchos-layout-traits.js	2021-08-02 16:08:10 UTC (rev 280533)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/watchos-layout-traits.js	2021-08-02 16:38:30 UTC (rev 280534)
@@ -85,3 +85,5 @@
         return `[WatchOSLayoutTraits]`;
     }
 }
+
+window.layoutTraitsClasses["WatchOSLayoutTraits"] = WatchOSLayoutTraits;

Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (280533 => 280534)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2021-08-02 16:08:10 UTC (rev 280533)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js	2021-08-02 16:38:30 UTC (rev 280534)
@@ -99,7 +99,7 @@
         let mode = this.isFullscreen ? LayoutTraits.Mode.Fullscreen : LayoutTraits.Mode.Inline;
     
         if (this.host) {
-            let LayoutTraitsClass = eval(this.host.layoutTraitsClassName);
+            let LayoutTraitsClass = window.layoutTraitsClasses[this.host.layoutTraitsClassName];
             return new LayoutTraitsClass(mode);
         }
         
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to