Title: [235414] trunk
Revision
235414
Author
wenson_hs...@apple.com
Date
2018-08-27 17:28:50 -0700 (Mon, 27 Aug 2018)

Log Message

[Attachment Support] Remove WebCore::AttachmentDisplayOptions and friends
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.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235413 => 235414)


--- trunk/Source/WebCore/ChangeLog	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebCore/ChangeLog	2018-08-28 00:28:50 UTC (rev 235414)
@@ -1,3 +1,19 @@
+2018-08-27  Wenson Hsieh  <wenson_hs...@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  <krol...@apple.com>
 
         Unreviewed build fix -- disable LTO for production builds

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (235413 => 235414)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-08-28 00:28:50 UTC (rev 235414)
@@ -4806,7 +4806,6 @@
 		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, ); }; };
@@ -14458,7 +14457,6 @@
 		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>"; };
@@ -15240,8 +15238,8 @@
 				41103AA71E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.cpp */,
 				41103AA81E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.h */,
 				5CDD833B1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.cpp */,
+				5CDD833C1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.h */,
 				419242472127B7CC00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm */,
-				5CDD833C1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.h */,
 				070A9F5E1FFECC70003DF649 /* ScreenDisplayCaptureSourceMac.h */,
 				070A9F601FFECC71003DF649 /* ScreenDisplayCaptureSourceMac.mm */,
 				07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */,
@@ -20284,7 +20282,6 @@
 				97C1F5511228558800EDE616 /* parser */,
 				4150F9ED12B6E0990008C860 /* shadow */,
 				B1AD4E7713A12A7200846B27 /* track */,
-				F43759B31FCF48FA00100706 /* AttachmentTypes.h */,
 				A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */,
 				A501920C132EBF2E008BFE55 /* Autocapitalize.h */,
 				A5A7AA42132F0ECC00D3A3C2 /* AutocapitalizeTypes.h */,
@@ -27037,7 +27034,6 @@
 				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 */,
@@ -31446,6 +31442,7 @@
 				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 */,
@@ -31566,7 +31563,6 @@
 				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 */,

Modified: trunk/Source/WebCore/editing/Editor.cpp (235413 => 235414)


--- trunk/Source/WebCore/editing/Editor.cpp	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebCore/editing/Editor.cpp	2018-08-28 00:28:50 UTC (rev 235414)
@@ -3876,7 +3876,7 @@
     }
 }
 
-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);

Modified: trunk/Source/WebCore/editing/Editor.h (235413 => 235414)


--- trunk/Source/WebCore/editing/Editor.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebCore/editing/Editor.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -95,7 +95,6 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 class HTMLAttachmentElement;
-struct AttachmentDisplayOptions;
 #endif
 
 enum TemporarySelectionOption : uint8_t {
@@ -503,7 +502,7 @@
     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);

Deleted: trunk/Source/WebCore/html/AttachmentTypes.h (235413 => 235414)


--- trunk/Source/WebCore/html/AttachmentTypes.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebCore/html/AttachmentTypes.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -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)

Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.h (235413 => 235414)


--- trunk/Source/WebCore/html/HTMLAttachmentElement.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -27,7 +27,6 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT)
 
-#include "AttachmentTypes.h"
 #include "HTMLElement.h"
 
 namespace WebCore {

Modified: trunk/Source/WebKit/ChangeLog (235413 => 235414)


--- trunk/Source/WebKit/ChangeLog	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/ChangeLog	2018-08-28 00:28:50 UTC (rev 235414)
@@ -1,3 +1,46 @@
+2018-08-27  Wenson Hsieh  <wenson_hs...@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  <achristen...@webkit.org>
 
         NetworkLoad::didReceiveResponse should pass its completion handler to its client

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (235413 => 235414)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2018-08-28 00:28:50 UTC (rev 235414)
@@ -377,7 +377,6 @@
         '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>'],

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (235413 => 235414)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2018-08-28 00:28:50 UTC (rev 235414)
@@ -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>

Modified: trunk/Source/WebKit/UIProcess/API/APIAttachment.cpp (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/API/APIAttachment.cpp	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/API/APIAttachment.cpp	2018-08-28 00:28:50 UTC (rev 235414)
@@ -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 @@
 {
 }
 
-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) {

Modified: trunk/Source/WebKit/UIProcess/API/APIAttachment.h (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/API/APIAttachment.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/API/APIAttachment.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -38,7 +38,6 @@
 
 namespace WebCore {
 class SharedBuffer;
-struct AttachmentDisplayOptions;
 }
 
 namespace WebKit {
@@ -55,7 +54,6 @@
     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();

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-08-28 00:28:50 UTC (rev 235414)
@@ -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 @@
 
 - (_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);
     });

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -182,7 +182,8 @@
 @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.

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.h (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -54,7 +54,6 @@
 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));

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm	2018-08-28 00:28:50 UTC (rev 235414)
@@ -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 InvalidAttachmentErrorCode = 2;
 
 @implementation _WKAttachmentDisplayOptions : NSObject
-
-- (WebCore::AttachmentDisplayOptions)coreDisplayOptions
-{
-    return { };
-}
-
 @end
 
 @implementation _WKAttachmentInfo {
@@ -131,25 +124,6 @@
     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()) {

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAttachmentInternal.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -34,10 +34,6 @@
 
 }
 
-@interface _WKAttachmentDisplayOptions ()
-@property (nonatomic, readonly) WebCore::AttachmentDisplayOptions coreDisplayOptions;
-@end
-
 @interface _WKAttachment () <WKObject> {
 @package
     API::ObjectStorage<API::Attachment> _attachment;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-08-28 00:28:50 UTC (rev 235414)
@@ -122,7 +122,6 @@
 #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 @@
     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 @@
 
     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()) {

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (235413 => 235414)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -196,12 +196,6 @@
 using FloatBoxExtent = RectEdges<float>;
 }
 
-#if ENABLE(ATTACHMENT_ELEMENT)
-namespace WebCore {
-struct AttachmentDisplayOptions;
-}
-#endif
-
 #if PLATFORM(GTK)
 typedef GtkWidget* PlatformWidget;
 #endif
@@ -1319,8 +1313,7 @@
 
 #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
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (235413 => 235414)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-08-28 00:28:50 UTC (rev 235414)
@@ -6066,18 +6066,13 @@
 
 #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);
+    frame.editor().insertAttachment(identifier, WTFMove(fileSize), fileName, contentType);
     send(Messages::WebPageProxy::VoidCallback(callbackID));
 }
 
-void WebPage::setAttachmentDisplayOptions(const String&, const AttachmentDisplayOptions&, CallbackID callbackID)
-{
-    send(Messages::WebPageProxy::VoidCallback(callbackID));
-}
-
 void WebPage::updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, std::optional<String>&& newFilename, CallbackID callbackID)
 {
     if (auto attachment = attachmentElementWithIdentifier(identifier)) {

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (235413 => 235414)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-08-28 00:28:50 UTC (rev 235414)
@@ -172,11 +172,8 @@
 struct TextCheckingResult;
 struct ViewportArguments;
 
-
-
 #if ENABLE(ATTACHMENT_ELEMENT)
 class HTMLAttachmentElement;
-struct AttachmentDisplayOptions;
 #endif
 }
 
@@ -1075,8 +1072,7 @@
 #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
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (235413 => 235414)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2018-08-28 00:28:50 UTC (rev 235414)
@@ -510,8 +510,7 @@
 #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
 

Modified: trunk/Tools/ChangeLog (235413 => 235414)


--- trunk/Tools/ChangeLog	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Tools/ChangeLog	2018-08-28 00:28:50 UTC (rev 235414)
@@ -1,3 +1,17 @@
+2018-08-27  Wenson Hsieh  <wenson_hs...@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.fra...@apple.com>
 
         Teach WebKitTestRunner and DumpRenderTree about detecting world leaks

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm (235413 => 235414)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2018-08-28 00:26:41 UTC (rev 235413)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2018-08-28 00:28:50 UTC (rev 235414)
@@ -261,7 +261,7 @@
 - (_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 @@
     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 @@
 
 @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;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to