[Webkit-unassigned] [Bug 240356] New: [cssom] Computed styles shouldn't index shorthands with 1 longhand

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 12 13:13:39 PDT 2022


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

            Bug ID: 240356
           Summary: [cssom] Computed styles shouldn't index shorthands
                    with 1 longhand
           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: obrufau at igalia.com

A computed style shouldn't index shorthands:

   var props = new Set(getComputedStyle(document.documentElement));
   props.has("margin-left"); // true
   props.has("margin"); // false

However, shorthands that have a single longhand are indexed: https://webkit-search.igalia.com/webkit/rev/0d5437dbaa7bdb52f60b64bc7dd5a39adee14e81/Source/WebCore/css/makeprop.pl#215

   var props = new Set(getComputedStyle(document.documentElement));
   props.has("-webkit-text-orientation"); // true

This is wrong. Being a shorthand of a single property typically happens with legacy shorthands (https://www.w3.org/TR/css-cascade-5/#legacy-shorthand)
In this case, -webkit-text-orientation is the legacy name of text-orientation, but it can't be an alias because they have different syntax.
But aliases are not indexed, so it doesn't make sense that if an alias is turned into a shorthand, it becomes indexed in the computed style.

The list of affected properties can be obtained with

   var el = document.documentElement;
   [...getComputedStyle(el)].filter(prop => {
     el.style.cssText = prop + ": initial";
     return el.style.length === 1 && el.style[0] !== prop;
   });

* page-break-after (legacy shorthand of break-after)
* page-break-before (legacy shorthand of break-before)
* page-break-inside (legacy shorthand of break-inside)
* text-decoration (shorthand of text-decoration-line, it should have more longhands, see bug 230083)
* text-decoration-skip (shorthand of text-decoration-skip-ink, no other longhand has been implemented)
* -webkit-column-break-after (legacy shorthand of break-after)
* -webkit-column-break-before (legacy shorthand of break-before)
* -webkit-column-break-inside (legacy shorthand of break-inside)
* -webkit-text-orientation (legacy shorthand of text-orientation)

Bug 104805 is also turning -webkit-perspective into a legacy shorthand of perspective

-- 
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/20220512/691380a9/attachment.htm>


More information about the webkit-unassigned mailing list