@@ -189,16 +189,6 @@ static inline StyleCSSFloat GetRotate(const StyleAngle& aAngle) {
189189 return aAngle.ToDegrees ();
190190}
191191
192- static inline StyleCSSFloat Resolve (const StyleCSSFloat& aValue,
193- CSSCoord aBasis) {
194- return aValue;
195- }
196-
197- static inline StyleCSSFloat Resolve (const LengthPercentage& aValue,
198- CSSCoord aBasis) {
199- return aValue.ResolveToCSSPixels (aBasis);
200- }
201-
202192template <typename Angle, typename Position, typename LP>
203193static already_AddRefed<Path> BuildPathInternal (
204194 Span<const StyleGenericShapeCommand<Angle, Position, LP>> aPath,
@@ -327,8 +317,8 @@ static already_AddRefed<Path> BuildPathInternal(
327317 break ;
328318 }
329319 case Command::Tag::HLine: {
330- const float x = Resolve ( cmd.h_line .x , aPercentageBasis.width );
331- if (cmd.h_line .by_to == StyleByTo::To ) {
320+ const auto x = cmd.h_line .x . ToGfxCoord ( aPercentageBasis.width );
321+ if (cmd.h_line .x . IsToPosition () ) {
332322 segEnd = Point (x, segStart.y );
333323 } else {
334324 segEnd = segStart + Point (x, 0 .0f );
@@ -341,8 +331,8 @@ static already_AddRefed<Path> BuildPathInternal(
341331 break ;
342332 }
343333 case Command::Tag::VLine: {
344- const float y = Resolve ( cmd.v_line .y , aPercentageBasis.height );
345- if (cmd.v_line .by_to == StyleByTo::To ) {
334+ const auto y = cmd.v_line .y . ToGfxCoord ( aPercentageBasis.height );
335+ if (cmd.v_line .y . IsToPosition () ) {
346336 segEnd = Point (segStart.x , y);
347337 } else {
348338 segEnd = segStart + Point (0 .0f , y);
@@ -640,19 +630,21 @@ void SVGPathData::GetMarkerPositioningData(Span<const StylePathCommand> aPath,
640630 break ;
641631 }
642632 case StylePathCommand::Tag::HLine: {
643- if (cmd.h_line .by_to == StyleByTo::To) {
644- segEnd = Point (cmd.h_line .x , segStart.y ) * aZoom;
633+ const auto x = cmd.h_line .x .ToGfxCoord ();
634+ if (cmd.h_line .x .IsToPosition ()) {
635+ segEnd = Point (x, segStart.y ) * aZoom;
645636 } else {
646- segEnd = segStart + Point (cmd. h_line . x , 0 .0f ) * aZoom;
637+ segEnd = segStart + Point (x, 0 .0f ) * aZoom;
647638 }
648639 segStartAngle = segEndAngle = AngleOfVector (segEnd, segStart);
649640 break ;
650641 }
651642 case StylePathCommand::Tag::VLine: {
652- if (cmd.v_line .by_to == StyleByTo::To) {
653- segEnd = Point (segStart.x , cmd.v_line .y ) * aZoom;
643+ const auto y = cmd.v_line .y .ToGfxCoord ();
644+ if (cmd.v_line .y .IsToPosition ()) {
645+ segEnd = Point (segStart.x , y) * aZoom;
654646 } else {
655- segEnd = segStart + Point (0 .0f , cmd. v_line . y ) * aZoom;
647+ segEnd = segStart + Point (0 .0f , y) * aZoom;
656648 }
657649 segStartAngle = segEndAngle = AngleOfVector (segEnd, segStart);
658650 break ;
0 commit comments