⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286708 in webkit


Ignore:
Timestamp:
Dec 8, 2021, 12:46:39 PM (5 years ago)
Author:
don.olmstead@sony.com
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):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286705 r286708  
     12021-12-08  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [Win] WebCore::cfHDropFormat implementation is not CF specific
     4        https://bugs.webkit.org/show_bug.cgi?id=234021
     5
     6        Reviewed by Alex Christensen.
     7
     8        The implementation of cfHDropFormat was guarded by USE(CF) but there is nothing CF specific
     9        about the implementation. Drop the guards around it and any of its callers.
     10
     11        Renaming CFData functions to HDropData to better represent the underlying Windows type for
     12        the clipboard and make sure its not mistaken for CoreFoundation functionality.
     13
     14        * platform/win/ClipboardUtilitiesWin.cpp:
     15        (WebCore::getWebLocData):
     16        (WebCore::getHDropData):
     17        (WebCore::setHDropData):
     18        (WebCore::getClipboardMap):
     19        (WebCore::getCFData): Deleted.
     20        (WebCore::setCFData): Deleted.
     21        * platform/win/DragDataWin.cpp:
     22        (WebCore::DragData::containsFiles const):
     23        (WebCore::DragData::numberOfFiles const):
     24        (WebCore::DragData::asFilenames const):
     25        * platform/win/PasteboardWin.cpp:
     26        (WebCore::Pasteboard::read):
     27        (WebCore::writeFileToDataObject):
     28
    1292021-12-08  Truitt Savell  <tsavell@apple.com>
    230
  • trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp

    r277967 r286708  
    4747namespace WebCore {
    4848
    49 #if USE(CF)
    5049FORMATETC* cfHDropFormat()
    5150{
     
    5352    return &urlFormat;
    5453}
     54
     55#if USE(CF)
    5556
    5657static bool urlFromPath(CFStringRef path, String& url)
     
    8586{
    8687    bool succeeded = false;
    87 #if USE(CF)
    8888    WCHAR filename[MAX_PATH];
    8989    WCHAR urlBuffer[INTERNET_MAX_URL_LENGTH];
     
    119119    DragFinish(hdrop);
    120120    GlobalUnlock(medium.hGlobal);
    121 #endif
    122121    return succeeded;
    123122}
     
    125124static bool getWebLocData(const DragDataMap* dataObject, String& url, String* title)
    126125{
    127 #if USE(CF)
    128126    WCHAR filename[MAX_PATH];
    129127    WCHAR urlBuffer[INTERNET_MAX_URL_LENGTH];
     
    146144    url = String(urlBuffer);
    147145    return true;
    148 #else
    149     return false;
    150 #endif
    151146}
    152147
     
    740735}
    741736
    742 #if USE(CF)
    743 void getCFData(IDataObject* data, FORMATETC* format, Vector<String>& dataStrings)
     737void getHDropData(IDataObject* data, FORMATETC* format, Vector<String>& dataStrings)
    744738{
    745739    STGMEDIUM store;
     
    762756    ReleaseStgMedium(&store);
    763757}
    764 #endif
    765758
    766759// Setter functions.
     
    796789}
    797790
    798 #if USE(CF)
    799 void setCFData(IDataObject* data, FORMATETC* format, const Vector<String>& dataStrings)
     791void setHDropData(IDataObject* data, FORMATETC* format, const Vector<String>& dataStrings)
    800792{
    801793    STGMEDIUM medium { };
     
    816808    ::GlobalFree(medium.hGlobal);
    817809}
    818 #endif
    819810
    820811static const ClipboardFormatMap& getClipboardMap()
     
    826817        formatMap.add(plainTextFormat()->cfFormat,  new ClipboardDataItem(plainTextFormat(), getStringData<char>, setUtf8Data));
    827818        formatMap.add(plainTextWFormat()->cfFormat,  new ClipboardDataItem(plainTextWFormat(), getStringData<UChar>, setUCharData));
    828 #if USE(CF)
    829         formatMap.add(cfHDropFormat()->cfFormat,  new ClipboardDataItem(cfHDropFormat(), getCFData, setCFData));
    830 #endif
     819        formatMap.add(cfHDropFormat()->cfFormat,  new ClipboardDataItem(cfHDropFormat(), getHDropData, setHDropData));
    831820        formatMap.add(filenameFormat()->cfFormat,  new ClipboardDataItem(filenameFormat(), getStringData<char>, setUtf8Data));
    832821        formatMap.add(filenameWFormat()->cfFormat,  new ClipboardDataItem(filenameWFormat(), getStringData<UChar>, setUCharData));
  • trunk/Source/WebCore/platform/win/DragDataWin.cpp

    r278253 r286708  
    104104bool DragData::containsFiles() const
    105105{
    106 #if USE(CF)
    107106    return (m_platformDragData) ? SUCCEEDED(m_platformDragData->QueryGetData(cfHDropFormat())) : m_dragDataMap.contains(cfHDropFormat()->cfFormat);
    108 #else
    109     return false;
    110 #endif
    111107}
    112108
    113109unsigned DragData::numberOfFiles() const
    114110{
    115 #if USE(CF)
    116111    if (!m_platformDragData)
    117112        return 0;
     
    132127
    133128    return numFiles;
    134 #else
    135     return 0;
    136 #endif
    137129}
    138130
     
    141133    Vector<String> result;
    142134
    143 #if USE(CF)
    144135    if (m_platformDragData) {
    145136        WCHAR filename[MAX_PATH];
     
    168159    }
    169160    result = m_dragDataMap.get(cfHDropFormat()->cfFormat);
    170 #endif
    171161
    172162    return result;
  • trunk/Source/WebCore/platform/win/PasteboardWin.cpp

    r284095 r286708  
    372372void Pasteboard::read(PasteboardFileReader& reader, std::optional<size_t>)
    373373{
    374 #if USE(CF)
    375374    if (m_dataObject) {
    376375        STGMEDIUM medium;
     
    400399    for (auto& filename : list->value)
    401400        reader.readFilename(filename);
    402 #else
    403     UNUSED_PARAM(reader);
    404     notImplemented();
    405     return;
    406 #endif
    407401}
    408402
     
    672666        goto exit;
    673667
    674 #if USE(CF)
    675668    // HDROP
    676669    if (hDropContent) {
     
    678671        hr = dataObject->SetData(cfHDropFormat(), &medium, TRUE);
    679672    }
    680 #endif
    681673
    682674exit:
Note: See TracChangeset for help on using the changeset viewer.