WebKit Bugzilla
Attachment 347148 Details for
Bug 188596
: [Attachment SPI] Remove attachment display mode options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188596-20180814212651.patch (text/plain), 50.72 KB, created by
Wenson Hsieh
on 2018-08-14 21:26:52 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-08-14 21:26:52 PDT
Size:
50.72 KB
patch
obsolete
>Subversion Revision: 234863 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6c0bbbdc87ccde7234632cbb415ca9bed1797c8e..5be3fc9163210e86755a2d34cea257f9d3da4b6c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,56 @@ >+2018-08-14 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [Attachment SPI] Remove attachment display mode options >+ https://bugs.webkit.org/show_bug.cgi?id=188596 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove the ability to specify an "in-place" or "icon" representation for attachment elements, as well as logic >+ needed to allow an attachment element to render image or video elements in a shadow root. The requirements that >+ initially drove this effort are obviated by r227068, which allows Mail to intercept and provide a custom scheme >+ for images inserted into the document via rich editing operations. >+ >+ Removed some existing API tests in _WKAttachmentTests that exercised this functionality. >+ >+ * editing/Editor.cpp: >+ (WebCore::Editor::insertAttachmentFromFile): >+ * editing/cocoa/WebContentReaderCocoa.mm: >+ (WebCore::createFragmentForImageAttachment): >+ (WebCore::replaceRichContentWithAttachments): >+ * html/AttachmentTypes.h: >+ (WebCore::AttachmentDisplayOptions::encode const): >+ (WebCore::AttachmentDisplayOptions::decode): >+ >+ Remove logic for encoding the attachment display mode. While this leaves AttachmentDisplayOptions completely >+ empty, I haven't removed AttachmentDisplayOptions as well in this patch, since it's not clear that we won't be >+ needing any mechanism for influencing the display of attachment elements inserted via native SPI. >+ >+ (): Deleted. >+ * html/HTMLAttachmentElement.cpp: >+ (WebCore::HTMLAttachmentElement::createElementRenderer): >+ (WebCore::HTMLAttachmentElement::setFile): >+ (WebCore::HTMLAttachmentElement::parseAttribute): >+ (WebCore::HTMLAttachmentElement::invalidateShadowRootChildrenIfNecessary): Deleted. >+ (WebCore::HTMLAttachmentElement::attachmentRenderer const): Deleted. >+ (WebCore::HTMLAttachmentElement::updateDisplayMode): Deleted. >+ (WebCore::HTMLAttachmentElement::ensureInnerImage): Deleted. >+ (WebCore::HTMLAttachmentElement::ensureInnerVideo): Deleted. >+ (WebCore::HTMLAttachmentElement::innerImage const): Deleted. >+ (WebCore::HTMLAttachmentElement::innerVideo const): Deleted. >+ (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary): Deleted. >+ >+ Remove logic for building the shadow root to house inline media elements. >+ >+ * html/HTMLAttachmentElement.h: >+ >+ The renderer of the attachment element is once again always a `RenderAttachment`, so we can remove >+ `attachmentRenderer()` altogether and revert to overriding `renderer()` to return a `RenderAttachment*`. >+ >+ * page/DragController.cpp: >+ (WebCore::DragController::startDrag): >+ * rendering/RenderAttachment.h: >+ (WebCore::HTMLAttachmentElement::renderer const): >+ > 2018-08-14 Alex Christensen <achristensen@webkit.org> > > Use a Variant instead of a union in CSSSelector >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 33b11eb01641aa739a1272e7b108659d07540366..e5ab13183f190ab0cd98a8b36fba1a0e760a811f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2018-08-14 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [Attachment SPI] Remove attachment display mode options >+ https://bugs.webkit.org/show_bug.cgi?id=188596 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove attachment display mode from WebKit. Note that _WKAttachmentDisplayOptions needs to remain in the private >+ header for source compatibility with Mail. >+ >+ * UIProcess/API/Cocoa/_WKAttachment.mm: >+ (-[_WKAttachmentDisplayOptions coreDisplayOptions]): Deleted. >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::setAttachmentDisplayOptions): >+ > 2018-08-14 Antti Koivisto <antti@apple.com> > > RemoteLayerTreeTransaction should use OptionSet for change flags >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index 1bac7f4e36df365eb2ef2b7280cc842442a94aea..7d26c5636be31ef36b713f07780431a649d4e055 100644 >--- a/Source/WebCore/editing/Editor.cpp >+++ b/Source/WebCore/editing/Editor.cpp >@@ -3873,7 +3873,7 @@ void Editor::insertAttachment(const String& identifier, const AttachmentDisplayO > insertAttachmentFromFile(identifier, options, filename, *contentType, File::create(Blob::create(WTFMove(data), *contentType), filename)); > } > >-void Editor::insertAttachmentFromFile(const String& identifier, const AttachmentDisplayOptions& options, const String& filename, const String& contentType, Ref<File>&& file) >+void Editor::insertAttachmentFromFile(const String& identifier, const AttachmentDisplayOptions&, const String& filename, const String& contentType, Ref<File>&& file) > { > auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document()); > attachment->setAttribute(HTMLNames::titleAttr, filename); >@@ -3881,7 +3881,6 @@ void Editor::insertAttachmentFromFile(const String& identifier, const Attachment > attachment->setAttribute(HTMLNames::typeAttr, contentType); > attachment->setUniqueIdentifier(identifier); > attachment->setFile(WTFMove(file)); >- attachment->updateDisplayMode(options.mode); > > auto fragmentToInsert = document().createDocumentFragment(); > fragmentToInsert->appendChild(attachment.get()); >diff --git a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >index 97285587be206f94abba8b7011d3dd626a34a80d..1cb2b1ce6adca4656117cda274b0811d3188b459 100644 >--- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >+++ b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >@@ -209,7 +209,6 @@ static Ref<DocumentFragment> createFragmentForImageAttachment(Document& document > #if ENABLE(ATTACHMENT_ELEMENT) > auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document); > attachment->setFile(File::create(blob, AtomicString("image")), HTMLAttachmentElement::UpdateDisplayAttributes::Yes); >- attachment->updateDisplayMode(AttachmentDisplayMode::InPlace); > > auto fragment = document.createDocumentFragment(); > fragment->appendChild(attachment); >@@ -225,7 +224,6 @@ static void replaceRichContentWithAttachments(DocumentFragment& fragment, const > { > #if ENABLE(ATTACHMENT_ELEMENT) > struct AttachmentReplacementInfo { >- AttachmentDisplayMode displayMode; > Ref<File> file; > Ref<Element> elementToReplace; > }; >@@ -257,7 +255,7 @@ static void replaceRichContentWithAttachments(DocumentFragment& fragment, const > if (title.isEmpty()) > title = AtomicString("media"); > >- attachmentReplacementInfo.append({ AttachmentDisplayMode::InPlace, File::create(*blob, title), image }); >+ attachmentReplacementInfo.append({ File::create(*blob, title), image }); > } > > for (auto& object : descendantsOfType<HTMLObjectElement>(fragment)) { >@@ -277,7 +275,7 @@ static void replaceRichContentWithAttachments(DocumentFragment& fragment, const > if (title.isEmpty()) > title = AtomicString("file"); > >- attachmentReplacementInfo.append({ AttachmentDisplayMode::AsIcon, File::create(*blob, title), object }); >+ attachmentReplacementInfo.append({ File::create(*blob, title), object }); > } > > for (auto& info : attachmentReplacementInfo) { >@@ -289,7 +287,6 @@ static void replaceRichContentWithAttachments(DocumentFragment& fragment, const > > auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, fragment.document()); > attachment->setFile(WTFMove(file), HTMLAttachmentElement::UpdateDisplayAttributes::Yes); >- attachment->updateDisplayMode(info.displayMode); > parent->replaceChild(attachment, elementToReplace); > } > >diff --git a/Source/WebCore/html/AttachmentTypes.h b/Source/WebCore/html/AttachmentTypes.h >index 88c1817eaf04cf1cc16467f6a1776cfd7dc1420b..b5077ca4082217550e1bf5cb74285cc4a43ee6cc 100644 >--- a/Source/WebCore/html/AttachmentTypes.h >+++ b/Source/WebCore/html/AttachmentTypes.h >@@ -34,31 +34,20 @@ namespace WebCore { > > class SharedBuffer; > >-enum class AttachmentDisplayMode { >- Auto, >- InPlace, >- AsIcon >-}; >- > struct AttachmentDisplayOptions { >- AttachmentDisplayMode mode { AttachmentDisplayMode::Auto }; >- > 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 > { >- encoder.encodeEnum(mode); >+ UNUSED_PARAM(encoder); > } > > template<class Decoder> inline std::optional<AttachmentDisplayOptions> AttachmentDisplayOptions::decode(Decoder& decoder) > { >- AttachmentDisplayMode mode; >- if (!decoder.decodeEnum(mode)) >- return std::nullopt; >- >- return {{ mode }}; >+ UNUSED_PARAM(decoder); >+ return AttachmentDisplayOptions(); > } > > struct AttachmentInfo { >diff --git a/Source/WebCore/html/HTMLAttachmentElement.cpp b/Source/WebCore/html/HTMLAttachmentElement.cpp >index fe7dd533a22b8b3a7c37ee3fec13f24ed48b400a..e1719cd11f666035bd804db3b97b2f336a00f306 100644 >--- a/Source/WebCore/html/HTMLAttachmentElement.cpp >+++ b/Source/WebCore/html/HTMLAttachmentElement.cpp >@@ -35,21 +35,12 @@ > #include "FileReaderLoader.h" > #include "FileReaderLoaderClient.h" > #include "Frame.h" >-#include "HTMLImageElement.h" > #include "HTMLNames.h" >-#include "HTMLVideoElement.h" >-#include "MIMETypeRegistry.h" > #include "RenderAttachment.h" >-#include "RenderBlockFlow.h" >-#include "ShadowRoot.h" > #include "SharedBuffer.h" > #include <pal/FileSizeFormatter.h> > #include <wtf/IsoMallocInlines.h> > >-#if PLATFORM(COCOA) >-#include "UTIUtilities.h" >-#endif >- > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(HTMLAttachmentElement); >@@ -101,11 +92,6 @@ Ref<HTMLAttachmentElement> HTMLAttachmentElement::create(const QualifiedName& ta > > RenderPtr<RenderElement> HTMLAttachmentElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) > { >- if (!style.hasAppearance()) { >- // If this attachment element doesn't have an appearance, defer rendering to child elements. >- return createRenderer<RenderBlockFlow>(*this, WTFMove(style)); >- } >- > return createRenderer<RenderAttachment>(*this, WTFMove(style)); > } > >@@ -135,29 +121,8 @@ void HTMLAttachmentElement::setFile(RefPtr<File>&& file, UpdateDisplayAttributes > } > } > >- if (auto* renderAttachment = attachmentRenderer()) >- renderAttachment->invalidate(); >- >- invalidateShadowRootChildrenIfNecessary(); >- populateShadowRootIfNecessary(); >-} >- >-void HTMLAttachmentElement::invalidateShadowRootChildrenIfNecessary() >-{ >- if (auto image = innerImage()) { >- image->setAttributeWithoutSynchronization(srcAttr, emptyString()); >- image->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true); >- } >- if (auto video = innerVideo()) { >- video->setAttributeWithoutSynchronization(srcAttr, emptyString()); >- video->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true); >- } >-} >- >-RenderAttachment* HTMLAttachmentElement::attachmentRenderer() const >-{ >- auto* renderer = this->renderer(); >- return is<RenderAttachment>(renderer) ? downcast<RenderAttachment>(renderer) : nullptr; >+ if (auto* renderer = this->renderer()) >+ renderer->invalidate(); > } > > Node::InsertedIntoAncestorResult HTMLAttachmentElement::insertedIntoAncestor(InsertionType type, ContainerNode& ancestor) >@@ -178,8 +143,8 @@ void HTMLAttachmentElement::removedFromAncestor(RemovalType type, ContainerNode& > void HTMLAttachmentElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == progressAttr || name == subtitleAttr || name == titleAttr || name == typeAttr) { >- if (auto* renderAttachment = attachmentRenderer()) >- renderAttachment->invalidate(); >+ if (auto* renderer = this->renderer()) >+ renderer->invalidate(); > } > > HTMLElement::parseAttribute(name, value); >@@ -203,28 +168,6 @@ String HTMLAttachmentElement::attachmentPath() const > return attributeWithoutSynchronization(webkitattachmentpathAttr); > } > >-void HTMLAttachmentElement::updateDisplayMode(AttachmentDisplayMode mode) >-{ >- mode = mode == AttachmentDisplayMode::Auto ? defaultDisplayMode() : mode; >- >- switch (mode) { >- case AttachmentDisplayMode::InPlace: >- populateShadowRootIfNecessary(); >- setInlineStyleProperty(CSSPropertyWebkitAppearance, CSSValueNone, true); >- setInlineStyleProperty(CSSPropertyDisplay, CSSValueInlineBlock, true); >- break; >- case AttachmentDisplayMode::AsIcon: >- removeInlineStyleProperty(CSSPropertyWebkitAppearance); >- removeInlineStyleProperty(CSSPropertyDisplay); >- break; >- default: >- ASSERT_NOT_REACHED(); >- break; >- } >- >- invalidateStyleAndRenderersForSubtree(); >-} >- > void HTMLAttachmentElement::updateFileWithData(Ref<SharedBuffer>&& data, std::optional<String>&& newContentType, std::optional<String>&& newFilename) > { > auto filename = newFilename ? *newFilename : attachmentTitle(); >@@ -233,75 +176,6 @@ void HTMLAttachmentElement::updateFileWithData(Ref<SharedBuffer>&& data, std::op > setFile(WTFMove(file), UpdateDisplayAttributes::Yes); > } > >-Ref<HTMLImageElement> HTMLAttachmentElement::ensureInnerImage() >-{ >- if (auto image = innerImage()) >- return *image; >- >- auto image = HTMLImageElement::create(document()); >- ensureUserAgentShadowRoot().appendChild(image); >- return image; >-} >- >-Ref<HTMLVideoElement> HTMLAttachmentElement::ensureInnerVideo() >-{ >- if (auto video = innerVideo()) >- return *video; >- >- auto video = HTMLVideoElement::create(document()); >- ensureUserAgentShadowRoot().appendChild(video); >- return video; >-} >- >-RefPtr<HTMLImageElement> HTMLAttachmentElement::innerImage() const >-{ >- if (auto root = userAgentShadowRoot()) >- return childrenOfType<HTMLImageElement>(*root).first(); >- return nullptr; >-} >- >-RefPtr<HTMLVideoElement> HTMLAttachmentElement::innerVideo() const >-{ >- if (auto root = userAgentShadowRoot()) >- return childrenOfType<HTMLVideoElement>(*root).first(); >- return nullptr; >-} >- >-void HTMLAttachmentElement::populateShadowRootIfNecessary() >-{ >- if (!m_file) >- return; >- >- auto mimeType = attachmentType(); >- >-#if PLATFORM(COCOA) >- if (isDeclaredUTI(mimeType)) >- mimeType = MIMETypeFromUTI(mimeType); >-#endif >- >- if (mimeType.isEmpty()) >- return; >- >- if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType) || MIMETypeRegistry::isPDFMIMEType(mimeType)) { >- auto image = ensureInnerImage(); >- if (image->attributeWithoutSynchronization(srcAttr).isEmpty()) { >- image->setAttributeWithoutSynchronization(srcAttr, DOMURL::createObjectURL(document(), *m_file)); >- image->setAttributeWithoutSynchronization(draggableAttr, AtomicString("false")); >- image->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline, true); >- image->setInlineStyleProperty(CSSPropertyMaxWidth, 100, CSSPrimitiveValue::UnitType::CSS_PERCENTAGE, true); >- } >- >- } else if (MIMETypeRegistry::isSupportedMediaMIMEType(mimeType)) { >- auto video = ensureInnerVideo(); >- if (video->attributeWithoutSynchronization(srcAttr).isEmpty()) { >- video->setAttributeWithoutSynchronization(srcAttr, DOMURL::createObjectURL(document(), *m_file)); >- video->setAttributeWithoutSynchronization(controlsAttr, emptyString()); >- video->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline, true); >- video->setInlineStyleProperty(CSSPropertyMaxWidth, 100, CSSPrimitiveValue::UnitType::CSS_PERCENTAGE, true); >- } >- } >-} >- > void HTMLAttachmentElement::requestInfo(Function<void(const AttachmentInfo&)>&& callback) > { > if (!m_file) { >diff --git a/Source/WebCore/html/HTMLAttachmentElement.h b/Source/WebCore/html/HTMLAttachmentElement.h >index 2367e8e372a05d3b389e07c8bbf52134cbfb2767..14fc84bd9a5790160d0b87af33fd9849c4c9a93f 100644 >--- a/Source/WebCore/html/HTMLAttachmentElement.h >+++ b/Source/WebCore/html/HTMLAttachmentElement.h >@@ -53,7 +53,6 @@ public: > String uniqueIdentifier() const { return m_uniqueIdentifier; } > void setUniqueIdentifier(const String& uniqueIdentifier) { m_uniqueIdentifier = uniqueIdentifier; } > >- WEBCORE_EXPORT void updateDisplayMode(AttachmentDisplayMode); > WEBCORE_EXPORT void updateFileWithData(Ref<SharedBuffer>&& data, std::optional<String>&& newContentType = std::nullopt, std::optional<String>&& newFilename = std::nullopt); > > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; >@@ -63,7 +62,7 @@ public: > String attachmentType() const; > String attachmentPath() const; > >- RenderAttachment* attachmentRenderer() const; >+ RenderAttachment* renderer() const; > > WEBCORE_EXPORT void requestInfo(Function<void(const AttachmentInfo&)>&& callback); > void destroyReader(AttachmentDataReader&); >@@ -73,22 +72,6 @@ private: > virtual ~HTMLAttachmentElement(); > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >- Ref<HTMLImageElement> ensureInnerImage(); >- Ref<HTMLVideoElement> ensureInnerVideo(); >- RefPtr<HTMLImageElement> innerImage() const; >- RefPtr<HTMLVideoElement> innerVideo() const; >- >- void populateShadowRootIfNecessary(); >- void invalidateShadowRootChildrenIfNecessary(); >- >- AttachmentDisplayMode defaultDisplayMode() const >- { >- // FIXME: For now, all attachment elements automatically display using a file icon. >- // In a followup patch, we'll change the default behavior to use in-place presentation >- // for certain image MIME types. >- return AttachmentDisplayMode::AsIcon; >- } >- > bool shouldSelectOnMouseDown() final { > #if PLATFORM(IOS) > return false; >diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp >index 6c49e66983452dfdd8d7064dda461290f559a2a7..7b503beb2cbbecd248117385861c79e741b47f6f 100644 >--- a/Source/WebCore/page/DragController.cpp >+++ b/Source/WebCore/page/DragController.cpp >@@ -1088,7 +1088,7 @@ bool DragController::startDrag(Frame& src, const DragState& state, DragOperation > #if ENABLE(ATTACHMENT_ELEMENT) > if (is<HTMLAttachmentElement>(element) && m_dragSourceAction & DragSourceActionAttachment) { > auto& attachment = downcast<HTMLAttachmentElement>(element); >- auto* attachmentRenderer = attachment.attachmentRenderer(); >+ auto* attachmentRenderer = attachment.renderer(); > > src.editor().setIgnoreSelectionChanges(true); > auto previousSelection = src.selection().selection(); >diff --git a/Source/WebCore/rendering/RenderAttachment.h b/Source/WebCore/rendering/RenderAttachment.h >index 8ddec5d61a792f1423f13e43fbbcb95a4265cf56..4caae03709d9ca4647e9806f0cc36f2779dd1a2a 100644 >--- a/Source/WebCore/rendering/RenderAttachment.h >+++ b/Source/WebCore/rendering/RenderAttachment.h >@@ -59,6 +59,11 @@ private: > bool m_shouldDrawBorder { true }; > }; > >+inline RenderAttachment* HTMLAttachmentElement::renderer() const >+{ >+ return downcast<RenderAttachment>(HTMLElement::renderer()); >+} >+ > } // namespace WebCore > > SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderAttachment, isAttachment()) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm >index 2de500ce92c6f80c84116d2b6d89e20bdf87d1f6..5f00c8cee2a3f5cd615a886ca57a1afb272a741d 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm >@@ -39,32 +39,9 @@ using namespace WebKit; > > @implementation _WKAttachmentDisplayOptions : NSObject > >-- (instancetype)init >-{ >- if (self = [super init]) >- _mode = _WKAttachmentDisplayModeAuto; >- >- return self; >-} >- > - (WebCore::AttachmentDisplayOptions)coreDisplayOptions > { >- WebCore::AttachmentDisplayMode mode; >- switch (self.mode) { >- case _WKAttachmentDisplayModeAuto: >- mode = WebCore::AttachmentDisplayMode::Auto; >- break; >- case _WKAttachmentDisplayModeAsIcon: >- mode = WebCore::AttachmentDisplayMode::AsIcon; >- break; >- case _WKAttachmentDisplayModeInPlace: >- mode = WebCore::AttachmentDisplayMode::InPlace; >- break; >- default: >- ASSERT_NOT_REACHED(); >- mode = WebCore::AttachmentDisplayMode::Auto; >- } >- return { mode }; >+ return { }; > } > > @end >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index d6b96556866d98560b0b2ef4e3da85e5573933ea..51143a32db4099e6fff5a58c04b5a0f7784778e2 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -6105,12 +6105,8 @@ void WebPage::requestAttachmentInfo(const String& identifier, CallbackID callbac > }); > } > >-void WebPage::setAttachmentDisplayOptions(const String& identifier, const AttachmentDisplayOptions& options, CallbackID callbackID) >+void WebPage::setAttachmentDisplayOptions(const String&, const AttachmentDisplayOptions&, CallbackID callbackID) > { >- if (auto attachment = attachmentElementWithIdentifier(identifier)) { >- attachment->document().updateLayout(); >- attachment->updateDisplayMode(options.mode); >- } > send(Messages::WebPageProxy::VoidCallback(callbackID)); > } > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 052c175006f65757655e5979303d3fc18d2c7fc7..55cc8e27562bc9f7e7cbd9876c95c61beee96f91 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,19 @@ >+2018-08-14 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [Attachment SPI] Remove attachment display mode options >+ https://bugs.webkit.org/show_bug.cgi?id=188596 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove API tests and API test helpers for verifying the behavior of in-place media attachment elements. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: >+ (-[TestWKWebView synchronouslyInsertAttachmentWithFilename:contentType:data:]): >+ (TestWebKitAPI::TEST): >+ (testVideoData): Deleted. >+ (displayOptionsWithMode): Deleted. >+ (-[TestWKWebView synchronouslyInsertAttachmentWithFilename:contentType:data:options:]): Deleted. >+ > 2018-08-14 Fujii Hironori <Hironori.Fujii@sony.com> > > [webkitpy][Win] LayoutTests: test names should be Unix style, separated by slash not backslash >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >index d8f56bd37279b63cf4b8532ffe8423cab7abfb2c..2f7c50369d1f2e9dd8f9803f88f1353c52a33948 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >@@ -188,12 +188,6 @@ static NSData *testImageData() > return [NSData dataWithContentsOfURL:testImageFileURL()]; > } > >-static NSData *testVideoData() >-{ >- NSURL *url = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"mp4" subdirectory:@"TestWebKitAPI.resources"]; >- return [NSData dataWithContentsOfURL:url]; >-} >- > static NSURL *testPDFFileURL() > { > return [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"pdf" subdirectory:@"TestWebKitAPI.resources"]; >@@ -204,13 +198,6 @@ static NSData *testPDFData() > return [NSData dataWithContentsOfURL:testPDFFileURL()]; > } > >-static _WKAttachmentDisplayOptions *displayOptionsWithMode(_WKAttachmentDisplayMode mode) >-{ >- _WKAttachmentDisplayOptions *options = [[[_WKAttachmentDisplayOptions alloc] init] autorelease]; >- options.mode = mode; >- return options; >-} >- > @implementation TestWKWebView (AttachmentTesting) > > - (NSArray<NSString *> *)tagsInBody >@@ -250,10 +237,10 @@ static _WKAttachmentDisplayOptions *displayOptionsWithMode(_WKAttachmentDisplayM > return success; > } > >-- (_WKAttachment *)synchronouslyInsertAttachmentWithFilename:(NSString *)filename contentType:(NSString *)contentType data:(NSData *)data options:(_WKAttachmentDisplayOptions *)options >+- (_WKAttachment *)synchronouslyInsertAttachmentWithFilename:(NSString *)filename contentType:(NSString *)contentType data:(NSData *)data > { > __block bool done = false; >- RetainPtr<_WKAttachment> attachment = [self _insertAttachmentWithFilename:filename contentType:contentType data:data options:options completion:^(BOOL) { >+ RetainPtr<_WKAttachment> attachment = [self _insertAttachmentWithFilename:filename contentType:contentType data:data options:nil completion:^(BOOL) { > done = true; > }]; > TestWebKitAPI::Util::run(&done); >@@ -505,7 +492,7 @@ TEST(WKAttachmentTests, AttachmentElementInsertion) > { > ObserveAttachmentUpdatesForScope observer(webView.get()); > // Use the given content type for the attachment element's type. >- firstAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo" contentType:@"text/html" data:testHTMLData() options:nil]; >+ firstAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo" contentType:@"text/html" data:testHTMLData()]; > EXPECT_WK_STREQ(@"foo", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); > EXPECT_WK_STREQ(@"text/html", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); > EXPECT_WK_STREQ(@"38 bytes", [webView valueOfAttribute:@"subtitle" forQuerySelector:@"attachment"]); >@@ -522,7 +509,7 @@ TEST(WKAttachmentTests, AttachmentElementInsertion) > ObserveAttachmentUpdatesForScope scope(webView.get()); > // Since no content type is explicitly specified, compute it from the file extension. > [webView _executeEditCommand:@"DeleteBackward" argument:nil completion:nil]; >- secondAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"bar.png" contentType:nil data:testImageData() options:nil]; >+ secondAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"bar.png" contentType:nil data:testImageData()]; > EXPECT_WK_STREQ(@"bar.png", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); > EXPECT_WK_STREQ(@"image/png", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); > EXPECT_WK_STREQ(@"37 KB", [webView valueOfAttribute:@"subtitle" forQuerySelector:@"attachment"]); >@@ -542,7 +529,7 @@ TEST(WKAttachmentTests, AttachmentUpdatesWhenInsertingAndDeletingNewline) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData() options:nil]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData()]; > observer.expectAttachmentUpdates(@[ ], @[attachment.get()]); > } > [webView expectUpdatesAfterCommand:@"InsertParagraph" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]]; >@@ -569,7 +556,7 @@ TEST(WKAttachmentTests, AttachmentUpdatesWhenUndoingAndRedoing) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData() options:nil]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData()]; > observer.expectAttachmentUpdates(@[ ], @[attachment.get()]); > } > [webView expectUpdatesAfterCommand:@"Undo" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]]; >@@ -595,7 +582,7 @@ TEST(WKAttachmentTests, AttachmentUpdatesWhenChangingFontStyles) > [webView _synchronouslyExecuteEditCommand:@"InsertText" argument:@"Hello"]; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData() options:nil]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData()]; > observer.expectAttachmentUpdates(@[ ], @[attachment.get()]); > } > [webView expectUpdatesAfterCommand:@"InsertText" withArgument:@"World" expectedRemovals:@[] expectedInsertions:@[]]; >@@ -619,7 +606,7 @@ TEST(WKAttachmentTests, AttachmentUpdatesWhenInsertingLists) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData() options:nil]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData()]; > observer.expectAttachmentUpdates(@[ ], @[attachment.get()]); > } > [webView expectUpdatesAfterCommand:@"InsertOrderedList" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]]; >@@ -663,7 +650,7 @@ TEST(WKAttachmentTests, AttachmentUpdatesWhenCuttingAndPasting) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData() options:nil]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:testHTMLData()]; > observer.expectAttachmentUpdates(@[], @[attachment.get()]); > } > [attachment expectRequestedDataToBe:testHTMLData()]; >@@ -692,7 +679,7 @@ TEST(WKAttachmentTests, AttachmentDataForEmptyFile) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"empty.txt" contentType:@"text/plain" data:[NSData data] options:nil]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"empty.txt" contentType:@"text/plain" data:[NSData data]]; > observer.expectAttachmentUpdates(@[], @[attachment.get()]); > } > [attachment expectRequestedDataToBe:[NSData data]]; >@@ -705,20 +692,6 @@ TEST(WKAttachmentTests, AttachmentDataForEmptyFile) > [attachment expectRequestedDataToBe:nil]; > } > >-TEST(WKAttachmentTests, InsertedImageSizeIsClampedByMaxWidth) >-{ >- auto webView = webViewForTestingAttachments(CGSizeMake(100, 100)); >- RetainPtr<NSData> imageData = testImageData(); >- RetainPtr<_WKAttachment> attachment; >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"icon.png" contentType:@"image/png" data:imageData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]; >- [attachment expectRequestedDataToBe:imageData.get()]; >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- } >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(84, 67)]; >-} >- > TEST(WKAttachmentTests, MultipleSimultaneousAttachmentDataRequests) > { > auto webView = webViewForTestingAttachments(); >@@ -726,7 +699,7 @@ TEST(WKAttachmentTests, MultipleSimultaneousAttachmentDataRequests) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:htmlData.get() options:nil]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:htmlData.get()]; > observer.expectAttachmentUpdates(@[], @[attachment.get()]); > } > __block RetainPtr<NSData> dataForFirstRequest; >@@ -748,97 +721,6 @@ TEST(WKAttachmentTests, MultipleSimultaneousAttachmentDataRequests) > EXPECT_TRUE([dataForSecondRequest isEqualToData:htmlData.get()]); > } > >-TEST(WKAttachmentTests, InPlaceImageAttachmentToggleDisplayMode) >-{ >- auto webView = webViewForTestingAttachments(); >- RetainPtr<NSData> imageData = testImageData(); >- RetainPtr<_WKAttachment> attachment; >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"icon.png" contentType:@"image/png" data:imageData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon)]; >- [attachment expectRequestedDataToBe:imageData.get()]; >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- } >- CGSize iconAttachmentSize = [webView attachmentElementSize]; >- >- [attachment synchronouslySetDisplayOptions:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace) error:nil]; >- [attachment expectRequestedDataToBe:imageData.get()]; >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)]; >- >- [attachment synchronouslySetDisplayOptions:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon) error:nil]; >- [attachment expectRequestedDataToBe:imageData.get()]; >- [webView waitForAttachmentElementSizeToBecome:iconAttachmentSize]; >- >- [attachment synchronouslySetDisplayOptions:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace) error:nil]; >- [attachment expectRequestedDataToBe:imageData.get()]; >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)]; >-} >- >-TEST(WKAttachmentTests, InPlaceImageAttachmentParagraphInsertion) >-{ >- auto webView = webViewForTestingAttachments(); >- RetainPtr<NSData> imageData = testImageData(); >- RetainPtr<_WKAttachment> attachment; >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"icon.png" contentType:@"image/png" data:imageData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]; >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- } >- [webView expectUpdatesAfterCommand:@"InsertParagraph" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]]; >- [webView expectUpdatesAfterCommand:@"DeleteBackward" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]]; >- [webView stringByEvaluatingJavaScript:@"getSelection().collapse(document.body)"]; >- [webView expectUpdatesAfterCommand:@"InsertParagraph" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]]; >- [webView expectUpdatesAfterCommand:@"DeleteBackward" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]]; >- >- [attachment expectRequestedDataToBe:imageData.get()]; >- EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]); >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)]; >- >- [webView expectUpdatesAfterCommand:@"DeleteForward" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]]; >-} >- >-TEST(WKAttachmentTests, InPlaceVideoAttachmentInsertionWithinList) >-{ >- auto webView = webViewForTestingAttachments(); >- RetainPtr<NSData> videoData = testVideoData(); >- RetainPtr<_WKAttachment> attachment; >- >- [webView _synchronouslyExecuteEditCommand:@"InsertOrderedList" argument:nil]; >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"test.mp4" contentType:@"video/mp4" data:videoData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]; >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- } >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(320, 240)]; >- >- [webView expectUpdatesAfterCommand:@"DeleteBackward" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]]; >- [webView expectUpdatesAfterCommand:@"Undo" withArgument:nil expectedRemovals:@[] expectedInsertions:@[attachment.get()]]; >- [webView expectUpdatesAfterCommand:@"InsertOrderedList" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]]; >- >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(320, 240)]; >- [attachment expectRequestedDataToBe:videoData.get()]; >-} >- >-TEST(WKAttachmentTests, InPlacePDFAttachmentCutAndPaste) >-{ >- auto webView = webViewForTestingAttachments(); >- RetainPtr<NSData> pdfData = testPDFData(); >- RetainPtr<_WKAttachment> attachment; >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"test.pdf" contentType:@"application/pdf" data:pdfData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]; >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(130, 29)]; >- } >- >- [webView _synchronouslyExecuteEditCommand:@"SelectAll" argument:nil]; >- [webView expectUpdatesAfterCommand:@"Cut" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]]; >- >- [webView expectUpdatesAfterCommand:@"Paste" withArgument:nil expectedRemovals:@[] expectedInsertions:@[attachment.get()]]; >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(130, 29)]; >- [attachment expectRequestedDataToBe:pdfData.get()]; >-} >- > TEST(WKAttachmentTests, ChangeAttachmentDataAndFileInformation) > { > auto webView = webViewForTestingAttachments(); >@@ -846,7 +728,7 @@ TEST(WKAttachmentTests, ChangeAttachmentDataAndFileInformation) > { > RetainPtr<NSData> pdfData = testPDFData(); > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"test.pdf" contentType:@"application/pdf" data:pdfData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon)]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"test.pdf" contentType:@"application/pdf" data:pdfData.get()]; > [attachment expectRequestedDataToBe:pdfData.get()]; > EXPECT_WK_STREQ(@"test.pdf", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); > EXPECT_WK_STREQ(@"application/pdf", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); >@@ -864,7 +746,6 @@ TEST(WKAttachmentTests, ChangeAttachmentDataAndFileInformation) > { > RetainPtr<NSData> textData = testHTMLData(); > ObserveAttachmentUpdatesForScope observer(webView.get()); >- [attachment synchronouslySetDisplayOptions:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon) error:nil]; > // The new content type should be inferred from the file name. > [attachment synchronouslySetData:textData.get() newContentType:nil newFilename:@"foo.txt" error:nil]; > [attachment expectRequestedDataToBe:textData.get()]; >@@ -885,43 +766,6 @@ TEST(WKAttachmentTests, ChangeAttachmentDataAndFileInformation) > [webView expectUpdatesAfterCommand:@"DeleteBackward" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]]; > } > >-TEST(WKAttachmentTests, ChangeAttachmentDataUpdatesWithInPlaceDisplay) >-{ >- auto webView = webViewForTestingAttachments(); >- RetainPtr<_WKAttachment> attachment; >- { >- RetainPtr<NSData> pdfData = testPDFData(); >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"test.pdf" contentType:@"application/pdf" data:pdfData.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]; >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(130, 29)]; >- [attachment expectRequestedDataToBe:pdfData.get()]; >- EXPECT_WK_STREQ(@"test.pdf", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); >- EXPECT_WK_STREQ(@"application/pdf", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- } >- { >- RetainPtr<NSData> videoData = testVideoData(); >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- [attachment synchronouslySetData:videoData.get() newContentType:@"video/mp4" newFilename:@"test.mp4" error:nil]; >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(320, 240)]; >- [attachment expectRequestedDataToBe:videoData.get()]; >- EXPECT_WK_STREQ(@"test.mp4", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); >- EXPECT_WK_STREQ(@"video/mp4", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); >- observer.expectAttachmentUpdates(@[], @[]); >- } >- { >- RetainPtr<NSData> imageData = testImageData(); >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- [attachment synchronouslySetData:imageData.get() newContentType:@"image/png" newFilename:@"icon.png" error:nil]; >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)]; >- [attachment expectRequestedDataToBe:imageData.get()]; >- EXPECT_WK_STREQ(@"icon.png", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); >- EXPECT_WK_STREQ(@"image/png", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); >- observer.expectAttachmentUpdates(@[], @[]); >- } >- [webView expectUpdatesAfterCommand:@"DeleteBackward" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]]; >-} >- > TEST(WKAttachmentTests, InsertPastedImageAsAttachment) > { > platformCopyPNG(); >@@ -1054,7 +898,7 @@ TEST(WKAttachmentTests, InsertAndRemoveDuplicateAttachment) > RetainPtr<_WKAttachment> pastedAttachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- originalAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:data.get() options:nil]; >+ originalAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:data.get()]; > EXPECT_EQ(0U, observer.observer().removed.count); > observer.expectAttachmentUpdates(@[], @[originalAttachment.get()]); > } >@@ -1090,7 +934,7 @@ TEST(WKAttachmentTests, InsertDuplicateAttachmentAndUpdateData) > RetainPtr<_WKAttachment> pastedAttachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- originalAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:originalData.get() options:nil]; >+ originalAttachment = [webView synchronouslyInsertAttachmentWithFilename:@"foo.txt" contentType:@"text/plain" data:originalData.get()]; > EXPECT_EQ(0U, observer.observer().removed.count); > observer.expectAttachmentUpdates(@[], @[originalAttachment.get()]); > } >@@ -1386,7 +1230,7 @@ TEST(WKAttachmentTestsIOS, DragAttachmentInsertedAsData) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"document.pdf" contentType:@"application/pdf" data:data.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon)]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"document.pdf" contentType:@"application/pdf" data:data.get()]; > observer.expectAttachmentUpdates(@[], @[attachment.get()]); > } > >@@ -1408,34 +1252,6 @@ TEST(WKAttachmentTestsIOS, DragAttachmentInsertedAsData) > [dragAndDropSimulator endDataTransfer]; > } > >-TEST(WKAttachmentTestsIOS, DragInPlaceVideoAttachmentElement) >-{ >- auto webView = webViewForTestingAttachments(); >- auto data = retainPtr(testVideoData()); >- RetainPtr<_WKAttachment> attachment; >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"video.mp4" contentType:@"video/mp4" data:data.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]; >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- } >- >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(320, 240)]; >- [attachment expectRequestedDataToBe:data.get()]; >- EXPECT_WK_STREQ("video.mp4", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); >- EXPECT_WK_STREQ("video/mp4", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); >- >- [webView evaluateJavaScript:@"getSelection().removeAllRanges()" completionHandler:nil]; >- auto dragAndDropSimulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]); >- [dragAndDropSimulator runFrom:CGPointMake(25, 25) to:CGPointMake(-100, -100)]; >- >- EXPECT_EQ(1U, [dragAndDropSimulator sourceItemProviders].count); >- NSItemProvider *itemProvider = [dragAndDropSimulator sourceItemProviders].firstObject; >- EXPECT_EQ(UIPreferredPresentationStyleAttachment, itemProvider.preferredPresentationStyle); >- [itemProvider expectType:(NSString *)kUTTypeMPEG4 withData:data.get()]; >- EXPECT_WK_STREQ("video.mp4", [itemProvider suggestedName]); >- [dragAndDropSimulator endDataTransfer]; >-} >- > TEST(WKAttachmentTestsIOS, MoveAttachmentElementAsIconByDragging) > { > auto webView = webViewForTestingAttachments(); >@@ -1443,7 +1259,7 @@ TEST(WKAttachmentTestsIOS, MoveAttachmentElementAsIconByDragging) > RetainPtr<_WKAttachment> attachment; > { > ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"document.pdf" contentType:@"application/pdf" data:data.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeAsIcon)]; >+ attachment = [webView synchronouslyInsertAttachmentWithFilename:@"document.pdf" contentType:@"application/pdf" data:data.get()]; > observer.expectAttachmentUpdates(@[], @[attachment.get()]); > } > >@@ -1464,35 +1280,6 @@ TEST(WKAttachmentTestsIOS, MoveAttachmentElementAsIconByDragging) > [dragAndDropSimulator endDataTransfer]; > } > >-TEST(WKAttachmentTestsIOS, MoveInPlaceAttachmentElementByDragging) >-{ >- auto webView = webViewForTestingAttachments(); >- auto data = retainPtr(testImageData()); >- RetainPtr<_WKAttachment> attachment; >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- attachment = [webView synchronouslyInsertAttachmentWithFilename:@"icon.png" contentType:@"image/png" data:data.get() options:displayOptionsWithMode(_WKAttachmentDisplayModeInPlace)]; >- observer.expectAttachmentUpdates(@[], @[attachment.get()]); >- } >- >- [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)]; >- [webView _executeEditCommand:@"InsertParagraph" argument:nil completion:nil]; >- [webView _executeEditCommand:@"InsertHTML" argument:@"<strong>text</strong>" completion:nil]; >- [webView _synchronouslyExecuteEditCommand:@"InsertParagraph" argument:nil]; >- [webView expectElementTag:@"ATTACHMENT" toComeBefore:@"STRONG"]; >- >- auto dragAndDropSimulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]); >- [dragAndDropSimulator runFrom:CGPointMake(25, 25) to:CGPointMake(25, 425)]; >- >- attachment = [[dragAndDropSimulator insertedAttachments] firstObject]; >- [attachment expectRequestedDataToBe:data.get()]; >- EXPECT_WK_STREQ("icon.png", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment"]); >- EXPECT_WK_STREQ("image/png", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]); >- >- [webView expectElementTag:@"STRONG" toComeBefore:@"ATTACHMENT"]; >- [dragAndDropSimulator endDataTransfer]; >-} >- > #endif // PLATFORM(IOS) > > } // namespace TestWebKitAPI >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a7b6582f35c6587438aa5cbe78875e985ca0bab9..7f39af5861f9559f7e4cdb0141a063e5d1142570 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2018-08-14 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [Attachment SPI] Remove attachment display mode options >+ https://bugs.webkit.org/show_bug.cgi?id=188596 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove a layout test which verified that attachment elements with `-webkit-appearance: none` would render >+ child elements. This was only used to implement in-place attachment display modes. >+ >+ * fast/attachment/attachment-without-appearance-expected.html: Removed. >+ * fast/attachment/attachment-without-appearance.html: Removed. >+ * platform/gtk/TestExpectations: >+ > 2018-08-14 Ryan Haddad <ryanhaddad@apple.com> > > Mark svg/custom/scrolling-embedded-svg-file-image-repaint-problem.html as flaky. >diff --git a/LayoutTests/fast/attachment/attachment-without-appearance-expected.html b/LayoutTests/fast/attachment/attachment-without-appearance-expected.html >deleted file mode 100644 >index 24cbfc2dd346466b8790cd3bc40aa6eb21b92cce..0000000000000000000000000000000000000000 >--- a/LayoutTests/fast/attachment/attachment-without-appearance-expected.html >+++ /dev/null >@@ -1,13 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<style> >- span { >- display: inline-block; >- } >-</style> >-<body> >-<div>This test passes if you observe two green squares below.</div> >-<span><div style="width: 100px; height: 100px; background-color: green; color: white;">Lorem.</div></span> >-<span><div style="width: 100px; height: 100px; background-color: green; color: white;">Ipsum.</div></span> >-</body> >-</html> >diff --git a/LayoutTests/fast/attachment/attachment-without-appearance.html b/LayoutTests/fast/attachment/attachment-without-appearance.html >deleted file mode 100644 >index 1cfa4792e0080d87e6bbd39e664c3efa2395c2e9..0000000000000000000000000000000000000000 >--- a/LayoutTests/fast/attachment/attachment-without-appearance.html >+++ /dev/null >@@ -1,11 +0,0 @@ >-<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] --> >-<html> >-<body> >-<div>This test passes if you observe two green squares below.</div> >-<attachment style="-webkit-appearance: none;"><div style="width: 100px; height: 100px; background-color: green; color: white;">Lorem.</div></attachment> >-<attachment id="attachment"><div style="width: 100px; height: 100px; background-color: green; color: white;">Ipsum.</div></attachment> >-<script> >- attachment.style.webkitAppearance = "none"; >-</script> >-</body> >-</html> >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index 955d55d03b50247c5a23ca8d4b94a127731f7b6e..bce938a1d56730235ef71f899057123c5ae0e0f6 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -3385,8 +3385,6 @@ webkit.org/b/177632 fast/text/flag-codepoint.html [ ImageOnlyFailure ] > > webkit.org/b/179052 compositing/contents-format/subpixel-antialiased-nested-layer.html [ Failure ] > >-webkit.org/b/180371 fast/attachment/attachment-without-appearance.html [ ImageOnlyFailure ] >- > webkit.org/b/180749 http/wpt/offscreen-canvas/transferToImageBitmap-webgl.html [ ImageOnlyFailure ] > > webkit.org/b/180802 imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html [ Failure ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188596
:
347147
| 347148