[webkit-changes] [WebKit/WebKit] 1a21a0: [MultiRep HEIC] Ensure <attachment> creation upon ...
Aditya Keerthi
noreply at github.com
Mon Jan 29 22:37:00 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1a21a036fbffe9356104277a52b78df35801cf1c
https://github.com/WebKit/WebKit/commit/1a21a036fbffe9356104277a52b78df35801cf1c
Author: Aditya Keerthi <akeerthi at apple.com>
Date: 2024-01-29 (Mon, 29 Jan 2024)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/dom/Element.cpp
M Source/WebCore/dom/Element.h
M Source/WebCore/editing/Editor.cpp
M Source/WebCore/editing/Editor.h
M Source/WebCore/editing/cocoa/EditorCocoa.mm
A Source/WebCore/html/AttachmentAssociatedElement.cpp
A Source/WebCore/html/AttachmentAssociatedElement.h
M Source/WebCore/html/HTMLAttachmentElement.cpp
M Source/WebCore/html/HTMLAttachmentElement.h
M Source/WebCore/html/HTMLAttachmentElement.idl
M Source/WebCore/html/HTMLImageElement.cpp
M Source/WebCore/html/HTMLImageElement.h
M Source/WebCore/html/HTMLSourceElement.cpp
M Source/WebCore/html/HTMLSourceElement.h
M Source/WebCore/page/EditorClient.h
M Source/WebKit/Scripts/webkit/messages.py
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/API/APIAttachment.cpp
M Source/WebKit/UIProcess/API/APIAttachment.h
M Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.h
M Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
M Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm
M Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Log Message:
-----------
[MultiRep HEIC] Ensure <attachment> creation upon insertion
https://bugs.webkit.org/show_bug.cgi?id=268243
rdar://121767827
Reviewed by Wenson Hsieh.
Ensure that the HEIC <source> and PNG <img> are associated with <attachment>s
and are registered as `_WKAttachment`s in the UI process.
In order to support this functionality, refactor attachment code to support
associating <source> elements with an <attachment> element, in addition to the
existing support for <img> elements.
`AttachmentAssociatedElement` is introduced to share code between elements the
two elements that can be associated with <attachment>. Additionally rename all
methods that refer to an "enclosing image" to refer to an "associated element".
Note that this patch does not make it so that *all* <source> elements are
<attachment> associated, only those associated with a multi-representation HEIC.
This is because, in general, not all <source> elements have loaded content.
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::registerAttachmentIdentifier):
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::asAttachmentAssociatedElement):
* Source/WebCore/dom/Element.h:
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::registerAttachmentIdentifier):
(WebCore::Editor::notifyClientOfAttachmentUpdates):
* Source/WebCore/editing/Editor.h:
* Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::insertMultiRepresentationHEIC):
Create and register <attachment> elements for the inserted <source> and <img>.
* Source/WebCore/html/AttachmentAssociatedElement.cpp: Added.
(WebCore::AttachmentAssociatedElement::setAttachmentElement):
(WebCore::AttachmentAssociatedElement::attachmentElement const):
(WebCore::AttachmentAssociatedElement::attachmentIdentifier const):
(WebCore::AttachmentAssociatedElement::didUpdateAttachmentIdentifier):
(WebCore::AttachmentAssociatedElement::copyAttachmentAssociatedPropertiesFromElement):
(WebCore::AttachmentAssociatedElement::cloneAttachmentAssociatedElementWithoutAttributesAndChildren):
* Source/WebCore/html/AttachmentAssociatedElement.h: Added.
Introduce `AttachmentAssociatedElement` to share attachment-related code between
<img> and <source> elements.
(WebCore::AttachmentAssociatedElement::ref const):
(WebCore::AttachmentAssociatedElement::deref const):
* Source/WebCore/html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::getAttachmentIdentifier):
(WebCore::HTMLAttachmentElement::ensureUniqueIdentifier):
(WebCore::HTMLAttachmentElement::setUniqueIdentifier):
(WebCore::HTMLAttachmentElement::associatedElement const):
(WebCore::HTMLAttachmentElement::associatedElementType const):
(WebCore::HTMLAttachmentElement::updateAttributes):
(WebCore::HTMLAttachmentElement::updateAssociatedElementWithData):
(WebCore::HTMLAttachmentElement::enclosingImageElement const): Deleted.
(WebCore::HTMLAttachmentElement::updateEnclosingImageWithData): Deleted.
* Source/WebCore/html/HTMLAttachmentElement.h:
* Source/WebCore/html/HTMLAttachmentElement.idl:
Update `getAttachmentIdentifier` to take an `HTMLElement`, as both
`HTMLSourceElement` and `HTMLImageElement` can be associated with an
`HTMLAttachmentElement`.
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::setAttachmentElement):
(WebCore::HTMLImageElement::copyNonAttributePropertiesFromElement):
(WebCore::HTMLImageElement::cloneElementWithoutAttributesAndChildren):
(WebCore::HTMLImageElement::didUpdateAttachmentIdentifier): Deleted.
(WebCore::HTMLImageElement::attachmentElement const): Deleted.
(WebCore::HTMLImageElement::attachmentIdentifier const): Deleted.
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::cloneElementWithoutAttributesAndChildren):
(WebCore::HTMLSourceElement::copyNonAttributePropertiesFromElement):
* Source/WebCore/html/HTMLSourceElement.h:
* Source/WebCore/page/EditorClient.h:
(WebCore::EditorClient::didInsertAttachmentWithIdentifier):
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/APIAttachment.cpp:
(API::Attachment::associatedElementData const):
(API::Attachment::enclosingImageData const): Deleted.
* Source/WebKit/UIProcess/API/APIAttachment.h:
* Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
(API::Attachment::associatedElementData const):
(API::Attachment::associatedElementNSData const):
(API::Attachment::enclosingImageData const): Deleted.
(API::Attachment::enclosingImageNSData const): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.h:
Introduce a new `shouldPreserveFidelity` bit on `_WKAttachmentInfo`, to ensure
that clients do not transcode data from a <source> element.
* Source/WebKit/UIProcess/API/Cocoa/_WKAttachment.mm:
(-[_WKAttachmentInfo shouldPreserveFidelity]):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateAttachmentAttributes):
(WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):
* Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::didInsertAttachmentWithIdentifier):
* Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateAttachmentAttributes):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Canonical link: https://commits.webkit.org/273731@main
More information about the webkit-changes
mailing list