<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286708] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286708">286708</a></dd>
<dt>Author</dt> <dd>don.olmstead@sony.com</dd>
<dt>Date</dt> <dd>2021-12-08 12:46:39 -0800 (Wed, 08 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformwinClipboardUtilitiesWincpp">trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinDragDataWincpp">trunk/Source/WebCore/platform/win/DragDataWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinPasteboardWincpp">trunk/Source/WebCore/platform/win/PasteboardWin.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (286707 => 286708)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2021-12-08  Don Olmstead  <don.olmstead@sony.com>
+
+        [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):
+
</ins><span class="cx"> 2021-12-08  Truitt Savell  <tsavell@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, reverting r286632.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinClipboardUtilitiesWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp (286707 => 286708)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,7 +46,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-#if USE(CF)
</del><span class="cx"> FORMATETC* cfHDropFormat()
</span><span class="cx"> {
</span><span class="cx">     static FORMATETC urlFormat = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
</span><span class="lines">@@ -53,6 +52,8 @@
</span><span class="cx">     return &urlFormat;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(CF)
+
</ins><span class="cx"> static bool urlFromPath(CFStringRef path, String& url)
</span><span class="cx"> {
</span><span class="cx">     if (!path)
</span><span class="lines">@@ -84,7 +85,6 @@
</span><span class="cx"> static bool getWebLocData(IDataObject* dataObject, String& url, String* title) 
</span><span class="cx"> {
</span><span class="cx">     bool succeeded = false;
</span><del>-#if USE(CF)
</del><span class="cx">     WCHAR filename[MAX_PATH];
</span><span class="cx">     WCHAR urlBuffer[INTERNET_MAX_URL_LENGTH];
</span><span class="cx"> 
</span><span class="lines">@@ -118,13 +118,11 @@
</span><span class="cx">     // Free up memory.
</span><span class="cx">     DragFinish(hdrop);
</span><span class="cx">     GlobalUnlock(medium.hGlobal);
</span><del>-#endif
</del><span class="cx">     return succeeded;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool getWebLocData(const DragDataMap* dataObject, String& url, String* title) 
</span><span class="cx"> {
</span><del>-#if USE(CF)
</del><span class="cx">     WCHAR filename[MAX_PATH];
</span><span class="cx">     WCHAR urlBuffer[INTERNET_MAX_URL_LENGTH];
</span><span class="cx"> 
</span><span class="lines">@@ -145,9 +143,6 @@
</span><span class="cx">     
</span><span class="cx">     url = String(urlBuffer);
</span><span class="cx">     return true;
</span><del>-#else
-    return false;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static String extractURL(const String &inURL, String* title)
</span><span class="lines">@@ -739,8 +734,7 @@
</span><span class="cx">     ReleaseStgMedium(&store);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if USE(CF)
-void getCFData(IDataObject* data, FORMATETC* format, Vector<String>& dataStrings)
</del><ins>+void getHDropData(IDataObject* data, FORMATETC* format, Vector<String>& dataStrings)
</ins><span class="cx"> {
</span><span class="cx">     STGMEDIUM store;
</span><span class="cx">     if (FAILED(data->GetData(format, &store)))
</span><span class="lines">@@ -761,7 +755,6 @@
</span><span class="cx">     GlobalUnlock(store.hGlobal);
</span><span class="cx">     ReleaseStgMedium(&store);
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> // Setter functions.
</span><span class="cx"> 
</span><span class="lines">@@ -795,8 +788,7 @@
</span><span class="cx">     ::GlobalFree(medium.hGlobal);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if USE(CF)
-void setCFData(IDataObject* data, FORMATETC* format, const Vector<String>& dataStrings)
</del><ins>+void setHDropData(IDataObject* data, FORMATETC* format, const Vector<String>& dataStrings)
</ins><span class="cx"> {
</span><span class="cx">     STGMEDIUM medium { };
</span><span class="cx">     medium.tymed = TYMED_HGLOBAL;
</span><span class="lines">@@ -815,7 +807,6 @@
</span><span class="cx">     data->SetData(format, &medium, FALSE);
</span><span class="cx">     ::GlobalFree(medium.hGlobal);
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> static const ClipboardFormatMap& getClipboardMap()
</span><span class="cx"> {
</span><span class="lines">@@ -825,9 +816,7 @@
</span><span class="cx">         formatMap.add(texthtmlFormat()->cfFormat, new ClipboardDataItem(texthtmlFormat(), getStringData<UChar>, setUCharData));
</span><span class="cx">         formatMap.add(plainTextFormat()->cfFormat,  new ClipboardDataItem(plainTextFormat(), getStringData<char>, setUtf8Data));
</span><span class="cx">         formatMap.add(plainTextWFormat()->cfFormat,  new ClipboardDataItem(plainTextWFormat(), getStringData<UChar>, setUCharData));
</span><del>-#if USE(CF)
-        formatMap.add(cfHDropFormat()->cfFormat,  new ClipboardDataItem(cfHDropFormat(), getCFData, setCFData));
-#endif
</del><ins>+        formatMap.add(cfHDropFormat()->cfFormat,  new ClipboardDataItem(cfHDropFormat(), getHDropData, setHDropData));
</ins><span class="cx">         formatMap.add(filenameFormat()->cfFormat,  new ClipboardDataItem(filenameFormat(), getStringData<char>, setUtf8Data));
</span><span class="cx">         formatMap.add(filenameWFormat()->cfFormat,  new ClipboardDataItem(filenameWFormat(), getStringData<UChar>, setUCharData));
</span><span class="cx">         formatMap.add(urlFormat()->cfFormat,  new ClipboardDataItem(urlFormat(), getStringData<char>, setUtf8Data));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinDragDataWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/DragDataWin.cpp (286707 => 286708)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -103,16 +103,11 @@
</span><span class="cx"> 
</span><span class="cx"> bool DragData::containsFiles() const
</span><span class="cx"> {
</span><del>-#if USE(CF)
</del><span class="cx">     return (m_platformDragData) ? SUCCEEDED(m_platformDragData->QueryGetData(cfHDropFormat())) : m_dragDataMap.contains(cfHDropFormat()->cfFormat);
</span><del>-#else
-    return false;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned DragData::numberOfFiles() const
</span><span class="cx"> {
</span><del>-#if USE(CF)
</del><span class="cx">     if (!m_platformDragData)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="lines">@@ -131,9 +126,6 @@
</span><span class="cx">     GlobalUnlock(medium.hGlobal);
</span><span class="cx"> 
</span><span class="cx">     return numFiles;
</span><del>-#else
-    return 0;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector<String> DragData::asFilenames() const
</span><span class="lines">@@ -140,7 +132,6 @@
</span><span class="cx"> {
</span><span class="cx">     Vector<String> result;
</span><span class="cx"> 
</span><del>-#if USE(CF)
</del><span class="cx">     if (m_platformDragData) {
</span><span class="cx">         WCHAR filename[MAX_PATH];
</span><span class="cx"> 
</span><span class="lines">@@ -167,7 +158,6 @@
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="cx">     result = m_dragDataMap.get(cfHDropFormat()->cfFormat);
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx">     return result;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinPasteboardWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (286707 => 286708)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -371,7 +371,6 @@
</span><span class="cx"> 
</span><span class="cx"> void Pasteboard::read(PasteboardFileReader& reader, std::optional<size_t>)
</span><span class="cx"> {
</span><del>-#if USE(CF)
</del><span class="cx">     if (m_dataObject) {
</span><span class="cx">         STGMEDIUM medium;
</span><span class="cx">         if (FAILED(m_dataObject->GetData(cfHDropFormat(), &medium)))
</span><span class="lines">@@ -399,11 +398,6 @@
</span><span class="cx"> 
</span><span class="cx">     for (auto& filename : list->value)
</span><span class="cx">         reader.readFilename(filename);
</span><del>-#else
-    UNUSED_PARAM(reader);
-    notImplemented();
-    return;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool writeURL(WCDataObject *data, const URL& url, String title, bool withPlainText, bool withHTML)
</span><span class="lines">@@ -671,13 +665,11 @@
</span><span class="cx">     if (FAILED(hr = dataObject->SetData(fe, &medium, TRUE)))
</span><span class="cx">         goto exit;
</span><span class="cx"> 
</span><del>-#if USE(CF)
</del><span class="cx">     // HDROP
</span><span class="cx">     if (hDropContent) {
</span><span class="cx">         medium.hGlobal = hDropContent;
</span><span class="cx">         hr = dataObject->SetData(cfHDropFormat(), &medium, TRUE);
</span><span class="cx">     }
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> exit:
</span><span class="cx">     if (FAILED(hr)) {
</span></span></pre>
</div>
</div>

</body>
</html>