[webkit-changes] [WebKit/WebKit] 0b81c7: [Cocoa] Text inserted after resized adaptive image...
Aditya Keerthi
noreply at github.com
Tue Aug 27 01:11:03 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0b81c7acf2f706c5ca0a33be8f5ddcb7ae511114
https://github.com/WebKit/WebKit/commit/0b81c7acf2f706c5ca0a33be8f5ddcb7ae511114
Author: Aditya Keerthi <akeerthi at apple.com>
Date: 2024-08-27 (Tue, 27 Aug 2024)
Changed paths:
M Source/WebCore/editing/InsertTextCommand.cpp
M Tools/TestWebKitAPI/Tests/WebKitCocoa/AdaptiveImageGlyph.mm
Log Message:
-----------
[Cocoa] Text inserted after resized adaptive image glyph does not match font size
https://bugs.webkit.org/show_bug.cgi?id=278693
rdar://127761275
Reviewed by Wenson Hsieh and Richard Robinson.
Adaptive image glyphs are essentially `<picture>` element with text-like behavior.
Traditional text insertion matches the font size of surrounding content as
created text nodes are inserted into a styled element.
However, when resizing an adaptive image glyph, the `font-size` property is
applied to the `<picture>` element. Then when inserting text after the
`<picture>` element, the text node is simply inserted as a sibling to the
`<picture>`, as `<picture>` cannot contain non-`<source>` or non-`<img>`
children due to editing. Consequently, the text takes on the size of the
common parent, rather than the adaptive image glyph.
Fix by getting an `EditingStyle` for the adaptive image glyph and applying
it to the inserted text.
* Source/WebCore/editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::doApply):
The approach taken here can easily be generalized to other inline elements.
However, to reduce risk and surface of the behavior change, restrict the fix to
adaptive image glyphs. Other browsers are also inconsistent in their behavior
here.
Additionally, remove a comment that simply describes what the code does.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/AdaptiveImageGlyph.mm:
(TestWebKitAPI::TEST(AdaptiveImageGlyph, InsertTextAfterAdaptiveImageGlyph)):
Canonical link: https://commits.webkit.org/282778@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list