Title: [286752] trunk/Source/WebCore
Revision
286752
Author
[email protected]
Date
2021-12-08 16:32:05 -0800 (Wed, 08 Dec 2021)

Log Message

[Win] Remove CF when using Windows clipboard
https://bugs.webkit.org/show_bug.cgi?id=194876

Reviewed by Brent Fulgham.

Remove any CF code from ClipboardUtilitiesWin and replace it with WTF code. The
urlFromPath function is deleted since it is no longer relevant.

* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::getURL):
(WebCore::urlFromPath): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286751 => 286752)


--- trunk/Source/WebCore/ChangeLog	2021-12-09 00:19:46 UTC (rev 286751)
+++ trunk/Source/WebCore/ChangeLog	2021-12-09 00:32:05 UTC (rev 286752)
@@ -1,3 +1,17 @@
+2021-12-08  Don Olmstead  <[email protected]>
+
+        [Win] Remove CF when using Windows clipboard
+        https://bugs.webkit.org/show_bug.cgi?id=194876
+
+        Reviewed by Brent Fulgham.
+
+        Remove any CF code from ClipboardUtilitiesWin and replace it with WTF code. The
+        urlFromPath function is deleted since it is no longer relevant.
+
+        * platform/win/ClipboardUtilitiesWin.cpp:
+        (WebCore::getURL):
+        (WebCore::urlFromPath): Deleted.
+
 2021-12-08  Jer Noble  <[email protected]>
 
         [VTT] Fix various issues with complicated rendering of VTT cues

Modified: trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp (286751 => 286752)


--- trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp	2021-12-09 00:19:46 UTC (rev 286751)
+++ trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp	2021-12-09 00:32:05 UTC (rev 286752)
@@ -39,11 +39,6 @@
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/win/WCharStringExtras.h>
 
-#if USE(CF)
-#include <CoreFoundation/CoreFoundation.h>
-#include <wtf/RetainPtr.h>
-#endif
-
 namespace WebCore {
 
 FORMATETC* cfHDropFormat()
@@ -52,27 +47,6 @@
     return &urlFormat;
 }
 
-#if USE(CF)
-
-static bool urlFromPath(CFStringRef path, String& url)
-{
-    if (!path)
-        return false;
-
-    RetainPtr<CFURLRef> cfURL = adoptCF(CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false));
-    if (!cfURL)
-        return false;
-
-    url = ""
-
-    // Work around <rdar://problem/6708300>, where CFURLCreateWithFileSystemPath makes URLs with "localhost".
-    if (url.startsWith("file://localhost/"))
-        url.remove(7, 9);
-
-    return true;
-}
-#endif
-
 static bool getDataMapItem(const DragDataMap* dataObject, FORMATETC* format, String& item)
 {
     DragDataMap::const_iterator found = dataObject->find(format->cfFormat);
@@ -486,14 +460,13 @@
         GlobalUnlock(store.hGlobal);
         ReleaseStgMedium(&store);
     }
-#if USE(CF)
     else if (filenamePolicy == DragData::ConvertFilenames) {
         if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) {
             // file using unicode
             wchar_t* data = ""
             if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) {
-                RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data)));
-                if (urlFromPath(pathAsCFString.get(), url) && title)
+                url = ""
+                if (title)
                     *title = url;
             }
             GlobalUnlock(store.hGlobal);
@@ -502,8 +475,8 @@
             // filename using ascii
             char* data = ""
             if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) {
-                RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII));
-                if (urlFromPath(pathAsCFString.get(), url) && title)
+                url = ""
+                if (title)
                     *title = url;
             }
             GlobalUnlock(store.hGlobal);
@@ -510,7 +483,6 @@
             ReleaseStgMedium(&store);
         }
     }
-#endif
     return url;
 }
 
@@ -524,7 +496,6 @@
         return extractURL(url, title);
     if (getDataMapItem(data, urlFormat(), url))
         return extractURL(url, title);
-#if USE(CF)
     if (filenamePolicy != DragData::ConvertFilenames)
         return url;
 
@@ -535,10 +506,11 @@
     auto wcharData = stringData.wideCharacters().data();
     if (stringData.isEmpty() || (!PathFileExists(wcharData) && !PathIsUNC(wcharData)))
         return url;
-    RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)wcharData, wcslen(wcharData)));
-    if (urlFromPath(pathAsCFString.get(), url) && title)
+
+    url = ""
+    if (title)
         *title = url;
-#endif
+
     return url;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to