From 783c2abf0c5cd2f14230352c27de92d7d08f39d6 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Mon, 6 Jan 2025 07:08:22 +0000 Subject: [PATCH] Make `HTMLEditor::ClearStyleAt` stop forgetting removed line break It does tricky if the styled element contains a padding line break. First, it splits the inline containers at the point. E.g., if the DOM is `abc []
`, it's split as `abc
`. Next, it deletes the latter one if it has only a padding line break. Then, previously, it didn't forget the disconnected `
`, but D231655 made it forget [1]. However, the method needs to insert a padding line break temporarily, i.e., It needs to make it as `abc
`, because `WhiteSpaceVisibilityKeeper` will treat the collapsible white-space as an invisible trailing white-space of the block. Therefore, it does it only when it removes a padding line break [2]. Therefore, this patch makes it forget the deleted padding line break. 1. https://searchfox.org/mozilla-central/rev/94c62970ba2f9c40efd5a4f83a538595425820d9/editor/libeditor/HTMLStyleEditor.cpp#2465-2467 2. https://searchfox.org/mozilla-central/rev/94c62970ba2f9c40efd5a4f83a538595425820d9/editor/libeditor/HTMLStyleEditor.cpp#2499-2502,2512-2514 Differential Revision: https://phabricator.services.mozilla.com/D233232 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1940014 gecko-commit: dd8b1488a379ee395592f636d084cf81117f3b4c gecko-reviewers: m_kato --- editing/data/multitest.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editing/data/multitest.js b/editing/data/multitest.js index 2d5404ba898903..5d0a60bf89ee37 100644 --- a/editing/data/multitest.js +++ b/editing/data/multitest.js @@ -3250,4 +3250,11 @@ var browserTests = [ "
a

Be
"], [true,true], {}], + +// Preseve the collapsible white-space after the style is cleared. +["

abc[]

", + [["inserttext"," "],["bold",""],["inserttext","d"]], + "

abc d

", + [true,true,true], + {}], ]