[Attachment Support] Remove WebCore::AttachmentDisplayOptions and friends
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2018 00:28:50 +0000 (00:28 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2018 00:28:50 +0000 (00:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189004

Reviewed by Dan Bernstein.

Source/WebCore:

No new tests, since there is no change in behavior.

* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::insertAttachment):
* editing/Editor.h:
* html/AttachmentTypes.h: Removed.
* html/HTMLAttachmentElement.h:

Source/WebKit:

Removes all usage of WebCore::AttachmentDisplayOptions, and deletes an SPI method that isn't being used by any
internal clients. Removal of _WKAttachmentDisplayOptions itself is still blocked on the submission of
<rdar://problem/43357281>.

* Scripts/webkit/messages.py:
* Shared/WebCoreArgumentCoders.cpp:
* UIProcess/API/APIAttachment.cpp:
(API::Attachment::setDisplayOptions): Deleted.
* UIProcess/API/APIAttachment.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]):
(-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Deprecate -_insertAttachmentWithFileWrapper:contentType:options:completion:, in favor of
-_insertAttachmentWithFileWrapper:contentType:completion:.

* UIProcess/API/Cocoa/_WKAttachment.h:

Remove -setDisplayOptions:completion:, since it is a now a noop, and also isn't used by any internal clients.

* UIProcess/API/Cocoa/_WKAttachment.mm:
(-[_WKAttachmentDisplayOptions coreDisplayOptions]): Deleted.
(-[_WKAttachment setDisplayOptions:completion:]): Deleted.
* UIProcess/API/Cocoa/_WKAttachmentInternal.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::insertAttachment):
(WebKit::WebPageProxy::setAttachmentDisplayOptions): Deleted.
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::insertAttachment):
(WebKit::WebPage::setAttachmentDisplayOptions): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

Move off of deprecated attachment insertion SPI.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(-[TestWKWebView synchronouslyInsertAttachmentWithFileWrapper:contentType:]):
(-[TestWKWebView synchronouslyInsertAttachmentWithFilename:contentType:data:]):
(-[_WKAttachment synchronouslySetDisplayOptions:error:]): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235414 268f45cc-cd09-0410-ab3c-d52691b4dbfc

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/html/AttachmentTypes.h [deleted file]
Source/WebCore/html/HTMLAttachmentElement.h
Source/WebKit/ChangeLog
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/UIProcess/API/APIAttachment.cpp
Source/WebKit/UIProcess/API/APIAttachment.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.h
Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm
Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm

index ec62d76..7ff98e3 100644 (file)
@@ -1,3 +1,19 @@
+2018-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Attachment Support] Remove WebCore::AttachmentDisplayOptions and friends
+        https://bugs.webkit.org/show_bug.cgi?id=189004
+
+        Reviewed by Dan Bernstein.
+
+        No new tests, since there is no change in behavior.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * editing/Editor.cpp:
+        (WebCore::Editor::insertAttachment):
+        * editing/Editor.h:
+        * html/AttachmentTypes.h: Removed.
+        * html/HTMLAttachmentElement.h:
+
 2018-08-27  Keith Rollin  <krollin@apple.com>
 
         Unreviewed build fix -- disable LTO for production builds
index 7255d26..b6df748 100644 (file)
                F3ABFE0C130E9DA000E7F7D1 /* InstrumentingAgents.h in Headers */ = {isa = PBXBuildFile; fileRef = F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */; };
                F3D461491161D53200CA0D09 /* JSErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D461471161D53200CA0D09 /* JSErrorHandler.h */; };
                F433E9031DBBDBA200EF0D14 /* StaticPasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = F433E9021DBBDBA200EF0D14 /* StaticPasteboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               F43759B41FCF48FA00100706 /* AttachmentTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = F43759B31FCF48FA00100706 /* AttachmentTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F44A5F591FED38F2007F5944 /* LegacyNSPasteboardTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = F44A5F571FED3830007F5944 /* LegacyNSPasteboardTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F44EBBD91DB5D21400277334 /* StaticRange.h in Headers */ = {isa = PBXBuildFile; fileRef = F44EBBD81DB5D21400277334 /* StaticRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F45C231E1995B73B00A6E2E3 /* AxisScrollSnapOffsets.h in Headers */ = {isa = PBXBuildFile; fileRef = F45C231C1995B73B00A6E2E3 /* AxisScrollSnapOffsets.h */; settings = {ATTRIBUTES = (Private, ); }; };
                F3D461471161D53200CA0D09 /* JSErrorHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorHandler.h; sourceTree = "<group>"; };
                F433E9021DBBDBA200EF0D14 /* StaticPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticPasteboard.h; sourceTree = "<group>"; };
                F433E9041DBBDBC200EF0D14 /* StaticPasteboard.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StaticPasteboard.cpp; sourceTree = "<group>"; };
-               F43759B31FCF48FA00100706 /* AttachmentTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AttachmentTypes.h; sourceTree = "<group>"; };
                F44A5F571FED3830007F5944 /* LegacyNSPasteboardTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LegacyNSPasteboardTypes.h; sourceTree = "<group>"; };
                F44EBBD61DB5D1B600277334 /* StaticRange.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StaticRange.idl; sourceTree = "<group>"; };
                F44EBBD81DB5D21400277334 /* StaticRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticRange.h; sourceTree = "<group>"; };
                                41103AA71E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.cpp */,
                                41103AA81E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.h */,
                                5CDD833B1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.cpp */,
-                               419242472127B7CC00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm */,
                                5CDD833C1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.h */,
+                               419242472127B7CC00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm */,
                                070A9F5E1FFECC70003DF649 /* ScreenDisplayCaptureSourceMac.h */,
                                070A9F601FFECC71003DF649 /* ScreenDisplayCaptureSourceMac.mm */,
                                07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */,
                                97C1F5511228558800EDE616 /* parser */,
                                4150F9ED12B6E0990008C860 /* shadow */,
                                B1AD4E7713A12A7200846B27 /* track */,
-                               F43759B31FCF48FA00100706 /* AttachmentTypes.h */,
                                A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */,
                                A501920C132EBF2E008BFE55 /* Autocapitalize.h */,
                                A5A7AA42132F0ECC00D3A3C2 /* AutocapitalizeTypes.h */,
                                FD5686CA13AC180200B69C68 /* AsyncAudioDecoder.h in Headers */,
                                E1CDE9221501916900862CC5 /* AsyncFileStream.h in Headers */,
                                0FFD4D6118651FA300512F6E /* AsyncScrollingCoordinator.h in Headers */,
-                               F43759B41FCF48FA00100706 /* AttachmentTypes.h in Headers */,
                                A8C4A80D09D563270003AC8D /* Attr.h in Headers */,
                                A8C4A80B09D563270003AC8D /* Attribute.h in Headers */,
                                E4A814DA1C70E10D00BF85AC /* AttributeChangeInvalidation.h in Headers */,
                                AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerIOS.mm in Sources */,
                                CDA29A301CBF74D400901CCF /* PlaybackSessionInterfaceAVKit.mm in Sources */,
                                CDA29A161CBDA56C00901CCF /* PlaybackSessionInterfaceMac.mm in Sources */,
+                               419242492127B93E00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm in Sources */,
                                316DCB8A1E7A6996001B5F87 /* RTCIceTransport.cpp in Sources */,
                                BC51156E12B1749C00C96754 /* ScrollAnimatorMac.mm in Sources */,
                                BCEF869F0E844E9D00A85CD5 /* ScrollbarThemeMac.mm in Sources */,
                                538EC8A11F993F9D004D22A8 /* UnifiedSource48.cpp in Sources */,
                                DE5F85991FA1ABF4006DB63A /* UnifiedSource49-mm.mm in Sources */,
                                538EC8A21F993F9D004D22A8 /* UnifiedSource49.cpp in Sources */,
-                               419242492127B93E00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm in Sources */,
                                DE5F859A1FA1ABF4006DB63A /* UnifiedSource50-mm.mm in Sources */,
                                538EC8A31F993F9D004D22A8 /* UnifiedSource50.cpp in Sources */,
                                DE5F86501FA2AF24006DB63A /* UnifiedSource51-mm.mm in Sources */,
index 4eca915..438737a 100644 (file)
@@ -3876,7 +3876,7 @@ void Editor::notifyClientOfAttachmentUpdates()
     }
 }
 
-void Editor::insertAttachment(const String& identifier, const AttachmentDisplayOptions&, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType)
+void Editor::insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType)
 {
     auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document());
     attachment->setUniqueIdentifier(identifier);
index 6f5abba..3d63ce1 100644 (file)
@@ -95,7 +95,6 @@ enum class MailBlockquoteHandling {
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 class HTMLAttachmentElement;
-struct AttachmentDisplayOptions;
 #endif
 
 enum TemporarySelectionOption : uint8_t {
@@ -503,7 +502,7 @@ public:
     bool isGettingDictionaryPopupInfo() const { return m_isGettingDictionaryPopupInfo; }
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    WEBCORE_EXPORT void insertAttachment(const String& identifier, const AttachmentDisplayOptions&, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType);
+    WEBCORE_EXPORT void insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType);
     void registerAttachmentIdentifier(const String&, const String& /* contentType */, const String& /* preferredFileName */, Ref<SharedBuffer>&&);
     void registerAttachmentIdentifier(const String&, const String& /* contentType */, const String& /* filePath */);
     void cloneAttachmentData(const String& fromIdentifier, const String& toIdentifier);
diff --git a/Source/WebCore/html/AttachmentTypes.h b/Source/WebCore/html/AttachmentTypes.h
deleted file mode 100644 (file)
index 89bbcab..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(ATTACHMENT_ELEMENT)
-
-#include <wtf/Optional.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-struct AttachmentDisplayOptions {
-    template<class Encoder> void encode(Encoder&) const;
-    template<class Decoder> static std::optional<AttachmentDisplayOptions> decode(Decoder&);
-};
-
-template<class Encoder> inline void AttachmentDisplayOptions::encode(Encoder& encoder) const
-{
-    UNUSED_PARAM(encoder);
-}
-
-template<class Decoder> inline std::optional<AttachmentDisplayOptions> AttachmentDisplayOptions::decode(Decoder& decoder)
-{
-    UNUSED_PARAM(decoder);
-    return AttachmentDisplayOptions();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(ATTACHMENT_ELEMENT)
index 61ea15a..bf9443c 100644 (file)
@@ -27,7 +27,6 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 
-#include "AttachmentTypes.h"
 #include "HTMLElement.h"
 
 namespace WebCore {
index 52f3583..b73c679 100644 (file)
@@ -1,3 +1,46 @@
+2018-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Attachment Support] Remove WebCore::AttachmentDisplayOptions and friends
+        https://bugs.webkit.org/show_bug.cgi?id=189004
+
+        Reviewed by Dan Bernstein.
+
+        Removes all usage of WebCore::AttachmentDisplayOptions, and deletes an SPI method that isn't being used by any
+        internal clients. Removal of _WKAttachmentDisplayOptions itself is still blocked on the submission of
+        <rdar://problem/43357281>.
+
+        * Scripts/webkit/messages.py:
+        * Shared/WebCoreArgumentCoders.cpp:
+        * UIProcess/API/APIAttachment.cpp:
+        (API::Attachment::setDisplayOptions): Deleted.
+        * UIProcess/API/APIAttachment.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
+        (-[WKWebView _insertAttachmentWithFileWrapper:contentType:options:completion:]):
+        (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
+        Deprecate -_insertAttachmentWithFileWrapper:contentType:options:completion:, in favor of
+        -_insertAttachmentWithFileWrapper:contentType:completion:.
+
+        * UIProcess/API/Cocoa/_WKAttachment.h:
+
+        Remove -setDisplayOptions:completion:, since it is a now a noop, and also isn't used by any internal clients.
+
+        * UIProcess/API/Cocoa/_WKAttachment.mm:
+        (-[_WKAttachmentDisplayOptions coreDisplayOptions]): Deleted.
+        (-[_WKAttachment setDisplayOptions:completion:]): Deleted.
+        * UIProcess/API/Cocoa/_WKAttachmentInternal.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::insertAttachment):
+        (WebKit::WebPageProxy::setAttachmentDisplayOptions): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::insertAttachment):
+        (WebKit::WebPage::setAttachmentDisplayOptions): Deleted.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2018-08-27  Alex Christensen  <achristensen@webkit.org>
 
         NetworkLoad::didReceiveResponse should pass its completion handler to its client
index 7af168c..06bea1c 100644 (file)
@@ -377,7 +377,6 @@ def headers_for_type(type):
         'WallTime': ['<wtf/WallTime.h>'],
         'String': ['<wtf/text/WTFString.h>'],
         'PAL::SessionID': ['<pal/SessionID.h>'],
-        'WebCore::AttachmentDisplayOptions': ['<WebCore/AttachmentTypes.h>'],
         'WebCore::AutoplayEventFlags': ['<WebCore/AutoplayEvent.h>'],
         'WebCore::ExceptionDetails': ['<WebCore/JSDOMExceptionHandling.h>'],
         'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
index 353d328..f44438f 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "DataReference.h"
 #include "ShareableBitmap.h"
-#include <WebCore/AttachmentTypes.h>
 #include <WebCore/AuthenticationChallenge.h>
 #include <WebCore/BlobPart.h>
 #include <WebCore/CacheQueryOptions.h>
index 073a44c..64106c6 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 
-#include <WebCore/AttachmentTypes.h>
 #include <WebCore/SharedBuffer.h>
 #include <wtf/text/WTFString.h>
 
@@ -49,14 +48,6 @@ Attachment::~Attachment()
 {
 }
 
-void Attachment::setDisplayOptions(WebCore::AttachmentDisplayOptions options, Function<void(WebKit::CallbackBase::Error)>&& callback)
-{
-    if (m_webPage)
-        m_webPage->setAttachmentDisplayOptions(m_identifier, options, WTFMove(callback));
-    else
-        callback(WebKit::CallbackBase::Error::OwnerWasInvalidated);
-}
-
 void Attachment::updateAttributes(Function<void(WebKit::CallbackBase::Error)>&& callback)
 {
     if (!m_webPage) {
index 8443f43..952f41b 100644 (file)
@@ -38,7 +38,6 @@ OBJC_CLASS NSFileWrapper;
 
 namespace WebCore {
 class SharedBuffer;
-struct AttachmentDisplayOptions;
 }
 
 namespace WebKit {
@@ -55,7 +54,6 @@ public:
     enum class InsertionState : uint8_t { NotInserted, Inserted };
 
     const WTF::String& identifier() const { return m_identifier; }
-    void setDisplayOptions(WebCore::AttachmentDisplayOptions, Function<void(WebKit::CallbackBase::Error)>&&);
     void updateAttributes(Function<void(WebKit::CallbackBase::Error)>&&);
 
     void invalidate();
index 2fa783f..69ee3d3 100644 (file)
@@ -94,7 +94,6 @@
 #import "_WKSessionStateInternal.h"
 #import "_WKVisitedLinkStoreInternal.h"
 #import "_WKWebsitePoliciesInternal.h"
-#import <WebCore/AttachmentTypes.h>
 #import <WebCore/GraphicsContextCG.h>
 #import <WebCore/IOSurface.h>
 #import <WebCore/JSDOMBinding.h>
@@ -4442,20 +4441,26 @@ WEBCORE_COMMAND(yankAndSelect)
 
 - (_WKAttachment *)_insertAttachmentWithFilename:(NSString *)filename contentType:(NSString *)contentType data:(NSData *)data options:(_WKAttachmentDisplayOptions *)options completion:(void(^)(BOOL success))completionHandler
 {
+    UNUSED_PARAM(options);
     auto fileWrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:data]);
     if (filename)
         [fileWrapper setPreferredFilename:filename];
-    return [self _insertAttachmentWithFileWrapper:fileWrapper.get() contentType:contentType options:options completion:completionHandler];
+    return [self _insertAttachmentWithFileWrapper:fileWrapper.get() contentType:contentType completion:completionHandler];
 }
 
 - (_WKAttachment *)_insertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType options:(_WKAttachmentDisplayOptions *)options completion:(void(^)(BOOL success))completionHandler
 {
+    UNUSED_PARAM(options);
+    return [self _insertAttachmentWithFileWrapper:fileWrapper contentType:contentType completion:completionHandler];
+}
+
+- (_WKAttachment *)_insertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType completion:(void(^)(BOOL success))completionHandler
+{
 #if ENABLE(ATTACHMENT_ELEMENT)
     auto identifier = createCanonicalUUIDString();
-    auto coreOptions = options ? options.coreDisplayOptions : WebCore::AttachmentDisplayOptions { };
     auto attachment = API::Attachment::create(identifier, *_page);
     attachment->setFileWrapperAndUpdateContentType(fileWrapper, contentType);
-    _page->insertAttachment(attachment.copyRef(), coreOptions, [capturedHandler = makeBlockPtr(completionHandler)] (WebKit::CallbackBase::Error error) {
+    _page->insertAttachment(attachment.copyRef(), [capturedHandler = makeBlockPtr(completionHandler)] (WebKit::CallbackBase::Error error) {
         if (capturedHandler)
             capturedHandler(error == WebKit::CallbackBase::Error::None);
     });
index a3c5fa0..f050eb0 100644 (file)
@@ -182,7 +182,8 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) {
 @property (nonatomic, setter=_setBackgroundExtendsBeyondPage:) BOOL _backgroundExtendsBeyondPage WK_API_AVAILABLE(macosx(10.13.4), ios(8.0));
 
 - (_WKAttachment *)_insertAttachmentWithFilename:(NSString *)filename contentType:(NSString *)contentType data:(NSData *)data options:(_WKAttachmentDisplayOptions *)options completion:(void(^)(BOOL success))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("-_insertAttachmentWithFileWrapper:contentType:options:completion:", macosx(10.13.4, WK_MAC_TBA), ios(11.3, WK_IOS_TBA));
-- (_WKAttachment *)_insertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType options:(_WKAttachmentDisplayOptions *)options completion:(void(^)(BOOL success))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (_WKAttachment *)_insertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType options:(_WKAttachmentDisplayOptions *)options completion:(void(^)(BOOL success))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("-_insertAttachmentWithFileWrapper:contentType:completion:", macosx(WK_MAC_TBA, WK_MAC_TBA), ios(WK_IOS_TBA, WK_IOS_TBA));
+- (_WKAttachment *)_insertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType completion:(void(^)(BOOL success))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 #if TARGET_OS_IPHONE
 // DERECATED: The setters of the three following function are deprecated, please use overrideLayoutParameters.
index a1f302c..32d1f3a 100644 (file)
@@ -54,7 +54,6 @@ WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
 WK_CLASS_AVAILABLE(macosx(10.13.4), ios(11.3))
 @interface _WKAttachment : NSObject
 
-- (void)setDisplayOptions:(_WKAttachmentDisplayOptions *)options completion:(void(^ _Nullable)(NSError * _Nullable))completionHandler;
 - (void)setFileWrapper:(NSFileWrapper *)fileWrapper contentType:(nullable NSString *)contentType completion:(void(^ _Nullable)(NSError * _Nullable))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, readonly, nullable) _WKAttachmentInfo *info WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
index 0ca3d53..811240d 100644 (file)
@@ -31,7 +31,6 @@
 #import "APIAttachment.h"
 #import "WKErrorPrivate.h"
 #import "_WKAttachmentInternal.h"
-#import <WebCore/AttachmentTypes.h>
 #import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/SharedBuffer.h>
 #import <wtf/BlockPtr.h>
@@ -46,12 +45,6 @@ static const NSInteger UnspecifiedAttachmentErrorCode = 1;
 static const NSInteger InvalidAttachmentErrorCode = 2;
 
 @implementation _WKAttachmentDisplayOptions : NSObject
-
-- (WebCore::AttachmentDisplayOptions)coreDisplayOptions
-{
-    return { };
-}
-
 @end
 
 @implementation _WKAttachmentInfo {
@@ -131,25 +124,6 @@ static const NSInteger InvalidAttachmentErrorCode = 2;
     completionHandler(self.info, nil);
 }
 
-- (void)setDisplayOptions:(_WKAttachmentDisplayOptions *)options completion:(void(^)(NSError *))completionHandler
-{
-    if (!_attachment->isValid()) {
-        completionHandler([NSError errorWithDomain:WKErrorDomain code:InvalidAttachmentErrorCode userInfo:nil]);
-        return;
-    }
-
-    auto coreOptions = options ? options.coreDisplayOptions : WebCore::AttachmentDisplayOptions { };
-    _attachment->setDisplayOptions(coreOptions, [capturedBlock = makeBlockPtr(completionHandler)] (CallbackBase::Error error) {
-        if (!capturedBlock)
-            return;
-
-        if (error == CallbackBase::Error::None)
-            capturedBlock(nil);
-        else
-            capturedBlock([NSError errorWithDomain:WKErrorDomain code:UnspecifiedAttachmentErrorCode userInfo:nil]);
-    });
-}
-
 - (void)setFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType completion:(void (^)(NSError *))completionHandler
 {
     if (!_attachment->isValid()) {
index 138a953..abda152 100644 (file)
@@ -34,10 +34,6 @@ template<> struct WrapperTraits<API::Attachment> {
 
 }
 
-@interface _WKAttachmentDisplayOptions ()
-@property (nonatomic, readonly) WebCore::AttachmentDisplayOptions coreDisplayOptions;
-@end
-
 @interface _WKAttachment () <WKObject> {
 @package
     API::ObjectStorage<API::Attachment> _attachment;
index 831c729..7003120 100644 (file)
 #include "WebURLSchemeHandler.h"
 #include "WebUserContentControllerProxy.h"
 #include "WebsiteDataStore.h"
-#include <WebCore/AttachmentTypes.h>
 #include <WebCore/BitmapImage.h>
 #include <WebCore/DeprecatedGlobalSettings.h>
 #include <WebCore/DiagnosticLoggingClient.h>
@@ -7683,7 +7682,7 @@ RefPtr<API::Attachment> WebPageProxy::attachmentForIdentifier(const String& iden
     return m_attachmentIdentifierToAttachmentMap.get(identifier);
 }
 
-void WebPageProxy::insertAttachment(Ref<API::Attachment>&& attachment, const AttachmentDisplayOptions& options, Function<void(CallbackBase::Error)>&& callback)
+void WebPageProxy::insertAttachment(Ref<API::Attachment>&& attachment, Function<void(CallbackBase::Error)>&& callback)
 {
     if (!isValid()) {
         callback(CallbackBase::Error::OwnerWasInvalidated);
@@ -7692,21 +7691,10 @@ void WebPageProxy::insertAttachment(Ref<API::Attachment>&& attachment, const Att
 
     auto attachmentIdentifier = attachment->identifier();
     auto callbackID = m_callbacks.put(WTFMove(callback), m_process->throttler().backgroundActivityToken());
-    m_process->send(Messages::WebPage::InsertAttachment(attachmentIdentifier, options, attachment->fileSizeForDisplay(), attachment->fileName(), attachment->contentType(), callbackID), m_pageID);
+    m_process->send(Messages::WebPage::InsertAttachment(attachmentIdentifier, attachment->fileSizeForDisplay(), attachment->fileName(), attachment->contentType(), callbackID), m_pageID);
     m_attachmentIdentifierToAttachmentMap.set(attachmentIdentifier, WTFMove(attachment));
 }
 
-void WebPageProxy::setAttachmentDisplayOptions(const String& identifier, AttachmentDisplayOptions options, Function<void(CallbackBase::Error)>&& callback)
-{
-    if (!isValid()) {
-        callback(CallbackBase::Error::OwnerWasInvalidated);
-        return;
-    }
-
-    auto callbackID = m_callbacks.put(WTFMove(callback), m_process->throttler().backgroundActivityToken());
-    m_process->send(Messages::WebPage::SetAttachmentDisplayOptions(identifier, options, callbackID), m_pageID);
-}
-
 void WebPageProxy::updateAttachmentAttributes(const API::Attachment& attachment, Function<void(CallbackBase::Error)>&& callback)
 {
     if (!isValid()) {
index 8c55d25..25fe4a2 100644 (file)
@@ -196,12 +196,6 @@ template <typename> class RectEdges;
 using FloatBoxExtent = RectEdges<float>;
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-namespace WebCore {
-struct AttachmentDisplayOptions;
-}
-#endif
-
 #if PLATFORM(GTK)
 typedef GtkWidget* PlatformWidget;
 #endif
@@ -1319,8 +1313,7 @@ public:
 
 #if ENABLE(ATTACHMENT_ELEMENT)
     RefPtr<API::Attachment> attachmentForIdentifier(const String& identifier) const;
-    void insertAttachment(Ref<API::Attachment>&&, const WebCore::AttachmentDisplayOptions&, Function<void(CallbackBase::Error)>&&);
-    void setAttachmentDisplayOptions(const String& identifier, WebCore::AttachmentDisplayOptions, Function<void(CallbackBase::Error)>&&);
+    void insertAttachment(Ref<API::Attachment>&&, Function<void(CallbackBase::Error)>&&);
     void updateAttachmentAttributes(const API::Attachment&, Function<void(CallbackBase::Error)>&&);
 #endif
 
index 4b5f5ab..3265997 100644 (file)
@@ -6066,15 +6066,10 @@ void WebPage::storageAccessResponse(bool wasGranted, uint64_t contextId)
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 
-void WebPage::insertAttachment(const String& identifier, const AttachmentDisplayOptions& options, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID callbackID)
+void WebPage::insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID callbackID)
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
-    frame.editor().insertAttachment(identifier, options, WTFMove(fileSize), fileName, contentType);
-    send(Messages::WebPageProxy::VoidCallback(callbackID));
-}
-
-void WebPage::setAttachmentDisplayOptions(const String&, const AttachmentDisplayOptions&, CallbackID callbackID)
-{
+    frame.editor().insertAttachment(identifier, WTFMove(fileSize), fileName, contentType);
     send(Messages::WebPageProxy::VoidCallback(callbackID));
 }
 
index 4d4ae85..2559a0d 100644 (file)
@@ -172,11 +172,8 @@ struct PromisedAttachmentInfo;
 struct TextCheckingResult;
 struct ViewportArguments;
 
-
-
 #if ENABLE(ATTACHMENT_ELEMENT)
 class HTMLAttachmentElement;
-struct AttachmentDisplayOptions;
 #endif
 }
 
@@ -1075,8 +1072,7 @@ public:
 #endif
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    void insertAttachment(const String& identifier, const WebCore::AttachmentDisplayOptions&, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
-    void setAttachmentDisplayOptions(const String& identifier, const WebCore::AttachmentDisplayOptions&, CallbackID);
+    void insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
     void updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, std::optional<String>&& newFilename, CallbackID);
 #endif
 
index 289abda..7ddcb9b 100644 (file)
@@ -510,8 +510,7 @@ messages -> WebPage LegacyReceiver {
 #endif
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    InsertAttachment(String identifier, struct WebCore::AttachmentDisplayOptions options, std::optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID)
-    SetAttachmentDisplayOptions(String identifier, struct WebCore::AttachmentDisplayOptions options, WebKit::CallbackID callbackID)
+    InsertAttachment(String identifier, std::optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID)
     UpdateAttachmentAttributes(String identifier, std::optional<uint64_t> fileSize, String newContentType, std::optional<String> newFilename, WebKit::CallbackID callbackID)
 #endif
 
index 76e2a34..f750911 100644 (file)
@@ -1,3 +1,17 @@
+2018-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Attachment Support] Remove WebCore::AttachmentDisplayOptions and friends
+        https://bugs.webkit.org/show_bug.cgi?id=189004
+
+        Reviewed by Dan Bernstein.
+
+        Move off of deprecated attachment insertion SPI.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
+        (-[TestWKWebView synchronouslyInsertAttachmentWithFileWrapper:contentType:]):
+        (-[TestWKWebView synchronouslyInsertAttachmentWithFilename:contentType:data:]):
+        (-[_WKAttachment synchronouslySetDisplayOptions:error:]): Deleted.
+
 2018-08-27  Simon Fraser  <simon.fraser@apple.com>
 
         Teach WebKitTestRunner and DumpRenderTree about detecting world leaks
index 0a0103b..70d2270 100644 (file)
@@ -261,7 +261,7 @@ static NSData *testPDFData()
 - (_WKAttachment *)synchronouslyInsertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType
 {
     __block bool done = false;
-    RetainPtr<_WKAttachment> attachment = [self _insertAttachmentWithFileWrapper:fileWrapper contentType:contentType options:nil completion:^(BOOL) {
+    RetainPtr<_WKAttachment> attachment = [self _insertAttachmentWithFileWrapper:fileWrapper contentType:contentType completion:^(BOOL) {
         done = true;
     }];
     TestWebKitAPI::Util::run(&done);
@@ -274,7 +274,7 @@ static NSData *testPDFData()
     auto fileWrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:data]);
     if (filename)
         [fileWrapper setPreferredFilename:filename];
-    RetainPtr<_WKAttachment> attachment = [self _insertAttachmentWithFileWrapper:fileWrapper.get() contentType:contentType options:nil completion:^(BOOL) {
+    RetainPtr<_WKAttachment> attachment = [self _insertAttachmentWithFileWrapper:fileWrapper.get() contentType:contentType completion:^(BOOL) {
         done = true;
     }];
     TestWebKitAPI::Util::run(&done);
@@ -343,21 +343,6 @@ static NSData *testPDFData()
 
 @implementation _WKAttachment (AttachmentTesting)
 
-- (void)synchronouslySetDisplayOptions:(_WKAttachmentDisplayOptions *)options error:(NSError **)error
-{
-    __block RetainPtr<NSError> resultError;
-    __block bool done = false;
-    [self setDisplayOptions:options completion:^(NSError *error) {
-        resultError = error;
-        done = true;
-    }];
-
-    TestWebKitAPI::Util::run(&done);
-
-    if (error)
-        *error = resultError.autorelease();
-}
-
 - (void)synchronouslySetFileWrapper:(NSFileWrapper *)fileWrapper newContentType:(NSString *)newContentType error:(NSError **)error
 {
     __block RetainPtr<NSError> resultError;