Skip to content

box-shadow serialization drops zero blur before nonzero spread #249

Closed

Description

@PrzemyslawKlys

Prerequisites

  • Reproduced with a minimal example
  • Reproduced with the latest release (1.1.2) and devel
  • Checked the FAQ and existing issues
  • This affects AngleSharp.Css serialization

Description

Serializing a box shadow with zero blur and nonzero spread drops the blur value. The spread then occupies the blur position, changing the shadow.

Steps to Reproduce

using AngleSharp.Css.Parser;
using System;

var parser = new CssParser();

foreach (var spread in new[] { "5px", "-5px" })
{
    var style = parser.ParseDeclaration("box-shadow: 0 0 0 " + spread + " red");
    Console.WriteLine(style.GetPropertyValue("box-shadow"));
}

Expected Behavior

Retain zero blur so reparsing preserves blur 0 and spread 5px or -5px. The box-shadow specification assigns the third length to blur and the fourth to spread.

Actual Behavior

0 0 5px rgba(255, 0, 0, 1)
0 0 -5px rgba(255, 0, 0, 1)

The spread becomes blur. The negative case also produces a negative blur, which CSS disallows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions