[webkit-changes] [WebKit/WebKit] 1235e0: [Cocoa] Mail sometimes shows placeholder text inst...

Aditya Keerthi noreply at github.com
Mon Aug 12 10:03:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1235e0b1e525aa28ff5572f3d3624ea273eab719
      https://github.com/WebKit/WebKit/commit/1235e0b1e525aa28ff5572f3d3624ea273eab719
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2024-08-12 (Mon, 12 Aug 2024)

  Changed paths:
    M Source/WebCore/editing/cocoa/EditorCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/AdaptiveImageGlyph.mm

  Log Message:
  -----------
  [Cocoa] Mail sometimes shows placeholder text instead of an adaptive image glyph
https://bugs.webkit.org/show_bug.cgi?id=277937
rdar://130934430

Reviewed by Richard Robinson.

Adaptive image glyph attachments are occasionally going missing in Mail. In the
failure scenario, it is observed that `-[WKWebView _webView:didInsertAttachment:withSource:]`
is not being called.

The cause of the issue is due to the fact that attachment elements are created
and attached to the originally created `<source>` and `<img>` elements after
the `ReplaceSelectionCommand` performed. This is problematic as
`ReplaceSelectionCommand` may clone nodes and discard the original, in order
to merge paragraphs. Consequently, the attachment elements can be added to
"stale" nodes which are never actually inserted into the document.

Fix by creating and associating attachment elements prior to performing
the `ReplaceSelectionCommand`. This ensures that attachment elements are
always present on the nodes which end up in the document.

* Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::insertMultiRepresentationHEIC):

Associate attachments before performing the `ReplaceSelectionCommand`.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/AdaptiveImageGlyph.mm:
(TestWebKitAPI::TEST(AdaptiveImageGlyph, InsertWKAttachmentsMovingParagraphs)):

Use a test case directly from real Mail content.

Canonical link: https://commits.webkit.org/282121@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