[webkit-changes] [WebKit/WebKit] 6220d3: lh unit is sometimes computed before line-height i...

Tim Nguyen noreply at github.com
Fri Aug 2 22:25:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6220d3d8995a515d5fb13351683645f59153e603
      https://github.com/WebKit/WebKit/commit/6220d3d8995a515d5fb13351683645f59153e603
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2024-08-02 (Fri, 02 Aug 2024)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-font-size-dependency-expected.xht
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-font-size-dependency.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-line-height-dependency-expected.xht
    A LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-line-height-dependency.html
    M Source/WebCore/style/StyleBuilder.cpp

  Log Message:
  -----------
  lh unit is sometimes computed before line-height is resolved
https://bugs.webkit.org/show_bug.cgi?id=265287
rdar://118983248

Reviewed by Darin Adler.

Compute `line-height` before other properties, but after updating the font, since `line-height` can itself depend on `font-size` if it uses `em` units.

Note that there is no circular dependency with font-size since using `lh` in `font` properties will resolve against the parent style per-spec:

> Similarly, when lh or rlh units are used in the value of the line-height property or font-* properties on the element they refer to,
> they resolve against the computed line-height and font metrics of the parent element -or the computed metrics corresponding to the
> initial values of the font and line-height properties, if the element has no parent.

https://drafts.csswg.org/css-values/#font-relative-lengths

In the long run, the {top/high/low/sink} property setup should be cleaned up since it is quite fragile.

* LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-font-size-dependency-expected.xht: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-font-size-dependency.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-line-height-dependency-expected.xht: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/lh-unit-same-element-line-height-dependency.html: Added.
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyHighPriorityProperties):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list