[webkit-changes] [WebKit/WebKit] 0dd51c: [CSS] Fix @supports nested with declarations

Matthieu Dubet noreply at github.com
Wed Dec 13 10:08:17 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0dd51c9b2c6dbfba7603249bfb0f16abf4a9b2bd
      https://github.com/WebKit/WebKit/commit/0dd51c9b2c6dbfba7603249bfb0f16abf4a9b2bd
  Author: Matthieu Dubet <m_dubet at apple.com>
  Date:   2023-12-13 (Wed, 13 Dec 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/at-supports-048-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/at-supports-048-ref.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/at-supports-048.html
    M Source/WebCore/css/parser/CSSParserImpl.cpp

  Log Message:
  -----------
  [CSS] Fix @supports nested with declarations
https://bugs.webkit.org/show_bug.cgi?id=259752
rdar://113652033

Reviewed by Antti Koivisto.

Unfortunately, the parser code use local member variables (m_parsedProperties/m_parsedRules)
to store parsing results instead of using return values and the programming language builtin stack.

This patch uses the existing stack mecanism CSSParserImpl::runInNewNestingContext()
to isolate the parsing of the @supports(...) prelude declaration
from the rest of the parsing (specifically, from declarations before or after this @supports rule at the same nesting level)

This fixes code like:

div {
  color: green;
  @supports() {

  }
}

where the `color: green` declaration was being ignored.

* LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/at-supports-048-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/at-supports-048-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/at-supports-048.html: Added.
* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::supportsDeclaration):

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




More information about the webkit-changes mailing list