Bug 1931285 - Simplify -moz-pre-space implementation. r=jfkthame

Make it an alias of the preserve-spaces value, and don't bother
serializing the shorthand to that value.

Update internal usages to the standard keyword.

Differential Revision: https://phabricator.services.mozilla.com/D228958
This commit is contained in:
Emilio Cobos Álvarez
2024-11-14 11:13:21 +00:00
parent 91372d0433
commit 52a0225b5c
6 changed files with 10 additions and 21 deletions

View File

@@ -15,23 +15,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=116083
<div style="white-space: pre">foo bar</div>
<div style="white-space: pre-wrap">foo bar</div>
<div style="white-space: pre-line">foo bar</div>
<div style="white-space: -moz-pre-space">foo bar</div>
<div style="white-space: preserve-spaces">foo bar</div>
<div style="white-space: pre" data-collapse-selection-to-child-and-extend>foo bar</div>
<div style="white-space: pre-wrap" data-collapse-selection-to-child-and-extend>foo bar</div>
<div style="white-space: pre-line" data-collapse-selection-to-child-and-extend>foo bar</div>
<div style="white-space: -moz-pre-space" data-collapse-selection-to-child-and-extend>foo bar</div>
<div style="white-space: preserve-spaces" data-collapse-selection-to-child-and-extend>foo bar</div>
<div data-result="bar baz"><span style="white-space: pre">bar </span>baz</div>
<div data-result="bar baz"><span style="white-space: pre-wrap">bar </span>baz</div>
<div data-result="bar baz"><span style="white-space: pre-line">bar </span>baz</div>
<div data-result="bar baz"><span style="white-space: -moz-pre-space">bar </span>baz</div>
<div data-result="bar baz"><span style="white-space: preserve-spaces">bar </span>baz</div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: pre"><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: pre" contenteditable><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: pre-wrap"><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: pre-wrap" contenteditable><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: pre-line"><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: pre-line" contenteditable><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: -moz-pre-space"><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: -moz-pre-space" contenteditable><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: preserve-spaces"><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo &#10; bar&#10;&#10;!&#10;&#10;&#10;baz" style="white-space: preserve-spaces" contenteditable><div>foo </div><div> bar</div><div><br></div><div>!</div><div><br><br></div><div>baz</div></div>
<div data-result="foo&#10;bar&#10;baz&#10;qux"><div>foo<br></div><span>bar<br>baz<br>qux</span></div>
<div data-result="foo&#10;bar&#10;baz&#10;qux" contenteditable><div>foo<br></div><span>bar<br>baz<br>qux</span></div>
<div data-result="foo&#10;&#10;"><div>foo</div><span><br></span></div>

View File

@@ -1,6 +1,6 @@
<!DOCTYPE html>
<style>
p { font: 16px monospace; white-space: -moz-pre-space; }
p { font: 16px monospace; white-space: preserve-spaces; }
span { background-color: lime }
</style>
<p><span>a b</span></p>

View File

@@ -8781,14 +8781,7 @@ var gCSSProperties = {
applies_to_cue: true,
applies_to_marker: true,
initial_values: ["normal"],
other_values: [
"pre",
"nowrap",
"pre-wrap",
"pre-line",
"-moz-pre-space",
"break-spaces",
],
other_values: ["pre", "nowrap", "pre-wrap", "pre-line", "break-spaces"],
invalid_values: [],
},
"white-space-collapse": {
@@ -8804,6 +8797,7 @@ var gCSSProperties = {
"preserve-breaks",
"preserve-spaces",
"break-spaces",
"-moz-pre-space",
],
invalid_values: ["normal", "auto"],
},

View File

@@ -66,7 +66,7 @@ foreignObject {
}
*[xml|space=preserve] {
white-space: -moz-pre-space;
white-space: preserve-spaces;
}
*|*::-moz-svg-marker-anon-child {

View File

@@ -144,6 +144,7 @@ ${helpers.single_keyword(
name="white-space-collapse",
values="collapse preserve preserve-breaks break-spaces",
extra_gecko_values="preserve-spaces",
gecko_aliases="-moz-pre-space=preserve-spaces",
engines="gecko servo",
gecko_enum_prefix="StyleWhiteSpaceCollapse",
animation_type="discrete",

View File

@@ -127,10 +127,6 @@
"pre" => (Wrap::Nowrap, Collapse::Preserve),
"pre-wrap" => (Wrap::Wrap, Collapse::Preserve),
"pre-line" => (Wrap::Wrap, Collapse::PreserveBreaks),
// TODO: deprecate/remove -moz-pre-space; the white-space-collapse: preserve-spaces value
// should serve this purpose?
#[cfg(feature = "gecko")]
"-moz-pre-space" => (Wrap::Wrap, Collapse::PreserveSpaces),
};
Ok(expanded! {
text_wrap_mode: mode,
@@ -182,8 +178,6 @@
Collapse::Collapse => return dest.write_str("normal"),
Collapse::Preserve => return dest.write_str("pre-wrap"),
Collapse::PreserveBreaks => return dest.write_str("pre-line"),
#[cfg(feature = "gecko")]
Collapse::PreserveSpaces => return dest.write_str("-moz-pre-space"),
_ => (),
}
},