Changeset 166669 in webkit


Ignore:
Timestamp:
Apr 2, 2014 2:42:30 PM (10 years ago)
Author:
dino@apple.com
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:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166668 r166669  
     12014-04-01  Dean Jackson  <dino@apple.com>
     2
     3        Load Media Controls js/css from bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=131086
     5
     6        Reviewed by Eric Carlson.
     7
     8        Rather than embed encoded versions of the JS and CSS files
     9        into C++ source, just load the files directly from the bundle.
     10
     11        * DerivedSources.make: Removed now unnecessary rules.
     12        * WebCore.xcodeproj/project.pbxproj: Copy mediaControls files to the bundle.
     13        * rendering/RenderThemeIOS.h:
     14        * rendering/RenderThemeIOS.mm:
     15        (WebCore::RenderThemeIOS::RenderThemeIOS):
     16        (WebCore::RenderThemeIOS::mediaControlsStyleSheet): Load from the bundle.
     17        (WebCore::RenderThemeIOS::mediaControlsScript): Ditto.
     18        * rendering/RenderThemeMac.h:
     19        * rendering/RenderThemeMac.mm:
     20        (WebCore::RenderThemeMac::RenderThemeMac):
     21        (WebCore::RenderThemeMac::mediaControlsStyleSheet):
     22        (WebCore::RenderThemeMac::mediaControlsScript):
     23
    1242014-04-02  Daniel Bates  <dabates@apple.com>
    225
  • trunk/Source/WebCore/DerivedSources.make

    r166657 r166669  
    883883endif
    884884
    885 ifeq ($(findstring ENABLE_MEDIA_CONTROLS_SCRIPT,$(FEATURE_DEFINES)), ENABLE_MEDIA_CONTROLS_SCRIPT)
    886         USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/mediacontrols/mediaControlsApple.css
    887 ifeq ($(WTF_PLATFORM_IOS), 1)
    888     USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/mediacontrols/mediaControlsiOS.css
    889 endif
    890 endif
    891 
    892885ifeq ($(findstring ENABLE_IMAGE_CONTROLS,$(FEATURE_DEFINES)), ENABLE_IMAGE_CONTROLS)
    893886        USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/html/shadow/mac/imageControlsMac.css
     
    906899
    907900USER_AGENT_SCRIPTS =
    908 
    909 ifeq ($(findstring ENABLE_MEDIA_CONTROLS_SCRIPT,$(FEATURE_DEFINES)), ENABLE_MEDIA_CONTROLS_SCRIPT)
    910         USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/mediacontrols/mediaControlsApple.js
    911 ifeq ($(WTF_PLATFORM_IOS), 1)
    912         USER_AGENT_SCRIPTS := $(USER_AGENT_SCRIPTS) $(WebCore)/Modules/mediacontrols/mediaControlsiOS.js
    913 endif
    914 endif
    915901
    916902ifeq ($(OS),MACOS)
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r166657 r166669  
    11531153                31078CC91880AAC9008099DC /* JSOESTextureHalfFloatLinear.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31078CC51880AAAA008099DC /* JSOESTextureHalfFloatLinear.cpp */; };
    11541154                31078CCA1880AACE008099DC /* JSOESTextureHalfFloatLinear.h in Headers */ = {isa = PBXBuildFile; fileRef = 31078CC61880AAAA008099DC /* JSOESTextureHalfFloatLinear.h */; };
     1155                311C08BD18EB7CAF00B65615 /* mediaControlsApple.css in Resources */ = {isa = PBXBuildFile; fileRef = CDC1DD4117CC2C48008CB55D /* mediaControlsApple.css */; };
     1156                311C08BE18EB7CAF00B65615 /* mediaControlsApple.js in Resources */ = {isa = PBXBuildFile; fileRef = CDE6560E17CA6E7600526BA7 /* mediaControlsApple.js */; };
     1157                311C08BF18EB7CAF00B65615 /* mediaControlsiOS.css in Resources */ = {isa = PBXBuildFile; fileRef = CDAAF45D1869094E003C1717 /* mediaControlsiOS.css */; };
     1158                311C08C018EB7CAF00B65615 /* mediaControlsiOS.js in Resources */ = {isa = PBXBuildFile; fileRef = CD32A189184EB46A0029B1BB /* mediaControlsiOS.js */; };
    11551159                31288E720E3005D6003619AE /* WebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */; };
    11561160                31288E730E3005D6003619AE /* WebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */; };
     
    2642626430                                85136C9C0AED665900F90A3D /* linkCursor.png in Resources */,
    2642726431                                BCAD180A131C7A0D00990406 /* Localizable.strings in Resources */,
     26432                                311C08BD18EB7CAF00B65615 /* mediaControlsApple.css in Resources */,
     26433                                311C08BE18EB7CAF00B65615 /* mediaControlsApple.js in Resources */,
     26434                                311C08BF18EB7CAF00B65615 /* mediaControlsiOS.css in Resources */,
     26435                                311C08C018EB7CAF00B65615 /* mediaControlsiOS.js in Resources */,
    2642826436                                93153BE214195A5700FCF5BE /* missingImage.png in Resources */,
    2642926437                                93153BDA14181F7A00FCF5BE /* missingImage@2x.png in Resources */,
  • trunk/Source/WebCore/rendering/RenderThemeIOS.h

    r162139 r166669  
    117117    const Color& shadowColor() const;
    118118    FloatRect addRoundedBorderClip(RenderObject* box, GraphicsContext*, const IntRect&);
     119
     120    String m_mediaControlsScript;
     121    String m_mediaControlsStyleSheet;
     122    bool m_mediaControlsScriptLoaded;
     123    bool m_mediaControlsStyleSheetLoaded;
    119124};
    120125
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r165057 r166669  
    7777#define UIContentSizeCategoryDidChangeNotification getUIContentSizeCategoryDidChangeNotification()
    7878
     79@interface WebCoreRenderThemeBundle : NSObject
     80@end
     81
     82@implementation WebCoreRenderThemeBundle
     83@end
     84
    7985namespace WebCore {
    8086
     
    277283
    278284RenderThemeIOS::RenderThemeIOS()
     285    : m_mediaControlsScriptLoaded(false)
     286    , m_mediaControlsStyleSheetLoaded(false)
    279287{
    280288    CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, contentSizeCategoryDidChange, UIContentSizeCategoryDidChangeNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
     
    11981206{
    11991207#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    1200     return String(mediaControlsiOSUserAgentStyleSheet, sizeof(mediaControlsiOSUserAgentStyleSheet));
     1208    if (!m_mediaControlsStyleSheetLoaded) {
     1209        m_mediaControlsStyleSheet = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
     1210        m_mediaControlsStyleSheetLoaded = true;
     1211    }
     1212    return m_mediaControlsStyleSheet;
    12011213#else
    12021214    return emptyString();
     
    12071219{
    12081220#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    1209     StringBuilder scriptBuilder;
    1210     scriptBuilder.append(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
    1211     scriptBuilder.append(mediaControlsiOSJavaScript, sizeof(mediaControlsiOSJavaScript));
    1212     return scriptBuilder.toString();
     1221    if (!m_mediaControlsScriptLoaded) {
     1222        StringBuilder scriptBuilder;
     1223        scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
     1224        scriptBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
     1225        m_mediaControlsScript = scriptBuilder.toString();
     1226        m_mediaControlsScriptLoaded = true;
     1227    }
     1228    return m_mediaControlsScript;
    12131229#else
    12141230    return emptyString();
  • trunk/Source/WebCore/rendering/RenderThemeMac.h

    r165676 r166669  
    249249
    250250    RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver;
     251
     252    String m_mediaControlsScript;
     253    String m_mediaControlsStyleSheet;
     254    bool m_mediaControlsScriptLoaded;
     255    bool m_mediaControlsStyleSheetLoaded;
    251256};
    252257
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r166422 r166669  
    166166@end
    167167
     168@interface WebCoreRenderThemeBundle : NSObject
     169@end
     170
     171@implementation WebCoreRenderThemeBundle
     172@end
     173
    168174namespace WebCore {
    169175
     
    199205    , m_isSliderThumbVerticalPressed(false)
    200206    , m_notificationObserver(adoptNS([[WebCoreRenderThemeNotificationObserver alloc] initWithTheme:this]))
     207    , m_mediaControlsScriptLoaded(false)
     208    , m_mediaControlsStyleSheetLoaded(false)
    201209{
    202210    [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get()
     
    221229{
    222230#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    223     return String(mediaControlsAppleUserAgentStyleSheet, sizeof(mediaControlsAppleUserAgentStyleSheet));
     231    if (!m_mediaControlsStyleSheetLoaded) {
     232        m_mediaControlsStyleSheet = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
     233        m_mediaControlsStyleSheetLoaded = true;
     234    }
     235    return m_mediaControlsStyleSheet;
    224236#else
    225237    return emptyString();
     
    230242{
    231243#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    232     return String(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
     244    if (!m_mediaControlsScriptLoaded) {
     245        m_mediaControlsScript = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil];
     246        m_mediaControlsScriptLoaded = true;
     247    }
     248    return m_mediaControlsScript;
    233249#else
    234250    return emptyString();
  • trunk/Tools/ChangeLog

    r166661 r166669  
     12014-04-01  Dean Jackson  <dino@apple.com>
     2
     3        Load Media Controls js/css from bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=131086
     5
     6        Reviewed by Eric Carlson.
     7
     8        We're now putting CSS files into the bundle, so remove the test for them.
     9
     10        * Scripts/check-for-inappropriate-files-in-framework:
     11
    1122014-04-02  Martin Hock  <mhock@apple.com>
    213
  • trunk/Tools/Scripts/check-for-inappropriate-files-in-framework

    r80080 r166669  
    2828is_shallow_bundle = (ENV['SHALLOW_BUNDLE'] || "NO").upcase == "YES"
    2929
    30 $INAPPROPRIATE_FILES = { "WebCore" => { "Resources" => ["*.css", "*.in", "*.idl", "*.h"] },
     30$INAPPROPRIATE_FILES = { "WebCore" => { "Resources" => ["*.in", "*.idl", "*.h"] },
    3131                         "WebKit2" => { "Resources" => ["*.in", "*.h"] },
    3232                       }
Note: See TracChangeset for help on using the changeset viewer.