Skip to content

Commit

Permalink
part 2: Make HTMLEditor::FormatBlockContainerWithTransaction refer …
Browse files Browse the repository at this point in the history
…the computed style when considering the wrapping part

In bug 1851951, I considered that the method should keep the traditional
behavior for the backward compatibility because of mainly used by handling
a block level command, `formatBlock`, but I think that computing the replacing
part should be considered with the computed style of the elements.  That's
compatible with the other browsers.

Depends on D199844

Differential Revision: https://phabricator.services.mozilla.com/D199845

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1876913
gecko-commit: 505443c66b747ccc1247f4eeb960681204fd2ac7
gecko-reviewers: m_kato
  • Loading branch information
masayuki-nakano authored and moz-wptsync-bot committed Jan 31, 2024
1 parent b1c80da commit c0ff725
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions editing/data/formatblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -1886,4 +1886,10 @@ var browserTests = [
"<div><div contenteditable=\"false\"><div contenteditable=\"\"><div>[foo]</div></div></div></div>", // <div> can have <div>, so, wrap it with <div>
[true],
{"formatblock":[false,false,"",false,false,"div"]}],

["<span style=display:block>abc</span><span style=display:block>[def]</span><span style=display:block>ghi</span>",
[["formatblock","div"]],
"<span style=\"display:block\">abc</span><div><span style=\"display:block\">def</span></div><span style=\"display:block\">ghi</span>",
[true],
{"formatblock":[false,false,"",false,false,"div"]}],
]
15 changes: 15 additions & 0 deletions editing/data/insertparagraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2558,4 +2558,19 @@ var browserTests = [
"foo<br><p><br></p><p>bar<span>baz</span><br>qux</p>"],
[true,true],
{}],

// Inserting paragraph before <br> followed by a blocked <span> should cause
// inserting an empty paragraph to start of the editing host at least.
["{}<br><span style=display:block>abc<br>def<br></span>",
[["defaultparagraphseparator","div"],["insertparagraph",""]],
["<div><br></div><br><span style=\"display:block\">abc<br>def<br></span>",
"<div><br></div><div><br></div><span style=\"display:block\">abc<br>def<br></span>"],
[true,true],
{}],
["{}<br><span style=display:block>abc<br>def<br></span>",
[["defaultparagraphseparator","p"],["insertparagraph",""]],
["<p><br></p><br><span style=\"display:block\">abc<br>def<br></span>",
"<p><br></p><p><br></p><span style=\"display:block\">abc<br>def<br></span>"],
[true,true],
{}],
]
3 changes: 2 additions & 1 deletion editing/run/formatblock.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">
<meta name="variant" content="?3001-4000">
<meta name="variant" content="?4001-last">
<meta name="variant" content="?4001-5000">
<meta name="variant" content="?5001-last">
<link rel=stylesheet href=../include/reset.css>
<title>formatblock - HTML editing conformance tests</title>

Expand Down

0 comments on commit c0ff725

Please sign in to comment.