Bug 1913536 - Expose the special shorthands in the SpecifiedValueInfo for the CSS white-space shorthand. a=RyanVM

Original Revision: https://phabricator.services.mozilla.com/D219426

Differential Revision: https://phabricator.services.mozilla.com/D225215
This commit is contained in:
Jonathan Kew 2024-10-10 15:31:38 +00:00
parent 1c5f1fb914
commit c7118866af
2 changed files with 24 additions and 0 deletions

View file

@ -51,6 +51,17 @@ window.onload = function() {
"A property with color values includes papayawhip.");
ok(bgColorValues.includes("rgb"),
"A property with color values includes non-colors.");
// Check that the "special" shorthands for white-space are exposed.
const whiteSpaceValues = cssProperties.getValues("white-space");
ok(whiteSpaceValues.includes("normal"),
"Values for the white-space shorthand include normal.");
ok(whiteSpaceValues.includes("pre"),
"Values for the white-space shorthand include pre.");
ok(whiteSpaceValues.includes("pre-line"),
"Values for the white-space shorthand include pre-line.");
ok(whiteSpaceValues.includes("pre-wrap"),
"Values for the white-space shorthand include pre-wrap.");
};
addAsyncTest(async function setup() {

View file

@ -109,6 +109,7 @@
name="white-space"
engines="gecko"
sub_properties="text-wrap-mode white-space-collapse"
derive_value_info="False"
spec="https://www.w3.org/TR/css-text-4/#white-space-property"
>
use crate::properties::longhands::{text_wrap_mode, white_space_collapse};
@ -207,6 +208,18 @@
Ok(())
}
}
impl SpecifiedValueInfo for Longhands {
fn collect_completion_keywords(f: KeywordsCollectFn) {
// Collect keywords from our longhands.
text_wrap_mode::SpecifiedValue::collect_completion_keywords(f);
white_space_collapse::SpecifiedValue::collect_completion_keywords(f);
// Add the special values supported only by the shorthand
// (see parse_special_shorthands() above).
f(&["normal", "pre", "pre-wrap", "pre-line"])
}
}
</%helpers:shorthand>
// CSS Compatibility