Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information