[webkit-changes] [WebKit/WebKit] b950a8: css/css-transitions/transition-base-response-002.h...

Antoine Quint noreply at github.com
Sat Feb 18 03:22:07 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b950a86d454a2f4913770bafad3ee882cd6d7a99
      https://github.com/WebKit/WebKit/commit/b950a86d454a2f4913770bafad3ee882cd6d7a99
  Author: Antoine Quint <graouts at webkit.org>
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-002-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-002.html

  Log Message:
  -----------
  css/css-transitions/transition-base-response-002.html is a unique failure
https://bugs.webkit.org/show_bug.cgi?id=235135
rdar://problem/87785135

Reviewed by Antti Koivisto.

The goal of this test is to check that a transition for the `font-size` on the `:root` is
accounted for when resolving `rem` units on child elements.

However, this test failed in WebKit because it loads scripts in a blocking way prior to
parsing the `<style>` element containing this rule:

    :root {
        font-size: 20px;
        transition: font-size steps(2, start) 10s;
    }

What may happen though is that before we get to parsing this `<style>` element the `:root`
styles may be resolved and the default `font-size` is computed (to 16px in WebKit). Then,
when the `<style>` element is parsed and styles are resolved due to the first line of the
test:

    let unused = getComputedStyle(document.documentElement).getPropertyValue('font-size');

… we start a transition from the previously resolved value of 16px to the newly specified
value of 20px in the `<style>` element. This is clearly not the intention of the test, and
yet that is an acceptable behavior because what constitutes a "style change event" is not
specified by CSS Transitions (https://drafts.csswg.org/css-transitions/#style-change-event):

    Since this specification does not define when a style change event occurs, and thus what
    changes to computed values are considered simultaneous, authors should be aware that
    changing any of the transition properties a small amount of time after making a change
    that might transition can result in behavior that varies between implementations, since
    the changes might be considered simultaneous in some implementations but not others.

So we update this test to be more explicit about when the transition may start by setting the
`transition` property only in the `:root.changed` rule which is set by the test and sandwiched
between two explicit style recomputations on the first and third lines:

    let unused = getComputedStyle(document.documentElement).getPropertyValue('font-size');
    document.documentElement.className = 'change';
    assert_equals(getComputedStyle(target1).getPropertyValue('width'), '25px');

As a result of this change, Chrome, Firefox and Safari all pass the test reliably.

* LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-002-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-002.html:

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




More information about the webkit-changes mailing list