Title: [166669] trunk
Revision
166669
Author
[email protected]
Date
2014-04-02 14:42:30 -0700 (Wed, 02 Apr 2014)

Log Message

Load Media Controls js/css from bundle
https://bugs.webkit.org/show_bug.cgi?id=131086

Reviewed by Eric Carlson.

Source/WebCore:

Rather than embed encoded versions of the JS and CSS files
into C++ source, just load the files directly from the bundle.

* DerivedSources.make: Removed now unnecessary rules.
* WebCore.xcodeproj/project.pbxproj: Copy mediaControls files to the bundle.
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::RenderThemeIOS):
(WebCore::RenderThemeIOS::mediaControlsStyleSheet): Load from the bundle.
(WebCore::RenderThemeIOS::mediaControlsScript): Ditto.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::RenderThemeMac):
(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):

Tools:

We're now putting CSS files into the bundle, so remove the test for them.

* Scripts/check-for-inappropriate-files-in-framework:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (166668 => 166669)


--- trunk/Source/WebCore/ChangeLog	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Source/WebCore/ChangeLog	2014-04-02 21:42:30 UTC (rev 166669)
@@ -1,3 +1,26 @@
+2014-04-01  Dean Jackson  <[email protected]>
+
+        Load Media Controls js/css from bundle
+        https://bugs.webkit.org/show_bug.cgi?id=131086
+
+        Reviewed by Eric Carlson.
+
+        Rather than embed encoded versions of the JS and CSS files
+        into C++ source, just load the files directly from the bundle.
+
+        * DerivedSources.make: Removed now unnecessary rules.
+        * WebCore.xcodeproj/project.pbxproj: Copy mediaControls files to the bundle.
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::RenderThemeIOS):
+        (WebCore::RenderThemeIOS::mediaControlsStyleSheet): Load from the bundle.
+        (WebCore::RenderThemeIOS::mediaControlsScript): Ditto.
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::RenderThemeMac):
+        (WebCore::RenderThemeMac::mediaControlsStyleSheet):
+        (WebCore::RenderThemeMac::mediaControlsScript):
+
 2014-04-02  Daniel Bates  <[email protected]>
 
         Move focus management API from HTMLDocument to Document

Modified: trunk/Source/WebCore/DerivedSources.make (166668 => 166669)


--- trunk/Source/WebCore/DerivedSources.make	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Source/WebCore/DerivedSources.make	2014-04-02 21:42:30 UTC (rev 166669)
@@ -882,13 +882,6 @@
     USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/fullscreen.css
 endif
 
-ifeq ($(findstring ENABLE_MEDIA_CONTROLS_SCRIPT,$(FEATURE_DEFINES)), ENABLE_MEDIA_CONTROLS_SCRIPT)
-	USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/mediacontrols/mediaControlsApple.css
-ifeq ($(WTF_PLATFORM_IOS), 1)
-    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/mediacontrols/mediaControlsiOS.css
-endif
-endif
-
 ifeq ($(findstring ENABLE_IMAGE_CONTROLS,$(FEATURE_DEFINES)), ENABLE_IMAGE_CONTROLS)
 	USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/html/shadow/mac/imageControlsMac.css
 endif
@@ -906,13 +899,6 @@
 
 USER_AGENT_SCRIPTS = 
 
-ifeq ($(findstring ENABLE_MEDIA_CONTROLS_SCRIPT,$(FEATURE_DEFINES)), ENABLE_MEDIA_CONTROLS_SCRIPT)
-	USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/mediacontrols/mediaControlsApple.js
-ifeq ($(WTF_PLATFORM_IOS), 1)
-	USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/mediacontrols/mediaControlsiOS.js
-endif
-endif
-
 ifeq ($(OS),MACOS)
 	USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/plugins/QuickTimePluginReplacement.js
 endif

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (166668 => 166669)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-04-02 21:42:30 UTC (rev 166669)
@@ -1152,6 +1152,10 @@
 		31078CC81880AABB008099DC /* OESTextureHalfFloatLinear.h in Headers */ = {isa = PBXBuildFile; fileRef = 31078CC31880A6A6008099DC /* OESTextureHalfFloatLinear.h */; };
 		31078CC91880AAC9008099DC /* JSOESTextureHalfFloatLinear.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31078CC51880AAAA008099DC /* JSOESTextureHalfFloatLinear.cpp */; };
 		31078CCA1880AACE008099DC /* JSOESTextureHalfFloatLinear.h in Headers */ = {isa = PBXBuildFile; fileRef = 31078CC61880AAAA008099DC /* JSOESTextureHalfFloatLinear.h */; };
+		311C08BD18EB7CAF00B65615 /* mediaControlsApple.css in Resources */ = {isa = PBXBuildFile; fileRef = CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */; };
+		311C08BE18EB7CAF00B65615 /* mediaControlsApple.js in Resources */ = {isa = PBXBuildFile; fileRef = CDE6560E17CA6E7600526BA7 /* mediaControlsApple.js */; };
+		311C08BF18EB7CAF00B65615 /* mediaControlsiOS.css in Resources */ = {isa = PBXBuildFile; fileRef = CDAAF45D1869094E003C1717 /* mediaControlsiOS.css */; };
+		311C08C018EB7CAF00B65615 /* mediaControlsiOS.js in Resources */ = {isa = PBXBuildFile; fileRef = CD32A189184EB46A0029B1BB /* mediaControlsiOS.js */; };
 		31288E720E3005D6003619AE /* WebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */; };
 		31288E730E3005D6003619AE /* WebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */; };
 		31288E740E3005D6003619AE /* WebKitCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */; };
@@ -26425,6 +26429,10 @@
 				2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */,
 				85136C9C0AED665900F90A3D /* linkCursor.png in Resources */,
 				BCAD180A131C7A0D00990406 /* Localizable.strings in Resources */,
+				311C08BD18EB7CAF00B65615 /* mediaControlsApple.css in Resources */,
+				311C08BE18EB7CAF00B65615 /* mediaControlsApple.js in Resources */,
+				311C08BF18EB7CAF00B65615 /* mediaControlsiOS.css in Resources */,
+				311C08C018EB7CAF00B65615 /* mediaControlsiOS.js in Resources */,
 				93153BE214195A5700FCF5BE /* missingImage.png in Resources */,
 				93153BDA14181F7A00FCF5BE /* [email protected] in Resources */,
 				85136C9D0AED665900F90A3D /* moveCursor.png in Resources */,

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (166668 => 166669)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.h	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h	2014-04-02 21:42:30 UTC (rev 166669)
@@ -116,6 +116,11 @@
 
     const Color& shadowColor() const;
     FloatRect addRoundedBorderClip(RenderObject* box, GraphicsContext*, const IntRect&);
+
+    String m_mediaControlsScript;
+    String m_mediaControlsStyleSheet;
+    bool m_mediaControlsScriptLoaded;
+    bool m_mediaControlsStyleSheetLoaded;
 };
 
 }

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (166668 => 166669)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2014-04-02 21:42:30 UTC (rev 166669)
@@ -76,6 +76,12 @@
 SOFT_LINK_CONSTANT(UIKit, UIContentSizeCategoryDidChangeNotification, CFStringRef)
 #define UIContentSizeCategoryDidChangeNotification getUIContentSizeCategoryDidChangeNotification()
 
+@interface WebCoreRenderThemeBundle : NSObject
+@end
+
+@implementation WebCoreRenderThemeBundle
+@end
+
 namespace WebCore {
 
 const float ControlBaseHeight = 20;
@@ -276,6 +282,8 @@
 }
 
 RenderThemeIOS::RenderThemeIOS()
+    : m_mediaControlsScriptLoaded(false)
+    , m_mediaControlsStyleSheetLoaded(false)
 {
     CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, contentSizeCategoryDidChange, UIContentSizeCategoryDidChangeNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
 }
@@ -1197,7 +1205,11 @@
 String RenderThemeIOS::mediaControlsStyleSheet()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    return String(mediaControlsiOSUserAgentStyleSheet, sizeof(mediaControlsiOSUserAgentStyleSheet));
+    if (!m_mediaControlsStyleSheetLoaded) {
+        m_mediaControlsStyleSheet = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
+        m_mediaControlsStyleSheetLoaded = true;
+    }
+    return m_mediaControlsStyleSheet;
 #else
     return emptyString();
 #endif
@@ -1206,10 +1218,14 @@
 String RenderThemeIOS::mediaControlsScript()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    StringBuilder scriptBuilder;
-    scriptBuilder.append(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
-    scriptBuilder.append(mediaControlsiOSJavaScript, sizeof(mediaControlsiOSJavaScript));
-    return scriptBuilder.toString();
+    if (!m_mediaControlsScriptLoaded) {
+        StringBuilder scriptBuilder;
+        scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+        scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+        m_mediaControlsScript = scriptBuilder.toString();
+        m_mediaControlsScriptLoaded = true;
+    }
+    return m_mediaControlsScript;
 #else
     return emptyString();
 #endif

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (166668 => 166669)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2014-04-02 21:42:30 UTC (rev 166669)
@@ -248,6 +248,11 @@
     mutable HashMap<int, RGBA32> m_systemColorCache;
 
     RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver;
+
+    String m_mediaControlsScript;
+    String m_mediaControlsStyleSheet;
+    bool m_mediaControlsScriptLoaded;
+    bool m_mediaControlsStyleSheetLoaded;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (166668 => 166669)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2014-04-02 21:42:30 UTC (rev 166669)
@@ -165,6 +165,12 @@
 }
 @end
 
+@interface WebCoreRenderThemeBundle : NSObject
+@end
+
+@implementation WebCoreRenderThemeBundle
+@end
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -198,6 +204,8 @@
     : m_isSliderThumbHorizontalPressed(false)
     , m_isSliderThumbVerticalPressed(false)
     , m_notificationObserver(adoptNS([[WebCoreRenderThemeNotificationObserver alloc] initWithTheme:this]))
+    , m_mediaControlsScriptLoaded(false)
+    , m_mediaControlsStyleSheetLoaded(false)
 {
     [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get()
                                                         selector:@selector(systemColorsDidChange:)
@@ -220,7 +228,11 @@
 String RenderThemeMac::mediaControlsStyleSheet()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    return String(mediaControlsAppleUserAgentStyleSheet, sizeof(mediaControlsAppleUserAgentStyleSheet));
+    if (!m_mediaControlsStyleSheetLoaded) {
+        m_mediaControlsStyleSheet = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
+        m_mediaControlsStyleSheetLoaded = true;
+    }
+    return m_mediaControlsStyleSheet;
 #else
     return emptyString();
 #endif
@@ -229,7 +241,11 @@
 String RenderThemeMac::mediaControlsScript()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    return String(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
+    if (!m_mediaControlsScriptLoaded) {
+        m_mediaControlsScript = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil];
+        m_mediaControlsScriptLoaded = true;
+    }
+    return m_mediaControlsScript;
 #else
     return emptyString();
 #endif

Modified: trunk/Tools/ChangeLog (166668 => 166669)


--- trunk/Tools/ChangeLog	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Tools/ChangeLog	2014-04-02 21:42:30 UTC (rev 166669)
@@ -1,3 +1,14 @@
+2014-04-01  Dean Jackson  <[email protected]>
+
+        Load Media Controls js/css from bundle
+        https://bugs.webkit.org/show_bug.cgi?id=131086
+
+        Reviewed by Eric Carlson.
+
+        We're now putting CSS files into the bundle, so remove the test for them.
+
+        * Scripts/check-for-inappropriate-files-in-framework:
+
 2014-04-02  Martin Hock  <[email protected]>
 
         Unify private browsing with sessions.

Modified: trunk/Tools/Scripts/check-for-inappropriate-files-in-framework (166668 => 166669)


--- trunk/Tools/Scripts/check-for-inappropriate-files-in-framework	2014-04-02 21:40:26 UTC (rev 166668)
+++ trunk/Tools/Scripts/check-for-inappropriate-files-in-framework	2014-04-02 21:42:30 UTC (rev 166669)
@@ -27,7 +27,7 @@
 project_name = ENV['PROJECT_NAME'] or throw "Unable to find PROJECT_NAME in the environment!"
 is_shallow_bundle = (ENV['SHALLOW_BUNDLE'] || "NO").upcase == "YES"
 
-$INAPPROPRIATE_FILES = { "WebCore" => { "Resources" => ["*.css", "*.in", "*.idl", "*.h"] },
+$INAPPROPRIATE_FILES = { "WebCore" => { "Resources" => ["*.in", "*.idl", "*.h"] },
                          "WebKit2" => { "Resources" => ["*.in", "*.h"] },
                        }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to