Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: efc8e7c710e136ba7f1472e2e8e4fe829f592af8
      
https://github.com/WebKit/WebKit/commit/efc8e7c710e136ba7f1472e2e8e4fe829f592af8
  Author: Aditya Keerthi <akeer...@apple.com>
  Date:   2024-05-13 (Mon, 13 May 2024)

  Changed paths:
    M Source/WebCore/editing/SimplifyMarkupCommand.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteWebArchive.mm

  Log Message:
  -----------
  Pasting a web archive drops <picture> when wrapped in a <span>
https://bugs.webkit.org/show_bug.cgi?id=274062
rdar://127319160

Reviewed by Richard Robinson and Abrar Rahman Protyasha.

Pasting a web archive results in markup simplification being performed in
`SimplifyMarkupCommand`, via `ReplaceSelectionCommand`.

However, the logic for simplifying markup is incorrect. It currently
treats all inline elements that have the same style as equivalent. Then,
equivalent elements are removed bottom-up. This means that a `<picture>`
inside a `<span>` will be removed, as `<picture>` is an inline element,
with no custom style. Removing `<picture>` is incorrect, as it can affect the
rendered content due to source selection.

Fix by excluding `<picture>` from markup simplification. A better solution
would be to eliminate the `<span>` rather than the `<picture>`. However, that
approach requires a complete rewrite of the markup simplification algorithm.

* Source/WebCore/editing/SimplifyMarkupCommand.cpp:
(WebCore::SimplifyMarkupCommand::doApply):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteWebArchive.mm:
(TEST(PasteWebArchive, PreservesPictureInsideSpan)):

Canonical link: https://commits.webkit.org/278714@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to