Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5bff2eb26e59dd23485d7482aacc3a08f7df0974
      
https://github.com/WebKit/WebKit/commit/5bff2eb26e59dd23485d7482aacc3a08f7df0974
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-07 (Tue, 07 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/pservers/reftests/gradient-objectBoundingBox-absolute-units-expected.svg
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/pservers/reftests/gradient-objectBoundingBox-absolute-units.svg
    M Source/WebCore/svg/SVGLengthContext.cpp
    M Source/WebCore/svg/SVGLengthValue.cpp

  Log Message:
  -----------
  SVGLengthValue::valueAsPercentage() should resolve absolute units to pixels 
for objectBoundingBox
https://bugs.webkit.org/show_bug.cgi?id=311615

Reviewed by Anne van Kesteren.

SVGLengthValue::valueAsPercentage() is used to resolve coordinates for
SVG elements with objectBoundingBox units (gradients, filters, masks,
patterns). Previously, it returned the raw numeric value for all
non-percentage units, so "1in" was treated as the value 1.0 rather
than 96.0 (its CSS pixel equivalent). This caused incorrect rendering
when absolute length units (cm, mm, in, pt, pc) were used with
objectBoundingBox.

This aligns WebKit's behavior with Blink and Gecko, which both resolve
absolute CSS units to their pixel equivalents before using them as
objectBoundingBox coordinates.

Test: 
imported/w3c/web-platform-tests/svg/pservers/reftests/gradient-objectBoundingBox-absolute-units.svg
- This test is failing in shipping Safari but passing in both Chrome and 
Firefox.

* 
LayoutTests/imported/w3c/web-platform-tests/svg/pservers/reftests/gradient-objectBoundingBox-absolute-units-expected.svg:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/pservers/reftests/gradient-objectBoundingBox-absolute-units.svg:
 Added.
* Source/WebCore/svg/SVGLengthContext.cpp:
(WebCore::SVGLengthContext::resolvePoint):
(WebCore::SVGLengthContext::resolveLength):
* Source/WebCore/svg/SVGLengthValue.cpp:
(WebCore::convertToPixels):
(WebCore::SVGLengthValue::valueAsPercentage const):

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



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

Reply via email to