Title: [215509] trunk/Source/WebCore
Revision
215509
Author
[email protected]
Date
2017-04-19 07:57:52 -0700 (Wed, 19 Apr 2017)

Log Message

[Modern Media Controls] Allow non-PNG resources
https://bugs.webkit.org/show_bug.cgi?id=170992
<rdar://problem/31706590>

Reviewed by Dean Jackson.

Instead of passing in a name and a platform to MediaControlsHost::base64StringForIconAndPlatform(),
we now pass in a name and a type to MediaControlsHost::base64StringForIconNameAndType(). We've removed
the need to provide a platform by copying the resources directly under "Resources/modern-media-controls"
insted of "Resources/modern-media-controls/platform-name-here", and now we provide a type so that it
may be passed down to -[NSBundle pathForResource:ofType:inDirectory:].

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::base64StringForIconNameAndType):
(WebCore::MediaControlsHost::base64StringForIconAndPlatform): Deleted.
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:
* Modules/modern-media-controls/controls/icon-service.js:
(const.iconService.new.IconService.prototype.imageForIconNameAndLayoutTraits):
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderTheme.h:
(WebCore::RenderTheme::mediaControlsBase64StringForIconNameAndType):
(WebCore::RenderTheme::mediaControlsBase64StringForIconAndPlatform): Deleted.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsBase64StringForIconNameAndType):
(WebCore::RenderThemeIOS::mediaControlsBase64StringForIconAndPlatform): Deleted.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType):
(WebCore::RenderThemeMac::mediaControlsBase64StringForIconAndPlatform): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215508 => 215509)


--- trunk/Source/WebCore/ChangeLog	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/ChangeLog	2017-04-19 14:57:52 UTC (rev 215509)
@@ -1,3 +1,37 @@
+2017-04-19  Antoine Quint  <[email protected]>
+
+        [Modern Media Controls] Allow non-PNG resources
+        https://bugs.webkit.org/show_bug.cgi?id=170992
+        <rdar://problem/31706590>
+
+        Reviewed by Dean Jackson.
+
+        Instead of passing in a name and a platform to MediaControlsHost::base64StringForIconAndPlatform(),
+        we now pass in a name and a type to MediaControlsHost::base64StringForIconNameAndType(). We've removed
+        the need to provide a platform by copying the resources directly under "Resources/modern-media-controls"
+        insted of "Resources/modern-media-controls/platform-name-here", and now we provide a type so that it
+        may be passed down to -[NSBundle pathForResource:ofType:inDirectory:].
+
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::base64StringForIconNameAndType):
+        (WebCore::MediaControlsHost::base64StringForIconAndPlatform): Deleted.
+        * Modules/mediacontrols/MediaControlsHost.h:
+        * Modules/mediacontrols/MediaControlsHost.idl:
+        * Modules/modern-media-controls/controls/icon-service.js:
+        (const.iconService.new.IconService.prototype.imageForIconNameAndLayoutTraits):
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::mediaControlsBase64StringForIconNameAndType):
+        (WebCore::RenderTheme::mediaControlsBase64StringForIconAndPlatform): Deleted.
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::mediaControlsBase64StringForIconNameAndType):
+        (WebCore::RenderThemeIOS::mediaControlsBase64StringForIconAndPlatform): Deleted.
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType):
+        (WebCore::RenderThemeMac::mediaControlsBase64StringForIconAndPlatform): Deleted.
+
 2017-04-19  Antti Koivisto  <[email protected]>
 
         Avoid repaints for invisible animations on tumblr.com/search/aww

Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (215508 => 215509)


--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp	2017-04-19 14:57:52 UTC (rev 215509)
@@ -286,12 +286,12 @@
     return RenderTheme::themeForPage(page)->modernMediaControlsStyleSheet();
 }
 
-String MediaControlsHost::base64StringForIconAndPlatform(const String& iconName, const String& platform) const
+String MediaControlsHost::base64StringForIconNameAndType(const String& iconName, const String& iconType) const
 {
     Page* page = m_mediaElement->document().page();
     if (!page)
         return emptyString();
-    return RenderTheme::themeForPage(page)->mediaControlsBase64StringForIconAndPlatform(iconName, platform);
+    return RenderTheme::themeForPage(page)->mediaControlsBase64StringForIconNameAndType(iconName, iconType);
 }
 
 }

Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (215508 => 215509)


--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h	2017-04-19 14:57:52 UTC (rev 215509)
@@ -88,7 +88,7 @@
     String generateUUID() const;
 
     String shadowRootCSSText() const;
-    String base64StringForIconAndPlatform(const String& iconName, const String& platform) const;
+    String base64StringForIconNameAndType(const String& iconName, const String& iconType) const;
 
 private:
     MediaControlsHost(HTMLMediaElement*);

Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (215508 => 215509)


--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl	2017-04-19 14:57:52 UTC (rev 215509)
@@ -62,5 +62,5 @@
     DOMString generateUUID();
 
     [EnabledAtRuntime=ModernMediaControls] readonly attribute DOMString shadowRootCSSText;
-    [EnabledAtRuntime=ModernMediaControls] DOMString base64StringForIconAndPlatform(DOMString iconName, DOMString platform);
+    [EnabledAtRuntime=ModernMediaControls] DOMString base64StringForIconNameAndType(DOMString iconName, DOMString iconType);
 };

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/icon-service.js (215508 => 215509)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/icon-service.js	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/icon-service.js	2017-04-19 14:57:52 UTC (rev 215509)
@@ -70,7 +70,7 @@
         image = this.images[path] = new Image;
 
         if (this.mediaControlsHost)
-            image.src = "" + this.mediaControlsHost.base64StringForIconAndPlatform(fileName, platform);
+            image.src = "" + this.mediaControlsHost.base64StringForIconNameAndType(fileName, "png");
         else
             image.src = ""
 

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (215508 => 215509)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-04-19 14:57:52 UTC (rev 215509)
@@ -30336,7 +30336,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "WKA_DIR=\"$BUILT_PRODUCTS_DIR/usr/local/include/WebKitAdditions/modern-media-controls\"\nSRC_DIR=\"$SRCROOT/Modules/modern-media-controls\"\nDST_DIR=\"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls\"\n\nif [ -d \"$WKA_DIR\" ]; then\n    MMC_DIR=$WKA_DIR;\nelse\n    MMC_DIR=$SRC_DIR\nfi\n\nmkdir -p \"$DST_DIR\"\n\nif [ \"${PLATFORM_NAME}\" == \"macosx\" ]; then\n    IMG_OS_PREFIX=\"macOS\"\nfi\n\nif [ \"${PLATFORM_NAME}\" == \"iphoneos\" ] || [ \"${PLATFORM_NAME}\" == \"iphonesimulator\" ]; then\n    IMG_OS_PREFIX=\"iOS\"\nfi\n\nif [ -n \"$IMG_OS_PREFIX\" ]; then\n    mkdir -p \"$DST_DIR/images\"\n    rsync -aq --exclude \".svn\" --exclude \".DS_Store\" \"$MMC_DIR/images/$IMG_OS_PREFIX\" \"$DST_DIR/images\"\nfi\n\ncd \"$MMC_DIR\
 "\ncat controls/*.css > \"$DST_DIR/modern-media-controls.css\"\ncat `cat js-files` > \"$DST_DIR/modern-media-controls.js\"";
+			shellScript = "WKA_DIR=\"$BUILT_PRODUCTS_DIR/usr/local/include/WebKitAdditions/modern-media-controls\"\nSRC_DIR=\"$SRCROOT/Modules/modern-media-controls\"\nDST_DIR=\"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls\"\n\nif [ -d \"$WKA_DIR\" ]; then\n    MMC_DIR=$WKA_DIR;\nelse\n    MMC_DIR=$SRC_DIR\nfi\n\nmkdir -p \"$DST_DIR\"\n\nif [ \"${PLATFORM_NAME}\" == \"macosx\" ]; then\n    IMG_OS_PREFIX=\"macOS\"\nfi\n\nif [ \"${PLATFORM_NAME}\" == \"iphoneos\" ] || [ \"${PLATFORM_NAME}\" == \"iphonesimulator\" ]; then\n    IMG_OS_PREFIX=\"iOS\"\nfi\n\nif [ -n \"$IMG_OS_PREFIX\" ]; then\n    rsync -aq --exclude \".svn\" --exclude \".DS_Store\" \"$MMC_DIR/images/$IMG_OS_PREFIX/\" \"$DST_DIR/images\"\nfi\n\ncd \"$MMC_DIR\"\ncat controls/*.css > \"$DST_
 DIR/modern-media-controls.css\"\ncat `cat js-files` > \"$DST_DIR/modern-media-controls.js\"";
 		};
 		A5E79CEC1E67F2CF00FB8153 /* Make Frameworks Symbolic Link */ = {
 			isa = PBXShellScriptBuildPhase;

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (215508 => 215509)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2017-04-19 14:57:52 UTC (rev 215509)
@@ -101,7 +101,7 @@
     virtual String modernMediaControlsStyleSheet() { return String(); }
     virtual String extraMediaControlsStyleSheet() { return String(); }
     virtual String mediaControlsScript() { return String(); }
-    virtual String mediaControlsBase64StringForIconAndPlatform(const String&, const String&) { return String(); }
+    virtual String mediaControlsBase64StringForIconNameAndType(const String&, const String&) { return String(); }
 #endif
 #if ENABLE(FULLSCREEN_API)
     virtual String extraFullScreenStyleSheet() { return String(); }

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (215508 => 215509)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.h	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h	2017-04-19 14:57:52 UTC (rev 215509)
@@ -109,7 +109,7 @@
     String mediaControlsStyleSheet() override;
     String modernMediaControlsStyleSheet() override;
     String mediaControlsScript() override;
-    String mediaControlsBase64StringForIconAndPlatform(const String&, const String&) override;
+    String mediaControlsBase64StringForIconNameAndType(const String&, const String&) override;
 #endif
 
 #if ENABLE(ATTACHMENT_ELEMENT)

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (215508 => 215509)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2017-04-19 14:57:52 UTC (rev 215509)
@@ -1372,15 +1372,15 @@
 #endif
 }
 
-String RenderThemeIOS::mediaControlsBase64StringForIconAndPlatform(const String& iconName, const String& platform)
+String RenderThemeIOS::mediaControlsBase64StringForIconNameAndType(const String& iconName, const String& iconType)
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (!RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled())
         return emptyString();
 
-    String directory = "modern-media-controls/images/" + platform;
+    String directory = "modern-media-controls/images";
     NSBundle *bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
-    return [[NSData dataWithContentsOfFile:[bundle pathForResource:iconName ofType:@"png" inDirectory:directory]] base64EncodedStringWithOptions:0];
+    return [[NSData dataWithContentsOfFile:[bundle pathForResource:iconName ofType:iconType inDirectory:directory]] base64EncodedStringWithOptions:0];
 #else
     return emptyString();
 #endif

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (215508 => 215509)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2017-04-19 14:57:52 UTC (rev 215509)
@@ -109,7 +109,7 @@
     String mediaControlsStyleSheet() override;
     String modernMediaControlsStyleSheet() override;
     String mediaControlsScript() override;
-    String mediaControlsBase64StringForIconAndPlatform(const String&, const String&) override;
+    String mediaControlsBase64StringForIconNameAndType(const String&, const String&) override;
 #endif
 
 #if ENABLE(SERVICE_CONTROLS)

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (215508 => 215509)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2017-04-19 13:00:37 UTC (rev 215508)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2017-04-19 14:57:52 UTC (rev 215509)
@@ -292,15 +292,15 @@
 #endif
 }
 
-String RenderThemeMac::mediaControlsBase64StringForIconAndPlatform(const String& iconName, const String& platform)
+String RenderThemeMac::mediaControlsBase64StringForIconNameAndType(const String& iconName, const String& iconType)
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (!RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled())
         return emptyString();
 
-    String directory = "modern-media-controls/images/" + platform;
+    String directory = "modern-media-controls/images";
     NSBundle *bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
-    return [[NSData dataWithContentsOfFile:[bundle pathForResource:iconName ofType:@"png" inDirectory:directory]] base64EncodedStringWithOptions:0];
+    return [[NSData dataWithContentsOfFile:[bundle pathForResource:iconName ofType:iconType inDirectory:directory]] base64EncodedStringWithOptions:0];
 #else
     return emptyString();
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to