[webkit-changes] [WebKit/WebKit] 333b4b: Use RenderAttachment for wide-layout attachments, ...
Gerald Squelart
noreply at github.com
Tue Jun 6 17:03:14 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 333b4b2030a128aebb08c23403fb50e4465172ca
https://github.com/WebKit/WebKit/commit/333b4b2030a128aebb08c23403fb50e4465172ca
Author: Gerald Squelart <g_squelart at apple.com>
Date: 2023-06-06 (Tue, 06 Jun 2023)
Changed paths:
M LayoutTests/fast/attachment/cocoa/wide-attachment-save-event-expected.txt
M LayoutTests/fast/attachment/mac/wide-attachment-image-controls-basic-expected.txt
M LayoutTests/platform/ios-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt
M LayoutTests/platform/mac-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt
M Source/WebCore/html/HTMLAttachmentElement.cpp
M Source/WebCore/html/HTMLAttachmentElement.h
M Source/WebCore/html/shadow/attachmentElementShadow.css
M Source/WebCore/rendering/RenderAttachment.cpp
M Source/WebCore/rendering/RenderAttachment.h
M Source/WebCore/rendering/RenderThemeIOS.mm
M Source/WebCore/rendering/RenderThemeMac.mm
Log Message:
-----------
Use RenderAttachment for wide-layout attachments, with some modified layout and rendering
https://bugs.webkit.org/show_bug.cgi?id=256637
rdar://108157331
Reviewed by Alan Baradlay.
A lot of the editor code interacting with attachments relies on the renderer being exactly `RenderAttachment`, which led to some misbehavior when the wide-layout attachment was using the more generic `RenderBlockFlow`.
So now the renderer is always `RenderAttachment`, but the layout and rendering paths redirect to special wide-layout-only functions.
* LayoutTests/fast/attachment/cocoa/wide-attachment-save-event-expected.txt:
* LayoutTests/fast/attachment/mac/wide-attachment-image-controls-basic-expected.txt:
* LayoutTests/platform/ios-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt:
* LayoutTests/platform/mac-wk2/fast/attachment/cocoa/wide-attachment-rendering-expected.txt:
* Source/WebCore/html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::createElementRenderer):
Always return a `RenderAttachment`, like it was before introducing the wide-layout styling.
(WebCore::HTMLAttachmentElement::insertedIntoAncestor):
Because of how the root element does the layout, the shadow root element's margins were ignored, so now the margins are added here in the root element.
* Source/WebCore/html/HTMLAttachmentElement.h:
* Source/WebCore/html/shadow/attachmentElementShadow.css:
(div#attachment-container):
Since the margin is now in the top-level element outside the shadow tree, it is not needed here anymore.
(div#attachment-container::selection): Deleted.
The selection coloring is handled by the `RenderReplaced` painting code, so this styling was ignored anyway.
* Source/WebCore/rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::RenderAttachment):
(WebCore::RenderAttachment::layoutWideLayoutAttachmentOnly):
(WebCore::RenderAttachment::layout):
Layout the wide-layout shadow tree if present, the "replaced" and shadow content layouts are still performed to handle all the necessary sizing and optional image controls.
(WebCore::RenderAttachment::paintWideLayoutAttachmentOnly const):
New wide-layout paint code, handling the full Foreground and Selection phases and painting everything in the shadow tree.
* Source/WebCore/rendering/RenderAttachment.h:
Cleaned up "Shadow" functions, to separate just "shadow controls" (like image controls) and any "shadow content" that may include the wide-layout shadow tree.
Also let the `RenderReplaced` painting code handle the selection tint.
* Source/WebCore/rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintAttachment):
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintAttachment):
When actually painting a wide-layout attachment, skip the legacy painting.
Canonical link: https://commits.webkit.org/264914@main
More information about the webkit-changes
mailing list