Changeset 166782 in webkit


Ignore:
Timestamp:
Apr 4, 2014 9:12:35 AM (10 years ago)
Author:
Brent Fulgham
Message:

[Win] Load Media Controls js/css from bundle
https://bugs.webkit.org/show_bug.cgi?id=131194

Reviewed by Dean Jackson.

  • DerivedSources.cpp: Remove no-longer generated file.
  • DerivedSources.make: Don't generate unneeded files.
  • WebCore.vcxproj/WebCore.vcxproj: Don't compile unneeded files.
  • WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
  • WebCore.vcxproj/copyWebCoreResourceFiles.cmd: Copy css/js to resource
  • rendering/RenderThemeSafari.cpp:
  • rendering/RenderThemeSafari.h:
  • rendering/RenderThemeWin.cpp:
  • rendering/RenderThemeWin.h:
Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166781 r166782  
     12014-04-03  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Win] Load Media Controls js/css from bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=131194
     5
     6        Reviewed by Dean Jackson.
     7
     8        * DerivedSources.cpp: Remove no-longer generated file.
     9        * DerivedSources.make: Don't generate unneeded files.
     10        * WebCore.vcxproj/WebCore.vcxproj: Don't compile unneeded files.
     11        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
     12        * WebCore.vcxproj/copyWebCoreResourceFiles.cmd: Copy css/js to resource
     13        * rendering/RenderThemeSafari.cpp:
     14        * rendering/RenderThemeSafari.h:
     15        * rendering/RenderThemeWin.cpp:
     16        * rendering/RenderThemeWin.h:
     17
    1182014-04-04  Mihnea Ovidenie  <mihnea@adobe.com>
    219
  • trunk/Source/WebCore/DerivedSources.cpp

    r166221 r166782  
    247247#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    248248#include "JSMediaControlsHost.cpp"
    249 #include "UserAgentScriptsData.cpp"
    250249#endif
    251250#include "JSMediaError.cpp"
  • trunk/Source/WebCore/DerivedSources.make

    r166689 r166782  
    883883endif
    884884
    885 ifeq ($(OS),Windows_NT)
    886 ifeq ($(findstring ENABLE_MEDIA_CONTROLS_SCRIPT,$(FEATURE_DEFINES)), ENABLE_MEDIA_CONTROLS_SCRIPT)
    887         USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/Modules/mediacontrols/mediaControlsApple.css
    888 endif
    889 endif
    890 
    891885ifeq ($(findstring ENABLE_IMAGE_CONTROLS,$(FEATURE_DEFINES)), ENABLE_IMAGE_CONTROLS)
    892886        USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/html/shadow/mac/imageControlsMac.css
     
    905899
    906900USER_AGENT_SCRIPTS =
    907 
    908 ifeq ($(OS),Windows_NT)
    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 endif
    912 endif
    913901
    914902ifeq ($(OS),MACOS)
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r166752 r166782  
    64266426    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGElementFactory.cpp" />
    64276427    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGNames.cpp" />
    6428     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\UserAgentScriptsData.cpp">
    6429       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    6430       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    6431       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
    6432       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
    6433       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
    6434       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
    6435       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
    6436       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    6437       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
    6438       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
    6439       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
    6440       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
    6441     </ClCompile>
    64426428    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\UserAgentStyleSheetsData.cpp">
    64436429      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     
    1854018526    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGElementTypeHelpers.h" />
    1854118527    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGNames.h" />
    18542     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\UserAgentScripts.h" />
    1854318528    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\UserAgentStyleSheets.h" />
    1854418529    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\WebKitFontFamilyNames.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r166752 r166782  
    68306830      <Filter>DerivedSources</Filter>
    68316831    </ClCompile>
    6832     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\UserAgentScriptsData.cpp">
    6833       <Filter>DerivedSources</Filter>
    6834     </ClCompile>
    68356832    <ClCompile Include="..\Modules\mediacontrols\MediaControlsHost.cpp">
    68366833      <Filter>Modules\mediacontrols</Filter>
     
    1482914826    <ClInclude Include="..\rendering\TextPaintStyle.h">
    1483014827      <Filter>rendering</Filter>
    14831     </ClInclude>
    14832     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\UserAgentScripts.h">
    14833       <Filter>DerivedSources</Filter>
    1483414828    </ClInclude>
    1483514829    <ClInclude Include="..\rendering\OrderIterator.h">
  • trunk/Source/WebCore/WebCore.vcxproj/copyWebCoreResourceFiles.cmd

    r157465 r166782  
    11mkdir 2>NUL "%CONFIGURATIONBUILDDIR%\bin%PlatformArchitecture%\WebKit.resources\en.lproj"
    22xcopy /y /d /s /exclude:xcopy.excludes "%ProjectDir%..\English.lproj\Localizable.strings" "%CONFIGURATIONBUILDDIR%\bin%PlatformArchitecture%\WebKit.resources\en.lproj"
     3xcopy /y /d /s "%ProjectDir%..\Modules\mediacontrols\mediaControlsApple.css" "%CONFIGURATIONBUILDDIR%\bin%PlatformArchitecture%\WebKit.resources"
     4xcopy /y /d /s "%ProjectDir%..\Modules\mediacontrols\mediaControlsApple.js" "%CONFIGURATIONBUILDDIR%\bin%PlatformArchitecture%\WebKit.resources"
  • trunk/Source/WebCore/rendering/RenderThemeSafari.cpp

    r166653 r166782  
    4747#include "StyleResolver.h"
    4848#include "UserAgentStyleSheets.h"
     49#include "WebCoreBundleWin.h"
    4950#include <CoreGraphics/CoreGraphics.h>
    5051#include <wtf/RetainPtr.h>
    51 
    52 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
    53 #include "UserAgentScripts.h"
    54 #endif
    5552
    5653using std::min;
     
    11791176{
    11801177#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    1181     return String(mediaControlsAppleUserAgentStyleSheet, sizeof(mediaControlsAppleUserAgentStyleSheet));
     1178    if (m_mediaControlsStyleSheet.isEmpty())
     1179        m_mediaControlsStyleSheet = RenderThemeWin::stringWithContentsOfFile(CFSTR("mediaControlsApple"), CFSTR("css"));
     1180    return m_mediaControlsStyleSheet;
    11821181#else
    11831182    return emptyString();
     
    11881187{
    11891188#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    1190     return String(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
     1189    if (m_mediaControlsScript.isEmpty())
     1190        m_mediaControlsScript = RenderThemeWin::stringWithContentsOfFile(CFSTR("mediaControlsApple"), CFSTR("js"));
     1191    return m_mediaControlsScript;
    11911192#else
    11921193    return emptyString();
  • trunk/Source/WebCore/rendering/RenderThemeSafari.h

    r166653 r166782  
    11/*
    2  * Copyright (C) 2007, 2008, 2013 Apple Inc.
     2 * Copyright (C) 2007, 2008, 2013, 2014 Apple Inc.
    33 * Copyright (C) 2009 Kenneth Rohde Christiansen
    44 *
     
    182182
    183183    ThemeControlState determineState(RenderObject*) const;
     184
     185    String m_mediaControlsScript;
     186    String m_mediaControlsStyleSheet;
    184187};
    185188
  • trunk/Source/WebCore/rendering/RenderThemeWin.cpp

    r165084 r166782  
    3838#include "SystemInfo.h"
    3939#include "UserAgentStyleSheets.h"
     40#include "WebCoreBundleWin.h"
    4041#include <wtf/win/GDIObject.h>
    41 
    42 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
    43 #include "UserAgentScripts.h"
    44 #endif
    4542
    4643#if ENABLE(VIDEO)
     
    10801077
    10811078#if ENABLE(VIDEO)
     1079static const size_t maximumReasonableBufferSize = 32768;
     1080
     1081static void fillBufferWithContentsOfFile(PlatformFileHandle file, long long filesize, Vector<char>& buffer)
     1082{
     1083    // Load the file content into buffer
     1084    buffer.resize(filesize + 1);
     1085
     1086    int bufferPosition = 0;
     1087    int bufferReadSize = 4096;
     1088    int bytesRead = 0;
     1089    while (filesize > bufferPosition) {
     1090        if (filesize - bufferPosition < bufferReadSize)
     1091            bufferReadSize = filesize - bufferPosition;
     1092
     1093        bytesRead = readFromFile(file, buffer.data() + bufferPosition, bufferReadSize);
     1094        if (bytesRead != bufferReadSize) {
     1095            buffer.clear();
     1096            return;
     1097        }
     1098
     1099        bufferPosition += bufferReadSize;
     1100    }
     1101
     1102    buffer[filesize] = 0;
     1103}
     1104
     1105String RenderThemeWin::stringWithContentsOfFile(CFStringRef name, CFStringRef type)
     1106{
     1107    RetainPtr<CFURLRef> requestedURLRef = adoptCF(CFBundleCopyResourceURL(webKitBundle(), name, type, 0));
     1108    if (!requestedURLRef)
     1109        return String();
     1110
     1111    UInt8 requestedFilePath[MAX_PATH];
     1112    if (!CFURLGetFileSystemRepresentation(requestedURLRef.get(), false, requestedFilePath, MAX_PATH))
     1113        return String();
     1114
     1115    PlatformFileHandle requestedFileHandle = openFile(requestedFilePath, OpenForRead);
     1116    if (!isHandleValid(requestedFileHandle))
     1117        return String();
     1118
     1119    long long filesize = -1;
     1120    if (!getFileSize(requestedFilePath, filesize)) {
     1121        closeFile(requestedFileHandle);
     1122        return String();
     1123    }
     1124
     1125    Vector<char> fileContents;
     1126    fillBufferWithContentsOfFile(requestedFileHandle, filesize, fileContents);
     1127    closeFile(requestedFileHandle);
     1128
     1129    return String(fileContents.data(), static_cast<size_t>(filesize));
     1130}
     1131
    10821132String RenderThemeWin::mediaControlsStyleSheet()
    10831133{
    10841134#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    1085     return String(mediaControlsAppleUserAgentStyleSheet, sizeof(mediaControlsAppleUserAgentStyleSheet));
     1135    if (m_mediaControlsStyleSheet.isEmpty())
     1136        m_mediaControlsStyleSheet = stringWithContentsOfFile(CFSTR("mediaControlsApple"), CFSTR("css"));
     1137    return m_mediaControlsStyleSheet;
    10861138#else
    10871139    return emptyString();
     
    10921144{
    10931145#if ENABLE(MEDIA_CONTROLS_SCRIPT)
    1094     return String(mediaControlsAppleJavaScript, sizeof(mediaControlsAppleJavaScript));
     1146    if (m_mediaControlsScript.isEmpty())
     1147        m_mediaControlsScript = stringWithContentsOfFile(CFSTR("mediaControlsApple"), CFSTR("js"));
     1148    return m_mediaControlsScript;
    10951149#else
    10961150    return emptyString();
  • trunk/Source/WebCore/rendering/RenderThemeWin.h

    r165676 r166782  
    22 * This file is part of the WebKit project.
    33 *
    4  * Copyright (C) 2006, 2008, 2013 Apple Inc.
     4 * Copyright (C) 2006, 2008, 2013, 2014 Apple Inc.
    55 * Copyright (C) 2009 Kenneth Rohde Christiansen
    66 *
     
    121121    static void setWebKitIsBeingUnloaded();
    122122
     123    static String stringWithContentsOfFile(CFStringRef name, CFStringRef type);
     124
    123125    virtual bool supportsFocusRing(const RenderStyle*) const;
    124126
     
    174176    mutable HANDLE m_spinButtonTheme;
    175177    mutable HANDLE m_progressBarTheme;
     178
     179    String m_mediaControlsScript;
     180    String m_mediaControlsStyleSheet;
    176181};
    177182
Note: See TracChangeset for help on using the changeset viewer.