[webkit-changes] [WebKit/WebKit] 9d5c68: Fix CSS.supports behaviour with regards to !import...

Ahmad Saleem noreply at github.com
Fri Dec 2 05:28:48 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d5c6857a50c7f6381b03290fab4bd2e3c49f5d4
      https://github.com/WebKit/WebKit/commit/9d5c6857a50c7f6381b03290fab4bd2e3c49f5d4
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2022-12-02 (Fri, 02 Dec 2022)

  Changed paths:
    M LayoutTests/css3/supports-dom-api-expected.txt
    M LayoutTests/css3/supports-dom-api.html
    M Source/WebCore/css/DOMCSSNamespace.cpp

  Log Message:
  -----------
  Fix CSS.supports behaviour with regards to !important and whitespace

Fix CSS.supports behaviour with regards to !important and whitespace
https://bugs.webkit.org/show_bug.cgi?id=248450

Reviewed by Darin Adler.

This patch is to align Webkit with Blink / Chromium, Gecko / Firefox and Web-Specification.

Web-Spec:

[1] https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
[2] https://drafts.csswg.org/cssom-1/#dom-cssstyledeclaration-setpropertyvalue

Merge - https://chromium.googlesource.com/chromium/blink/+/36890765b05b48d8065737682b4e878645b601b2

This patch changes some small issues in CSS.supports:

1) Whitespace in CSS properties are not allowed. This aligns with FF and
the spec.
2) !important in a value is not removed. The !important flag is not part
of a CSS value, so something like CSS.supports("left","10px !important")
should return false. This is aligned with Web-Spec:
https://drafts.csswg.org/css-conditional-3/#the-css-namespace

>> Note: !important flags are not part of property grammars, and will cause value to parse
as invalid, just as they would in the value argument to element.style.setProperty().

More Details - https://github.com/w3c/csswg-drafts/issues/5692

3) Newlines are not turned into spaces. These are not equivalent in CSS,
as newlines will cause strings to become bad string tokens.

* Source/WebCore/css/DOMCSSNamespace.cpp:
(valeWithoutImportant): Removed
(DOMCSSNamespace::supports): Update to remove "whitespace" and return 'value' rather than 'normalizedValue'
* LayoutTests/css3/supports-dom-api.html: Rebaselined
* LayoutTests/css3/supports-dom-api-expected.txt: Rebaselined

Canonical link: https://commits.webkit.org/257280@main




More information about the webkit-changes mailing list