tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 65eef9a90d2d0543762d819042619bd72dfee9f0
parent 206bf411f6d60a537ccceec222dfc71549fb1fa0
Author: Swarup Ukil <sukil@mozilla.com>
Date:   Sat, 15 Nov 2025 09:16:37 +0000

Bug 1993308 - Fix specified value serialization of <position> in shape() to preserve keyword syntax. r=firefox-style-system-reviewers,layout-reviewers,emilio

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

Diffstat:
Mdom/svg/SVGAnimatedPathSegList.cpp | 15+++++++--------
Mdom/svg/SVGPathData.cpp | 6+++---
Mdom/svg/SVGPathElement.cpp | 8++++----
Mdom/svg/SVGPathSegUtils.h | 23+++++++++++++++++++++--
Mdom/svg/SVGPathSegment.cpp | 9++++-----
Mdom/svg/SVGPathSegment.h | 4++--
Mlayout/base/MotionPathUtils.cpp | 6++++--
Mlayout/inspector/tests/test_bug877690.html | 3++-
Mlayout/style/ServoStyleConstsInlines.h | 30++++++++++++++++++------------
Mservo/components/style/values/computed/basic_shape.rs | 35++++++++++++++++++-----------------
Mservo/components/style/values/generics/basic_shape.rs | 128+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mservo/components/style/values/specified/basic_shape.rs | 55+++++++++++++++++++++----------------------------------
Mservo/components/style/values/specified/svg_path.rs | 65+++++++++++++++++++++++++++++++----------------------------------
Mtesting/web-platform/meta/css/css-shapes/shape-functions/shape-function-valid.html.ini | 62--------------------------------------------------------------
Mtesting/web-platform/meta/css/motion/parsing/offset-path-shape-parsing.html.ini | 43-------------------------------------------
15 files changed, 201 insertions(+), 291 deletions(-)

diff --git a/dom/svg/SVGAnimatedPathSegList.cpp b/dom/svg/SVGAnimatedPathSegList.cpp @@ -30,21 +30,20 @@ nsresult SVGAnimatedPathSegList::SetBaseValueString(const nsAString& aValue) { enum class PositionType { Absolute, Relative }; -static StyleCommandEndPoint<float> MakeEndPoint(PositionType type, float x, - float y) { +static StyleEndPoint<float> MakeEndPoint(PositionType type, float x, float y) { if (type == PositionType::Absolute) { - return StyleCommandEndPoint<float>::ToPosition({x, y}); + return StyleEndPoint<float>::ToPosition({x, y}); } else { - return StyleCommandEndPoint<float>::ByCoordinate({x, y}); + return StyleEndPoint<float>::ByCoordinate({x, y}); } } -static StyleControlPoint<float> MakeControlPoint(PositionType type, float x, - float y) { +static StyleCurveControlPoint<float> MakeControlPoint(PositionType type, + float x, float y) { if (type == PositionType::Absolute) { - return StyleControlPoint<float>::Position({x, y}); + return StyleCurveControlPoint<float>::Absolute({x, y}); } else { - return StyleControlPoint<float>::Relative( + return StyleCurveControlPoint<float>::Relative( StyleRelativeControlPoint<float>{{x, y}, StyleControlReference::None}); } } diff --git a/dom/svg/SVGPathData.cpp b/dom/svg/SVGPathData.cpp @@ -199,13 +199,13 @@ static inline StyleCSSFloat Resolve(const LengthPercentage& aValue, return aValue.ResolveToCSSPixels(aBasis); } -template <typename Angle, typename LP> +template <typename Angle, typename Position, typename LP> static already_AddRefed<Path> BuildPathInternal( - Span<const StyleGenericShapeCommand<Angle, LP>> aPath, + Span<const StyleGenericShapeCommand<Angle, Position, LP>> aPath, PathBuilder* aBuilder, StyleStrokeLinecap aStrokeLineCap, Float aStrokeWidth, const CSSSize& aPercentageBasis, const Point& aOffset, float aZoomFactor) { - using Command = StyleGenericShapeCommand<Angle, LP>; + using Command = StyleGenericShapeCommand<Angle, Position, LP>; if (aPath.IsEmpty() || !aPath[0].IsMove()) { return nullptr; // paths without an initial moveto are invalid diff --git a/dom/svg/SVGPathElement.cpp b/dom/svg/SVGPathElement.cpp @@ -137,10 +137,10 @@ static void CreatePathSegments(SVGPathElement* aPathElement, Point cp1, cp2; while (converter.GetNextSegment(&cp1, &cp2, &segEnd)) { auto curve = StylePathCommand::CubicCurve( - StyleCommandEndPoint<StyleCSSFloat>::ToPosition( - {segEnd.x, segEnd.y}), - StyleControlPoint<StyleCSSFloat>::Position({cp1.x, cp1.y}), - StyleControlPoint<StyleCSSFloat>::Position({cp2.x, cp2.y})); + StyleEndPoint<StyleCSSFloat>::ToPosition({segEnd.x, segEnd.y}), + StyleCurveControlPoint<StyleCSSFloat>::Absolute({cp1.x, cp1.y}), + StyleCurveControlPoint<StyleCSSFloat>::Absolute( + {cp2.x, cp2.y})); aValues.AppendElement(new SVGPathSegment(aPathElement, curve)); } break; diff --git a/dom/svg/SVGPathSegUtils.h b/dom/svg/SVGPathSegUtils.h @@ -12,9 +12,28 @@ #include "mozilla/gfx/Rect.h" namespace mozilla { -template <typename Angle, typename LP> + +// Position +template <typename H, typename V> +struct StyleGenericPosition; + +// Command Endpoint +template <typename Position, typename LP> +struct StyleCommandEndPoint; +template <typename T> +using StyleEndPoint = StyleCommandEndPoint<StyleGenericPosition<T, T>, T>; + +// Control Point +template <typename Position, typename LP> +struct StyleControlPoint; +template <typename T> +using StyleCurveControlPoint = StyleControlPoint<StyleGenericPosition<T, T>, T>; + +// Shape Command +template <typename Angle, typename Position, typename LP> struct StyleGenericShapeCommand; -using StylePathCommand = StyleGenericShapeCommand<float, float>; +using StylePathCommand = + StyleGenericShapeCommand<float, StyleGenericPosition<float, float>, float>; /** * Code that works with path segments can use an instance of this class to diff --git a/dom/svg/SVGPathSegment.cpp b/dom/svg/SVGPathSegment.cpp @@ -20,8 +20,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(SVGPathSegment, mSVGPathElement) //---------------------------------------------------------------------- // Implementation -void SVGPathSegment::AppendEndPoint( - const StyleCommandEndPoint<StyleCSSFloat>& point) { +void SVGPathSegment::AppendEndPoint(const StyleEndPoint<StyleCSSFloat>& point) { if (point.IsToPosition()) { const auto& pos = point.AsToPosition(); mValues.AppendElement(pos.horizontal); @@ -34,9 +33,9 @@ void SVGPathSegment::AppendEndPoint( } void SVGPathSegment::AppendControlPoint( - const StyleControlPoint<StyleCSSFloat>& point) { - if (point.IsPosition()) { - const auto& pos = point.AsPosition(); + const StyleCurveControlPoint<StyleCSSFloat>& point) { + if (point.IsAbsolute()) { + const auto& pos = point.AsAbsolute(); mValues.AppendElement(pos.horizontal); mValues.AppendElement(pos.vertical); } else if (point.IsRelative()) { diff --git a/dom/svg/SVGPathSegment.h b/dom/svg/SVGPathSegment.h @@ -42,8 +42,8 @@ class SVGPathSegment final : public nsWrapperCache { RefPtr<SVGPathElement> mSVGPathElement; nsString mCommand; nsTArray<float> mValues; - void AppendEndPoint(const StyleCommandEndPoint<StyleCSSFloat>& point); - void AppendControlPoint(const StyleControlPoint<StyleCSSFloat>& point); + void AppendEndPoint(const StyleEndPoint<StyleCSSFloat>& point); + void AppendControlPoint(const StyleCurveControlPoint<StyleCSSFloat>& point); }; } // namespace mozilla::dom diff --git a/layout/base/MotionPathUtils.cpp b/layout/base/MotionPathUtils.cpp @@ -475,8 +475,10 @@ static already_AddRefed<gfx::Path> BuildDefaultPathForURL( return nullptr; } - Array<const StylePathCommand, 1> array(StylePathCommand::Move( - StyleCommandEndPoint<StyleCSSFloat>::ByCoordinate({0.0, 0.0}))); + using CommandEndPoint = + StyleCommandEndPoint<StyleShapePosition<StyleCSSFloat>, StyleCSSFloat>; + Array<const StylePathCommand, 1> array( + StylePathCommand::Move(CommandEndPoint::ByCoordinate({0.0, 0.0}))); return SVGPathData::BuildPath(array, aBuilder, StyleStrokeLinecap::Butt, 0.0); } diff --git a/layout/inspector/tests/test_bug877690.html b/layout/inspector/tests/test_bug877690.html @@ -293,7 +293,8 @@ function do_test() { // Regression test for bug 1255379. var shapeFunction = [ "close", "evenodd", "nonzero", "by", "to", "cw", "ccw", - "small", "large", "end", "origin", "start"]; + "small", "large", "end", "origin", "start", "center", + "left", "right", "top", "bottom"]; var expected = [ "inherit", "initial", "unset", "revert", "revert-layer", "none", "url", "polygon", "circle", "ellipse", "inset", "path", "rect", "xywh", "fill-box", "stroke-box", diff --git a/layout/style/ServoStyleConstsInlines.h b/layout/style/ServoStyleConstsInlines.h @@ -1291,8 +1291,9 @@ inline gfx::Point StyleShapePosition<LengthPercentage>::ToGfxPoint( } template <> -inline gfx::Point StyleCommandEndPoint<StyleCSSFloat>::ToGfxPoint( - const CSSSize* aBasis) const { +inline gfx::Point +StyleCommandEndPoint<StyleShapePosition<StyleCSSFloat>, + StyleCSSFloat>::ToGfxPoint(const CSSSize* aBasis) const { if (IsToPosition()) { auto& pos = AsToPosition(); return pos.ToGfxPoint(); @@ -1303,8 +1304,9 @@ inline gfx::Point StyleCommandEndPoint<StyleCSSFloat>::ToGfxPoint( } template <> -inline gfx::Point StyleCommandEndPoint<LengthPercentage>::ToGfxPoint( - const CSSSize* aBasis) const { +inline gfx::Point StyleCommandEndPoint< + StyleShapePosition<LengthPercentage>, + LengthPercentage>::ToGfxPoint(const CSSSize* aBasis) const { MOZ_ASSERT(aBasis); if (IsToPosition()) { auto& pos = AsToPosition(); @@ -1316,11 +1318,12 @@ inline gfx::Point StyleCommandEndPoint<LengthPercentage>::ToGfxPoint( } template <> -inline gfx::Point StyleControlPoint<StyleCSSFloat>::ToGfxPoint( +inline gfx::Point +StyleControlPoint<StyleShapePosition<StyleCSSFloat>, StyleCSSFloat>::ToGfxPoint( const gfx::Point aStatePos, const gfx::Point aEndPoint, const bool isRelativeEndPoint, const CSSSize* aBasis) const { - if (IsPosition()) { - auto& pos = AsPosition(); + if (IsAbsolute()) { + auto& pos = AsAbsolute(); return pos.ToGfxPoint(); } @@ -1341,12 +1344,15 @@ inline gfx::Point StyleControlPoint<StyleCSSFloat>::ToGfxPoint( } template <> -inline gfx::Point StyleControlPoint<LengthPercentage>::ToGfxPoint( - const gfx::Point aStatePos, const gfx::Point aEndPoint, - const bool isRelativeEndPoint, const CSSSize* aBasis) const { +inline gfx::Point +StyleControlPoint<StyleShapePosition<LengthPercentage>, + LengthPercentage>::ToGfxPoint(const gfx::Point aStatePos, + const gfx::Point aEndPoint, + const bool isRelativeEndPoint, + const CSSSize* aBasis) const { MOZ_ASSERT(aBasis); - if (IsPosition()) { - auto& pos = AsPosition(); + if (IsAbsolute()) { + auto& pos = AsAbsolute(); return pos.ToGfxPoint(aBasis); } diff --git a/servo/components/style/values/computed/basic_shape.rs b/servo/components/style/values/computed/basic_shape.rs @@ -10,9 +10,9 @@ use crate::values::animated::{Animate, Procedure}; use crate::values::computed::angle::Angle; use crate::values::computed::url::ComputedUrl; -use crate::values::computed::{Image, LengthPercentage, NonNegativeLengthPercentage, Position}; +use crate::values::computed::{Image, LengthPercentage, Position}; use crate::values::generics::basic_shape as generic; -use crate::values::generics::position::Position as GenericPosition; +use crate::values::generics::basic_shape::ShapePosition; use crate::values::specified::svg_path::{CoordPair, PathCommand}; use crate::values::CSSFloat; @@ -32,34 +32,35 @@ pub type BasicShape = generic::GenericBasicShape<Angle, Position, LengthPercenta pub type InsetRect = generic::GenericInsetRect<LengthPercentage>; /// A computed circle. -pub type Circle = generic::Circle<Position, NonNegativeLengthPercentage>; +pub type Circle = generic::Circle<LengthPercentage>; /// A computed ellipse. -pub type Ellipse = generic::Ellipse<Position, NonNegativeLengthPercentage>; +pub type Ellipse = generic::Ellipse<LengthPercentage>; /// The computed value of `ShapeRadius`. -pub type ShapeRadius = generic::GenericShapeRadius<NonNegativeLengthPercentage>; +pub type ShapeRadius = generic::GenericShapeRadius<LengthPercentage>; /// The computed value of `shape()`. -pub type Shape = generic::Shape<Angle, LengthPercentage>; +pub type Shape = generic::Shape<Angle, Position, LengthPercentage>; /// The computed value of `ShapeCommand`. -pub type ShapeCommand = generic::GenericShapeCommand<Angle, LengthPercentage>; +pub type ShapeCommand = generic::GenericShapeCommand<Angle, Position, LengthPercentage>; /// The computed value of `PathOrShapeFunction`. -pub type PathOrShapeFunction = generic::GenericPathOrShapeFunction<Angle, LengthPercentage>; +pub type PathOrShapeFunction = + generic::GenericPathOrShapeFunction<Angle, Position, LengthPercentage>; /// The computed value of `CoordinatePair`. pub type CoordinatePair = generic::CoordinatePair<LengthPercentage>; /// The computed value of 'ControlPoint'. -pub type ControlPoint = generic::ControlPoint<LengthPercentage>; +pub type ControlPoint = generic::ControlPoint<Position, LengthPercentage>; /// The computed value of 'RelativeControlPoint'. pub type RelativeControlPoint = generic::RelativeControlPoint<LengthPercentage>; /// The computed value of 'CommandEndPoint'. -pub type CommandEndPoint = generic::CommandEndPoint<LengthPercentage>; +pub type CommandEndPoint = generic::CommandEndPoint<Position, LengthPercentage>; /// Animate from `Shape` to `Path`, and vice versa. macro_rules! animate_shape { @@ -214,9 +215,9 @@ impl From<&CoordPair> for CoordinatePair { } } -impl From<&GenericPosition<CSSFloat, CSSFloat>> for Position { +impl From<&ShapePosition<CSSFloat>> for Position { #[inline] - fn from(p: &GenericPosition<CSSFloat, CSSFloat>) -> Self { + fn from(p: &ShapePosition<CSSFloat>) -> Self { use crate::values::computed::CSSPixelLength; Self::new( LengthPercentage::new_length(CSSPixelLength::new(p.horizontal)), @@ -225,9 +226,9 @@ impl From<&GenericPosition<CSSFloat, CSSFloat>> for Position { } } -impl From<&generic::CommandEndPoint<CSSFloat>> for CommandEndPoint { +impl From<&generic::CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat>> for CommandEndPoint { #[inline] - fn from(p: &generic::CommandEndPoint<CSSFloat>) -> Self { + fn from(p: &generic::CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat>) -> Self { match p { generic::CommandEndPoint::ToPosition(pos) => Self::ToPosition(pos.into()), generic::CommandEndPoint::ByCoordinate(coord) => Self::ByCoordinate(coord.into()), @@ -235,11 +236,11 @@ impl From<&generic::CommandEndPoint<CSSFloat>> for CommandEndPoint { } } -impl From<&generic::ControlPoint<CSSFloat>> for ControlPoint { +impl From<&generic::ControlPoint<ShapePosition<CSSFloat>, CSSFloat>> for ControlPoint { #[inline] - fn from(p: &generic::ControlPoint<CSSFloat>) -> Self { + fn from(p: &generic::ControlPoint<ShapePosition<CSSFloat>, CSSFloat>) -> Self { match p { - generic::ControlPoint::Position(pos) => Self::Position(pos.into()), + generic::ControlPoint::Absolute(pos) => Self::Absolute(pos.into()), generic::ControlPoint::Relative(point) => Self::Relative(RelativeControlPoint { coord: CoordinatePair::from(&point.coord), reference: point.reference, diff --git a/servo/components/style/values/generics/basic_shape.rs b/servo/components/style/values/generics/basic_shape.rs @@ -18,8 +18,7 @@ use crate::Zero; use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; -/// TODO(bug 1982941): Replace with GenericPosition directly if ShapePosition is under utilized. -/// A generic value for `<position>` in basic_shape. +/// A generic value for `<position>` in circle(), ellipse(), and shape(). pub type ShapePosition<LengthPercentage> = GenericPosition<LengthPercentage, LengthPercentage>; /// <https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box> @@ -207,14 +206,14 @@ pub enum GenericBasicShape<Angle, Position, LengthPercentage, BasicShapeRect> { #[animation(field_bound)] #[css(field_bound)] #[shmem(field_bound)] - Circle<Position, NonNegative<LengthPercentage>>, + Circle<LengthPercentage>, ), /// Defines an ellipse with a center and x-axis/y-axis radii. Ellipse( #[animation(field_bound)] #[css(field_bound)] #[shmem(field_bound)] - Ellipse<Position, NonNegative<LengthPercentage>>, + Ellipse<LengthPercentage>, ), /// Defines a polygon with pair arguments. Polygon(GenericPolygon<LengthPercentage>), @@ -222,7 +221,7 @@ pub enum GenericBasicShape<Angle, Position, LengthPercentage, BasicShapeRect> { PathOrShape( #[animation(field_bound)] #[css(field_bound)] - GenericPathOrShapeFunction<Angle, LengthPercentage>, + GenericPathOrShapeFunction<Angle, Position, LengthPercentage>, ), } @@ -276,9 +275,10 @@ pub use self::GenericInsetRect as InsetRect; )] #[css(function)] #[repr(C)] -pub struct Circle<Position, NonNegativeLengthPercentage> { - pub position: GenericPositionOrAuto<Position>, - pub radius: GenericShapeRadius<NonNegativeLengthPercentage>, +pub struct Circle<LengthPercentage> { + pub position: GenericPositionOrAuto<ShapePosition<LengthPercentage>>, + #[animation(field_bound)] + pub radius: GenericShapeRadius<LengthPercentage>, } /// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse> @@ -301,10 +301,12 @@ pub struct Circle<Position, NonNegativeLengthPercentage> { )] #[css(function)] #[repr(C)] -pub struct Ellipse<Position, NonNegativeLengthPercentage> { - pub position: GenericPositionOrAuto<Position>, - pub semiaxis_x: GenericShapeRadius<NonNegativeLengthPercentage>, - pub semiaxis_y: GenericShapeRadius<NonNegativeLengthPercentage>, +pub struct Ellipse<LengthPercentage> { + pub position: GenericPositionOrAuto<ShapePosition<LengthPercentage>>, + #[animation(field_bound)] + pub semiaxis_x: GenericShapeRadius<LengthPercentage>, + #[animation(field_bound)] + pub semiaxis_y: GenericShapeRadius<LengthPercentage>, } /// <https://drafts.csswg.org/css-shapes/#typedef-shape-radius> @@ -328,8 +330,12 @@ pub struct Ellipse<Position, NonNegativeLengthPercentage> { ToShmem, )] #[repr(C, u8)] -pub enum GenericShapeRadius<NonNegativeLengthPercentage> { - Length(NonNegativeLengthPercentage), +pub enum GenericShapeRadius<LengthPercentage> { + Length( + #[animation(field_bound)] + #[parse(field_bound)] + NonNegative<LengthPercentage>, + ), #[animation(error)] ClosestSide, #[animation(error)] @@ -405,11 +411,11 @@ pub struct PolygonCoord<LengthPercentage>(pub LengthPercentage, pub LengthPercen ToShmem, )] #[repr(C, u8)] -pub enum GenericPathOrShapeFunction<Angle, LengthPercentage> { +pub enum GenericPathOrShapeFunction<Angle, Position, LengthPercentage> { /// Defines a path with SVG path syntax. Path(Path), /// Defines a shape function, which is identical to path() but it uses the CSS syntax. - Shape(#[css(field_bound)] Shape<Angle, LengthPercentage>), + Shape(#[css(field_bound)] Shape<Angle, Position, LengthPercentage>), } // https://drafts.csswg.org/css-shapes/#typedef-fill-rule @@ -510,10 +516,10 @@ where } } -impl<Position, NonNegativeLengthPercentage> ToCss for Circle<Position, NonNegativeLengthPercentage> +impl<LengthPercentage> ToCss for Circle<LengthPercentage> where - Position: ToCss, - NonNegativeLengthPercentage: ToCss + PartialEq, + LengthPercentage: ToCss + PartialEq, + ShapePosition<LengthPercentage>: ToCss, { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where @@ -539,10 +545,10 @@ where } } -impl<Position, NonNegativeLengthPercentage> ToCss for Ellipse<Position, NonNegativeLengthPercentage> +impl<LengthPercentage> ToCss for Ellipse<LengthPercentage> where - Position: ToCss, - NonNegativeLengthPercentage: ToCss + PartialEq, + LengthPercentage: ToCss + PartialEq, + ShapePosition<LengthPercentage>: ToCss, { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where @@ -637,26 +643,27 @@ fn is_default<T: Default + PartialEq>(fill: &T) -> bool { ToShmem, )] #[repr(C)] -pub struct Shape<Angle, LengthPercentage> { +pub struct Shape<Angle, Position, LengthPercentage> { /// The filling rule for this shape. pub fill: FillRule, /// The shape command data. Note that the starting point will be the first command in this /// slice. // Note: The first command is always GenericShapeCommand::Move. - pub commands: crate::OwnedSlice<GenericShapeCommand<Angle, LengthPercentage>>, + pub commands: crate::OwnedSlice<GenericShapeCommand<Angle, Position, LengthPercentage>>, } -impl<Angle, LengthPercentage> Shape<Angle, LengthPercentage> { +impl<Angle, Position, LengthPercentage> Shape<Angle, Position, LengthPercentage> { /// Returns the slice of GenericShapeCommand<..>. #[inline] - pub fn commands(&self) -> &[GenericShapeCommand<Angle, LengthPercentage>] { + pub fn commands(&self) -> &[GenericShapeCommand<Angle, Position, LengthPercentage>] { &self.commands } } -impl<Angle, LengthPercentage> Animate for Shape<Angle, LengthPercentage> +impl<Angle, Position, LengthPercentage> Animate for Shape<Angle, Position, LengthPercentage> where Angle: Animate, + Position: Animate, LengthPercentage: Animate, { fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> { @@ -672,9 +679,11 @@ where } } -impl<Angle, LengthPercentage> ComputeSquaredDistance for Shape<Angle, LengthPercentage> +impl<Angle, Position, LengthPercentage> ComputeSquaredDistance + for Shape<Angle, Position, LengthPercentage> where Angle: ComputeSquaredDistance, + Position: ComputeSquaredDistance, LengthPercentage: ComputeSquaredDistance, { fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> { @@ -685,11 +694,11 @@ where } } -impl<Angle, LengthPercentage> ToCss for Shape<Angle, LengthPercentage> +impl<Angle, Position, LengthPercentage> ToCss for Shape<Angle, Position, LengthPercentage> where Angle: ToCss + Zero, + Position: ToCss, LengthPercentage: PartialEq + ToCss, - ShapePosition<LengthPercentage>: ToCss, { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where @@ -709,11 +718,7 @@ where match &self.commands[0] { ShapeCommand::Move { point: CommandEndPoint::ToPosition(pos), - } => { - pos.horizontal.to_css(dest)?; - dest.write_char(' ')?; - pos.vertical.to_css(dest)? - }, + } => pos.to_css(dest)?, ShapeCommand::Move { point: CommandEndPoint::ByCoordinate(coord), } => coord.to_css(dest)?, @@ -753,14 +758,14 @@ where )] #[allow(missing_docs)] #[repr(C, u8)] -pub enum GenericShapeCommand<Angle, LengthPercentage> { +pub enum GenericShapeCommand<Angle, Position, LengthPercentage> { /// The move command. Move { - point: CommandEndPoint<LengthPercentage>, + point: CommandEndPoint<Position, LengthPercentage>, }, /// The line command. Line { - point: CommandEndPoint<LengthPercentage>, + point: CommandEndPoint<Position, LengthPercentage>, }, /// The hline command. HLine { by_to: ByTo, x: LengthPercentage }, @@ -768,27 +773,27 @@ pub enum GenericShapeCommand<Angle, LengthPercentage> { VLine { by_to: ByTo, y: LengthPercentage }, /// The cubic Bézier curve command. CubicCurve { - point: CommandEndPoint<LengthPercentage>, - control1: ControlPoint<LengthPercentage>, - control2: ControlPoint<LengthPercentage>, + point: CommandEndPoint<Position, LengthPercentage>, + control1: ControlPoint<Position, LengthPercentage>, + control2: ControlPoint<Position, LengthPercentage>, }, /// The quadratic Bézier curve command. QuadCurve { - point: CommandEndPoint<LengthPercentage>, - control1: ControlPoint<LengthPercentage>, + point: CommandEndPoint<Position, LengthPercentage>, + control1: ControlPoint<Position, LengthPercentage>, }, /// The smooth command. SmoothCubic { - point: CommandEndPoint<LengthPercentage>, - control2: ControlPoint<LengthPercentage>, + point: CommandEndPoint<Position, LengthPercentage>, + control2: ControlPoint<Position, LengthPercentage>, }, /// The smooth quadratic Bézier curve command. SmoothQuad { - point: CommandEndPoint<LengthPercentage>, + point: CommandEndPoint<Position, LengthPercentage>, }, /// The arc command. Arc { - point: CommandEndPoint<LengthPercentage>, + point: CommandEndPoint<Position, LengthPercentage>, radii: CoordinatePair<LengthPercentage>, arc_sweep: ArcSweep, arc_size: ArcSize, @@ -800,11 +805,11 @@ pub enum GenericShapeCommand<Angle, LengthPercentage> { pub use self::GenericShapeCommand as ShapeCommand; -impl<Angle, LengthPercentage> ToCss for ShapeCommand<Angle, LengthPercentage> +impl<Angle, Position, LengthPercentage> ToCss for ShapeCommand<Angle, Position, LengthPercentage> where Angle: ToCss + Zero, + Position: ToCss, LengthPercentage: PartialEq + ToCss, - ShapePosition<LengthPercentage>: ToCss, { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where @@ -972,12 +977,12 @@ impl ByTo { ToShmem, )] #[repr(C, u8)] -pub enum CommandEndPoint<LengthPercentage> { - ToPosition(ShapePosition<LengthPercentage>), +pub enum CommandEndPoint<Position, LengthPercentage> { + ToPosition(Position), ByCoordinate(CoordinatePair<LengthPercentage>), } -impl<LengthPercentage> CommandEndPoint<LengthPercentage> { +impl<Position, LengthPercentage> CommandEndPoint<Position, LengthPercentage> { /// Return true if it is absolute, i.e. it is To. #[inline] pub fn is_abs(&self) -> bool { @@ -985,18 +990,17 @@ impl<LengthPercentage> CommandEndPoint<LengthPercentage> { } } -impl<LengthPercentage: ToCss> ToCss for CommandEndPoint<LengthPercentage> { - /// TODO(bug 1993308): Should print position keywords as keywords. I.e. like the to_css in specified/position.rs. +impl<Position, LengthPercentage> CommandEndPoint<Position, LengthPercentage> { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write, + Position: ToCss, + LengthPercentage: ToCss, { match self { CommandEndPoint::ToPosition(pos) => { dest.write_str("to ")?; - pos.horizontal.to_css(dest)?; - dest.write_char(' ')?; - pos.vertical.to_css(dest) + pos.to_css(dest) }, CommandEndPoint::ByCoordinate(coord) => { dest.write_str("by ")?; @@ -1066,21 +1070,21 @@ impl<LengthPercentage> CoordinatePair<LengthPercentage> { ToShmem, )] #[repr(C, u8)] -pub enum ControlPoint<LengthPercentage> { - Position(ShapePosition<LengthPercentage>), +pub enum ControlPoint<Position, LengthPercentage> { + Absolute(Position), Relative(RelativeControlPoint<LengthPercentage>), } -impl<LengthPercentage> ControlPoint<LengthPercentage> { +impl<Position, LengthPercentage> ControlPoint<Position, LengthPercentage> { /// Serialize <control-point> pub fn to_css<W>(&self, dest: &mut CssWriter<W>, is_endpoint_abs: bool) -> fmt::Result where W: Write, + Position: ToCss, LengthPercentage: ToCss, - ShapePosition<LengthPercentage>: ToCss, { match self { - ControlPoint::Position(pos) => pos.to_css(dest), + ControlPoint::Absolute(pos) => pos.to_css(dest), ControlPoint::Relative(point) => point.to_css(dest, is_endpoint_abs), } } diff --git a/servo/components/style/values/specified/basic_shape.rs b/servo/components/style/values/specified/basic_shape.rs @@ -12,13 +12,13 @@ use crate::values::computed::basic_shape::InsetRect as ComputedInsetRect; use crate::values::computed::{Context, ToComputedValue}; use crate::values::generics::basic_shape as generic; use crate::values::generics::basic_shape::{Path, PolygonCoord}; -use crate::values::generics::position::{GenericPosition, GenericPositionOrAuto}; +use crate::values::generics::position::GenericPositionOrAuto; use crate::values::generics::rect::Rect; use crate::values::specified::angle::Angle; use crate::values::specified::border::BorderRadius; use crate::values::specified::image::Image; use crate::values::specified::length::LengthPercentageOrAuto; -use crate::values::specified::position::Side; +use crate::values::specified::position::{Position, Side}; use crate::values::specified::url::SpecifiedUrl; use crate::values::specified::PositionComponent; use crate::values::specified::{LengthPercentage, NonNegativeLengthPercentage, SVGPathData}; @@ -39,32 +39,32 @@ pub type ShapeOutside = generic::GenericShapeOutside<BasicShape, Image>; /// A specified value for `at <position>` in circle() and ellipse(). // Note: its computed value is the same as computed::position::Position. We just want to always use // LengthPercentage as the type of its components, for basic shapes. -pub type ShapePosition = GenericPosition<LengthPercentage, LengthPercentage>; +pub type RadialPosition = generic::ShapePosition<LengthPercentage>; /// A specified basic shape. -pub type BasicShape = - generic::GenericBasicShape<Angle, ShapePosition, LengthPercentage, BasicShapeRect>; +pub type BasicShape = generic::GenericBasicShape<Angle, Position, LengthPercentage, BasicShapeRect>; /// The specified value of `inset()`. pub type InsetRect = generic::GenericInsetRect<LengthPercentage>; /// A specified circle. -pub type Circle = generic::Circle<ShapePosition, NonNegativeLengthPercentage>; +pub type Circle = generic::Circle<LengthPercentage>; /// A specified ellipse. -pub type Ellipse = generic::Ellipse<ShapePosition, NonNegativeLengthPercentage>; +pub type Ellipse = generic::Ellipse<LengthPercentage>; /// The specified value of `ShapeRadius`. -pub type ShapeRadius = generic::ShapeRadius<NonNegativeLengthPercentage>; +pub type ShapeRadius = generic::ShapeRadius<LengthPercentage>; /// The specified value of `Polygon`. pub type Polygon = generic::GenericPolygon<LengthPercentage>; /// The specified value of `PathOrShapeFunction`. -pub type PathOrShapeFunction = generic::GenericPathOrShapeFunction<Angle, LengthPercentage>; +pub type PathOrShapeFunction = + generic::GenericPathOrShapeFunction<Angle, Position, LengthPercentage>; /// The specified value of `ShapeCommand`. -pub type ShapeCommand = generic::GenericShapeCommand<Angle, LengthPercentage>; +pub type ShapeCommand = generic::GenericShapeCommand<Angle, Position, LengthPercentage>; /// The specified value of `xywh()`. /// Defines a rectangle via offsets from the top and left edge of the reference box, and a @@ -384,7 +384,7 @@ impl InsetRect { } } -impl ToCss for ShapePosition { +impl ToCss for RadialPosition { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write, @@ -427,11 +427,11 @@ fn convert_to_length_percentage<S: Side>(c: PositionComponent<S>) -> LengthPerce fn parse_at_position<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, -) -> Result<GenericPositionOrAuto<ShapePosition>, ParseError<'i>> { +) -> Result<GenericPositionOrAuto<RadialPosition>, ParseError<'i>> { use crate::values::specified::position::Position; if input.try_parse(|i| i.expect_ident_matching("at")).is_ok() { Position::parse(context, input).map(|pos| { - GenericPositionOrAuto::Position(ShapePosition::new( + GenericPositionOrAuto::Position(RadialPosition::new( convert_to_length_percentage(pos.horizontal), convert_to_length_percentage(pos.vertical), )) @@ -442,19 +442,6 @@ fn parse_at_position<'i, 't>( } } -fn parse_to_position<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, -) -> Result<ShapePosition, ParseError<'i>> { - use crate::values::specified::position::Position; - Position::parse(context, input).map(|pos| { - ShapePosition::new( - convert_to_length_percentage(pos.horizontal), - convert_to_length_percentage(pos.vertical), - ) - }) -} - impl Parse for Circle { fn parse<'i, 't>( context: &ParserContext, @@ -746,7 +733,7 @@ impl ToComputedValue for BasicShapeRect { } } -impl generic::Shape<Angle, LengthPercentage> { +impl generic::Shape<Angle, Position, LengthPercentage> { /// Parse the inner arguments of a `shape` function. /// shape() = shape(<fill-rule>? from <coordinate-pair>, <shape-command>#) fn parse_function_arguments<'i, 't>( @@ -816,7 +803,7 @@ impl Parse for ShapeCommand { // parse 2 offsets as valid (i.e. hline to left 30% works), and similarly // incorrectly parse top or bottom as valid values. let x = if by_to.is_abs() { - parse_to_position(context, input)?.horizontal + convert_to_length_percentage(Position::parse(context, input)?.horizontal) } else { LengthPercentage::parse(context, input)? }; @@ -826,7 +813,7 @@ impl Parse for ShapeCommand { let by_to = ByTo::parse(input)?; // FIXME(Bug 1993311): Should parse y-start and y-end too. let y = if by_to.is_abs() { - parse_to_position(context, input)?.horizontal + convert_to_length_percentage(Position::parse(context, input)?.horizontal) } else { LengthPercentage::parse(context, input)? }; @@ -923,7 +910,7 @@ impl Parse for generic::CoordinatePair<LengthPercentage> { } } -impl generic::ControlPoint<LengthPercentage> { +impl generic::ControlPoint<Position, LengthPercentage> { /// Parse <control-point> = [ <position> | <relative-control-point> ] fn parse<'i, 't>( context: &ParserContext, @@ -934,8 +921,8 @@ impl generic::ControlPoint<LengthPercentage> { // Parse <position> if by_to.is_abs() && coord.is_err() { - let pos = parse_to_position(context, input)?; - return Ok(Self::Position(pos)); + let pos = Position::parse(context, input)?; + return Ok(Self::Absolute(pos)); } // Parse <relative-control-point> = <coordinate-pair> [from [ start | end | origin ]]? @@ -951,7 +938,7 @@ impl generic::ControlPoint<LengthPercentage> { } } -impl generic::CommandEndPoint<LengthPercentage> { +impl generic::CommandEndPoint<Position, LengthPercentage> { /// Parse <command-end-point> = to <position> | by <coordinate-pair> pub fn parse<'i, 't>( context: &ParserContext, @@ -959,7 +946,7 @@ impl generic::CommandEndPoint<LengthPercentage> { by_to: generic::ByTo, ) -> Result<Self, ParseError<'i>> { if by_to.is_abs() { - let point = parse_to_position(context, input)?; + let point = Position::parse(context, input)?; Ok(Self::ToPosition(point)) } else { let point = generic::CoordinatePair::parse(context, input)?; diff --git a/servo/components/style/values/specified/svg_path.rs b/servo/components/style/values/specified/svg_path.rs @@ -10,9 +10,9 @@ use crate::values::distance::{ComputeSquaredDistance, SquaredDistance}; use crate::values::generics::basic_shape::GenericShapeCommand; use crate::values::generics::basic_shape::{ ArcSize, ArcSweep, ByTo, CommandEndPoint, ControlPoint, ControlReference, CoordinatePair, - RelativeControlPoint, + RelativeControlPoint, ShapePosition, }; -use crate::values::generics::position::GenericPosition as Position; +use crate::values::generics::position::GenericPosition; use crate::values::CSSFloat; use cssparser::Parser; use std::fmt::{self, Write}; @@ -22,9 +22,6 @@ use std::slice; use style_traits::values::SequenceWriter; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; -/// A specified value for `<position>`. -pub type ShapePosition = Position<CSSFloat, CSSFloat>; - /// Whether to allow empty string in the parser. #[derive(Clone, Debug, Eq, PartialEq)] #[allow(missing_docs)] @@ -197,7 +194,7 @@ impl ComputeSquaredDistance for SVGPathData { /// points of the Bézier curve in the spec. /// /// https://www.w3.org/TR/SVG11/paths.html#PathData -pub type PathCommand = GenericShapeCommand<CSSFloat, CSSFloat>; +pub type PathCommand = GenericShapeCommand<CSSFloat, ShapePosition<CSSFloat>, CSSFloat>; /// For internal SVGPath normalization. #[allow(missing_docs)] @@ -304,8 +301,8 @@ impl PathCommand { state.last_control = control1.into(); CubicCurve { point, - control1: ControlPoint::Position(c1.into()), - control2: ControlPoint::Position(control2.into()), + control1: ControlPoint::Absolute(c1.into()), + control2: ControlPoint::Absolute(control2.into()), } } else { state.pos = point.into(); @@ -336,7 +333,7 @@ impl PathCommand { state.last_command = *self; CubicCurve { point, - control1: ControlPoint::Position(control1.into()), + control1: ControlPoint::Absolute(control1.into()), control2, } } else { @@ -364,8 +361,8 @@ impl PathCommand { state.last_control = control; CubicCurve { point, - control1: ControlPoint::Position(control1.into()), - control2: ControlPoint::Position(control2.into()), + control1: ControlPoint::Absolute(control1.into()), + control2: ControlPoint::Absolute(control2.into()), } } else { state.pos = point.into(); @@ -387,8 +384,8 @@ impl PathCommand { let end_point = CoordPair::from(point); CubicCurve { point: CommandEndPoint::ToPosition(state.pos.into()), - control1: ControlPoint::Position(end_point.into()), - control2: ControlPoint::Position(end_point.into()), + control1: ControlPoint::Absolute(end_point.into()), + control2: ControlPoint::Absolute(end_point.into()), } } else { Arc { @@ -550,14 +547,14 @@ impl ops::Div<CSSFloat> for CoordPair { } } -impl CommandEndPoint<CSSFloat> { +impl CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat> { /// Converts <command-end-point> into absolutely positioned type. - pub fn to_abs(self, state_pos: CoordPair) -> CommandEndPoint<CSSFloat> { + pub fn to_abs(self, state_pos: CoordPair) -> Self { // Consume self value. match self { CommandEndPoint::ToPosition(_) => self, CommandEndPoint::ByCoordinate(coord) => { - let pos = Position { + let pos = GenericPosition { horizontal: coord.x + state_pos.x, vertical: coord.y + state_pos.y, }; @@ -567,18 +564,18 @@ impl CommandEndPoint<CSSFloat> { } } -impl ControlPoint<CSSFloat> { +impl ControlPoint<ShapePosition<CSSFloat>, CSSFloat> { /// Converts <control-point> into absolutely positioned control point type. pub fn to_abs( self, state_pos: CoordPair, - end_point: CommandEndPoint<CSSFloat>, - ) -> ControlPoint<CSSFloat> { + end_point: CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat>, + ) -> Self { // Consume self value. match self { - ControlPoint::Position(_) => self, + ControlPoint::Absolute(_) => self, ControlPoint::Relative(point) => { - let mut pos = Position { + let mut pos = GenericPosition { horizontal: point.coord.x, vertical: point.coord.y, }; @@ -599,15 +596,15 @@ impl ControlPoint<CSSFloat> { }, _ => (), } - ControlPoint::Position(pos) + ControlPoint::Absolute(pos) }, } } } -impl From<CommandEndPoint<CSSFloat>> for CoordPair { +impl From<CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat>> for CoordPair { #[inline] - fn from(p: CommandEndPoint<CSSFloat>) -> Self { + fn from(p: CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat>) -> Self { match p { CommandEndPoint::ToPosition(pos) => CoordPair { x: pos.horizontal, @@ -618,11 +615,11 @@ impl From<CommandEndPoint<CSSFloat>> for CoordPair { } } -impl From<ControlPoint<CSSFloat>> for CoordPair { +impl From<ControlPoint<ShapePosition<CSSFloat>, CSSFloat>> for CoordPair { #[inline] - fn from(point: ControlPoint<CSSFloat>) -> Self { + fn from(point: ControlPoint<ShapePosition<CSSFloat>, CSSFloat>) -> Self { match point { - ControlPoint::Position(pos) => CoordPair { + ControlPoint::Absolute(pos) => CoordPair { x: pos.horizontal, y: pos.vertical, }, @@ -636,24 +633,24 @@ impl From<ControlPoint<CSSFloat>> for CoordPair { } } -impl From<CoordPair> for CommandEndPoint<CSSFloat> { +impl From<CoordPair> for CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat> { #[inline] fn from(coord: CoordPair) -> Self { CommandEndPoint::ByCoordinate(coord) } } -impl From<CoordPair> for Position<CSSFloat, CSSFloat> { +impl From<CoordPair> for ShapePosition<CSSFloat> { #[inline] fn from(coord: CoordPair) -> Self { - Position { + GenericPosition { horizontal: coord.x, vertical: coord.y, } } } -impl ToCss for ShapePosition { +impl ToCss for ShapePosition<CSSFloat> { fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: Write, @@ -892,7 +889,7 @@ fn parse_coord(iter: &mut Peekable<Cloned<slice::Iter<u8>>>) -> Result<CoordPair /// Parse a pair of numbers that describes the absolutely positioned endpoint. fn parse_command_point_abs( iter: &mut Peekable<Cloned<slice::Iter<u8>>>, -) -> Result<CommandEndPoint<f32>, ()> { +) -> Result<CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat>, ()> { let coord = parse_coord(iter)?; Ok(CommandEndPoint::ToPosition(coord.into())) } @@ -900,7 +897,7 @@ fn parse_command_point_abs( /// Parse a pair of numbers that describes the relatively positioned endpoint. fn parse_command_point_rel( iter: &mut Peekable<Cloned<slice::Iter<u8>>>, -) -> Result<CommandEndPoint<f32>, ()> { +) -> Result<CommandEndPoint<ShapePosition<CSSFloat>, CSSFloat>, ()> { let coord = parse_coord(iter)?; Ok(CommandEndPoint::ByCoordinate(coord)) } @@ -911,7 +908,7 @@ fn parse_command_point_rel( /// defaults to the commands coordinate mode (absolute or relative). fn parse_control_point( iter: &mut Peekable<Cloned<slice::Iter<u8>>>, -) -> Result<ControlPoint<f32>, ()> { +) -> Result<ControlPoint<ShapePosition<CSSFloat>, CSSFloat>, ()> { let coord = parse_coord(iter)?; Ok(ControlPoint::Relative(RelativeControlPoint { coord, diff --git a/testing/web-platform/meta/css/css-shapes/shape-functions/shape-function-valid.html.ini b/testing/web-platform/meta/css/css-shapes/shape-functions/shape-function-valid.html.ini @@ -10,65 +10,3 @@ [e.style['clip-path'\] = "shape(from 20px 40px, move to 20px 30px, vline to y-start, vline to y-end)" should set the property value] expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, curve to top left with 10px 30px / 12px 32px)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20% 40%, curve to center with center right / bottom center)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from bottom right, curve to left with center right / bottom center)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, curve to bottom left with 10px 30px from end)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, curve to right center with 10px 30px from start / 12px 32px from end)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, curve to right center with 10px 30px from start/12px 32px from end)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, curve to right center with 10px 30px from end / 12px 32px from origin)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, curve to right center with 10px 30px from origin / 12px 32px from start)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from top left, smooth to top right)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, smooth to center 20%)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from right bottom, smooth by 20px 20px with 12px 32px)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from center 40px, smooth by 20% 20% with 12px 32px from end)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from center, smooth by 20px 20px with 12px 32px from origin)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, arc to top right of 10%)" should set the property value] - expected: FAIL - - [e.style['clip-path'\] = "shape(from 20px 40px, curve by 20px 20px with 10px 30px from origin)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - if (os == "android") and not debug: [PASS, FAIL] - - [e.style['clip-path'\] = "shape(from 20px 40px, curve by 20% 20em with 10.3% 30px from origin / 12pt 5.4% from start)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - if (os == "android") and not debug: [PASS, FAIL] - - [e.style['clip-path'\] = "shape(from 20px 40px, curve by 20% 20em with 10px 30px from start / 12px 32px from end)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - if (os == "android") and not debug: [PASS, FAIL] - - [e.style['clip-path'\] = "shape(from 20px 40px, smooth by 20pt 20px with 12px 32px from start)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - if (os == "android") and not debug: [PASS, FAIL] diff --git a/testing/web-platform/meta/css/motion/parsing/offset-path-shape-parsing.html.ini b/testing/web-platform/meta/css/motion/parsing/offset-path-shape-parsing.html.ini @@ -1,40 +1,4 @@ [offset-path-shape-parsing.html] - [e.style['offset-path'\] = "shape(from 0px 0px, line to 10px 10px)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape( from 0px 0px, line to 10px 10px )" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape(from 1em 50%, line to 10px 10px)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape(from 1ch 50px, line to 10rem 10vh)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape(from 1ch -50px, line to -10% 12px)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape(from 10px 10px, move by 10px 5px, line by 20px 40%, close)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape(from 10px 10px, hline by 10px, vline to 5rem)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape(from 10px 10px, vline by 5%, hline to 1vw)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - - [e.style['offset-path'\] = "shape(from 10px 10px, smooth to 50px 1pt)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - [e.style['offset-path'\] = "shape(from 10px 10px, arc to 50px 1pt of 10px 10px)" should set the property value] expected: if (os == "mac") and not debug: [PASS, FAIL] @@ -45,10 +9,6 @@ if (os == "mac") and not debug: [PASS, FAIL] FAIL - [e.style['offset-path'\] = "shape(from 10% 1rem, arc to 50px 1pt of 20% cw large rotate 25deg)" should set the property value] - expected: - if (os == "mac") and not debug: [PASS, FAIL] - [e.style['offset-path'\] = "shape(evenodd from 0px 0px, line to 10px 10px)" should set the property value] expected: FAIL @@ -57,9 +17,6 @@ [e.style['offset-path'\] = "shape(evenodd from 0px 0px, close)" should set the property value] expected: FAIL - - [e.style['offset-path'\] = "shape(from 10px 10px, curve to 50px 20px with 10rem center)" should set the property value] - expected: FAIL [e.style['offset-path'\] = "shape(from 10px 10px, curve to 50px 20px with 10rem 1% 12px)" should not set the property value] expected: FAIL