[webkit-changes] [WebKit/WebKit] ec9527: Percentage-based translations don't work with SVG ...

Tim Nguyen noreply at github.com
Thu Sep 22 20:58:32 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec9527d7aa0c7ee697f0b3a0f55e2fb8a7b6ed14
      https://github.com/WebKit/WebKit/commit/ec9527d7aa0c7ee697f0b3a0f55e2fb8a7b6ed14
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2022-09-22 (Thu, 22 Sep 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/rendering/svg/RenderSVGText.cpp
    M Source/WebCore/svg/SVGTextElement.cpp
    M Source/WebCore/svg/SVGTextElement.h

  Log Message:
  -----------
  Percentage-based translations don't work with SVG <text>
https://bugs.webkit.org/show_bug.cgi?id=245122
<rdar://99854408>

Reviewed by Myles C. Maxfield.

The two main issues are:
- Stale SVGTextElement::animatedLocalTransform() function:
Historically, all SVG elements have had the same animatedLocalTransform function, see: https://github.com/WebKit/WebKit/commit/f8cc29f9d2d96f5761a8aab9f6bd31afb0edf0a8
This looks like an artifact of when SVGTextElement did not inherit from the common SVGGraphicsElement class, where we had to add the same function twice.
Removing this code puts it in-line with SVGGraphicsElement::animatedLocalTransform() which does take in account the reference box rect (for percentage based transforms) and transform-origin.

- We also need to compute transform at the end of RenderSVGText::layout, to avoid computing with the wrong bounds (which may happen if the font hasn't loaded yet).

Rebaseline tests resulting from these changes (mainly minor differences in dimensions that match other browsers).

Test: imported/w3c/web-platform-tests/css/css-transforms/transform-box/view-box-mutation-002.html

* LayoutTests/TestExpectations:
* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::layout):
* Source/WebCore/svg/SVGTextElement.cpp:
(WebCore::SVGTextElement::animatedLocalTransform const): Deleted.
* Source/WebCore/svg/SVGTextElement.h:

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




More information about the webkit-changes mailing list