Title: [207758] trunk/Source/WebCore
Revision
207758
Author
grao...@webkit.org
Date
2016-10-24 07:58:05 -0700 (Mon, 24 Oct 2016)

Log Message

[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):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207757 => 207758)


--- trunk/Source/WebCore/ChangeLog	2016-10-24 14:39:40 UTC (rev 207757)
+++ trunk/Source/WebCore/ChangeLog	2016-10-24 14:58:05 UTC (rev 207758)
@@ -1,3 +1,20 @@
+2016-10-21  Antoine Quint  <grao...@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  <hy...@apple.com>
 
         [CSS Parser] Unprefix -webkit-writing-mode

Added: trunk/Source/WebCore/Modules/modern-media-controls/js-files (0 => 207758)


--- trunk/Source/WebCore/Modules/modern-media-controls/js-files	                        (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/js-files	2016-10-24 14:58:05 UTC (rev 207758)
@@ -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

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207757 => 207758)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-24 14:39:40 UTC (rev 207757)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-24 14:58:05 UTC (rev 207758)
@@ -28000,7 +28000,7 @@
 			);
 			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;

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (207757 => 207758)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2016-10-24 14:39:40 UTC (rev 207757)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2016-10-24 14:58:05 UTC (rev 207758)
@@ -236,11 +236,9 @@
 #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 @@
     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]);
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to