[Win] Guard CF usage in RenderThemeWin
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2019 00:19:16 +0000 (00:19 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2019 00:19:16 +0000 (00:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194875

Reviewed by Alex Christensen.

No new tests. No change in behavior.

Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.

* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::stringWithContentsOfFile):
(WebCore::RenderThemeWin::mediaControlsStyleSheet):
(WebCore::RenderThemeWin::mediaControlsScript):
* rendering/RenderThemeWin.h:

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebCore/rendering/RenderThemeWin.h

index bc8218f..26d007b 100644 (file)
@@ -1,3 +1,20 @@
+2019-02-20  Don Olmstead  <don.olmstead@sony.com>
+
+        [Win] Guard CF usage in RenderThemeWin
+        https://bugs.webkit.org/show_bug.cgi?id=194875
+
+        Reviewed by Alex Christensen.
+
+        No new tests. No change in behavior.
+
+        Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.
+
+        * rendering/RenderThemeWin.cpp:
+        (WebCore::RenderThemeWin::stringWithContentsOfFile):
+        (WebCore::RenderThemeWin::mediaControlsStyleSheet):
+        (WebCore::RenderThemeWin::mediaControlsScript):
+        * rendering/RenderThemeWin.h:
+
 2019-02-20  Ryosuke Niwa  <rniwa@webkit.org>
 
         Crash in DOMWindowExtension::suspendForPageCache
index 219657e..6e41381 100644 (file)
@@ -1048,9 +1048,10 @@ static void fillBufferWithContentsOfFile(FileSystem::PlatformFileHandle file, lo
     buffer[filesize] = 0;
 }
 
-String RenderThemeWin::stringWithContentsOfFile(CFStringRef name, CFStringRef type)
+String RenderThemeWin::stringWithContentsOfFile(const String& name, const String& type)
 {
-    RetainPtr<CFURLRef> requestedURLRef = adoptCF(CFBundleCopyResourceURL(webKitBundle(), name, type, 0));
+#if USE(CF)
+    RetainPtr<CFURLRef> requestedURLRef = adoptCF(CFBundleCopyResourceURL(webKitBundle(), name.createCFString().get(), type.createCFString().get(), 0));
     if (!requestedURLRef)
         return String();
 
@@ -1073,13 +1074,16 @@ String RenderThemeWin::stringWithContentsOfFile(CFStringRef name, CFStringRef ty
     FileSystem::closeFile(requestedFileHandle);
 
     return String(fileContents.data(), static_cast<size_t>(filesize));
+#else
+    return emptyString();
+#endif
 }
 
 String RenderThemeWin::mediaControlsStyleSheet()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (m_mediaControlsStyleSheet.isEmpty())
-        m_mediaControlsStyleSheet = stringWithContentsOfFile(CFSTR("mediaControlsApple"), CFSTR("css"));
+        m_mediaControlsStyleSheet = stringWithContentsOfFile("mediaControlsApple"_s, "css"_s);
     return m_mediaControlsStyleSheet;
 #else
     return emptyString();
@@ -1091,8 +1095,8 @@ String RenderThemeWin::mediaControlsScript()
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     if (m_mediaControlsScript.isEmpty()) {
         StringBuilder scriptBuilder;
-        scriptBuilder.append(stringWithContentsOfFile(CFSTR("mediaControlsLocalizedStrings"), CFSTR("js")));
-        scriptBuilder.append(stringWithContentsOfFile(CFSTR("mediaControlsApple"), CFSTR("js")));
+        scriptBuilder.append(stringWithContentsOfFile("mediaControlsLocalizedStrings"_s, "js"_s));
+        scriptBuilder.append(stringWithContentsOfFile("mediaControlsApple"_s, "js"_s));
         m_mediaControlsScript = scriptBuilder.toString();
     }
     return m_mediaControlsScript;
index fee24b6..8280f91 100644 (file)
@@ -115,7 +115,7 @@ public:
 
     static void setWebKitIsBeingUnloaded();
 
-    static String stringWithContentsOfFile(CFStringRef name, CFStringRef type);
+    static String stringWithContentsOfFile(const String& name, const String& type);
 
     bool supportsFocusRing(const RenderStyle&) const override;