[Webkit-unassigned] [Bug 161271] New: calc(): + and - with one operand of unitless length 0 and another of a length with explicit units are incorrectly ignored as invalid

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 26 15:23:45 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=161271

            Bug ID: 161271
           Summary: calc(): + and - with one operand of unitless length 0
                    and another of a length with explicit units are
                    incorrectly ignored as invalid
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bicknellr at google.com

Example URL:
http://jsbin.com/jejewa/1/edit?html,output

Steps to reproduce the problem:
Write a CSS rule using `calc()` to produce a length and add unitless zero to that length within the `calc()`. For example, `calc(1px + 0)`. The rule will be considered invalid.

What is the expected behavior?
Unitless zero is a valid length (https://www.w3.org/TR/css-values/#lengths, https://drafts.csswg.org/css-values-3/#lengths) so adding and subtracting unitless zero and other lengths with explicit units should resolve to the type of unit of the other operand.

One specific problem this bug results in is when using `calc()` with CSS custom properties. If you write a `calc()` function using a custom property as an operand to an addition or subtraction with a length, the person setting the value of that custom property you've provided can't use the unitless zero shorthand even though it is a valid length.

What went wrong?
Safari (and all other browsers I tested) report this kind of expression as invalid and ignore it.

Also filed against Chrome:
https://bugs.chromium.org/p/chromium/issues/detail?id=641556

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160826/7e43c368/attachment.html>


More information about the webkit-unassigned mailing list