Bug 1918463: Fix `inset` auto-completion. r=firefox-style-system-reviewers,emilio

Prevent `anchor()`'s inner keywords from suggested, and make the suggestion of
`anchor()` only if the relevant pref is flipped.

Differential Revision: https://phabricator.services.mozilla.com/D222018
This commit is contained in:
David Shin 2024-09-12 19:18:27 +00:00
Родитель c07350c901
Коммит c507c766c3
2 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -135,6 +135,16 @@ function do_test() {
var expected = [ "initial", "unset", "auto", "inherit", "revert", "revert-layer" ];
ok(testValues(values, expected), "property margin's values.");
var prop = "inset";
var values = InspectorUtils.getCSSValuesForProperty(prop);
var expected = [ "initial", "unset", "auto", "inherit", "revert", "revert-layer" ];
if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) {
expected.push("anchor");
}
ok(testValues(values, expected), "property inset's values.");
// Test property with "normal"
var prop = "font-style";
var values = InspectorUtils.getCSSValuesForProperty(prop);

Просмотреть файл

@ -8,6 +8,7 @@
use std::fmt::Write;
use style_traits::CssWriter;
use style_traits::SpecifiedValueInfo;
use style_traits::ToCss;
use crate::values::animated::ToAnimatedZero;
@ -262,7 +263,6 @@ impl<N> ToAnimatedZero for AspectRatio<N> {
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToCss,
ToShmem,
ToAnimatedValue,
@ -286,6 +286,19 @@ pub enum GenericInset<P, LP> {
),
}
impl<P, LP> SpecifiedValueInfo for GenericInset<P, LP>
where
LP: SpecifiedValueInfo,
{
fn collect_completion_keywords(f: style_traits::KeywordsCollectFn) {
LP::collect_completion_keywords(f);
f(&["auto"]);
if static_prefs::pref!("layout.css.anchor-positioning.enabled") {
f(&["anchor"]);
}
}
}
impl<P, LP> GenericInset<P, LP> {
/// `auto` value.
#[inline]