[webkit-changes] [WebKit/WebKit] b7eeaa: Stop assuming shorthand is serializable when longh...

Oriol Brufau noreply at github.com
Thu Nov 10 23:45:38 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b7eeaa128fab066bdfeeaf9ee72ee7a43270861c
      https://github.com/WebKit/WebKit/commit/b7eeaa128fab066bdfeeaf9ee72ee7a43270861c
  Author: Oriol Brufau <obrufau at igalia.com>
  Date:   2022-11-10 (Thu, 10 Nov 2022)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText-expected.txt
    M Source/WebCore/css/StyleProperties.cpp

  Log Message:
  -----------
  Stop assuming shorthand is serializable when longhand has a pending-substitution value
https://bugs.webkit.org/show_bug.cgi?id=247734

Reviewed by Darin Adler.

When a shorthand is set to a value containing var(), all longhands are
set to a pending-substitution value that refers to the shorthand and its
original value.

When StyleProperties::asTextInternal() encountered a longhand set to a
pending-substitution value, it used to assume that the original value of
the shorthand was still a valid serialization.

However, that's not true, e.g.

   element.style.margin = "var(--m)";
   element.style.marginTop = "1px";

then margin-left is set to a pending-substitution still referring to
"var(--m)", but due to the later change in margin-top, margin is no
longer serializable.

So this patch uses getPropertyValue() to attempt to serialize the
shorthand, as was already been done for non-pending-substitution values.

Test: imported/w3c/web-platform-tests/css/css-variables/variable-cssText.html

* LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText-expected.txt:
* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::asTextInternal const):

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




More information about the webkit-changes mailing list