[Modern Media Controls] Concatenate JS and CSS files into a single JS and CSS resources
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 14:58:05 +0000 (14:58 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 14:58:05 +0000 (14:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163785
<rdar://problem/28890058>

Reviewed by Darin Adler.

Concatenate CSS and JS resources for modern media controls into single JS and CSS files
during build and load these single resources alone at runtime.

* Modules/modern-media-controls/js-files: Added.
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207758 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/js-files [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/rendering/RenderThemeMac.mm

index 1a7b85d..cdc44bb 100644 (file)
@@ -1,3 +1,20 @@
+2016-10-21  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] Concatenate JS and CSS files into a single JS and CSS resources
+        https://bugs.webkit.org/show_bug.cgi?id=163785
+        <rdar://problem/28890058>
+
+        Reviewed by Darin Adler.
+
+        Concatenate CSS and JS resources for modern media controls into single JS and CSS files
+        during build and load these single resources alone at runtime.
+
+        * Modules/modern-media-controls/js-files: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::mediaControlsStyleSheet):
+        (WebCore::RenderThemeMac::mediaControlsScript):
+
 2016-10-24  Dave Hyatt  <hyatt@apple.com>
 
         [CSS Parser] Unprefix -webkit-writing-mode
diff --git a/Source/WebCore/Modules/modern-media-controls/js-files b/Source/WebCore/Modules/modern-media-controls/js-files
new file mode 100644 (file)
index 0000000..795483c
--- /dev/null
@@ -0,0 +1,34 @@
+controls/scheduler.js
+controls/layout-node.js
+controls/layout-item.js
+controls/icon-service.js
+controls/time-control.js
+controls/time-label.js
+controls/slider.js
+controls/volume-slider.js
+controls/scrubber.js
+controls/button.js
+controls/start-button.js
+controls/icon-button.js
+controls/play-pause-button.js
+controls/skip-back-button.js
+controls/mute-button.js
+controls/airplay-button.js
+controls/pip-button.js
+controls/tracks-button.js
+controls/fullscreen-button.js
+controls/aspect-ratio-button.js
+controls/rewind-button.js
+controls/forward-button.js
+controls/media-controls.js
+controls/macos-media-controls.js
+controls/macos-inline-media-controls.js
+controls/buttons-container.js
+controls/placard.js
+controls/airplay-placard.js
+controls/pip-placard.js
+media/media-controller-support.js
+media/start-support.js
+media/mute-support.js
+media/media-controller.js
+main.js
index ae59add..a1803ff 100644 (file)
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "rsync -aq --exclude \".svn\" --exclude \".DS_Store\" --exclude \"tests\" \"$SRCROOT/Modules/modern-media-controls\" \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\"";
+                       shellScript = "rsync -aq --exclude \".svn\" --exclude \".DS_Store\" \"$SRCROOT/Modules/modern-media-controls/images\" \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls\"\ncd \"$SRCROOT/Modules/modern-media-controls\"\ncat controls/*.css > \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls/modern-media-controls.css\"\ncat `cat js-files` > \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls/modern-media-controls.js\"";
                };
                DD041FBD09D9DDBE0010AF2A /* Generate Derived Sources */ = {
                        isa = PBXShellScriptBuildPhase;
index 6d204e7..107e835 100644 (file)
@@ -236,11 +236,9 @@ String RenderThemeMac::mediaControlsStyleSheet()
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (m_mediaControlsStyleSheet.isEmpty()) {
         StringBuilder styleSheetBuilder;
-        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
-            NSArray *paths = @[@"airplay-button", @"button", @"buttons-container", @"icon-button", @"macos-inline-media-controls", @"media-controls", @"placard", @"scrubber", @"slider", @"start-button", @"time-label", @"volume-slider"];
-            for (NSString *path in paths)
-                styleSheetBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:path ofType:@"css" inDirectory:@"modern-media-controls/controls"] encoding:NSUTF8StringEncoding error:nil]);
-        } else
+        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled())
+            styleSheetBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"modern-media-controls" ofType:@"css" inDirectory:@"modern-media-controls"] encoding:NSUTF8StringEncoding error:nil]);
+        else
             styleSheetBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil]);
         m_mediaControlsStyleSheet = styleSheetBuilder.toString();
     }
@@ -256,15 +254,9 @@ String RenderThemeMac::mediaControlsScript()
     if (m_mediaControlsScript.isEmpty()) {
         StringBuilder scriptBuilder;
         NSBundle *bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
-        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
-            NSArray *controlsPaths = @[@"scheduler", @"layout-node", @"layout-item", @"icon-service", @"time-control", @"time-label", @"slider", @"volume-slider", @"scrubber", @"button", @"start-button", @"icon-button", @"play-pause-button", @"skip-back-button", @"mute-button", @"airplay-button", @"pip-button", @"tracks-button", @"fullscreen-button", @"aspect-ratio-button", @"rewind-button", @"forward-button", @"media-controls", @"macos-media-controls", @"macos-inline-media-controls", @"buttons-container", @"placard", @"airplay-placard", @"pip-placard"];
-            for (NSString *path in controlsPaths)
-                scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:path ofType:@"js" inDirectory:@"modern-media-controls/controls"] encoding:NSUTF8StringEncoding error:nil]);
-            NSArray *mediaPaths = @[@"media-controller-support", @"mute-support", @"start-support", @"media-controller"];
-            for (NSString *path in mediaPaths)
-                scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:path ofType:@"js" inDirectory:@"modern-media-controls/media"] encoding:NSUTF8StringEncoding error:nil]);
-            scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"main" ofType:@"js" inDirectory:@"modern-media-controls"] encoding:NSUTF8StringEncoding error:nil]);
-        } else {
+        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled())
+            scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"modern-media-controls" ofType:@"js" inDirectory:@"modern-media-controls"] encoding:NSUTF8StringEncoding error:nil]);
+        else {
             scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
             scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
         }