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

Tim Nguyen noreply at github.com
Mon Sep 19 19:21:49 PDT 2022


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

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/platform/gtk/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt
    M LayoutTests/platform/gtk/svg/batik/text/smallFonts-expected.txt
    M LayoutTests/platform/gtk/svg/batik/text/textFeatures-expected.txt
    M LayoutTests/platform/gtk/svg/text/select-textLength-spacing-squeeze-2-expected.txt
    M LayoutTests/platform/ios/svg/W3C-SVG-1.1-SE/types-dom-01-b-expected.txt
    M LayoutTests/platform/ios/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt
    M LayoutTests/platform/ios/svg/batik/text/textFeatures-expected.txt
    M LayoutTests/platform/ios/svg/text/append-text-node-to-tspan-expected.txt
    M LayoutTests/platform/ios/svg/text/modify-text-node-in-tspan-expected.txt
    M LayoutTests/platform/ios/svg/text/remove-text-node-from-tspan-expected.txt
    M LayoutTests/platform/ios/svg/text/scaled-font-expected.txt
    M LayoutTests/platform/ios/svg/text/scaling-font-with-geometric-precision-expected.txt
    M LayoutTests/platform/mac/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt
    M LayoutTests/platform/mac/svg/batik/text/smallFonts-expected.txt
    M LayoutTests/platform/mac/svg/batik/text/textFeatures-expected.txt
    M LayoutTests/platform/mac/svg/text/scaling-font-with-geometric-precision-expected.txt
    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:
* LayoutTests/platform/gtk/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt:
* LayoutTests/platform/gtk/svg/batik/text/smallFonts-expected.txt:
* LayoutTests/platform/gtk/svg/batik/text/textFeatures-expected.txt:
* LayoutTests/platform/gtk/svg/text/select-textLength-spacing-squeeze-2-expected.txt:
* LayoutTests/platform/ios/svg/W3C-SVG-1.1-SE/types-dom-01-b-expected.txt:
* LayoutTests/platform/ios/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt:
* LayoutTests/platform/ios/svg/batik/text/textFeatures-expected.txt:
* LayoutTests/platform/ios/svg/text/append-text-node-to-tspan-expected.txt:
* LayoutTests/platform/ios/svg/text/modify-text-node-in-tspan-expected.txt:
* LayoutTests/platform/ios/svg/text/remove-text-node-from-tspan-expected.txt:
* LayoutTests/platform/ios/svg/text/scaled-font-expected.txt:
* LayoutTests/platform/ios/svg/text/scaling-font-with-geometric-precision-expected.txt:
* LayoutTests/platform/mac/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt:
* LayoutTests/platform/mac/svg/batik/text/smallFonts-expected.txt:
* LayoutTests/platform/mac/svg/batik/text/textFeatures-expected.txt:
* LayoutTests/platform/mac/svg/text/scaling-font-with-geometric-precision-expected.txt:
* Source/WebCore/svg/SVGTextElement.cpp:
(WebCore::SVGTextElement::animatedLocalTransform const): Deleted.
* Source/WebCore/svg/SVGTextElement.h:
* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::layout):

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




More information about the webkit-changes mailing list