[Webkit-unassigned] [Bug 255280] New: CSS bug: Support division/multiplication of mixed units

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 11 05:39:57 PDT 2023


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

            Bug ID: 255280
           Summary: CSS bug: Support division/multiplication of mixed
                    units
           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: brandon at dreamthinkbuild.com

# Summary:
When dividing a length by another length, the CSS parser in the browser should return a number as specified in the `css-values-4` spec. However, this functionality is not yet implemented and instead throws an error or produces an unexpected result.

# Steps to Reproduce:
1. Create a CSS file with the following rule:
```css
div {
  width: 200px / 20px;
}
```
2. Link the CSS file to an HTML file with a `div` element.
3. Open the HTML file in the browser.

### Expected Results:
The `div` element should have a `width` of `10` since `200px / 20px` equals `10`.

### Actual Results:
The `div` element either does not have a `width` set or has an unexpected value such as `NaN` or an error message is thrown.

# Environment:
- Browser: [insert browser name and version]
- Operating System: [insert operating system name and version]

# Additional Information:
- The `css-values-4` spec specifies that multiplication and division are no longer restricted to specific argument types and can produce complex intermediate results. This change in functionality should be implemented in the browser's CSS parser.
- The lack of this functionality can lead to unexpected behavior in web pages and hinder the ability of developers to create responsive designs.
- This issue affects all web pages that use division of lengths in CSS rules.
- This issue can be worked around by manually calculating the result of the division and using that value instead of the division operation. However, this is not ideal and can lead to less readable and maintainable code.

# Related resources and discussions
- Discussion: https://github.com/w3c/csswg-drafts/issues/7448
- Specification: https://drafts.csswg.org/css-values/#calc-type-checking
  > NOTE: In previous versions of this specification, multiplication and division were limited in what arguments they could take, to avoid producing more complex intermediate results (such as 1px * 1em, which is <length>²) and to make division-by-zero detectable at parse time. This version now relaxes those restrictions.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230411/92779108/attachment.htm>


More information about the webkit-unassigned mailing list