Bug 1887738 - Remove preferences of motion path (ray(), basic-shapes, coord-box, offset-position). r=layout-reviewers,devtools-reviewers,emilio,nchevobbe

We have shipped them for more than 3 months and we don't have issue
right now. Chromium also removed the flags, so it should be fine to drop
them to make the code simpler.

Differential Revision: https://phabricator.services.mozilla.com/D205615
This commit is contained in:
Boris Chiou 2024-03-26 16:52:03 +00:00
parent 1e801cd396
commit c77eaa59f4
11 changed files with 50 additions and 136 deletions

View file

@ -38,7 +38,6 @@ const TEST_URL = `data:text/html,<meta charset=utf8>${encodeURIComponent(`
const HIGHLIGHTER_TYPE = "ShapesHighlighter";
add_task(async function () {
await pushPref("layout.css.motion-path-basic-shapes.enabled", true);
const env = await openInspectorForURL(TEST_URL);
const { highlighterTestFront, inspector } = env;
const view = selectRuleView(inspector);

View file

@ -6,7 +6,6 @@
add_task(async function () {
await pushPref("layout.css.backdrop-filter.enabled", true);
await pushPref("layout.css.individual-transform.enabled", true);
await pushPref("layout.css.motion-path-basic-shapes.enabled", true);
await addTab("about:blank");
await performTest();
gBrowser.removeCurrentTab();

View file

@ -5,10 +5,6 @@ prefs = [
"layout.css.basic-shape-rect.enabled=true",
"layout.css.basic-shape-xywh.enabled=true",
"layout.css.individual-transform.enabled=true",
"layout.css.motion-path-basic-shapes.enabled=true",
"layout.css.motion-path-coord-box.enabled=true",
"layout.css.motion-path-offset-position.enabled=true",
"layout.css.motion-path-ray.enabled=true",
]
support-files = [
"testcommon.js",

View file

@ -494,7 +494,7 @@ load 1463940.html
HTTP load 1464641.html
load 1464737.html
load 1466638.html
pref(layout.css.motion-path-ray.enabled,true) asserts(1-1) load 1467519.html # bogus size
asserts(1-1) load 1467519.html # bogus size
load 1467688.html
load 1467964.html
load 1469354.html

View file

@ -6,10 +6,6 @@ prefs = [
"gfx.font_loader.delay=0",
"layout.css.container-queries.enabled=true",
"layout.css.individual-transform.enabled=true",
"layout.css.motion-path-ray.enabled=true",
"layout.css.motion-path-basic-shapes.enabled=true",
"layout.css.motion-path-coord-box.enabled=true",
"layout.css.motion-path-offset-position.enabled=true",
"layout.css.motion-path-url.enabled=true",
"layout.css.backdrop-filter.enabled=true",
"layout.css.fit-content-function.enabled=true",

View file

@ -13445,6 +13445,7 @@ gCSSProperties["offset"] = {
"offset-distance",
"offset-rotate",
"offset-anchor",
"offset-position",
],
initial_values: ["none"],
other_values: [
@ -13463,6 +13464,9 @@ gCSSProperties["offset"] = {
"path('m 0 30 v 100') -7rad 8px / left top",
"path('m 0 0 h 100') -7rad 8px",
"path('M 0 0 H 100') 100px 0deg",
"top right / top left",
"top right ray(45deg closest-side)",
"50% 50% ray(0rad farthest-side)",
],
invalid_values: [
"100px 0deg path('m 0 0 h 100')",
@ -13485,12 +13489,7 @@ gCSSProperties["offset-path"] = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: ["none"],
other_values: [...pathValues.other_values],
invalid_values: ["path('')"].concat(pathValues.invalid_values),
};
if (IsCSSPropertyPrefEnabled("layout.css.motion-path-ray.enabled")) {
gCSSProperties["offset-path"]["other_values"].push(
other_values: [
"ray(0deg)",
"ray(45deg closest-side)",
"ray(0rad farthest-side)",
@ -13500,22 +13499,18 @@ if (IsCSSPropertyPrefEnabled("layout.css.motion-path-ray.enabled")) {
"ray(contain farthest-side 180deg)",
"ray(calc(180deg - 45deg) farthest-side)",
"ray(0deg at center center)",
"ray(at 10% 10% 1rad)"
);
gCSSProperties["offset-path"]["invalid_values"].push(
"ray(at 10% 10% 1rad)",
]
.concat(pathValues.other_values)
.concat(basicShapeOtherValues)
.concat(basicShapeXywhRectValues),
invalid_values: [
"path('')",
"ray(closest-side)",
"ray(0deg, closest-side)",
"ray(contain 0deg closest-side contain)"
);
}
if (IsCSSPropertyPrefEnabled("layout.css.motion-path-basic-shapes.enabled")) {
gCSSProperties["offset-path"]["other_values"].push(
...basicShapeOtherValues,
...basicShapeXywhRectValues
);
}
"ray(contain 0deg closest-side contain)",
].concat(pathValues.invalid_values),
};
if (IsCSSPropertyPrefEnabled("layout.css.motion-path-url.enabled")) {
gCSSProperties["offset-path"]["other_values"].push("url(#svgPath)");
@ -13556,37 +13551,23 @@ gCSSProperties["offset-anchor"] = {
invalid_values: ["none", "10deg", "left 10% top"],
};
if (
IsCSSPropertyPrefEnabled("layout.css.motion-path-offset-position.enabled")
) {
gCSSProperties["offset"]["subproperties"].push("offset-position");
gCSSProperties["offset"]["other_values"].push("top right / top left");
if (IsCSSPropertyPrefEnabled("layout.css.motion-path-ray.enabled")) {
gCSSProperties["offset"]["other_values"].push(
"top right ray(45deg closest-side)",
"50% 50% ray(0rad farthest-side)"
);
}
gCSSProperties["offset-position"] = {
domProp: "offsetPosition",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: ["normal"],
other_values: [
"auto",
"left bottom",
"center center",
"calc(20% + 10px) center",
"right 30em",
"10px 20%",
"left -10px top -20%",
"right 10% bottom 20em",
],
invalid_values: ["none", "10deg", "left 10% top"],
};
}
gCSSProperties["offset-position"] = {
domProp: "offsetPosition",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: ["normal"],
other_values: [
"auto",
"left bottom",
"center center",
"calc(20% + 10px) center",
"right 30em",
"10px 20%",
"left -10px top -20%",
"right 10% bottom 20em",
],
invalid_values: ["none", "10deg", "left 10% top"],
};
{
let linear_function_other_values = [

View file

@ -8674,36 +8674,6 @@
value: false
mirror: always
# Is support for motion-path <basic-shape> other than path() enabled?
# https://drafts.fxtf.org/motion-1/#valdef-offset-path-basic-shape
- name: layout.css.motion-path-basic-shapes.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# Is support for motion-path <coord-box> enabled?
# https://drafts.fxtf.org/motion-1/#valdef-offset-path-coord-box
- name: layout.css.motion-path-coord-box.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# Is support for motion-path ray() enabled?
- name: layout.css.motion-path-ray.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# Is support for motion-path offset-position enabled?
- name: layout.css.motion-path-offset-position.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# Is support for motion-path url enabled?
- name: layout.css.motion-path-url.enabled
type: RelaxedAtomicBool

View file

@ -281,7 +281,6 @@ ${helpers.predefined_type(
"computed::OffsetPosition::normal()",
engines="gecko",
animation_value_type="ComputedValue",
gecko_pref="layout.css.motion-path-offset-position.enabled",
flags="CAN_ANIMATE_ON_COMPOSITOR",
spec="https://drafts.fxtf.org/motion-1/#offset-position-property",
servo_restyle_damage="reflow_out_of_flow",

View file

@ -159,13 +159,7 @@ ${helpers.two_properties_shorthand(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
let offset_position =
if static_prefs::pref!("layout.css.motion-path-offset-position.enabled") {
input.try_parse(|i| OffsetPosition::parse(context, i)).ok()
} else {
None
};
let offset_position = input.try_parse(|i| OffsetPosition::parse(context, i)).ok();
let offset_path = input.try_parse(|i| OffsetPath::parse(context, i)).ok();
// Must have one of [offset-position, offset-path].
@ -212,24 +206,19 @@ ${helpers.two_properties_shorthand(
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
if let Some(offset_position) = self.offset_position {
// The basic concept is: we must serialize offset-position or offset-path group.
// offset-path group means "offset-path offset-distance offset-rotate".
let must_serialize_path = *self.offset_path != OffsetPath::None
|| (!self.offset_distance.is_zero() || !self.offset_rotate.is_auto());
let position_is_default = matches!(offset_position, OffsetPosition::Normal);
if !position_is_default || !must_serialize_path {
offset_position.to_css(dest)?;
}
// The basic concept is: we must serialize offset-position or offset-path group.
// offset-path group means "offset-path offset-distance offset-rotate".
let must_serialize_path = *self.offset_path != OffsetPath::None
|| (!self.offset_distance.is_zero() || !self.offset_rotate.is_auto());
let position_is_default = matches!(self.offset_position, OffsetPosition::Normal);
if !position_is_default || !must_serialize_path {
self.offset_position.to_css(dest)?;
}
if must_serialize_path {
if !position_is_default {
dest.write_char(' ')?;
}
self.offset_path.to_css(dest)?;
if must_serialize_path {
if !position_is_default {
dest.write_char(' ')?;
}
} else {
// If the pref is off, we always show offset-path.
self.offset_path.to_css(dest)?;
}

View file

@ -76,10 +76,6 @@ impl Parse for RayFunction {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if !static_prefs::pref!("layout.css.motion-path-ray.enabled") {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
input.expect_function_matching("ray")?;
input.parse_nested_block(|i| Self::parse_function_arguments(context, i))
}
@ -154,11 +150,8 @@ impl Parse for OffsetPathFunction {
// <offset-path> = <ray()> | <url> | <basic-shape>
// https://drafts.fxtf.org/motion-1/#typedef-offset-path
if static_prefs::pref!("layout.css.motion-path-ray.enabled") {
if let Ok(ray) = input.try_parse(|i| RayFunction::parse(context, i)) {
return Ok(OffsetPathFunction::Ray(ray));
}
if let Ok(ray) = input.try_parse(|i| RayFunction::parse(context, i)) {
return Ok(OffsetPathFunction::Ray(ray));
}
if static_prefs::pref!("layout.css.motion-path-url.enabled") {
@ -167,13 +160,7 @@ impl Parse for OffsetPathFunction {
}
}
let allowed_shapes = if static_prefs::pref!("layout.css.motion-path-basic-shapes.enabled") {
AllowedBasicShapes::ALL
} else {
AllowedBasicShapes::PATH
};
BasicShape::parse(context, input, allowed_shapes, ShapeType::Outline)
BasicShape::parse(context, input, AllowedBasicShapes::ALL, ShapeType::Outline)
.map(OffsetPathFunction::Shape)
}
}
@ -197,9 +184,7 @@ impl Parse for OffsetPath {
.ok();
}
if static_prefs::pref!("layout.css.motion-path-coord-box.enabled") &&
coord_box.is_none()
{
if coord_box.is_none() {
coord_box = input.try_parse(CoordBox::parse).ok();
if coord_box.is_some() {
continue;

View file

@ -1 +1 @@
prefs: [layout.css.individual-transform.enabled:true, layout.css.motion-path-ray.enabled:true, layout.css.motion-path-offset-position.enabled:true, layout.css.motion-path-basic-shapes.enabled:true, layout.css.motion-path-coord-box.enabled:true, layout.css.basic-shape-rect.enabled:true, layout.css.basic-shape-xywh.enabled:true, layout.css.motion-path-url.enabled:true]
prefs: [layout.css.individual-transform.enabled:true, layout.css.basic-shape-rect.enabled:true, layout.css.basic-shape-xywh.enabled:true, layout.css.motion-path-url.enabled:true]