Title: [286708] trunk/Source/WebCore
Revision
286708
Author
[email protected]
Date
2021-12-08 12:46:39 -0800 (Wed, 08 Dec 2021)

Log Message

[Win] WebCore::cfHDropFormat implementation is not CF specific
https://bugs.webkit.org/show_bug.cgi?id=234021

Reviewed by Alex Christensen.

The implementation of cfHDropFormat was guarded by USE(CF) but there is nothing CF specific
about the implementation. Drop the guards around it and any of its callers.

Renaming CFData functions to HDropData to better represent the underlying Windows type for
the clipboard and make sure its not mistaken for CoreFoundation functionality.

* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::getWebLocData):
(WebCore::getHDropData):
(WebCore::setHDropData):
(WebCore::getClipboardMap):
(WebCore::getCFData): Deleted.
(WebCore::setCFData): Deleted.
* platform/win/DragDataWin.cpp:
(WebCore::DragData::containsFiles const):
(WebCore::DragData::numberOfFiles const):
(WebCore::DragData::asFilenames const):
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::read):
(WebCore::writeFileToDataObject):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286707 => 286708)


--- trunk/Source/WebCore/ChangeLog	2021-12-08 20:44:38 UTC (rev 286707)
+++ trunk/Source/WebCore/ChangeLog	2021-12-08 20:46:39 UTC (rev 286708)
@@ -1,3 +1,31 @@
+2021-12-08  Don Olmstead  <[email protected]>
+
+        [Win] WebCore::cfHDropFormat implementation is not CF specific
+        https://bugs.webkit.org/show_bug.cgi?id=234021
+
+        Reviewed by Alex Christensen.
+
+        The implementation of cfHDropFormat was guarded by USE(CF) but there is nothing CF specific
+        about the implementation. Drop the guards around it and any of its callers.
+
+        Renaming CFData functions to HDropData to better represent the underlying Windows type for
+        the clipboard and make sure its not mistaken for CoreFoundation functionality.
+
+        * platform/win/ClipboardUtilitiesWin.cpp:
+        (WebCore::getWebLocData):
+        (WebCore::getHDropData):
+        (WebCore::setHDropData):
+        (WebCore::getClipboardMap):
+        (WebCore::getCFData): Deleted.
+        (WebCore::setCFData): Deleted.
+        * platform/win/DragDataWin.cpp:
+        (WebCore::DragData::containsFiles const):
+        (WebCore::DragData::numberOfFiles const):
+        (WebCore::DragData::asFilenames const):
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::Pasteboard::read):
+        (WebCore::writeFileToDataObject):
+
 2021-12-08  Truitt Savell  <[email protected]>
 
         Unreviewed, reverting r286632.

Modified: trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp (286707 => 286708)


--- trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp	2021-12-08 20:44:38 UTC (rev 286707)
+++ trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp	2021-12-08 20:46:39 UTC (rev 286708)
@@ -46,7 +46,6 @@
 
 namespace WebCore {
 
-#if USE(CF)
 FORMATETC* cfHDropFormat()
 {
     static FORMATETC urlFormat = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
@@ -53,6 +52,8 @@
     return &urlFormat;
 }
 
+#if USE(CF)
+
 static bool urlFromPath(CFStringRef path, String& url)
 {
     if (!path)
@@ -84,7 +85,6 @@
 static bool getWebLocData(IDataObject* dataObject, String& url, String* title) 
 {
     bool succeeded = false;
-#if USE(CF)
     WCHAR filename[MAX_PATH];
     WCHAR urlBuffer[INTERNET_MAX_URL_LENGTH];
 
@@ -118,13 +118,11 @@
     // Free up memory.
     DragFinish(hdrop);
     GlobalUnlock(medium.hGlobal);
-#endif
     return succeeded;
 }
 
 static bool getWebLocData(const DragDataMap* dataObject, String& url, String* title) 
 {
-#if USE(CF)
     WCHAR filename[MAX_PATH];
     WCHAR urlBuffer[INTERNET_MAX_URL_LENGTH];
 
@@ -145,9 +143,6 @@
     
     url = ""
     return true;
-#else
-    return false;
-#endif
 }
 
 static String extractURL(const String &inURL, String* title)
@@ -739,8 +734,7 @@
     ReleaseStgMedium(&store);
 }
 
-#if USE(CF)
-void getCFData(IDataObject* data, FORMATETC* format, Vector<String>& dataStrings)
+void getHDropData(IDataObject* data, FORMATETC* format, Vector<String>& dataStrings)
 {
     STGMEDIUM store;
     if (FAILED(data->GetData(format, &store)))
@@ -761,7 +755,6 @@
     GlobalUnlock(store.hGlobal);
     ReleaseStgMedium(&store);
 }
-#endif
 
 // Setter functions.
 
@@ -795,8 +788,7 @@
     ::GlobalFree(medium.hGlobal);
 }
 
-#if USE(CF)
-void setCFData(IDataObject* data, FORMATETC* format, const Vector<String>& dataStrings)
+void setHDropData(IDataObject* data, FORMATETC* format, const Vector<String>& dataStrings)
 {
     STGMEDIUM medium { };
     medium.tymed = TYMED_HGLOBAL;
@@ -815,7 +807,6 @@
     data->SetData(format, &medium, FALSE);
     ::GlobalFree(medium.hGlobal);
 }
-#endif
 
 static const ClipboardFormatMap& getClipboardMap()
 {
@@ -825,9 +816,7 @@
         formatMap.add(texthtmlFormat()->cfFormat, new ClipboardDataItem(texthtmlFormat(), getStringData<UChar>, setUCharData));
         formatMap.add(plainTextFormat()->cfFormat,  new ClipboardDataItem(plainTextFormat(), getStringData<char>, setUtf8Data));
         formatMap.add(plainTextWFormat()->cfFormat,  new ClipboardDataItem(plainTextWFormat(), getStringData<UChar>, setUCharData));
-#if USE(CF)
-        formatMap.add(cfHDropFormat()->cfFormat,  new ClipboardDataItem(cfHDropFormat(), getCFData, setCFData));
-#endif
+        formatMap.add(cfHDropFormat()->cfFormat,  new ClipboardDataItem(cfHDropFormat(), getHDropData, setHDropData));
         formatMap.add(filenameFormat()->cfFormat,  new ClipboardDataItem(filenameFormat(), getStringData<char>, setUtf8Data));
         formatMap.add(filenameWFormat()->cfFormat,  new ClipboardDataItem(filenameWFormat(), getStringData<UChar>, setUCharData));
         formatMap.add(urlFormat()->cfFormat,  new ClipboardDataItem(urlFormat(), getStringData<char>, setUtf8Data));

Modified: trunk/Source/WebCore/platform/win/DragDataWin.cpp (286707 => 286708)


--- trunk/Source/WebCore/platform/win/DragDataWin.cpp	2021-12-08 20:44:38 UTC (rev 286707)
+++ trunk/Source/WebCore/platform/win/DragDataWin.cpp	2021-12-08 20:46:39 UTC (rev 286708)
@@ -103,16 +103,11 @@
 
 bool DragData::containsFiles() const
 {
-#if USE(CF)
     return (m_platformDragData) ? SUCCEEDED(m_platformDragData->QueryGetData(cfHDropFormat())) : m_dragDataMap.contains(cfHDropFormat()->cfFormat);
-#else
-    return false;
-#endif
 }
 
 unsigned DragData::numberOfFiles() const
 {
-#if USE(CF)
     if (!m_platformDragData)
         return 0;
 
@@ -131,9 +126,6 @@
     GlobalUnlock(medium.hGlobal);
 
     return numFiles;
-#else
-    return 0;
-#endif
 }
 
 Vector<String> DragData::asFilenames() const
@@ -140,7 +132,6 @@
 {
     Vector<String> result;
 
-#if USE(CF)
     if (m_platformDragData) {
         WCHAR filename[MAX_PATH];
 
@@ -167,7 +158,6 @@
         return result;
     }
     result = m_dragDataMap.get(cfHDropFormat()->cfFormat);
-#endif
 
     return result;
 }

Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (286707 => 286708)


--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp	2021-12-08 20:44:38 UTC (rev 286707)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp	2021-12-08 20:46:39 UTC (rev 286708)
@@ -371,7 +371,6 @@
 
 void Pasteboard::read(PasteboardFileReader& reader, std::optional<size_t>)
 {
-#if USE(CF)
     if (m_dataObject) {
         STGMEDIUM medium;
         if (FAILED(m_dataObject->GetData(cfHDropFormat(), &medium)))
@@ -399,11 +398,6 @@
 
     for (auto& filename : list->value)
         reader.readFilename(filename);
-#else
-    UNUSED_PARAM(reader);
-    notImplemented();
-    return;
-#endif
 }
 
 static bool writeURL(WCDataObject *data, const URL& url, String title, bool withPlainText, bool withHTML)
@@ -671,13 +665,11 @@
     if (FAILED(hr = dataObject->SetData(fe, &medium, TRUE)))
         goto exit;
 
-#if USE(CF)
     // HDROP
     if (hDropContent) {
         medium.hGlobal = hDropContent;
         hr = dataObject->SetData(cfHDropFormat(), &medium, TRUE);
     }
-#endif
 
 exit:
     if (FAILED(hr)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to