| Differences between
and this patch
- a/Source/WebCore/ChangeLog +107 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2020-11-16  Devin Rousso  <drousso@apple.com>
2
3
        Ignore deprecation warnings for the uniform types C API
4
        https://bugs.webkit.org/show_bug.cgi?id=218989
5
6
        Reviewed by Tim Horton.
7
8
        These should eventually be replaced with the ObjC API `UniformTypeIdentifiers.framework`.
9
        See <https://developer.apple.com/documentation/uniformtypeidentifiers>.
10
11
        * editing/cocoa/WebContentReaderCocoa.mm:
12
        (WebCore::mimeTypeFromContentType):
13
        (WebCore::attachmentForFilePath):
14
        * editing/mac/EditorMac.mm:
15
        (WebCore::Editor::dataSelectionForPasteboard):
16
        * fileapi/FileCocoa.mm:
17
        (WebCore::File::shouldReplaceFile):
18
        * page/mac/DragControllerMac.mm:
19
        (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod const):
20
        * platform/cocoa/DragDataCocoa.mm:
21
        (WebCore::rtfPasteboardType):
22
        (WebCore::rtfdPasteboardType):
23
        (WebCore::stringPasteboardType):
24
        (WebCore::urlPasteboardType):
25
        (WebCore::htmlPasteboardType):
26
        (WebCore::pdfPasteboardType):
27
        (WebCore::tiffPasteboardType):
28
        (WebCore::DragData::containsCompatibleContent const):
29
        * platform/cocoa/MIMETypeRegistryCocoa.mm:
30
        (WebCore::extensionsForMIMETypeMap):
31
        * platform/cocoa/PasteboardCocoa.mm:
32
        (WebCore::cocoaTypeToImageType):
33
        (WebCore::Pasteboard::fileContentState):
34
        * platform/cocoa/PlatformPasteboardCocoa.mm:
35
        (WebCore::PlatformPasteboard::urlStringSuitableForLoading):
36
        * platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
37
        (WebCore::jpegUTI):
38
        (WebCore::utiFromImageBufferMIMEType):
39
        * platform/graphics/cg/ImageSourceCGMac.mm:
40
        (WebCore::preferredExtensionForImageType):
41
        * platform/graphics/mac/ImageMac.mm:
42
        (WebCore::BitmapImage::tiffRepresentation):
43
        * platform/ios/PasteboardIOS.mm:
44
        (WebCore::Pasteboard::writePlainText):
45
        (WebCore::Pasteboard::read):
46
        (WebCore::supportedImageTypes):
47
        (WebCore::isTypeAllowedByReadingPolicy):
48
        (WebCore::Pasteboard::readPasteboardWebContentDataForType):
49
        (WebCore::readURLAlongsideAttachmentIfNecessary):
50
        (WebCore::prefersAttachmentRepresentation):
51
        (WebCore::Pasteboard::supportedWebContentPasteboardTypes):
52
        (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
53
        (WebCore::utiTypeFromCocoaType):
54
        (WebCore::Pasteboard::readPlatformValuesAsStrings):
55
        (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType):
56
        * platform/ios/PlatformPasteboardIOS.mm:
57
        (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
58
        (WebCore::webSafeTypes):
59
        (WebCore::PlatformPasteboard::informationForItemAtIndex):
60
        (WebCore::PlatformPasteboard::stringForType const):
61
        (WebCore::PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite):
62
        (WebCore::addRepresentationsForPlainText):
63
        (WebCore::PlatformPasteboard::allowReadingURLAtIndex const):
64
        (WebCore::PlatformPasteboard::write):
65
        (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
66
        (WebCore::createItemProviderRegistrationList):
67
        (WebCore::PlatformPasteboard::readString const):
68
        (WebCore::PlatformPasteboard::readURL const):
69
        (WebCore::PlatformPasteboard::containsURLStringSuitableForLoading):
70
        * platform/ios/WebItemProviderPasteboard.mm:
71
        (typeConformsToTypes):
72
        (-[NSItemProvider web_containsFileURLAndFileUploadContent]):
73
        (-[NSItemProvider web_fileUploadContentTypes]):
74
        (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
75
        (classForTypeIdentifier):
76
        (linkTemporaryItemProviderFilesToDropStagingDirectory):
77
        (-[WebItemProviderPasteboard typeIdentifiersToLoad:]):
78
        * platform/mac/PasteboardMac.mm:
79
        (WebCore::Pasteboard::write):
80
        (WebCore::Pasteboard::read):
81
        (WebCore::cocoaTypeFromHTMLClipboardType):
82
        (WebCore::utiTypeFromCocoaType):
83
        (WebCore::Pasteboard::writeString):
84
        * platform/mac/PasteboardWriter.mm:
85
        (WebCore::toUTI):
86
        (WebCore::toUTIUnlessAlreadyUTI):
87
        (WebCore::createPasteboardWriter):
88
        * platform/mac/PlatformPasteboardMac.mm:
89
        (WebCore::canWritePasteboardType):
90
        (WebCore::urlStringsFromPasteboard):
91
        (WebCore::typeIdentifierForPasteboardType):
92
        (WebCore::PlatformPasteboard::allStringsForType const):
93
        (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
94
        (WebCore::PlatformPasteboard::setStringForType):
95
        * platform/network/ios/WebCoreURLResponseIOS.mm:
96
        (WebCore::adjustMIMETypeIfNecessary):
97
        * platform/network/mac/UTIUtilities.mm:
98
        (WebCore::MIMETypeFromUTI):
99
        (WebCore::MIMETypeFromUTITree):
100
        (WebCore::UTIFromMIMETypeCachePolicy::createValueForKey):
101
        (WebCore::isDeclaredUTI):
102
        (WebCore::UTIFromTag):
103
        * platform/network/mac/WebCoreURLResponse.mm:
104
        (WebCore::adjustMIMETypeIfNecessary):
105
        * rendering/RenderThemeMac.mm:
106
        (WebCore::iconForAttachment):
107
1
2020-11-13  Sihui Liu  <sihui_liu@apple.com>
108
2020-11-13  Sihui Liu  <sihui_liu@apple.com>
2
109
3
        Implement basic permission check for SpeechRecognition
110
        Implement basic permission check for SpeechRecognition
- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm +4 lines
Lines 217-228 static bool shouldReplaceRichContentWithAttachments() a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm_sec1
217
217
218
static String mimeTypeFromContentType(const String& contentType)
218
static String mimeTypeFromContentType(const String& contentType)
219
{
219
{
220
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
220
    if (contentType == String(kUTTypeVCard)) {
221
    if (contentType == String(kUTTypeVCard)) {
221
        // CoreServices erroneously reports that "public.vcard" maps to "text/directory", rather
222
        // CoreServices erroneously reports that "public.vcard" maps to "text/directory", rather
222
        // than either "text/vcard" or "text/x-vcard". Work around this by special casing the
223
        // than either "text/vcard" or "text/x-vcard". Work around this by special casing the
223
        // "public.vcard" UTI type. See <rdar://problem/49478229> for more detail.
224
        // "public.vcard" UTI type. See <rdar://problem/49478229> for more detail.
224
        return "text/vcard"_s;
225
        return "text/vcard"_s;
225
    }
226
    }
227
ALLOW_DEPRECATED_DECLARATIONS_END
226
    return isDeclaredUTI(contentType) ? MIMETypeFromUTI(contentType) : contentType;
228
    return isDeclaredUTI(contentType) ? MIMETypeFromUTI(contentType) : contentType;
227
}
229
}
228
230
Lines 713-718 static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path, a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm_sec2
713
    bool isDirectory = FileSystem::fileIsDirectory(path, FileSystem::ShouldFollowSymbolicLinks::Yes);
715
    bool isDirectory = FileSystem::fileIsDirectory(path, FileSystem::ShouldFollowSymbolicLinks::Yes);
714
    String contentType = typeForAttachmentElement(explicitContentType);
716
    String contentType = typeForAttachmentElement(explicitContentType);
715
    if (contentType.isEmpty()) {
717
    if (contentType.isEmpty()) {
718
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
716
        if (isDirectory)
719
        if (isDirectory)
717
            contentType = kUTTypeDirectory;
720
            contentType = kUTTypeDirectory;
718
        else {
721
        else {
Lines 720-725 static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path, a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm_sec3
720
            if (contentType.isEmpty())
723
            if (contentType.isEmpty())
721
                contentType = kUTTypeData;
724
                contentType = kUTTypeData;
722
        }
725
        }
726
ALLOW_DEPRECATED_DECLARATIONS_END
723
    }
727
    }
724
728
725
    Optional<uint64_t> fileSizeForDisplay;
729
    Optional<uint64_t> fileSizeForDisplay;
- a/Source/WebCore/editing/mac/EditorMac.mm +2 lines
Lines 181-188 RefPtr<SharedBuffer> Editor::dataSelectionForPasteboard(const String& pasteboard a/Source/WebCore/editing/mac/EditorMac.mm_sec1
181
    if (!canCopy())
181
    if (!canCopy())
182
        return nullptr;
182
        return nullptr;
183
183
184
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
184
    if (pasteboardType == WebArchivePboardType || pasteboardType == String(kUTTypeWebArchive))
185
    if (pasteboardType == WebArchivePboardType || pasteboardType == String(kUTTypeWebArchive))
185
        return selectionInWebArchiveFormat();
186
        return selectionInWebArchiveFormat();
187
ALLOW_DEPRECATED_DECLARATIONS_END
186
188
187
    if (pasteboardType == String(legacyRTFDPasteboardType()))
189
    if (pasteboardType == String(legacyRTFDPasteboardType()))
188
        return dataInRTFDFormat(attributedString(*adjustedSelectionRange()).string.get());
190
        return dataInRTFDFormat(attributedString(*adjustedSelectionRange()).string.get());
- a/Source/WebCore/fileapi/FileCocoa.mm +2 lines
Lines 54-60 bool File::shouldReplaceFile(const String& path) a/Source/WebCore/fileapi/FileCocoa.mm_sec1
54
        return false;
54
        return false;
55
    }
55
    }
56
56
57
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
57
    return UTTypeConformsTo((__bridge CFStringRef)uti, kUTTypePackage);
58
    return UTTypeConformsTo((__bridge CFStringRef)uti, kUTTypePackage);
59
ALLOW_DEPRECATED_DECLARATIONS_END
58
}
60
}
59
61
60
void File::computeNameAndContentTypeForReplacedFile(const String& path, const String& nameOverride, String& effectiveName, String& effectiveContentType)
62
void File::computeNameAndContentTypeForReplacedFile(const String& path, const String& nameOverride, String& effectiveName, String& effectiveContentType)
- a/Source/WebCore/page/mac/DragControllerMac.mm +2 lines
Lines 117-122 DragOperation DragController::platformGenericDragOperation() a/Source/WebCore/page/mac/DragControllerMac.mm_sec1
117
void DragController::updateSupportedTypeIdentifiersForDragHandlingMethod(DragHandlingMethod dragHandlingMethod, const DragData& dragData) const
117
void DragController::updateSupportedTypeIdentifiersForDragHandlingMethod(DragHandlingMethod dragHandlingMethod, const DragData& dragData) const
118
{
118
{
119
    Vector<String> supportedTypes;
119
    Vector<String> supportedTypes;
120
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
120
    switch (dragHandlingMethod) {
121
    switch (dragHandlingMethod) {
121
    case DragHandlingMethod::PageLoad:
122
    case DragHandlingMethod::PageLoad:
122
        supportedTypes.append(kUTTypeURL);
123
        supportedTypes.append(kUTTypeURL);
Lines 143-148 void DragController::updateSupportedTypeIdentifiersForDragHandlingMethod(DragHan a/Source/WebCore/page/mac/DragControllerMac.mm_sec2
143
            supportedTypes.append(type);
144
            supportedTypes.append(type);
144
        break;
145
        break;
145
    }
146
    }
147
ALLOW_DEPRECATED_DECLARATIONS_END
146
    platformStrategies()->pasteboardStrategy()->updateSupportedTypeIdentifiers(supportedTypes, dragData.pasteboardName());
148
    platformStrategies()->pasteboardStrategy()->updateSupportedTypeIdentifiers(supportedTypes, dragData.pasteboardName());
147
}
149
}
148
150
- a/Source/WebCore/platform/cocoa/DragDataCocoa.mm +16 lines
Lines 47-53 namespace WebCore { a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec1
47
static inline String rtfPasteboardType()
47
static inline String rtfPasteboardType()
48
{
48
{
49
#if PLATFORM(IOS_FAMILY)
49
#if PLATFORM(IOS_FAMILY)
50
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
50
    return String(kUTTypeRTF);
51
    return String(kUTTypeRTF);
52
ALLOW_DEPRECATED_DECLARATIONS_END
51
#else
53
#else
52
    return String(legacyRTFPasteboardType());
54
    return String(legacyRTFPasteboardType());
53
#endif
55
#endif
Lines 56-62 static inline String rtfPasteboardType() a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec2
56
static inline String rtfdPasteboardType()
58
static inline String rtfdPasteboardType()
57
{
59
{
58
#if PLATFORM(IOS_FAMILY)
60
#if PLATFORM(IOS_FAMILY)
61
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
59
    return String(kUTTypeFlatRTFD);
62
    return String(kUTTypeFlatRTFD);
63
ALLOW_DEPRECATED_DECLARATIONS_END
60
#else
64
#else
61
    return String(legacyRTFDPasteboardType());
65
    return String(legacyRTFDPasteboardType());
62
#endif
66
#endif
Lines 65-71 static inline String rtfdPasteboardType() a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec3
65
static inline String stringPasteboardType()
69
static inline String stringPasteboardType()
66
{
70
{
67
#if PLATFORM(IOS_FAMILY)
71
#if PLATFORM(IOS_FAMILY)
72
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
68
    return String(kUTTypeText);
73
    return String(kUTTypeText);
74
ALLOW_DEPRECATED_DECLARATIONS_END
69
#else
75
#else
70
    return String(legacyStringPasteboardType());
76
    return String(legacyStringPasteboardType());
71
#endif
77
#endif
Lines 74-80 static inline String stringPasteboardType() a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec4
74
static inline String urlPasteboardType()
80
static inline String urlPasteboardType()
75
{
81
{
76
#if PLATFORM(IOS_FAMILY)
82
#if PLATFORM(IOS_FAMILY)
83
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
77
    return String(kUTTypeURL);
84
    return String(kUTTypeURL);
85
ALLOW_DEPRECATED_DECLARATIONS_END
78
#else
86
#else
79
    return String(legacyURLPasteboardType());
87
    return String(legacyURLPasteboardType());
80
#endif
88
#endif
Lines 83-89 static inline String urlPasteboardType() a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec5
83
static inline String htmlPasteboardType()
91
static inline String htmlPasteboardType()
84
{
92
{
85
#if PLATFORM(IOS_FAMILY)
93
#if PLATFORM(IOS_FAMILY)
94
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
86
    return String(kUTTypeHTML);
95
    return String(kUTTypeHTML);
96
ALLOW_DEPRECATED_DECLARATIONS_END
87
#else
97
#else
88
    return String(legacyHTMLPasteboardType());
98
    return String(legacyHTMLPasteboardType());
89
#endif
99
#endif
Lines 101-107 static inline String colorPasteboardType() a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec6
101
static inline String pdfPasteboardType()
111
static inline String pdfPasteboardType()
102
{
112
{
103
#if PLATFORM(IOS_FAMILY)
113
#if PLATFORM(IOS_FAMILY)
114
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
104
    return String(kUTTypePDF);
115
    return String(kUTTypePDF);
116
ALLOW_DEPRECATED_DECLARATIONS_END
105
#else
117
#else
106
    return String(legacyPDFPasteboardType());
118
    return String(legacyPDFPasteboardType());
107
#endif
119
#endif
Lines 110-116 static inline String pdfPasteboardType() a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec7
110
static inline String tiffPasteboardType()
122
static inline String tiffPasteboardType()
111
{
123
{
112
#if PLATFORM(IOS_FAMILY)
124
#if PLATFORM(IOS_FAMILY)
125
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
113
    return String(kUTTypeTIFF);
126
    return String(kUTTypeTIFF);
127
ALLOW_DEPRECATED_DECLARATIONS_END
114
#else
128
#else
115
    return String(legacyTIFFPasteboardType());
129
    return String(legacyTIFFPasteboardType());
116
#endif
130
#endif
Lines 235-240 bool DragData::containsCompatibleContent(DraggingPurpose purpose) const a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec8
235
249
236
    Vector<String> types;
250
    Vector<String> types;
237
    platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
251
    platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
252
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
238
    return types.contains(String(WebArchivePboardType))
253
    return types.contains(String(WebArchivePboardType))
239
        || types.contains(htmlPasteboardType())
254
        || types.contains(htmlPasteboardType())
240
        || types.contains(String(kUTTypeWebArchive))
255
        || types.contains(String(kUTTypeWebArchive))
Lines 252-257 bool DragData::containsCompatibleContent(DraggingPurpose purpose) const a/Source/WebCore/platform/cocoa/DragDataCocoa.mm_sec9
252
        || types.contains(colorPasteboardType())
267
        || types.contains(colorPasteboardType())
253
        || types.contains(String(kUTTypeJPEG))
268
        || types.contains(String(kUTTypeJPEG))
254
        || types.contains(String(kUTTypePNG));
269
        || types.contains(String(kUTTypePNG));
270
ALLOW_DEPRECATED_DECLARATIONS_END
255
}
271
}
256
272
257
bool DragData::containsPromise() const
273
bool DragData::containsPromise() const
- a/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm +2 lines
Lines 58-63 static HashMap<String, HashSet<String>>& extensionsForMIMETypeMap() a/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm_sec1
58
58
59
        auto allUTIs = adoptCF(_UTCopyDeclaredTypeIdentifiers());
59
        auto allUTIs = adoptCF(_UTCopyDeclaredTypeIdentifiers());
60
60
61
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
61
        for (NSString *uti in (__bridge NSArray<NSString *> *)allUTIs.get()) {
62
        for (NSString *uti in (__bridge NSArray<NSString *> *)allUTIs.get()) {
62
            auto type = adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)uti, kUTTagClassMIMEType));
63
            auto type = adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)uti, kUTTagClassMIMEType));
63
            if (!type)
64
            if (!type)
Lines 67-72 static HashMap<String, HashSet<String>>& extensionsForMIMETypeMap() a/Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm_sec2
67
                continue;
68
                continue;
68
            addExtensions(type.get(), (__bridge NSArray<NSString *> *)extensions.get());
69
            addExtensions(type.get(), (__bridge NSArray<NSString *> *)extensions.get());
69
        }
70
        }
71
ALLOW_DEPRECATED_DECLARATIONS_END
70
72
71
        return map;
73
        return map;
72
    }());
74
    }());
- a/Source/WebCore/platform/cocoa/PasteboardCocoa.mm +4 lines
Lines 61-66 enum class ImageType { a/Source/WebCore/platform/cocoa/PasteboardCocoa.mm_sec1
61
61
62
static ImageType cocoaTypeToImageType(const String& cocoaType)
62
static ImageType cocoaTypeToImageType(const String& cocoaType)
63
{
63
{
64
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
64
#if PLATFORM(MAC)
65
#if PLATFORM(MAC)
65
    if (cocoaType == String(legacyTIFFPasteboardType()))
66
    if (cocoaType == String(legacyTIFFPasteboardType()))
66
        return ImageType::TIFF;
67
        return ImageType::TIFF;
Lines 77-82 static ImageType cocoaTypeToImageType(const String& cocoaType) a/Source/WebCore/platform/cocoa/PasteboardCocoa.mm_sec2
77
        return ImageType::JPEG;
78
        return ImageType::JPEG;
78
    if (cocoaType == String(kUTTypeGIF))
79
    if (cocoaType == String(kUTTypeGIF))
79
        return ImageType::GIF;
80
        return ImageType::GIF;
81
ALLOW_DEPRECATED_DECLARATIONS_END
80
    return ImageType::Invalid;
82
    return ImageType::Invalid;
81
}
83
}
82
84
Lines 164-170 Pasteboard::FileContentState Pasteboard::fileContentState() a/Source/WebCore/platform/cocoa/PasteboardCocoa.mm_sec3
164
            if (cocoaType == String(legacyURLPasteboardType()))
166
            if (cocoaType == String(legacyURLPasteboardType()))
165
                return true;
167
                return true;
166
#endif
168
#endif
169
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
167
            return cocoaType == String(kUTTypeURL);
170
            return cocoaType == String(kUTTypeURL);
171
ALLOW_DEPRECATED_DECLARATIONS_END
168
        });
172
        });
169
        mayContainFilePaths = indexOfURL != notFound && !platformStrategies()->pasteboardStrategy()->containsStringSafeForDOMToReadForType(cocoaTypes[indexOfURL], m_pasteboardName);
173
        mayContainFilePaths = indexOfURL != notFound && !platformStrategies()->pasteboardStrategy()->containsStringSafeForDOMToReadForType(cocoaTypes[indexOfURL], m_pasteboardName);
170
    }
174
    }
- a/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm +2 lines
Lines 74-81 String PlatformPasteboard::urlStringSuitableForLoading(String& title) a/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm_sec1
74
74
75
#if PLATFORM(IOS_FAMILY)
75
#if PLATFORM(IOS_FAMILY)
76
    UNUSED_PARAM(title);
76
    UNUSED_PARAM(title);
77
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
77
    String urlPasteboardType = kUTTypeURL;
78
    String urlPasteboardType = kUTTypeURL;
78
    String stringPasteboardType = kUTTypeText;
79
    String stringPasteboardType = kUTTypeText;
80
ALLOW_DEPRECATED_DECLARATIONS_END
79
#else
81
#else
80
    String urlPasteboardType = legacyURLPasteboardType();
82
    String urlPasteboardType = legacyURLPasteboardType();
81
    String stringPasteboardType = legacyStringPasteboardType();
83
    String stringPasteboardType = legacyStringPasteboardType();
- a/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp +4 lines
Lines 54-67 uint8_t verifyImageBufferIsBigEnough(const void* buffer, size_t bufferSize) a/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp_sec1
54
54
55
CFStringRef jpegUTI()
55
CFStringRef jpegUTI()
56
{
56
{
57
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
57
#if PLATFORM(IOS_FAMILY) || PLATFORM(WIN)
58
#if PLATFORM(IOS_FAMILY) || PLATFORM(WIN)
58
    static const CFStringRef kUTTypeJPEG = CFSTR("public.jpeg");
59
    static const CFStringRef kUTTypeJPEG = CFSTR("public.jpeg");
59
#endif
60
#endif
60
    return kUTTypeJPEG;
61
    return kUTTypeJPEG;
62
ALLOW_DEPRECATED_DECLARATIONS_END
61
}
63
}
62
64
63
RetainPtr<CFStringRef> utiFromImageBufferMIMEType(const String& mimeType)
65
RetainPtr<CFStringRef> utiFromImageBufferMIMEType(const String& mimeType)
64
{
66
{
67
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
65
    // FIXME: Why doesn't iOS use the CoreServices version?
68
    // FIXME: Why doesn't iOS use the CoreServices version?
66
#if PLATFORM(MAC)
69
#if PLATFORM(MAC)
67
    return UTIFromMIMEType(mimeType).createCFString();
70
    return UTIFromMIMEType(mimeType).createCFString();
Lines 83-88 RetainPtr<CFStringRef> utiFromImageBufferMIMEType(const String& mimeType) a/Source/WebCore/platform/graphics/cg/ImageBufferUtilitiesCG.cpp_sec2
83
    ASSERT_NOT_REACHED();
86
    ASSERT_NOT_REACHED();
84
    return kUTTypePNG;
87
    return kUTTypePNG;
85
#endif
88
#endif
89
ALLOW_DEPRECATED_DECLARATIONS_END
86
}
90
}
87
91
88
bool encodeImage(CGImageRef image, CFStringRef uti, Optional<double> quality, CFMutableDataRef data)
92
bool encodeImage(CGImageRef image, CFStringRef uti, Optional<double> quality, CFMutableDataRef data)
- a/Source/WebCore/platform/graphics/cg/ImageSourceCGMac.mm +2 lines
Lines 43-49 String MIMETypeForImageType(const String& uti) a/Source/WebCore/platform/graphics/cg/ImageSourceCGMac.mm_sec1
43
43
44
String preferredExtensionForImageType(const String& uti)
44
String preferredExtensionForImageType(const String& uti)
45
{
45
{
46
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
46
    return adoptCF(UTTypeCopyPreferredTagWithClass(uti.createCFString().get(), kUTTagClassFilenameExtension)).get();
47
    return adoptCF(UTTypeCopyPreferredTagWithClass(uti.createCFString().get(), kUTTagClassFilenameExtension)).get();
48
ALLOW_DEPRECATED_DECLARATIONS_END
47
}
49
}
48
50
49
} // namespace WebCore
51
} // namespace WebCore
- a/Source/WebCore/platform/graphics/mac/ImageMac.mm +3 lines
Lines 83-89 RetainPtr<CFDataRef> BitmapImage::tiffRepresentation(const Vector<Ref<NativeImag a/Source/WebCore/platform/graphics/mac/ImageMac.mm_sec1
83
        return nullptr;
83
        return nullptr;
84
84
85
    RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, 0));
85
    RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, 0));
86
87
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
86
    RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData(data.get(), kUTTypeTIFF, nativeImages.size(), 0));
88
    RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData(data.get(), kUTTypeTIFF, nativeImages.size(), 0));
89
ALLOW_DEPRECATED_DECLARATIONS_END
87
90
88
    if (!destination)
91
    if (!destination)
89
        return nullptr;
92
        return nullptr;
- a/Source/WebCore/platform/ios/PasteboardIOS.mm +26 lines
Lines 129-135 void Pasteboard::writePlainText(const String& text, SmartReplaceOption) a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec1
129
{
129
{
130
    // FIXME: We vend "public.text" here for backwards compatibility with pre-iOS 11 apps. In the future, we should stop vending this UTI,
130
    // FIXME: We vend "public.text" here for backwards compatibility with pre-iOS 11 apps. In the future, we should stop vending this UTI,
131
    // and instead set data for concrete plain text types. See <https://bugs.webkit.org/show_bug.cgi?id=173317>.
131
    // and instead set data for concrete plain text types. See <https://bugs.webkit.org/show_bug.cgi?id=173317>.
132
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
132
    platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text, m_pasteboardName);
133
    platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text, m_pasteboardName);
134
ALLOW_DEPRECATED_DECLARATIONS_END
133
}
135
}
134
136
135
void Pasteboard::write(const PasteboardURL& pasteboardURL)
137
void Pasteboard::write(const PasteboardURL& pasteboardURL)
Lines 163-169 void Pasteboard::read(PasteboardPlainText& text, PlainTextURLReadingPolicy allow a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec2
163
    PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy();
165
    PasteboardStrategy& strategy = *platformStrategies()->pasteboardStrategy();
164
166
165
    if (allowURL == PlainTextURLReadingPolicy::AllowURL) {
167
    if (allowURL == PlainTextURLReadingPolicy::AllowURL) {
168
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
166
        text.text = strategy.readStringFromPasteboard(itemIndexToQuery, kUTTypeURL, m_pasteboardName);
169
        text.text = strategy.readStringFromPasteboard(itemIndexToQuery, kUTTypeURL, m_pasteboardName);
170
ALLOW_DEPRECATED_DECLARATIONS_END
167
        if (!text.text.isEmpty()) {
171
        if (!text.text.isEmpty()) {
168
            text.isURL = true;
172
            text.isURL = true;
169
            return;
173
            return;
Lines 174-203 void Pasteboard::read(PasteboardPlainText& text, PlainTextURLReadingPolicy allow a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec3
174
    // plain text for this abstract UTI. In almost all cases, the more correct choice would be to write to
178
    // plain text for this abstract UTI. In almost all cases, the more correct choice would be to write to
175
    // one of the concrete "public.plain-text" representations (e.g. kUTTypeUTF8PlainText). In the future, we
179
    // one of the concrete "public.plain-text" representations (e.g. kUTTypeUTF8PlainText). In the future, we
176
    // should consider removing support for reading plain text from "public.text".
180
    // should consider removing support for reading plain text from "public.text".
181
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
177
    text.text = strategy.readStringFromPasteboard(itemIndexToQuery, kUTTypePlainText, m_pasteboardName);
182
    text.text = strategy.readStringFromPasteboard(itemIndexToQuery, kUTTypePlainText, m_pasteboardName);
178
    if (text.text.isEmpty())
183
    if (text.text.isEmpty())
179
        text.text = strategy.readStringFromPasteboard(itemIndexToQuery, kUTTypeText, m_pasteboardName);
184
        text.text = strategy.readStringFromPasteboard(itemIndexToQuery, kUTTypeText, m_pasteboardName);
185
ALLOW_DEPRECATED_DECLARATIONS_END
180
186
181
    text.isURL = false;
187
    text.isURL = false;
182
}
188
}
183
189
184
static NSArray* supportedImageTypes()
190
static NSArray* supportedImageTypes()
185
{
191
{
192
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
186
    return @[(__bridge NSString *)kUTTypePNG, (__bridge NSString *)kUTTypeTIFF, (__bridge NSString *)kUTTypeJPEG, (__bridge NSString *)kUTTypeGIF];
193
    return @[(__bridge NSString *)kUTTypePNG, (__bridge NSString *)kUTTypeTIFF, (__bridge NSString *)kUTTypeJPEG, (__bridge NSString *)kUTTypeGIF];
194
ALLOW_DEPRECATED_DECLARATIONS_END
187
}
195
}
188
196
189
static bool isTypeAllowedByReadingPolicy(NSString *type, WebContentReadingPolicy policy)
197
static bool isTypeAllowedByReadingPolicy(NSString *type, WebContentReadingPolicy policy)
190
{
198
{
199
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
191
    return policy == WebContentReadingPolicy::AnyType
200
    return policy == WebContentReadingPolicy::AnyType
192
        || [type isEqualToString:WebArchivePboardType]
201
        || [type isEqualToString:WebArchivePboardType]
193
        || [type isEqualToString:(__bridge NSString *)kUTTypeWebArchive]
202
        || [type isEqualToString:(__bridge NSString *)kUTTypeWebArchive]
194
        || [type isEqualToString:(__bridge NSString *)kUTTypeHTML]
203
        || [type isEqualToString:(__bridge NSString *)kUTTypeHTML]
195
        || [type isEqualToString:(__bridge NSString *)kUTTypeRTF]
204
        || [type isEqualToString:(__bridge NSString *)kUTTypeRTF]
196
        || [type isEqualToString:(__bridge NSString *)kUTTypeFlatRTFD];
205
        || [type isEqualToString:(__bridge NSString *)kUTTypeFlatRTFD];
206
ALLOW_DEPRECATED_DECLARATIONS_END
197
}
207
}
198
208
199
Pasteboard::ReaderResult Pasteboard::readPasteboardWebContentDataForType(PasteboardWebContentReader& reader, PasteboardStrategy& strategy, NSString *type, const PasteboardItemInfo& itemInfo, int itemIndex)
209
Pasteboard::ReaderResult Pasteboard::readPasteboardWebContentDataForType(PasteboardWebContentReader& reader, PasteboardStrategy& strategy, NSString *type, const PasteboardItemInfo& itemInfo, int itemIndex)
200
{
210
{
211
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
201
    if ([type isEqualToString:WebArchivePboardType] || [type isEqualToString:(__bridge NSString *)kUTTypeWebArchive]) {
212
    if ([type isEqualToString:WebArchivePboardType] || [type isEqualToString:(__bridge NSString *)kUTTypeWebArchive]) {
202
        auto buffer = strategy.readBufferFromPasteboard(itemIndex, type, m_pasteboardName);
213
        auto buffer = strategy.readBufferFromPasteboard(itemIndex, type, m_pasteboardName);
203
        if (m_changeCount != changeCount())
214
        if (m_changeCount != changeCount())
Lines 264-277 Pasteboard::ReaderResult Pasteboard::readPasteboardWebContentDataForType(Pastebo a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec4
264
            return ReaderResult::PasteboardWasChangedExternally;
275
            return ReaderResult::PasteboardWasChangedExternally;
265
        return !string.isNull() && reader.readPlainText(string) ? ReaderResult::ReadType : ReaderResult::DidNotReadType;
276
        return !string.isNull() && reader.readPlainText(string) ? ReaderResult::ReadType : ReaderResult::DidNotReadType;
266
    }
277
    }
278
ALLOW_DEPRECATED_DECLARATIONS_END
267
279
268
    return ReaderResult::DidNotReadType;
280
    return ReaderResult::DidNotReadType;
269
}
281
}
270
282
271
static void readURLAlongsideAttachmentIfNecessary(PasteboardWebContentReader& reader, PasteboardStrategy& strategy, const String& typeIdentifier, const String& pasteboardName, int itemIndex)
283
static void readURLAlongsideAttachmentIfNecessary(PasteboardWebContentReader& reader, PasteboardStrategy& strategy, const String& typeIdentifier, const String& pasteboardName, int itemIndex)
272
{
284
{
285
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
273
    if (!UTTypeConformsTo(typeIdentifier.createCFString().get(), kUTTypeVCard))
286
    if (!UTTypeConformsTo(typeIdentifier.createCFString().get(), kUTTypeVCard))
274
        return;
287
        return;
288
ALLOW_DEPRECATED_DECLARATIONS_END
275
289
276
    String title;
290
    String title;
277
    auto url = strategy.readURLFromPasteboard(itemIndex, pasteboardName, title);
291
    auto url = strategy.readURLFromPasteboard(itemIndex, pasteboardName, title);
Lines 288-294 static bool prefersAttachmentRepresentation(const PasteboardItemInfo& info) a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec5
288
    if (info.preferredPresentationStyle == PasteboardItemPresentationStyle::Inline)
302
    if (info.preferredPresentationStyle == PasteboardItemPresentationStyle::Inline)
289
        return false;
303
        return false;
290
304
305
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
291
    return info.canBeTreatedAsAttachmentOrFile() || UTTypeConformsTo(contentTypeForHighestFidelityItem.createCFString().get(), kUTTypeVCard);
306
    return info.canBeTreatedAsAttachmentOrFile() || UTTypeConformsTo(contentTypeForHighestFidelityItem.createCFString().get(), kUTTypeVCard);
307
ALLOW_DEPRECATED_DECLARATIONS_END
292
}
308
}
293
309
294
void Pasteboard::read(PasteboardWebContentReader& reader, WebContentReadingPolicy policy, Optional<size_t> itemIndex)
310
void Pasteboard::read(PasteboardWebContentReader& reader, WebContentReadingPolicy policy, Optional<size_t> itemIndex)
Lines 403-408 void Pasteboard::readRespectingUTIFidelities(PasteboardWebContentReader& reader, a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec6
403
419
404
NSArray *Pasteboard::supportedWebContentPasteboardTypes()
420
NSArray *Pasteboard::supportedWebContentPasteboardTypes()
405
{
421
{
422
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
406
    return @[
423
    return @[
407
#if !PLATFORM(MACCATALYST)
424
#if !PLATFORM(MACCATALYST)
408
        WebArchivePboardType,
425
        WebArchivePboardType,
Lines 420-430 NSArray *Pasteboard::supportedWebContentPasteboardTypes() a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec7
420
        (__bridge NSString *)kUTTypeURL,
437
        (__bridge NSString *)kUTTypeURL,
421
        (__bridge NSString *)kUTTypeText
438
        (__bridge NSString *)kUTTypeText
422
    ];
439
    ];
440
ALLOW_DEPRECATED_DECLARATIONS_END
423
}
441
}
424
442
425
NSArray *Pasteboard::supportedFileUploadPasteboardTypes()
443
NSArray *Pasteboard::supportedFileUploadPasteboardTypes()
426
{
444
{
445
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
427
    return @[ (__bridge NSString *)kUTTypeItem, (__bridge NSString *)kUTTypeContent, (__bridge NSString *)kUTTypeZipArchive ];
446
    return @[ (__bridge NSString *)kUTTypeItem, (__bridge NSString *)kUTTypeContent, (__bridge NSString *)kUTTypeZipArchive ];
447
ALLOW_DEPRECATED_DECLARATIONS_END
428
}
448
}
429
449
430
bool Pasteboard::hasData()
450
bool Pasteboard::hasData()
Lines 434-443 bool Pasteboard::hasData() a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec8
434
454
435
static String utiTypeFromCocoaType(NSString *type)
455
static String utiTypeFromCocoaType(NSString *type)
436
{
456
{
457
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
437
    RetainPtr<CFStringRef> utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (CFStringRef)type, NULL));
458
    RetainPtr<CFStringRef> utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (CFStringRef)type, NULL));
438
    if (!utiType)
459
    if (!utiType)
439
        return String();
460
        return String();
440
    return String(adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassMIMEType)).get());
461
    return String(adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassMIMEType)).get());
462
ALLOW_DEPRECATED_DECLARATIONS_END
441
}
463
}
442
464
443
static RetainPtr<NSString> cocoaTypeFromHTMLClipboardType(const String& type)
465
static RetainPtr<NSString> cocoaTypeFromHTMLClipboardType(const String& type)
Lines 481-491 Vector<String> Pasteboard::readPlatformValuesAsStrings(const String& domType, in a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec9
481
        return { };
503
        return { };
482
504
483
    auto values = strategy.allStringsForType(cocoaType.get(), pasteboardName);
505
    auto values = strategy.allStringsForType(cocoaType.get(), pasteboardName);
506
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
484
    if ([cocoaType isEqualToString:(__bridge NSString *)kUTTypePlainText]) {
507
    if ([cocoaType isEqualToString:(__bridge NSString *)kUTTypePlainText]) {
485
        values = values.map([&] (auto& value) -> String {
508
        values = values.map([&] (auto& value) -> String {
486
            return [value precomposedStringWithCanonicalMapping];
509
            return [value precomposedStringWithCanonicalMapping];
487
        });
510
        });
488
    }
511
    }
512
ALLOW_DEPRECATED_DECLARATIONS_END
489
513
490
    // Enforce changeCount ourselves for security. We check after reading instead of before to be
514
    // Enforce changeCount ourselves for security. We check after reading instead of before to be
491
    // sure it doesn't change between our testing the change count and accessing the data.
515
    // sure it doesn't change between our testing the change count and accessing the data.
Lines 497-502 Vector<String> Pasteboard::readPlatformValuesAsStrings(const String& domType, in a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec10
497
521
498
void Pasteboard::addHTMLClipboardTypesForCocoaType(ListHashSet<String>& resultTypes, const String& cocoaType)
522
void Pasteboard::addHTMLClipboardTypesForCocoaType(ListHashSet<String>& resultTypes, const String& cocoaType)
499
{
523
{
524
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
500
    // UTI may not do these right, so make sure we get the right, predictable result.
525
    // UTI may not do these right, so make sure we get the right, predictable result.
501
    if ([cocoaType isEqualToString:(NSString *)kUTTypePlainText]
526
    if ([cocoaType isEqualToString:(NSString *)kUTTypePlainText]
502
        || [cocoaType isEqualToString:(NSString *)kUTTypeUTF8PlainText]
527
        || [cocoaType isEqualToString:(NSString *)kUTTypeUTF8PlainText]
Lines 512-517 void Pasteboard::addHTMLClipboardTypesForCocoaType(ListHashSet<String>& resultTy a/Source/WebCore/platform/ios/PasteboardIOS.mm_sec11
512
        resultTypes.add("text/html"_s);
537
        resultTypes.add("text/html"_s);
513
        // We don't return here for App compatibility.
538
        // We don't return here for App compatibility.
514
    }
539
    }
540
ALLOW_DEPRECATED_DECLARATIONS_END
515
    if (Pasteboard::shouldTreatCocoaTypeAsFile(cocoaType))
541
    if (Pasteboard::shouldTreatCocoaTypeAsFile(cocoaType))
516
        return;
542
        return;
517
    String utiType = utiTypeFromCocoaType(cocoaType);
543
    String utiType = utiTypeFromCocoaType(cocoaType);
- a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm +32 lines
Lines 109-114 static bool shouldTreatAtLeastOneTypeAsFile(NSArray<NSString *> *platformTypes) a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec1
109
static const char *safeTypeForDOMToReadAndWriteForPlatformType(const String& platformType, PlatformPasteboard::IncludeImageTypes includeImageTypes)
109
static const char *safeTypeForDOMToReadAndWriteForPlatformType(const String& platformType, PlatformPasteboard::IncludeImageTypes includeImageTypes)
110
{
110
{
111
    auto cfType = platformType.createCFString();
111
    auto cfType = platformType.createCFString();
112
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
112
    if (UTTypeConformsTo(cfType.get(), kUTTypePlainText))
113
    if (UTTypeConformsTo(cfType.get(), kUTTypePlainText))
113
        return "text/plain"_s;
114
        return "text/plain"_s;
114
115
Lines 121-126 static const char *safeTypeForDOMToReadAndWriteForPlatformType(const String& pla a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec2
121
122
122
    if (includeImageTypes == PlatformPasteboard::IncludeImageTypes::Yes && UTTypeConformsTo(cfType.get(), kUTTypePNG))
123
    if (includeImageTypes == PlatformPasteboard::IncludeImageTypes::Yes && UTTypeConformsTo(cfType.get(), kUTTypePNG))
123
        return "image/png"_s;
124
        return "image/png"_s;
125
ALLOW_DEPRECATED_DECLARATIONS_END
124
126
125
    return nullptr;
127
    return nullptr;
126
}
128
}
Lines 139-146 static Vector<String> webSafeTypes(NSArray<NSString *> *platformTypes, PlatformP a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec3
139
141
140
        if (auto* coercedType = safeTypeForDOMToReadAndWriteForPlatformType(type, includeImageTypes)) {
142
        if (auto* coercedType = safeTypeForDOMToReadAndWriteForPlatformType(type, includeImageTypes)) {
141
            auto domTypeAsString = String::fromUTF8(coercedType);
143
            auto domTypeAsString = String::fromUTF8(coercedType);
144
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
142
            if (domTypeAsString == "text/uri-list"_s && ([platformTypes containsObject:(__bridge NSString *)kUTTypeFileURL] || shouldAvoidExposingURLType()))
145
            if (domTypeAsString == "text/uri-list"_s && ([platformTypes containsObject:(__bridge NSString *)kUTTypeFileURL] || shouldAvoidExposingURLType()))
143
                continue;
146
                continue;
147
ALLOW_DEPRECATED_DECLARATIONS_END
144
148
145
            domPasteboardTypes.add(WTFMove(domTypeAsString));
149
            domPasteboardTypes.add(WTFMove(domTypeAsString));
146
        }
150
        }
Lines 218-223 Optional<PasteboardItemInfo> PlatformPasteboard::informationForItemAtIndex(size_ a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec4
218
    for (NSString *typeIdentifier in registeredTypeIdentifiers) {
222
    for (NSString *typeIdentifier in registeredTypeIdentifiers) {
219
        info.platformTypesByFidelity.uncheckedAppend(typeIdentifier);
223
        info.platformTypesByFidelity.uncheckedAppend(typeIdentifier);
220
        CFStringRef cfTypeIdentifier = (CFStringRef)typeIdentifier;
224
        CFStringRef cfTypeIdentifier = (CFStringRef)typeIdentifier;
225
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
221
        if (!UTTypeIsDeclared(cfTypeIdentifier))
226
        if (!UTTypeIsDeclared(cfTypeIdentifier))
222
            continue;
227
            continue;
223
228
Lines 232-243 Optional<PasteboardItemInfo> PlatformPasteboard::informationForItemAtIndex(size_ a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec5
232
237
233
        if (UTTypeConformsTo(cfTypeIdentifier, kUTTypeFlatRTFD))
238
        if (UTTypeConformsTo(cfTypeIdentifier, kUTTypeFlatRTFD))
234
            continue;
239
            continue;
240
ALLOW_DEPRECATED_DECLARATIONS_END
235
241
236
        info.isNonTextType = true;
242
        info.isNonTextType = true;
237
    }
243
    }
238
244
239
    info.webSafeTypesByFidelity = webSafeTypes(registeredTypeIdentifiers, IncludeImageTypes::Yes, [&] {
245
    info.webSafeTypesByFidelity = webSafeTypes(registeredTypeIdentifiers, IncludeImageTypes::Yes, [&] {
246
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
240
        return shouldTreatAtLeastOneTypeAsFile(registeredTypeIdentifiers) && !Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles(readString(index, kUTTypeURL));
247
        return shouldTreatAtLeastOneTypeAsFile(registeredTypeIdentifiers) && !Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles(readString(index, kUTTypeURL));
248
ALLOW_DEPRECATED_DECLARATIONS_END
241
    });
249
    });
242
250
243
    return info;
251
    return info;
Lines 265-274 String PlatformPasteboard::stringForType(const String& type) const a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec6
265
{
273
{
266
    auto result = readString(0, type);
274
    auto result = readString(0, type);
267
275
276
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
268
    if (pasteboardMayContainFilePaths(m_pasteboard.get()) && type == String { kUTTypeURL }) {
277
    if (pasteboardMayContainFilePaths(m_pasteboard.get()) && type == String { kUTTypeURL }) {
269
        if (!Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles(result))
278
        if (!Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles(result))
270
            result = { };
279
            result = { };
271
    }
280
    }
281
ALLOW_DEPRECATED_DECLARATIONS_END
272
282
273
    return result;
283
    return result;
274
}
284
}
Lines 322-327 int64_t PlatformPasteboard::changeCount() const a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec7
322
332
323
String PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite(const String& domType, IncludeImageTypes includeImageTypes)
333
String PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite(const String& domType, IncludeImageTypes includeImageTypes)
324
{
334
{
335
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
325
    if (domType == "text/plain")
336
    if (domType == "text/plain")
326
        return kUTTypePlainText;
337
        return kUTTypePlainText;
327
338
Lines 333-338 String PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec8
333
344
334
    if (includeImageTypes == IncludeImageTypes::Yes && domType == "image/png")
345
    if (includeImageTypes == IncludeImageTypes::Yes && domType == "image/png")
335
        return kUTTypePNG;
346
        return kUTTypePNG;
347
ALLOW_DEPRECATED_DECLARATIONS_END
336
348
337
    return { };
349
    return { };
338
}
350
}
Lines 396-410 static void addRepresentationsForPlainText(WebItemProviderRegistrationInfoList * a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec9
396
    if (URL(platformURL).isValid())
408
    if (URL(platformURL).isValid())
397
        [itemsToRegister addRepresentingObject:platformURL];
409
        [itemsToRegister addRepresentingObject:platformURL];
398
410
411
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
399
    [itemsToRegister addData:[(NSString *)plainText dataUsingEncoding:NSUTF8StringEncoding] forType:(NSString *)kUTTypeUTF8PlainText];
412
    [itemsToRegister addData:[(NSString *)plainText dataUsingEncoding:NSUTF8StringEncoding] forType:(NSString *)kUTTypeUTF8PlainText];
413
ALLOW_DEPRECATED_DECLARATIONS_END
400
}
414
}
401
415
402
bool PlatformPasteboard::allowReadingURLAtIndex(const URL& url, int index) const
416
bool PlatformPasteboard::allowReadingURLAtIndex(const URL& url, int index) const
403
{
417
{
404
    NSItemProvider *itemProvider = (NSUInteger)index < [m_pasteboard itemProviders].count ? [[m_pasteboard itemProviders] objectAtIndex:index] : nil;
418
    NSItemProvider *itemProvider = (NSUInteger)index < [m_pasteboard itemProviders].count ? [[m_pasteboard itemProviders] objectAtIndex:index] : nil;
405
    for (NSString *type in itemProvider.registeredTypeIdentifiers) {
419
    for (NSString *type in itemProvider.registeredTypeIdentifiers) {
420
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
406
        if (UTTypeConformsTo((CFStringRef)type, kUTTypeURL))
421
        if (UTTypeConformsTo((CFStringRef)type, kUTTypeURL))
407
            return true;
422
            return true;
423
ALLOW_DEPRECATED_DECLARATIONS_END
408
    }
424
    }
409
425
410
    return url.isValid();
426
    return url.isValid();
Lines 425-431 void PlatformPasteboard::write(const PasteboardWebContent& content) a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec10
425
    if (content.dataInWebArchiveFormat) {
441
    if (content.dataInWebArchiveFormat) {
426
        auto webArchiveData = content.dataInWebArchiveFormat->createNSData();
442
        auto webArchiveData = content.dataInWebArchiveFormat->createNSData();
427
#if PLATFORM(MACCATALYST)
443
#if PLATFORM(MACCATALYST)
444
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
428
        NSString *webArchiveType = (__bridge NSString *)kUTTypeWebArchive;
445
        NSString *webArchiveType = (__bridge NSString *)kUTTypeWebArchive;
446
ALLOW_DEPRECATED_DECLARATIONS_END
429
#else
447
#else
430
        // FIXME: We should additionally register "com.apple.webarchive" once <rdar://problem/46830277> is fixed.
448
        // FIXME: We should additionally register "com.apple.webarchive" once <rdar://problem/46830277> is fixed.
431
        NSString *webArchiveType = WebArchivePboardType;
449
        NSString *webArchiveType = WebArchivePboardType;
Lines 438-443 void PlatformPasteboard::write(const PasteboardWebContent& content) a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec11
438
            [representationsToRegister addRepresentingObject:attributedString];
456
            [representationsToRegister addRepresentingObject:attributedString];
439
    }
457
    }
440
458
459
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
441
    if (content.dataInRTFDFormat)
460
    if (content.dataInRTFDFormat)
442
        [representationsToRegister addData:content.dataInRTFDFormat->createNSData().get() forType:(NSString *)kUTTypeFlatRTFD];
461
        [representationsToRegister addData:content.dataInRTFDFormat->createNSData().get() forType:(NSString *)kUTTypeFlatRTFD];
443
462
Lines 448-453 void PlatformPasteboard::write(const PasteboardWebContent& content) a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec12
448
        NSData *htmlAsData = [(NSString *)content.dataInHTMLFormat dataUsingEncoding:NSUTF8StringEncoding];
467
        NSData *htmlAsData = [(NSString *)content.dataInHTMLFormat dataUsingEncoding:NSUTF8StringEncoding];
449
        [representationsToRegister addData:htmlAsData forType:(NSString *)kUTTypeHTML];
468
        [representationsToRegister addData:htmlAsData forType:(NSString *)kUTTypeHTML];
450
    }
469
    }
470
ALLOW_DEPRECATED_DECLARATIONS_END
451
471
452
    if (!content.dataInStringFormat.isEmpty())
472
    if (!content.dataInStringFormat.isEmpty())
453
        addRepresentationsForPlainText(representationsToRegister.get(), content.dataInStringFormat);
473
        addRepresentationsForPlainText(representationsToRegister.get(), content.dataInStringFormat);
Lines 502-511 void PlatformPasteboard::write(const String& pasteboardType, const String& text) a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec13
502
    NSString *pasteboardTypeAsNSString = pasteboardType;
522
    NSString *pasteboardTypeAsNSString = pasteboardType;
503
    if (!text.isEmpty() && pasteboardTypeAsNSString.length) {
523
    if (!text.isEmpty() && pasteboardTypeAsNSString.length) {
504
        auto pasteboardTypeAsCFString = (CFStringRef)pasteboardTypeAsNSString;
524
        auto pasteboardTypeAsCFString = (CFStringRef)pasteboardTypeAsNSString;
525
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
505
        if (UTTypeConformsTo(pasteboardTypeAsCFString, kUTTypeURL) || UTTypeConformsTo(pasteboardTypeAsCFString, kUTTypeText))
526
        if (UTTypeConformsTo(pasteboardTypeAsCFString, kUTTypeURL) || UTTypeConformsTo(pasteboardTypeAsCFString, kUTTypeText))
506
            addRepresentationsForPlainText(representationsToRegister.get(), text);
527
            addRepresentationsForPlainText(representationsToRegister.get(), text);
507
        else
528
        else
508
            [representationsToRegister addData:[pasteboardTypeAsNSString dataUsingEncoding:NSUTF8StringEncoding] forType:pasteboardType];
529
            [representationsToRegister addData:[pasteboardTypeAsNSString dataUsingEncoding:NSUTF8StringEncoding] forType:pasteboardType];
530
ALLOW_DEPRECATED_DECLARATIONS_END
509
    }
531
    }
510
532
511
    registerItemToPasteboard(representationsToRegister.get(), m_pasteboard.get());
533
    registerItemToPasteboard(representationsToRegister.get(), m_pasteboard.get());
Lines 569-575 Vector<String> PlatformPasteboard::typesSafeForDOMToReadAndWrite(const String& o a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec14
569
591
570
    auto webSafePasteboardTypes = webSafeTypes([m_pasteboard pasteboardTypes], IncludeImageTypes::No, [&] {
592
    auto webSafePasteboardTypes = webSafeTypes([m_pasteboard pasteboardTypes], IncludeImageTypes::No, [&] {
571
        BOOL ableToDetermineProtocolOfPasteboardURL = ![m_pasteboard isKindOfClass:[WebItemProviderPasteboard class]];
593
        BOOL ableToDetermineProtocolOfPasteboardURL = ![m_pasteboard isKindOfClass:[WebItemProviderPasteboard class]];
594
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
572
        return ableToDetermineProtocolOfPasteboardURL && stringForType(kUTTypeURL).isEmpty();
595
        return ableToDetermineProtocolOfPasteboardURL && stringForType(kUTTypeURL).isEmpty();
596
ALLOW_DEPRECATED_DECLARATIONS_END
573
    });
597
    });
574
598
575
    for (auto& type : webSafePasteboardTypes)
599
    for (auto& type : webSafePasteboardTypes)
Lines 610-621 static RetainPtr<WebItemProviderRegistrationInfoList> createItemProviderRegistra a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec15
610
634
611
            NSString *nsStringValue = WTF::get<String>(value);
635
            NSString *nsStringValue = WTF::get<String>(value);
612
            auto cfType = cocoaType.createCFString();
636
            auto cfType = cocoaType.createCFString();
637
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
613
            if (UTTypeConformsTo(cfType.get(), kUTTypeURL))
638
            if (UTTypeConformsTo(cfType.get(), kUTTypeURL))
614
                [representationsToRegister addRepresentingObject:[NSURL URLWithString:nsStringValue]];
639
                [representationsToRegister addRepresentingObject:[NSURL URLWithString:nsStringValue]];
615
            else if (UTTypeConformsTo(cfType.get(), kUTTypePlainText))
640
            else if (UTTypeConformsTo(cfType.get(), kUTTypePlainText))
616
                [representationsToRegister addRepresentingObject:nsStringValue];
641
                [representationsToRegister addRepresentingObject:nsStringValue];
617
            else
642
            else
618
                [representationsToRegister addData:[nsStringValue dataUsingEncoding:NSUTF8StringEncoding] forType:(NSString *)cocoaType];
643
                [representationsToRegister addData:[nsStringValue dataUsingEncoding:NSUTF8StringEncoding] forType:(NSString *)cocoaType];
644
ALLOW_DEPRECATED_DECLARATIONS_END
619
            return;
645
            return;
620
        }
646
        }
621
647
Lines 709-714 RefPtr<SharedBuffer> PlatformPasteboard::readBuffer(size_t index, const String& a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec16
709
735
710
String PlatformPasteboard::readString(size_t index, const String& type) const
736
String PlatformPasteboard::readString(size_t index, const String& type) const
711
{
737
{
738
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
712
    if (type == String(kUTTypeURL)) {
739
    if (type == String(kUTTypeURL)) {
713
        String title;
740
        String title;
714
        return [(NSURL *)readURL(index, title) absoluteString];
741
        return [(NSURL *)readURL(index, title) absoluteString];
Lines 736-741 String PlatformPasteboard::readString(size_t index, const String& type) const a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec17
736
        if ([value isKindOfClass:[NSAttributedString class]])
763
        if ([value isKindOfClass:[NSAttributedString class]])
737
            return [(NSAttributedString *)value string];
764
            return [(NSAttributedString *)value string];
738
    }
765
    }
766
ALLOW_DEPRECATED_DECLARATIONS_END
739
767
740
    return String();
768
    return String();
741
}
769
}
Lines 745-751 URL PlatformPasteboard::readURL(size_t index, String& title) const a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec18
745
    if ((NSInteger)index < 0 || (NSInteger)index >= [m_pasteboard numberOfItems])
773
    if ((NSInteger)index < 0 || (NSInteger)index >= [m_pasteboard numberOfItems])
746
        return { };
774
        return { };
747
775
776
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
748
    id value = [m_pasteboard valuesForPasteboardType:(__bridge NSString *)kUTTypeURL inItemSet:[NSIndexSet indexSetWithIndex:index]].firstObject;
777
    id value = [m_pasteboard valuesForPasteboardType:(__bridge NSString *)kUTTypeURL inItemSet:[NSIndexSet indexSetWithIndex:index]].firstObject;
778
ALLOW_DEPRECATED_DECLARATIONS_END
749
    if (!value)
779
    if (!value)
750
        return { };
780
        return { };
751
781
Lines 783-792 bool PlatformPasteboard::containsURLStringSuitableForLoading() a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm_sec19
783
{
813
{
784
    Vector<String> types;
814
    Vector<String> types;
785
    getTypes(types);
815
    getTypes(types);
816
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
786
    if (!types.contains(String(kUTTypeURL)))
817
    if (!types.contains(String(kUTTypeURL)))
787
        return false;
818
        return false;
788
819
789
    auto urlString = stringForType(kUTTypeURL);
820
    auto urlString = stringForType(kUTTypeURL);
821
ALLOW_DEPRECATED_DECLARATIONS_END
790
    if (urlString.isEmpty()) {
822
    if (urlString.isEmpty()) {
791
        // On iOS, we don't get access to the contents of NSItemProviders until we perform the drag operation.
823
        // On iOS, we don't get access to the contents of NSItemProviders until we perform the drag operation.
792
        // Thus, we consider DragData to contain an URL if it contains the `public.url` UTI type. Later down the
824
        // Thus, we consider DragData to contain an URL if it contains the `public.url` UTI type. Later down the
- a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm +14 lines
Lines 52-59 using WebCore::PasteboardCustomData; a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec1
52
static BOOL typeConformsToTypes(NSString *type, NSArray *conformsToTypes)
52
static BOOL typeConformsToTypes(NSString *type, NSArray *conformsToTypes)
53
{
53
{
54
    for (NSString *conformsToType in conformsToTypes) {
54
    for (NSString *conformsToType in conformsToTypes) {
55
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
55
        if (UTTypeConformsTo((__bridge CFStringRef)type, (__bridge CFStringRef)conformsToType))
56
        if (UTTypeConformsTo((__bridge CFStringRef)type, (__bridge CFStringRef)conformsToType))
56
            return YES;
57
            return YES;
58
ALLOW_DEPRECATED_DECLARATIONS_END
57
    }
59
    }
58
    return NO;
60
    return NO;
59
}
61
}
Lines 63-70 @implementation NSItemProvider (WebCoreExtras) a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec2
63
- (BOOL)web_containsFileURLAndFileUploadContent
65
- (BOOL)web_containsFileURLAndFileUploadContent
64
{
66
{
65
    for (NSString *identifier in self.registeredTypeIdentifiers) {
67
    for (NSString *identifier in self.registeredTypeIdentifiers) {
68
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
66
        if (UTTypeConformsTo((__bridge CFStringRef)identifier, kUTTypeFileURL))
69
        if (UTTypeConformsTo((__bridge CFStringRef)identifier, kUTTypeFileURL))
67
            return self.web_fileUploadContentTypes.count;
70
            return self.web_fileUploadContentTypes.count;
71
ALLOW_DEPRECATED_DECLARATIONS_END
68
    }
72
    }
69
    return NO;
73
    return NO;
70
}
74
}
Lines 73-80 - (NSArray<NSString *> *)web_fileUploadContentTypes a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec3
73
{
77
{
74
    auto types = adoptNS([NSMutableArray new]);
78
    auto types = adoptNS([NSMutableArray new]);
75
    for (NSString *identifier in self.registeredTypeIdentifiers) {
79
    for (NSString *identifier in self.registeredTypeIdentifiers) {
80
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
76
        if (UTTypeConformsTo((__bridge CFStringRef)identifier, kUTTypeURL))
81
        if (UTTypeConformsTo((__bridge CFStringRef)identifier, kUTTypeURL))
77
            continue;
82
            continue;
83
ALLOW_DEPRECATED_DECLARATIONS_END
78
84
79
        if ([identifier isEqualToString:@"com.apple.mapkit.map-item"]) {
85
        if ([identifier isEqualToString:@"com.apple.mapkit.map-item"]) {
80
            // This type conforms to "public.content", yet the corresponding data is only a serialization of MKMapItem and isn't suitable for file uploads.
86
            // This type conforms to "public.content", yet the corresponding data is only a serialization of MKMapItem and isn't suitable for file uploads.
Lines 543-550 - (NSData *)_preLoadedDataConformingToType:(NSString *)typeIdentifier forItemPro a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec4
543
549
544
    WebItemProviderLoadResult *loadResult = _loadResults[index].get();
550
    WebItemProviderLoadResult *loadResult = _loadResults[index].get();
545
    for (NSString *loadedType in loadResult.loadedTypeIdentifiers) {
551
    for (NSString *loadedType in loadResult.loadedTypeIdentifiers) {
552
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
546
        if (!UTTypeConformsTo((CFStringRef)loadedType, (CFStringRef)typeIdentifier))
553
        if (!UTTypeConformsTo((CFStringRef)loadedType, (CFStringRef)typeIdentifier))
547
            continue;
554
            continue;
555
ALLOW_DEPRECATED_DECLARATIONS_END
548
556
549
        // We've already loaded data relevant for this UTI type onto disk, so there's no need to ask the NSItemProvider for the same data again.
557
        // We've already loaded data relevant for this UTI type onto disk, so there's no need to ask the NSItemProvider for the same data again.
550
        if (NSData *result = [NSData dataWithContentsOfURL:[loadResult fileURLForType:loadedType] options:NSDataReadingMappedIfSafe error:nil])
558
        if (NSData *result = [NSData dataWithContentsOfURL:[loadResult fileURLForType:loadedType] options:NSDataReadingMappedIfSafe error:nil])
Lines 593-603 static Class classForTypeIdentifier(NSString *typeIdentifier, NSString *&outType a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec5
593
601
594
    // If we were unable to load any object, check if the given type identifier is still something
602
    // If we were unable to load any object, check if the given type identifier is still something
595
    // WebKit knows how to handle.
603
    // WebKit knows how to handle.
604
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
596
    if ([typeIdentifier isEqualToString:(NSString *)kUTTypeHTML]) {
605
    if ([typeIdentifier isEqualToString:(NSString *)kUTTypeHTML]) {
597
        // Load kUTTypeHTML as a plain text HTML string.
606
        // Load kUTTypeHTML as a plain text HTML string.
598
        outTypeIdentifierToLoad = (NSString *)kUTTypePlainText;
607
        outTypeIdentifierToLoad = (NSString *)kUTTypePlainText;
599
        return [NSString class];
608
        return [NSString class];
600
    }
609
    }
610
ALLOW_DEPRECATED_DECLARATIONS_END
601
611
602
    return nil;
612
    return nil;
603
}
613
}
Lines 702-708 static NSURL *linkTemporaryItemProviderFilesToDropStagingDirectory(NSURL *url, N a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec6
702
        return nil;
712
        return nil;
703
713
704
    NSURL *destination = nil;
714
    NSURL *destination = nil;
715
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
705
    BOOL isFolder = UTTypeConformsTo((CFStringRef)typeIdentifier, kUTTypeFolder);
716
    BOOL isFolder = UTTypeConformsTo((CFStringRef)typeIdentifier, kUTTypeFolder);
717
ALLOW_DEPRECATED_DECLARATIONS_END
706
    NSFileManager *fileManager = [NSFileManager defaultManager];
718
    NSFileManager *fileManager = [NSFileManager defaultManager];
707
719
708
    if (!suggestedName)
720
    if (!suggestedName)
Lines 717-722 static NSURL *linkTemporaryItemProviderFilesToDropStagingDirectory(NSURL *url, N a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec7
717
729
718
- (NSArray<NSString *> *)typeIdentifiersToLoad:(NSItemProvider *)itemProvider
730
- (NSArray<NSString *> *)typeIdentifiersToLoad:(NSItemProvider *)itemProvider
719
{
731
{
732
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
720
    auto typesToLoad = adoptNS([[NSMutableOrderedSet alloc] init]);
733
    auto typesToLoad = adoptNS([[NSMutableOrderedSet alloc] init]);
721
    NSString *highestFidelitySupportedType = nil;
734
    NSString *highestFidelitySupportedType = nil;
722
    NSString *highestFidelityContentType = nil;
735
    NSString *highestFidelityContentType = nil;
Lines 758-763 - (NSArray<NSString *> *)typeIdentifiersToLoad:(NSItemProvider *)itemProvider a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm_sec8
758
            || UTTypeConformsTo((__bridge CFStringRef)registeredTypeIdentifier, kUTTypePlainText))
771
            || UTTypeConformsTo((__bridge CFStringRef)registeredTypeIdentifier, kUTTypePlainText))
759
            [typesToLoad addObject:registeredTypeIdentifier];
772
            [typesToLoad addObject:registeredTypeIdentifier];
760
    }
773
    }
774
ALLOW_DEPRECATED_DECLARATIONS_END
761
775
762
    return [typesToLoad array];
776
    return [typesToLoad array];
763
}
777
}
- a/Source/WebCore/platform/mac/PasteboardMac.mm +26 lines
Lines 136-142 void Pasteboard::write(const PasteboardWebContent& content) a/Source/WebCore/platform/mac/PasteboardMac.mm_sec1
136
        types.append(WebSmartPastePboardType);
136
        types.append(WebSmartPastePboardType);
137
    if (content.dataInWebArchiveFormat) {
137
    if (content.dataInWebArchiveFormat) {
138
        types.append(WebArchivePboardType);
138
        types.append(WebArchivePboardType);
139
140
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
139
        types.append(kUTTypeWebArchive);
141
        types.append(kUTTypeWebArchive);
142
ALLOW_DEPRECATED_DECLARATIONS_END
140
    }
143
    }
141
    if (content.dataInRTFDFormat)
144
    if (content.dataInRTFDFormat)
142
        types.append(String(legacyRTFDPasteboardType()));
145
        types.append(String(legacyRTFDPasteboardType()));
Lines 161-167 void Pasteboard::write(const PasteboardWebContent& content) a/Source/WebCore/platform/mac/PasteboardMac.mm_sec2
161
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(nullptr, WebSmartPastePboardType, m_pasteboardName);
164
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(nullptr, WebSmartPastePboardType, m_pasteboardName);
162
    if (content.dataInWebArchiveFormat) {
165
    if (content.dataInWebArchiveFormat) {
163
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInWebArchiveFormat.get(), WebArchivePboardType, m_pasteboardName);
166
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInWebArchiveFormat.get(), WebArchivePboardType, m_pasteboardName);
167
168
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
164
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInWebArchiveFormat.get(), kUTTypeWebArchive, m_pasteboardName);
169
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInWebArchiveFormat.get(), kUTTypeWebArchive, m_pasteboardName);
170
ALLOW_DEPRECATED_DECLARATIONS_END
165
    }
171
    }
166
    if (content.dataInRTFDFormat)
172
    if (content.dataInRTFDFormat)
167
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInRTFDFormat.get(), legacyRTFDPasteboardType(), m_pasteboardName);
173
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(content.dataInRTFDFormat.get(), legacyRTFDPasteboardType(), m_pasteboardName);
Lines 272-285 void Pasteboard::write(const PasteboardImage& pasteboardImage) a/Source/WebCore/platform/mac/PasteboardMac.mm_sec3
272
    auto types = writableTypesForImage();
278
    auto types = writableTypesForImage();
273
    if (pasteboardImage.dataInWebArchiveFormat) {
279
    if (pasteboardImage.dataInWebArchiveFormat) {
274
        types.append(WebArchivePboardType);
280
        types.append(WebArchivePboardType);
281
282
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
275
        types.append(kUTTypeWebArchive);
283
        types.append(kUTTypeWebArchive);
284
ALLOW_DEPRECATED_DECLARATIONS_END
276
    }
285
    }
277
286
278
    m_changeCount = writeURLForTypes(types, m_pasteboardName, pasteboardImage.url);
287
    m_changeCount = writeURLForTypes(types, m_pasteboardName, pasteboardImage.url);
279
    m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::create(imageData).ptr(), legacyTIFFPasteboardType(), m_pasteboardName);
288
    m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(SharedBuffer::create(imageData).ptr(), legacyTIFFPasteboardType(), m_pasteboardName);
280
    if (auto archiveData = pasteboardImage.dataInWebArchiveFormat) {
289
    if (auto archiveData = pasteboardImage.dataInWebArchiveFormat) {
281
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(archiveData.get(), WebArchivePboardType, m_pasteboardName);
290
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(archiveData.get(), WebArchivePboardType, m_pasteboardName);
291
292
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
282
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(archiveData.get(), kUTTypeWebArchive, m_pasteboardName);
293
        m_changeCount = platformStrategies()->pasteboardStrategy()->setBufferForType(archiveData.get(), kUTTypeWebArchive, m_pasteboardName);
294
ALLOW_DEPRECATED_DECLARATIONS_END
283
    }
295
    }
284
    if (!pasteboardImage.dataInHTMLFormat.isEmpty())
296
    if (!pasteboardImage.dataInHTMLFormat.isEmpty())
285
        m_changeCount = platformStrategies()->pasteboardStrategy()->setStringForType(pasteboardImage.dataInHTMLFormat, legacyHTMLPasteboardType(), m_pasteboardName);
297
        m_changeCount = platformStrategies()->pasteboardStrategy()->setStringForType(pasteboardImage.dataInHTMLFormat, legacyHTMLPasteboardType(), m_pasteboardName);
Lines 429-440 void Pasteboard::read(PasteboardWebContentReader& reader, WebContentReadingPolic a/Source/WebCore/platform/mac/PasteboardMac.mm_sec4
429
        }
441
        }
430
    }
442
    }
431
443
444
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
432
    if (types.contains(String(kUTTypeWebArchive))) {
445
    if (types.contains(String(kUTTypeWebArchive))) {
433
        if (auto buffer = readBufferAtPreferredItemIndex(kUTTypeWebArchive, itemIndex, strategy, m_pasteboardName)) {
446
        if (auto buffer = readBufferAtPreferredItemIndex(kUTTypeWebArchive, itemIndex, strategy, m_pasteboardName)) {
434
            if (m_changeCount != changeCount() || reader.readWebArchive(*buffer))
447
            if (m_changeCount != changeCount() || reader.readWebArchive(*buffer))
435
                return;
448
                return;
436
        }
449
        }
437
    }
450
    }
451
ALLOW_DEPRECATED_DECLARATIONS_END
438
452
439
    if (policy == WebContentReadingPolicy::AnyType && types.contains(String(legacyFilesPromisePasteboardType()))) {
453
    if (policy == WebContentReadingPolicy::AnyType && types.contains(String(legacyFilesPromisePasteboardType()))) {
440
        if (m_changeCount != changeCount() || reader.readFilePaths(m_promisedFilePaths))
454
        if (m_changeCount != changeCount() || reader.readFilePaths(m_promisedFilePaths))
Lines 519-537 void Pasteboard::read(PasteboardWebContentReader& reader, WebContentReadingPolic a/Source/WebCore/platform/mac/PasteboardMac.mm_sec5
519
        }
533
        }
520
    }
534
    }
521
535
536
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
522
    if (types.contains(String(kUTTypePNG))) {
537
    if (types.contains(String(kUTTypePNG))) {
523
        if (auto buffer = readBufferAtPreferredItemIndex(kUTTypePNG, itemIndex, strategy, m_pasteboardName)) {
538
        if (auto buffer = readBufferAtPreferredItemIndex(kUTTypePNG, itemIndex, strategy, m_pasteboardName)) {
524
            if (m_changeCount != changeCount() || reader.readImage(buffer.releaseNonNull(), "image/png"_s))
539
            if (m_changeCount != changeCount() || reader.readImage(buffer.releaseNonNull(), "image/png"_s))
525
                return;
540
                return;
526
        }
541
        }
527
    }
542
    }
543
ALLOW_DEPRECATED_DECLARATIONS_END
528
544
545
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
529
    if (types.contains(String(kUTTypeJPEG))) {
546
    if (types.contains(String(kUTTypeJPEG))) {
530
        if (auto buffer = readBufferAtPreferredItemIndex(kUTTypeJPEG, itemIndex, strategy, m_pasteboardName)) {
547
        if (auto buffer = readBufferAtPreferredItemIndex(kUTTypeJPEG, itemIndex, strategy, m_pasteboardName)) {
531
            if (m_changeCount != changeCount() || reader.readImage(buffer.releaseNonNull(), "image/jpeg"_s))
548
            if (m_changeCount != changeCount() || reader.readImage(buffer.releaseNonNull(), "image/jpeg"_s))
532
                return;
549
                return;
533
        }
550
        }
534
    }
551
    }
552
ALLOW_DEPRECATED_DECLARATIONS_END
535
553
536
    if (types.contains(String(legacyURLPasteboardType()))) {
554
    if (types.contains(String(legacyURLPasteboardType()))) {
537
        URL url = strategy.url(m_pasteboardName);
555
        URL url = strategy.url(m_pasteboardName);
Lines 546-556 void Pasteboard::read(PasteboardWebContentReader& reader, WebContentReadingPolic a/Source/WebCore/platform/mac/PasteboardMac.mm_sec6
546
            return;
564
            return;
547
    }
565
    }
548
566
567
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
549
    if (types.contains(String(kUTTypeUTF8PlainText))) {
568
    if (types.contains(String(kUTTypeUTF8PlainText))) {
550
        String string = strategy.stringForType(kUTTypeUTF8PlainText, m_pasteboardName);
569
        String string = strategy.stringForType(kUTTypeUTF8PlainText, m_pasteboardName);
551
        if (m_changeCount != changeCount() || (!string.isNull() && reader.readPlainText(string)))
570
        if (m_changeCount != changeCount() || (!string.isNull() && reader.readPlainText(string)))
552
            return;
571
            return;
553
    }
572
    }
573
ALLOW_DEPRECATED_DECLARATIONS_END
554
}
574
}
555
575
556
bool Pasteboard::hasData()
576
bool Pasteboard::hasData()
Lines 573-580 static String cocoaTypeFromHTMLClipboardType(const String& type) a/Source/WebCore/platform/mac/PasteboardMac.mm_sec7
573
593
574
    auto utiType = UTIFromMIMEType(type);
594
    auto utiType = UTIFromMIMEType(type);
575
    if (!utiType.isEmpty()) {
595
    if (!utiType.isEmpty()) {
596
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
576
        if (auto pbType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.createCFString().get(), kUTTagClassNSPboardType)))
597
        if (auto pbType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.createCFString().get(), kUTTagClassNSPboardType)))
577
            return pbType.get();
598
            return pbType.get();
599
ALLOW_DEPRECATED_DECLARATIONS_END
578
    }
600
    }
579
601
580
    // No mapping, just pass the whole string though
602
    // No mapping, just pass the whole string though
Lines 613-622 Vector<String> Pasteboard::readPlatformValuesAsStrings(const String& domType, in a/Source/WebCore/platform/mac/PasteboardMac.mm_sec8
613
635
614
static String utiTypeFromCocoaType(const String& type)
636
static String utiTypeFromCocoaType(const String& type)
615
{
637
{
638
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
616
    if (RetainPtr<CFStringRef> utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, type.createCFString().get(), 0))) {
639
    if (RetainPtr<CFStringRef> utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, type.createCFString().get(), 0))) {
617
        if (RetainPtr<CFStringRef> mimeType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassMIMEType)))
640
        if (RetainPtr<CFStringRef> mimeType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassMIMEType)))
618
            return String(mimeType.get());
641
            return String(mimeType.get());
619
    }
642
    }
643
ALLOW_DEPRECATED_DECLARATIONS_END
620
    return String();
644
    return String();
621
}
645
}
622
646
Lines 650-655 void Pasteboard::writeString(const String& type, const String& data) a/Source/WebCore/platform/mac/PasteboardMac.mm_sec9
650
    const String& cocoaType = cocoaTypeFromHTMLClipboardType(type);
674
    const String& cocoaType = cocoaTypeFromHTMLClipboardType(type);
651
    String cocoaData = data;
675
    String cocoaData = data;
652
676
677
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
653
    if (cocoaType == String(legacyURLPasteboardType()) || cocoaType == String(kUTTypeFileURL)) {
678
    if (cocoaType == String(legacyURLPasteboardType()) || cocoaType == String(kUTTypeFileURL)) {
654
        NSURL *url = [NSURL URLWithString:cocoaData];
679
        NSURL *url = [NSURL URLWithString:cocoaData];
655
        if ([url isFileURL])
680
        if ([url isFileURL])
Lines 662-667 void Pasteboard::writeString(const String& type, const String& data) a/Source/WebCore/platform/mac/PasteboardMac.mm_sec10
662
687
663
        return;
688
        return;
664
    }
689
    }
690
ALLOW_DEPRECATED_DECLARATIONS_END
665
691
666
    if (!cocoaType.isEmpty()) {
692
    if (!cocoaType.isEmpty()) {
667
        // everything else we know of goes on the pboard as a string
693
        // everything else we know of goes on the pboard as a string
- a/Source/WebCore/platform/mac/PasteboardWriter.mm +12 lines
Lines 38-52 namespace WebCore { a/Source/WebCore/platform/mac/PasteboardWriter.mm_sec1
38
38
39
static RetainPtr<NSString> toUTI(NSString *pasteboardType)
39
static RetainPtr<NSString> toUTI(NSString *pasteboardType)
40
{
40
{
41
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
41
    return adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)pasteboardType, nullptr));
42
    return adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)pasteboardType, nullptr));
43
ALLOW_DEPRECATED_DECLARATIONS_END
42
}
44
}
43
45
44
static RetainPtr<NSString> toUTIUnlessAlreadyUTI(NSString *type)
46
static RetainPtr<NSString> toUTIUnlessAlreadyUTI(NSString *type)
45
{
47
{
48
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
46
    if (UTTypeIsDeclared((__bridge CFStringRef)type) || UTTypeIsDynamic((__bridge CFStringRef)type)) {
49
    if (UTTypeIsDeclared((__bridge CFStringRef)type) || UTTypeIsDynamic((__bridge CFStringRef)type)) {
47
        // This is already a UTI.
50
        // This is already a UTI.
48
        return type;
51
        return type;
49
    }
52
    }
53
ALLOW_DEPRECATED_DECLARATIONS_END
50
54
51
    return toUTI(type);
55
    return toUTI(type);
52
}
56
}
Lines 58-64 RetainPtr<id <NSPasteboardWriting>> createPasteboardWriter(const PasteboardWrite a/Source/WebCore/platform/mac/PasteboardWriter.mm_sec2
58
    if (auto& plainText = data.plainText()) {
62
    if (auto& plainText = data.plainText()) {
59
        [pasteboardItem setString:plainText->text forType:NSPasteboardTypeString];
63
        [pasteboardItem setString:plainText->text forType:NSPasteboardTypeString];
60
        if (plainText->canSmartCopyOrDelete) {
64
        if (plainText->canSmartCopyOrDelete) {
65
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
61
            auto smartPasteType = adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)_NXSmartPaste, nullptr));
66
            auto smartPasteType = adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)_NXSmartPaste, nullptr));
67
ALLOW_DEPRECATED_DECLARATIONS_END
62
            [pasteboardItem setData:[NSData data] forType:smartPasteType.get()];
68
            [pasteboardItem setData:[NSData data] forType:smartPasteType.get()];
63
        }
69
        }
64
    }
70
    }
Lines 85-93 RetainPtr<id <NSPasteboardWriting>> createPasteboardWriter(const PasteboardWrite a/Source/WebCore/platform/mac/PasteboardWriter.mm_sec3
85
        else
91
        else
86
            [pasteboardItem setPropertyList:@[ @"", @"" ] forType:toUTI(WebCore::legacyURLPasteboardType()).get()];
92
            [pasteboardItem setPropertyList:@[ @"", @"" ] forType:toUTI(WebCore::legacyURLPasteboardType()).get()];
87
93
94
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
88
        if (cocoaURL.fileURL)
95
        if (cocoaURL.fileURL)
89
            [pasteboardItem setString:cocoaURL.absoluteString forType:(NSString *)kUTTypeFileURL];
96
            [pasteboardItem setString:cocoaURL.absoluteString forType:(NSString *)kUTTypeFileURL];
90
        [pasteboardItem setString:userVisibleString forType:(NSString *)kUTTypeURL];
97
        [pasteboardItem setString:userVisibleString forType:(NSString *)kUTTypeURL];
98
ALLOW_DEPRECATED_DECLARATIONS_END
91
99
92
        // WebURLNamePboardType.
100
        // WebURLNamePboardType.
93
        [pasteboardItem setString:title forType:@"public.url-name"];
101
        [pasteboardItem setString:title forType:@"public.url-name"];
Lines 98-108 RetainPtr<id <NSPasteboardWriting>> createPasteboardWriter(const PasteboardWrite a/Source/WebCore/platform/mac/PasteboardWriter.mm_sec4
98
106
99
    if (auto& webContent = data.webContent()) {
107
    if (auto& webContent = data.webContent()) {
100
        if (webContent->canSmartCopyOrDelete) {
108
        if (webContent->canSmartCopyOrDelete) {
109
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
101
            auto smartPasteType = adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)_NXSmartPaste, nullptr));
110
            auto smartPasteType = adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)_NXSmartPaste, nullptr));
111
ALLOW_DEPRECATED_DECLARATIONS_END
102
            [pasteboardItem setData:[NSData data] forType:smartPasteType.get()];
112
            [pasteboardItem setData:[NSData data] forType:smartPasteType.get()];
103
        }
113
        }
104
        if (webContent->dataInWebArchiveFormat) {
114
        if (webContent->dataInWebArchiveFormat) {
115
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
105
            auto webArchiveType = adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)@"Apple Web Archive pasteboard type", nullptr));
116
            auto webArchiveType = adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)@"Apple Web Archive pasteboard type", nullptr));
117
ALLOW_DEPRECATED_DECLARATIONS_END
106
            [pasteboardItem setData:webContent->dataInWebArchiveFormat->createNSData().get() forType:webArchiveType.get()];
118
            [pasteboardItem setData:webContent->dataInWebArchiveFormat->createNSData().get() forType:webArchiveType.get()];
107
        }
119
        }
108
        if (webContent->dataInRTFDFormat)
120
        if (webContent->dataInRTFDFormat)
- a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm +12 lines
Lines 44-51 namespace WebCore { a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec1
44
static bool canWritePasteboardType(const String& type)
44
static bool canWritePasteboardType(const String& type)
45
{
45
{
46
    auto cfString = type.createCFString();
46
    auto cfString = type.createCFString();
47
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
47
    if (UTTypeIsDeclared(cfString.get()) || UTTypeIsDynamic(cfString.get()))
48
    if (UTTypeIsDeclared(cfString.get()) || UTTypeIsDynamic(cfString.get()))
48
        return true;
49
        return true;
50
ALLOW_DEPRECATED_DECLARATIONS_END
49
51
50
    return [(__bridge NSString *)cfString.get() lengthOfBytesUsingEncoding:NSString.defaultCStringEncoding];
52
    return [(__bridge NSString *)cfString.get() lengthOfBytesUsingEncoding:NSString.defaultCStringEncoding];
51
}
53
}
Lines 129-138 static Vector<String> urlStringsFromPasteboard(NSPasteboard *pasteboard) a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec2
129
    urlStrings.reserveInitialCapacity(items.count);
131
    urlStrings.reserveInitialCapacity(items.count);
130
    if (items.count > 1) {
132
    if (items.count > 1) {
131
        for (NSPasteboardItem *item in items) {
133
        for (NSPasteboardItem *item in items) {
134
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
132
            if (id propertyList = [item propertyListForType:(__bridge NSString *)kUTTypeURL]) {
135
            if (id propertyList = [item propertyListForType:(__bridge NSString *)kUTTypeURL]) {
133
                if (auto urlFromItem = adoptNS([[NSURL alloc] initWithPasteboardPropertyList:propertyList ofType:(__bridge NSString *)kUTTypeURL]))
136
                if (auto urlFromItem = adoptNS([[NSURL alloc] initWithPasteboardPropertyList:propertyList ofType:(__bridge NSString *)kUTTypeURL]))
134
                    urlStrings.uncheckedAppend([urlFromItem absoluteString]);
137
                    urlStrings.uncheckedAppend([urlFromItem absoluteString]);
135
            }
138
            }
139
ALLOW_DEPRECATED_DECLARATIONS_END
136
        }
140
        }
137
    } else if (NSURL *urlFromPasteboard = [NSURL URLFromPasteboard:pasteboard])
141
    } else if (NSURL *urlFromPasteboard = [NSURL URLFromPasteboard:pasteboard])
138
        urlStrings.uncheckedAppend(urlFromPasteboard.absoluteString);
142
        urlStrings.uncheckedAppend(urlFromPasteboard.absoluteString);
Lines 149-154 static Vector<String> urlStringsFromPasteboard(NSPasteboard *pasteboard) a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec3
149
153
150
static String typeIdentifierForPasteboardType(const String& pasteboardType)
154
static String typeIdentifierForPasteboardType(const String& pasteboardType)
151
{
155
{
156
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
152
    if (UTTypeIsDeclared(pasteboardType.createCFString().get()))
157
    if (UTTypeIsDeclared(pasteboardType.createCFString().get()))
153
        return pasteboardType;
158
        return pasteboardType;
154
159
Lines 160-165 static String typeIdentifierForPasteboardType(const String& pasteboardType) a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec4
160
165
161
    if (pasteboardType == String(legacyURLPasteboardType()))
166
    if (pasteboardType == String(legacyURLPasteboardType()))
162
        return kUTTypeURL;
167
        return kUTTypeURL;
168
ALLOW_DEPRECATED_DECLARATIONS_END
163
169
164
    return { };
170
    return { };
165
}
171
}
Lines 167-174 static String typeIdentifierForPasteboardType(const String& pasteboardType) a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec5
167
Vector<String> PlatformPasteboard::allStringsForType(const String& pasteboardType) const
173
Vector<String> PlatformPasteboard::allStringsForType(const String& pasteboardType) const
168
{
174
{
169
    auto typeIdentifier = typeIdentifierForPasteboardType(pasteboardType);
175
    auto typeIdentifier = typeIdentifierForPasteboardType(pasteboardType);
176
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
170
    if (typeIdentifier == String(kUTTypeURL))
177
    if (typeIdentifier == String(kUTTypeURL))
171
        return urlStringsFromPasteboard(m_pasteboard.get());
178
        return urlStringsFromPasteboard(m_pasteboard.get());
179
ALLOW_DEPRECATED_DECLARATIONS_END
172
180
173
    NSArray<NSPasteboardItem *> *items = [m_pasteboard pasteboardItems];
181
    NSArray<NSPasteboardItem *> *items = [m_pasteboard pasteboardItems];
174
    Vector<String> strings;
182
    Vector<String> strings;
Lines 192-200 static const char* safeTypeForDOMToReadAndWriteForPlatformType(const String& pla a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec6
192
    if (platformType == String(legacyURLPasteboardType()))
200
    if (platformType == String(legacyURLPasteboardType()))
193
        return "text/uri-list"_s;
201
        return "text/uri-list"_s;
194
202
203
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
195
    if (platformType == String(legacyHTMLPasteboardType()) || platformType == String(WebArchivePboardType) || platformType == String(kUTTypeWebArchive)
204
    if (platformType == String(legacyHTMLPasteboardType()) || platformType == String(WebArchivePboardType) || platformType == String(kUTTypeWebArchive)
196
        || platformType == String(legacyRTFDPasteboardType()) || platformType == String(legacyRTFPasteboardType()))
205
        || platformType == String(legacyRTFDPasteboardType()) || platformType == String(legacyRTFPasteboardType()))
197
        return "text/html"_s;
206
        return "text/html"_s;
207
ALLOW_DEPRECATED_DECLARATIONS_END
198
208
199
    return nullptr;
209
    return nullptr;
200
}
210
}
Lines 382-387 int64_t PlatformPasteboard::setStringForType(const String& string, const String& a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec7
382
                return 0;
392
                return 0;
383
        }
393
        }
384
394
395
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
385
        if ([[m_pasteboard.get() types] containsObject:(NSString *)kUTTypeURL]) {
396
        if ([[m_pasteboard.get() types] containsObject:(NSString *)kUTTypeURL]) {
386
            didWriteData = [m_pasteboard.get() setString:[url absoluteString] forType:(NSString *)kUTTypeURL];
397
            didWriteData = [m_pasteboard.get() setString:[url absoluteString] forType:(NSString *)kUTTypeURL];
387
            if (!didWriteData)
398
            if (!didWriteData)
Lines 393-398 int64_t PlatformPasteboard::setStringForType(const String& string, const String& a/Source/WebCore/platform/mac/PlatformPasteboardMac.mm_sec8
393
            if (!didWriteData)
404
            if (!didWriteData)
394
                return 0;
405
                return 0;
395
        }
406
        }
407
ALLOW_DEPRECATED_DECLARATIONS_END
396
408
397
    } else {
409
    } else {
398
        didWriteData = [m_pasteboard.get() setString:string forType:pasteboardType];
410
        didWriteData = [m_pasteboard.get() setString:string forType:pasteboardType];
- a/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm +2 lines
Lines 87-93 void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse, bool isMainResourceL a/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm_sec1
87
            if ([(NSURL *)url isFileURL]) {
87
            if ([(NSURL *)url isFileURL]) {
88
                RetainPtr<CFStringRef> extension = adoptCF(CFURLCopyPathExtension(url));
88
                RetainPtr<CFStringRef> extension = adoptCF(CFURLCopyPathExtension(url));
89
                if (extension) {
89
                if (extension) {
90
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
90
                    RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), nullptr));
91
                    RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), nullptr));
92
ALLOW_DEPRECATED_DECLARATIONS_END
91
                    String MIMEType = MIMETypeFromUTITree(uti.get());
93
                    String MIMEType = MIMETypeFromUTITree(uti.get());
92
                    if (!MIMEType.isEmpty())
94
                    if (!MIMEType.isEmpty())
93
                        quickLookMIMEType = MIMEType.createCFString();
95
                        quickLookMIMEType = MIMEType.createCFString();
- a/Source/WebCore/platform/network/mac/UTIUtilities.mm +10 lines
Lines 39-51 namespace WebCore { a/Source/WebCore/platform/network/mac/UTIUtilities.mm_sec1
39
39
40
String MIMETypeFromUTI(const String& uti)
40
String MIMETypeFromUTI(const String& uti)
41
{
41
{
42
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
42
    return adoptCF(UTTypeCopyPreferredTagWithClass(uti.createCFString().get(), kUTTagClassMIMEType)).get();
43
    return adoptCF(UTTypeCopyPreferredTagWithClass(uti.createCFString().get(), kUTTagClassMIMEType)).get();
44
ALLOW_DEPRECATED_DECLARATIONS_END
43
}
45
}
44
46
45
String MIMETypeFromUTITree(const String& uti)
47
String MIMETypeFromUTITree(const String& uti)
46
{
48
{
47
    auto utiCF = uti.createCFString();
49
    auto utiCF = uti.createCFString();
48
50
51
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
49
    // Check if this UTI has a MIME type.
52
    // Check if this UTI has a MIME type.
50
    RetainPtr<CFStringRef> mimeType = adoptCF(UTTypeCopyPreferredTagWithClass(utiCF.get(), kUTTagClassMIMEType));
53
    RetainPtr<CFStringRef> mimeType = adoptCF(UTTypeCopyPreferredTagWithClass(utiCF.get(), kUTTagClassMIMEType));
51
    if (mimeType)
54
    if (mimeType)
Lines 56-61 String MIMETypeFromUTITree(const String& uti) a/Source/WebCore/platform/network/mac/UTIUtilities.mm_sec2
56
    if (!decl)
59
    if (!decl)
57
        return emptyString();
60
        return emptyString();
58
    CFTypeRef value = CFDictionaryGetValue(decl.get(), kUTTypeConformsToKey);
61
    CFTypeRef value = CFDictionaryGetValue(decl.get(), kUTTypeConformsToKey);
62
ALLOW_DEPRECATED_DECLARATIONS_END
59
    if (!value)
63
    if (!value)
60
        return emptyString();
64
        return emptyString();
61
    CFTypeID typeID = CFGetTypeID(value);
65
    CFTypeID typeID = CFGetTypeID(value);
Lines 112-118 struct UTIFromMIMETypeCachePolicy : TinyLRUCachePolicy<String, String> { a/Source/WebCore/platform/network/mac/UTIUtilities.mm_sec3
112
public:
116
public:
113
    static String createValueForKey(const String& mimeType)
117
    static String createValueForKey(const String& mimeType)
114
    {
118
    {
119
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
115
        auto type = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString().get(), 0));
120
        auto type = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString().get(), 0));
121
ALLOW_DEPRECATED_DECLARATIONS_END
116
        if (type)
122
        if (type)
117
            return type.get();
123
            return type.get();
118
        return UTIFromUnknownMIMEType(mimeType);
124
        return UTIFromUnknownMIMEType(mimeType);
Lines 133-144 String UTIFromMIMEType(const String& mimeType) a/Source/WebCore/platform/network/mac/UTIUtilities.mm_sec4
133
139
134
bool isDeclaredUTI(const String& UTI)
140
bool isDeclaredUTI(const String& UTI)
135
{
141
{
142
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
136
    return UTTypeIsDeclared(UTI.createCFString().get());
143
    return UTTypeIsDeclared(UTI.createCFString().get());
144
ALLOW_DEPRECATED_DECLARATIONS_END
137
}
145
}
138
146
139
String UTIFromTag(const String& tagClass, const String& tag, const String& conformingToUTI)
147
String UTIFromTag(const String& tagClass, const String& tag, const String& conformingToUTI)
140
{
148
{
149
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
141
    auto u = adoptCF(UTTypeCreatePreferredIdentifierForTag(tagClass.createCFString().get(), tag.createCFString().get(), conformingToUTI.createCFString().get()));
150
    auto u = adoptCF(UTTypeCreatePreferredIdentifierForTag(tagClass.createCFString().get(), tag.createCFString().get(), conformingToUTI.createCFString().get()));
151
ALLOW_DEPRECATED_DECLARATIONS_END
142
    return String(u.get());
152
    return String(u.get());
143
}
153
}
144
154
- a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm +2 lines
Lines 311-317 void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse, bool isMainResourceL a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm_sec1
311
                if (!result) {
311
                if (!result) {
312
                    // If the Gatekeeper-based map doesn't have a MIME type, we'll try to figure out what it should be by
312
                    // If the Gatekeeper-based map doesn't have a MIME type, we'll try to figure out what it should be by
313
                    // looking up the file extension in the UTI maps.
313
                    // looking up the file extension in the UTI maps.
314
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
314
                    RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), 0));
315
                    RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), 0));
316
ALLOW_DEPRECATED_DECLARATIONS_END
315
                    String MIMEType = MIMETypeFromUTITree(uti.get());
317
                    String MIMEType = MIMETypeFromUTITree(uti.get());
316
                    if (!MIMEType.isEmpty())
318
                    if (!MIMEType.isEmpty())
317
                        result = MIMEType.createCFString();
319
                        result = MIMEType.createCFString();
- a/Source/WebCore/rendering/RenderThemeMac.mm +2 lines
Lines 2592-2599 static RefPtr<Icon> iconForAttachment(const RenderAttachment& attachment) a/Source/WebCore/rendering/RenderThemeMac.mm_sec1
2592
    
2592
    
2593
    if (!attachmentType.isEmpty()) {
2593
    if (!attachmentType.isEmpty()) {
2594
        if (equalIgnoringASCIICase(attachmentType, "multipart/x-folder") || equalIgnoringASCIICase(attachmentType, "application/vnd.apple.folder")) {
2594
        if (equalIgnoringASCIICase(attachmentType, "multipart/x-folder") || equalIgnoringASCIICase(attachmentType, "application/vnd.apple.folder")) {
2595
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
2595
            if (auto icon = Icon::createIconForUTI(kUTTypeFolder))
2596
            if (auto icon = Icon::createIconForUTI(kUTTypeFolder))
2596
                return icon;
2597
                return icon;
2598
ALLOW_DEPRECATED_DECLARATIONS_END
2597
        } else {
2599
        } else {
2598
            String UTI;
2600
            String UTI;
2599
            if (isDeclaredUTI(attachmentType))
2601
            if (isDeclaredUTI(attachmentType))
- a/Source/WebKit/ChangeLog +39 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2020-11-16  Devin Rousso  <drousso@apple.com>
2
3
        Ignore deprecation warnings for the uniform types C API
4
        https://bugs.webkit.org/show_bug.cgi?id=218989
5
6
        Reviewed by Tim Horton.
7
8
        These should eventually be replaced with the ObjC API `UniformTypeIdentifiers.framework`.
9
        See <https://developer.apple.com/documentation/uniformtypeidentifiers>.
10
11
        * Shared/ios/WebIconUtilities.mm:
12
        (WebKit::iconForFile):
13
        * Shared/mac/PasteboardTypes.mm:
14
        (WebKit::PasteboardTypes::forEditing):
15
        (WebKit::PasteboardTypes::forSelection):
16
        * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
17
        (API::isDeclaredOrDynamicTypeIdentifier):
18
        (API::Attachment::mimeType const):
19
        (API::Attachment::utiType const):
20
        (API::Attachment::setFileWrapperAndUpdateContentType):
21
        * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
22
        (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
23
        * UIProcess/Cocoa/WebViewImpl.mm:
24
        (WebKit::WebViewImpl::setPromisedDataForImage):
25
        * UIProcess/ios/WKContentView.mm:
26
        (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
27
        * UIProcess/ios/WKContentViewInteraction.mm:
28
        (-[WKContentView supportedPasteboardTypesForCurrentSelection]):
29
        * UIProcess/ios/WKPDFView.mm:
30
        (-[WKPDFView actionSheetAssistant:performAction:]):
31
        * UIProcess/ios/forms/WKFileUploadPanel.mm:
32
        (-[WKFileUploadPanel currentAvailableActionTitles]):
33
        (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
34
        (-[WKFileUploadPanel showFilePickerMenu]):
35
        (-[WKFileUploadPanel showDocumentPickerMenu]):
36
        (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
37
        * UIProcess/mac/WebContextMenuProxyMac.mm:
38
        (WebKit::WebContextMenuProxyMac::setupServicesMenu):
39
1
2020-11-13  Sihui Liu  <sihui_liu@apple.com>
40
2020-11-13  Sihui Liu  <sihui_liu@apple.com>
2
41
3
        Implement basic permission check for SpeechRecognition
42
        Implement basic permission check for SpeechRecognition
- a/Source/WebKit/Shared/ios/WebIconUtilities.mm +2 lines
Lines 141-146 RetainPtr<UIImage> iconForFile(NSURL *file) a/Source/WebKit/Shared/ios/WebIconUtilities.mm_sec1
141
    if (!fileExtension.length)
141
    if (!fileExtension.length)
142
        return nil;
142
        return nil;
143
143
144
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
144
    RetainPtr<CFStringRef> fileUTI = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)fileExtension, 0));
145
    RetainPtr<CFStringRef> fileUTI = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)fileExtension, 0));
145
146
146
    if (UTTypeConformsTo(fileUTI.get(), kUTTypeImage))
147
    if (UTTypeConformsTo(fileUTI.get(), kUTTypeImage))
Lines 148-153 RetainPtr<UIImage> iconForFile(NSURL *file) a/Source/WebKit/Shared/ios/WebIconUtilities.mm_sec2
148
149
149
    if (UTTypeConformsTo(fileUTI.get(), kUTTypeMovie))
150
    if (UTTypeConformsTo(fileUTI.get(), kUTTypeMovie))
150
        return iconForVideoFile(file);
151
        return iconForVideoFile(file);
152
ALLOW_DEPRECATED_DECLARATIONS_END
151
153
152
    return fallbackIconForFile(file);
154
    return fallbackIconForFile(file);
153
}
155
}
- a/Source/WebKit/Shared/mac/PasteboardTypes.mm +4 lines
Lines 46-53 static inline NSArray *retain(NSArray *array) a/Source/WebKit/Shared/mac/PasteboardTypes.mm_sec1
46
    
46
    
47
NSArray* PasteboardTypes::forEditing()
47
NSArray* PasteboardTypes::forEditing()
48
{
48
{
49
ALLOW_DEPRECATED_DECLARATIONS_BEGIN 
49
    static NSArray *types = retain(@[WebArchivePboardType, (__bridge NSString *)kUTTypeWebArchive, WebCore::legacyHTMLPasteboardType(), WebCore::legacyFilenamesPasteboardType(), WebCore::legacyTIFFPasteboardType(), WebCore::legacyPDFPasteboardType(),
50
    static NSArray *types = retain(@[WebArchivePboardType, (__bridge NSString *)kUTTypeWebArchive, WebCore::legacyHTMLPasteboardType(), WebCore::legacyFilenamesPasteboardType(), WebCore::legacyTIFFPasteboardType(), WebCore::legacyPDFPasteboardType(),
50
        WebCore::legacyURLPasteboardType(), WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType(), WebCore::legacyColorPasteboardType(), (__bridge NSString *)kUTTypePNG]);
51
        WebCore::legacyURLPasteboardType(), WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType(), WebCore::legacyColorPasteboardType(), (__bridge NSString *)kUTTypePNG]);
52
ALLOW_DEPRECATED_DECLARATIONS_END
51
    return types;
53
    return types;
52
}
54
}
53
55
Lines 71-77 NSArray* PasteboardTypes::forImagesWithArchive() a/Source/WebKit/Shared/mac/PasteboardTypes.mm_sec2
71
73
72
NSArray* PasteboardTypes::forSelection()
74
NSArray* PasteboardTypes::forSelection()
73
{
75
{
76
ALLOW_DEPRECATED_DECLARATIONS_BEGIN 
74
    static NSArray *types = retain(@[WebArchivePboardType, (__bridge NSString *)kUTTypeWebArchive, WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType()]);
77
    static NSArray *types = retain(@[WebArchivePboardType, (__bridge NSString *)kUTTypeWebArchive, WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType()]);
78
ALLOW_DEPRECATED_DECLARATIONS_END
75
    return types;
79
    return types;
76
}
80
}
77
    
81
    
- a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm +8 lines
Lines 48-54 static WTF::String mimeTypeInferredFromFileExtension(const API::Attachment& atta a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm_sec1
48
48
49
static BOOL isDeclaredOrDynamicTypeIdentifier(NSString *type)
49
static BOOL isDeclaredOrDynamicTypeIdentifier(NSString *type)
50
{
50
{
51
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
51
    return UTTypeIsDeclared((__bridge CFStringRef)type) || UTTypeIsDynamic((__bridge CFStringRef)type);
52
    return UTTypeIsDeclared((__bridge CFStringRef)type) || UTTypeIsDynamic((__bridge CFStringRef)type);
53
ALLOW_DEPRECATED_DECLARATIONS_END
52
}
54
}
53
55
54
NSFileWrapper *Attachment::fileWrapper() const
56
NSFileWrapper *Attachment::fileWrapper() const
Lines 73-79 WTF::String Attachment::mimeType() const a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm_sec2
73
    if (!isDeclaredOrDynamicTypeIdentifier(contentType))
75
    if (!isDeclaredOrDynamicTypeIdentifier(contentType))
74
        return contentType;
76
        return contentType;
75
77
78
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
76
    return adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)contentType, kUTTagClassMIMEType)).get();
79
    return adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)contentType, kUTTagClassMIMEType)).get();
80
ALLOW_DEPRECATED_DECLARATIONS_END
77
}
81
}
78
82
79
WTF::String Attachment::utiType() const
83
WTF::String Attachment::utiType() const
Lines 84-90 WTF::String Attachment::utiType() const a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm_sec3
84
    if (isDeclaredOrDynamicTypeIdentifier(contentType))
88
    if (isDeclaredOrDynamicTypeIdentifier(contentType))
85
        return contentType;
89
        return contentType;
86
90
91
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
87
    return adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (__bridge CFStringRef)contentType, nullptr)).get();
92
    return adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (__bridge CFStringRef)contentType, nullptr)).get();
93
ALLOW_DEPRECATED_DECLARATIONS_END
88
}
94
}
89
95
90
WTF::String Attachment::fileName() const
96
WTF::String Attachment::fileName() const
Lines 100-105 WTF::String Attachment::fileName() const a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm_sec4
100
void Attachment::setFileWrapperAndUpdateContentType(NSFileWrapper *fileWrapper, NSString *contentType)
106
void Attachment::setFileWrapperAndUpdateContentType(NSFileWrapper *fileWrapper, NSString *contentType)
101
{
107
{
102
    if (!contentType.length) {
108
    if (!contentType.length) {
109
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
103
        if (fileWrapper.directory)
110
        if (fileWrapper.directory)
104
            contentType = (NSString *)kUTTypeDirectory;
111
            contentType = (NSString *)kUTTypeDirectory;
105
        else if (fileWrapper.regularFile) {
112
        else if (fileWrapper.regularFile) {
Lines 108-113 void Attachment::setFileWrapperAndUpdateContentType(NSFileWrapper *fileWrapper, a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm_sec5
108
            if (!contentType.length)
115
            if (!contentType.length)
109
                contentType = (NSString *)kUTTypeData;
116
                contentType = (NSString *)kUTTypeData;
110
        }
117
        }
118
ALLOW_DEPRECATED_DECLARATIONS_END
111
    }
119
    }
112
120
113
    setContentType(contentType);
121
    setContentType(contentType);
- a/Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm +2 lines
Lines 47-53 Optional<String> WebAutomationSession::platformGetBase64EncodedPNGData(const Sha a/Source/WebKit/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm_sec1
47
47
48
    RetainPtr<CGImageRef> cgImage = bitmap->makeCGImage();
48
    RetainPtr<CGImageRef> cgImage = bitmap->makeCGImage();
49
    RetainPtr<NSMutableData> imageData = adoptNS([[NSMutableData alloc] init]);
49
    RetainPtr<NSMutableData> imageData = adoptNS([[NSMutableData alloc] init]);
50
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
50
    RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData((CFMutableDataRef)imageData.get(), kUTTypePNG, 1, 0));
51
    RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData((CFMutableDataRef)imageData.get(), kUTTypePNG, 1, 0));
52
ALLOW_DEPRECATED_DECLARATIONS_END
51
    if (!destination)
53
    if (!destination)
52
        return WTF::nullopt;
54
        return WTF::nullopt;
53
55
- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm +2 lines
Lines 4356-4362 void WebViewImpl::setPromisedDataForImage(WebCore::Image* image, NSString *filen a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm_sec1
4356
4356
4357
    if (archiveBuffer) {
4357
    if (archiveBuffer) {
4358
        auto nsData = archiveBuffer->createNSData();
4358
        auto nsData = archiveBuffer->createNSData();
4359
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
4359
        [pasteboard setData:nsData.get() forType:(__bridge NSString *)kUTTypeWebArchive];
4360
        [pasteboard setData:nsData.get() forType:(__bridge NSString *)kUTTypeWebArchive];
4361
ALLOW_DEPRECATED_DECLARATIONS_END
4360
        [pasteboard setData:nsData.get() forType:PasteboardTypes::WebArchivePboardType];
4362
        [pasteboard setData:nsData.get() forType:PasteboardTypes::WebArchivePboardType];
4361
    }
4363
    }
4362
4364
- a/Source/WebKit/UIProcess/ios/WKContentView.mm +2 lines
Lines 197-203 - (instancetype)_commonInitializationWithProcessPool:(WebKit::WebProcessPool&)pr a/Source/WebKit/UIProcess/ios/WKContentView.mm_sec1
197
    self.layer.hitTestsAsOpaque = YES;
197
    self.layer.hitTestsAsOpaque = YES;
198
198
199
#if PLATFORM(MACCATALYST)
199
#if PLATFORM(MACCATALYST)
200
    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
200
    [self _setFocusRingType:UIFocusRingTypeNone];
201
    [self _setFocusRingType:UIFocusRingTypeNone];
202
    ALLOW_DEPRECATED_DECLARATIONS_END
201
#endif
203
#endif
202
204
203
#if HAVE(VISIBILITY_PROPAGATION_VIEW)
205
#if HAVE(VISIBILITY_PROPAGATION_VIEW)
- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm +2 lines
Lines 3013-3019 - (NSArray *)supportedPasteboardTypesForCurrentSelection a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm_sec1
3013
    static NSMutableArray *plainTextTypes = nil;
3013
    static NSMutableArray *plainTextTypes = nil;
3014
    if (!plainTextTypes) {
3014
    if (!plainTextTypes) {
3015
        plainTextTypes = [[NSMutableArray alloc] init];
3015
        plainTextTypes = [[NSMutableArray alloc] init];
3016
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
3016
        [plainTextTypes addObject:(id)kUTTypeURL];
3017
        [plainTextTypes addObject:(id)kUTTypeURL];
3018
ALLOW_DEPRECATED_DECLARATIONS_END
3017
        [plainTextTypes addObjectsFromArray:UIPasteboardTypeListString];
3019
        [plainTextTypes addObjectsFromArray:UIPasteboardTypeListString];
3018
3020
3019
        richTypes = [[NSMutableArray alloc] init];
3021
        richTypes = [[NSMutableArray alloc] init];
- a/Source/WebKit/UIProcess/ios/WKPDFView.mm +2 lines
Lines 528-537 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant performAction:( a/Source/WebKit/UIProcess/ios/WKPDFView.mm_sec1
528
    if (action != WebKit::SheetAction::Copy)
528
    if (action != WebKit::SheetAction::Copy)
529
        return;
529
        return;
530
530
531
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
531
    NSDictionary *representations = @{
532
    NSDictionary *representations = @{
532
        (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url.string(),
533
        (NSString *)kUTTypeUTF8PlainText : (NSString *)_positionInformation.url.string(),
533
        (NSString *)kUTTypeURL : (NSURL *)_positionInformation.url,
534
        (NSString *)kUTTypeURL : (NSURL *)_positionInformation.url,
534
    };
535
    };
536
ALLOW_DEPRECATED_DECLARATIONS_END
535
537
536
    [UIPasteboard generalPasteboard].items = @[ representations ];
538
    [UIPasteboard generalPasteboard].items = @[ representations ];
537
}
539
}
- a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm +12 lines
Lines 317-324 - (NSArray<NSString *> *)currentAvailableActionTitles a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec1
317
    NSMutableArray<NSString *> *actionTitles = [NSMutableArray array];
317
    NSMutableArray<NSString *> *actionTitles = [NSMutableArray array];
318
318
319
    NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
319
    NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
320
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
320
    BOOL allowsImageMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeImage);
321
    BOOL allowsImageMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeImage);
321
    BOOL allowsVideoMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeMovie);
322
    BOOL allowsVideoMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeMovie);
323
ALLOW_DEPRECATED_DECLARATIONS_END
322
    if (allowsImageMediaType || allowsVideoMediaType) {
324
    if (allowsImageMediaType || allowsVideoMediaType) {
323
        [actionTitles addObject:@"Photo Library"];
325
        [actionTitles addObject:@"Photo Library"];
324
        if (allowsImageMediaType && allowsVideoMediaType)
326
        if (allowsImageMediaType && allowsVideoMediaType)
Lines 338-343 static NSSet<NSString *> *UTIsForMIMETypes(NSArray *mimeTypes) a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec2
338
{
340
{
339
    NSMutableSet *mediaTypes = [NSMutableSet set];
341
    NSMutableSet *mediaTypes = [NSMutableSet set];
340
    for (NSString *mimeType in mimeTypes) {
342
    for (NSString *mimeType in mimeTypes) {
343
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
341
        if ([mimeType caseInsensitiveCompare:@"image/*"] == NSOrderedSame)
344
        if ([mimeType caseInsensitiveCompare:@"image/*"] == NSOrderedSame)
342
            [mediaTypes addObject:(__bridge NSString *)kUTTypeImage];
345
            [mediaTypes addObject:(__bridge NSString *)kUTTypeImage];
343
        else if ([mimeType caseInsensitiveCompare:@"video/*"] == NSOrderedSame)
346
        else if ([mimeType caseInsensitiveCompare:@"video/*"] == NSOrderedSame)
Lines 351-356 static NSSet<NSString *> *UTIsForMIMETypes(NSArray *mimeTypes) a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec3
351
            if (!uti.isEmpty())
354
            if (!uti.isEmpty())
352
                [mediaTypes addObject:(__bridge NSString *)uti];
355
                [mediaTypes addObject:(__bridge NSString *)uti];
353
        }
356
        }
357
ALLOW_DEPRECATED_DECLARATIONS_END
354
    }
358
    }
355
    return mediaTypes;
359
    return mediaTypes;
356
}
360
}
Lines 427-434 - (UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec4
427
        NSArray *actions;
431
        NSArray *actions;
428
        NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
432
        NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
429
433
434
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
430
        BOOL allowsImageMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeImage);
435
        BOOL allowsImageMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeImage);
431
        BOOL allowsVideoMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeMovie);
436
        BOOL allowsVideoMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeMovie);
437
ALLOW_DEPRECATED_DECLARATIONS_END
432
        auto strongSelf = weakSelf.get();
438
        auto strongSelf = weakSelf.get();
433
        
439
        
434
        if (!strongSelf)
440
        if (!strongSelf)
Lines 494-500 - (void)ensureContextMenuInteraction a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec5
494
- (void)showFilePickerMenu
500
- (void)showFilePickerMenu
495
{
501
{
496
    NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
502
    NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
503
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
497
    NSArray *documentTypes = mediaTypes.count ? mediaTypes : @[(__bridge NSString *)kUTTypeItem];
504
    NSArray *documentTypes = mediaTypes.count ? mediaTypes : @[(__bridge NSString *)kUTTypeItem];
505
ALLOW_DEPRECATED_DECLARATIONS_END
498
    
506
    
499
    _documentPickerController = adoptNS([[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeImport]);
507
    _documentPickerController = adoptNS([[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeImport]);
500
    [_documentPickerController setAllowsMultipleSelection:_allowMultipleFiles];
508
    [_documentPickerController setAllowsMultipleSelection:_allowMultipleFiles];
Lines 510-517 - (void)showDocumentPickerMenu a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec6
510
    // FIXME 49961589: Support picking media with UIImagePickerController
518
    // FIXME 49961589: Support picking media with UIImagePickerController
511
#if HAVE(UICONTEXTMENU_LOCATION)
519
#if HAVE(UICONTEXTMENU_LOCATION)
512
    NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
520
    NSArray *mediaTypes = UTIsForMIMETypes(_mimeTypes.get()).allObjects;
521
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
513
    BOOL allowsImageMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeImage);
522
    BOOL allowsImageMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeImage);
514
    BOOL allowsVideoMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeMovie);
523
    BOOL allowsVideoMediaType = !mediaTypes.count || arrayContainsUTIThatConformsTo(mediaTypes, kUTTypeMovie);
524
ALLOW_DEPRECATED_DECLARATIONS_END
515
    BOOL shouldPresentDocumentMenuViewController = allowsImageMediaType || allowsVideoMediaType;
525
    BOOL shouldPresentDocumentMenuViewController = allowsImageMediaType || allowsVideoMediaType;
516
    if (shouldPresentDocumentMenuViewController) {
526
    if (shouldPresentDocumentMenuViewController) {
517
        [self ensureContextMenuInteraction];
527
        [self ensureContextMenuInteraction];
Lines 806-811 - (void)_uploadItemFromMediaInfo:(NSDictionary *)info successBlock:(void (^)(_WK a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec7
806
{
816
{
807
    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
817
    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
808
818
819
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
809
    // For videos from the existing library or camera, the media URL will give us a file path.
820
    // For videos from the existing library or camera, the media URL will give us a file path.
810
    if (UTTypeConformsTo((CFStringRef)mediaType, kUTTypeMovie)) {
821
    if (UTTypeConformsTo((CFStringRef)mediaType, kUTTypeMovie)) {
811
        NSURL *mediaURL = [info objectForKey:UIImagePickerControllerMediaURL];
822
        NSURL *mediaURL = [info objectForKey:UIImagePickerControllerMediaURL];
Lines 826-831 - (void)_uploadItemFromMediaInfo:(NSDictionary *)info successBlock:(void (^)(_WK a/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm_sec8
826
        failureBlock();
837
        failureBlock();
827
        return;
838
        return;
828
    }
839
    }
840
ALLOW_DEPRECATED_DECLARATIONS_END
829
841
830
#if PLATFORM(IOS_FAMILY)
842
#if PLATFORM(IOS_FAMILY)
831
    if (NSURL *imageURL = info[UIImagePickerControllerImageURL]) {
843
    if (NSURL *imageURL = info[UIImagePickerControllerImageURL]) {
- a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm +2 lines
Lines 184-190 void WebContextMenuProxyMac::setupServicesMenu() a/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm_sec1
184
        auto cgImage = image->makeCGImage();
184
        auto cgImage = image->makeCGImage();
185
        auto nsImage = adoptNS([[NSImage alloc] initWithCGImage:cgImage.get() size:image->size()]);
185
        auto nsImage = adoptNS([[NSImage alloc] initWithCGImage:cgImage.get() size:image->size()]);
186
186
187
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
187
        auto itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:[nsImage TIFFRepresentation] typeIdentifier:(__bridge NSString *)kUTTypeTIFF]);
188
        auto itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:[nsImage TIFFRepresentation] typeIdentifier:(__bridge NSString *)kUTTypeTIFF]);
189
ALLOW_DEPRECATED_DECLARATIONS_END
188
        items = @[ itemProvider.get() ];
190
        items = @[ itemProvider.get() ];
189
    } else if (!m_context.controlledSelectionData().isEmpty()) {
191
    } else if (!m_context.controlledSelectionData().isEmpty()) {
190
        auto selectionData = adoptNS([[NSData alloc] initWithBytes:static_cast<const void*>(m_context.controlledSelectionData().data()) length:m_context.controlledSelectionData().size()]);
192
        auto selectionData = adoptNS([[NSData alloc] initWithBytes:static_cast<const void*>(m_context.controlledSelectionData().data()) length:m_context.controlledSelectionData().size()]);
- a/Source/WebKitLegacy/mac/ChangeLog +15 lines
Lines 1-3 a/Source/WebKitLegacy/mac/ChangeLog_sec1
1
2020-11-16  Devin Rousso  <drousso@apple.com>
2
3
        Ignore deprecation warnings for the uniform types C API
4
        https://bugs.webkit.org/show_bug.cgi?id=218989
5
6
        Reviewed by Tim Horton.
7
8
        These should eventually be replaced with the ObjC API `UniformTypeIdentifiers.framework`.
9
        See <https://developer.apple.com/documentation/uniformtypeidentifiers>.
10
11
        * WebView/WebHTMLView.mm:
12
        (-[WebHTMLView _documentFragmentFromPasteboard:inContext:allowPlainText:]):
13
        (+[WebHTMLView _insertablePasteboardTypes]):
14
        (-[WebHTMLView _documentFragmentFromPasteboard:forType:inContext:subresources:]):
15
1
2020-11-13  Sam Weinig  <weinig@apple.com>
16
2020-11-13  Sam Weinig  <weinig@apple.com>
2
17
3
        Move some more WebKit and WebKitLegacy preferences bound to Settings to WebPreferences.yaml
18
        Move some more WebKit and WebKitLegacy preferences bound to Settings to WebPreferences.yaml
- a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm +6 lines
Lines 1187-1194 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pastebo a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm_sec1
1187
    if ([types containsObject:WebCore::legacyPDFPasteboardType()] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:WebCore::legacyPDFPasteboardType() inContext:context subresources:0]))
1187
    if ([types containsObject:WebCore::legacyPDFPasteboardType()] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:WebCore::legacyPDFPasteboardType() inContext:context subresources:0]))
1188
        return fragment;
1188
        return fragment;
1189
1189
1190
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
1190
    if ([types containsObject:(NSString *)kUTTypePNG] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:(NSString *)kUTTypePNG inContext:context subresources:0]))
1191
    if ([types containsObject:(NSString *)kUTTypePNG] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:(NSString *)kUTTypePNG inContext:context subresources:0]))
1191
        return fragment;
1192
        return fragment;
1193
ALLOW_DEPRECATED_DECLARATIONS_END
1192
1194
1193
    if ([types containsObject:WebCore::legacyURLPasteboardType()] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:WebCore::legacyURLPasteboardType() inContext:context subresources:0]))
1195
    if ([types containsObject:WebCore::legacyURLPasteboardType()] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:WebCore::legacyURLPasteboardType() inContext:context subresources:0]))
1194
        return fragment;
1196
        return fragment;
Lines 1962-1969 + (NSArray *)_insertablePasteboardTypes a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm_sec2
1962
{
1964
{
1963
    static NSArray *types = nil;
1965
    static NSArray *types = nil;
1964
    if (!types) {
1966
    if (!types) {
1967
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
1965
        types = [[NSArray alloc] initWithObjects:WebArchivePboardType, WebCore::legacyHTMLPasteboardType(), WebCore::legacyFilenamesPasteboardType(), WebCore::legacyTIFFPasteboardType(), WebCore::legacyPDFPasteboardType(),
1968
        types = [[NSArray alloc] initWithObjects:WebArchivePboardType, WebCore::legacyHTMLPasteboardType(), WebCore::legacyFilenamesPasteboardType(), WebCore::legacyTIFFPasteboardType(), WebCore::legacyPDFPasteboardType(),
1966
            WebCore::legacyURLPasteboardType(), WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType(), WebCore::legacyColorPasteboardType(), kUTTypePNG, nil];
1969
            WebCore::legacyURLPasteboardType(), WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType(), WebCore::legacyColorPasteboardType(), kUTTypePNG, nil];
1970
ALLOW_DEPRECATED_DECLARATIONS_END
1967
        CFRetain(types);
1971
        CFRetain(types);
1968
    }
1972
    }
1969
    return types;
1973
    return types;
Lines 2353-2360 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pastebo a/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm_sec3
2353
        return [self _web_documentFragmentFromPasteboard:pasteboard pasteboardType:WebCore::legacyTIFFPasteboardType() imageMIMEType:@"image/tiff"];
2357
        return [self _web_documentFragmentFromPasteboard:pasteboard pasteboardType:WebCore::legacyTIFFPasteboardType() imageMIMEType:@"image/tiff"];
2354
    if ([pboardType isEqualToString:WebCore::legacyPDFPasteboardType()])
2358
    if ([pboardType isEqualToString:WebCore::legacyPDFPasteboardType()])
2355
        return [self _web_documentFragmentFromPasteboard:pasteboard pasteboardType:WebCore::legacyPDFPasteboardType() imageMIMEType:@"application/pdf"];
2359
        return [self _web_documentFragmentFromPasteboard:pasteboard pasteboardType:WebCore::legacyPDFPasteboardType() imageMIMEType:@"application/pdf"];
2360
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
2356
    if ([pboardType isEqualToString:(NSString *)kUTTypePNG])
2361
    if ([pboardType isEqualToString:(NSString *)kUTTypePNG])
2357
        return [self _web_documentFragmentFromPasteboard:pasteboard pasteboardType:(NSString *)kUTTypePNG imageMIMEType:@"image/png"];
2362
        return [self _web_documentFragmentFromPasteboard:pasteboard pasteboardType:(NSString *)kUTTypePNG imageMIMEType:@"image/png"];
2363
ALLOW_DEPRECATED_DECLARATIONS_END
2358
2364
2359
    if ([pboardType isEqualToString:WebCore::legacyURLPasteboardType()]) {
2365
    if ([pboardType isEqualToString:WebCore::legacyURLPasteboardType()]) {
2360
        NSURL *URL = [NSURL URLFromPasteboard:pasteboard];
2366
        NSURL *URL = [NSURL URLFromPasteboard:pasteboard];

Return to Bug 218989