[Attachment SPI] Remove attachment display mode options
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2018 14:26:05 +0000 (14:26 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2018 14:26:05 +0000 (14:26 +0000)
commit9e64463d428ca3339ab8050f3bd99722660fc694
treed76a019bd23cd9c15fa978db2e801d76d63f0ef5
parent49d44f8f5f29a46ed30345520b5f307c5e1457c0
[Attachment SPI] Remove attachment display mode options
https://bugs.webkit.org/show_bug.cgi?id=188596

Reviewed by Dan Bernstein.

Source/WebCore:

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):

Source/WebKit:

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):

Tools:

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.

LayoutTests:

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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/attachment/attachment-without-appearance-expected.html [deleted file]
LayoutTests/fast/attachment/attachment-without-appearance.html [deleted file]
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
Source/WebCore/html/AttachmentTypes.h
Source/WebCore/html/HTMLAttachmentElement.cpp
Source/WebCore/html/HTMLAttachmentElement.h
Source/WebCore/page/DragController.cpp
Source/WebCore/rendering/RenderAttachment.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm