Changeset 286752 in webkit
- Timestamp:
- Dec 8, 2021, 4:32:05 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/win/ClipboardUtilitiesWin.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286743 r286752 1 2021-12-08 Don Olmstead <don.olmstead@sony.com> 2 3 [Win] Remove CF when using Windows clipboard 4 https://bugs.webkit.org/show_bug.cgi?id=194876 5 6 Reviewed by Brent Fulgham. 7 8 Remove any CF code from ClipboardUtilitiesWin and replace it with WTF code. The 9 urlFromPath function is deleted since it is no longer relevant. 10 11 * platform/win/ClipboardUtilitiesWin.cpp: 12 (WebCore::getURL): 13 (WebCore::urlFromPath): Deleted. 14 1 15 2021-12-08 Jer Noble <jer.noble@apple.com> 2 16 -
trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp
r286708 r286752 40 40 #include <wtf/text/win/WCharStringExtras.h> 41 41 42 #if USE(CF)43 #include <CoreFoundation/CoreFoundation.h>44 #include <wtf/RetainPtr.h>45 #endif46 47 42 namespace WebCore { 48 43 … … 52 47 return &urlFormat; 53 48 } 54 55 #if USE(CF)56 57 static bool urlFromPath(CFStringRef path, String& url)58 {59 if (!path)60 return false;61 62 RetainPtr<CFURLRef> cfURL = adoptCF(CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false));63 if (!cfURL)64 return false;65 66 url = CFURLGetString(cfURL.get());67 68 // Work around <rdar://problem/6708300>, where CFURLCreateWithFileSystemPath makes URLs with "localhost".69 if (url.startsWith("file://localhost/"))70 url.remove(7, 9);71 72 return true;73 }74 #endif75 49 76 50 static bool getDataMapItem(const DragDataMap* dataObject, FORMATETC* format, String& item) … … 487 461 ReleaseStgMedium(&store); 488 462 } 489 #if USE(CF)490 463 else if (filenamePolicy == DragData::ConvertFilenames) { 491 464 if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) { … … 493 466 wchar_t* data = static_cast<wchar_t*>(GlobalLock(store.hGlobal)); 494 467 if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) { 495 RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data)));496 if ( urlFromPath(pathAsCFString.get(), url) &&title)468 url = URL::fileURLWithFileSystemPath(String(data)).fileSystemPath(); 469 if (title) 497 470 *title = url; 498 471 } … … 503 476 char* data = static_cast<char*>(GlobalLock(store.hGlobal)); 504 477 if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) { 505 RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII));506 if ( urlFromPath(pathAsCFString.get(), url) &&title)478 url = URL::fileURLWithFileSystemPath(String(data)).fileSystemPath(); 479 if (title) 507 480 *title = url; 508 481 } … … 511 484 } 512 485 } 513 #endif514 486 return url; 515 487 } … … 525 497 if (getDataMapItem(data, urlFormat(), url)) 526 498 return extractURL(url, title); 527 #if USE(CF)528 499 if (filenamePolicy != DragData::ConvertFilenames) 529 500 return url; … … 536 507 if (stringData.isEmpty() || (!PathFileExists(wcharData) && !PathIsUNC(wcharData))) 537 508 return url; 538 RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)wcharData, wcslen(wcharData))); 539 if (urlFromPath(pathAsCFString.get(), url) && title) 509 510 url = URL::fileURLWithFileSystemPath(stringData).fileSystemPath(); 511 if (title) 540 512 *title = url; 541 #endif 513 542 514 return url; 543 515 }
Note:
See TracChangeset
for help on using the changeset viewer.