[webkit-changes] [WebKit/WebKit] b348ce: [LBSE] Do not relayout on dynamic transform change...

Nikolas Zimmermann noreply at github.com
Fri Jan 20 17:20:11 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b348ce7635b6efa824493df9ac2b67716a4c95c6
      https://github.com/WebKit/WebKit/commit/b348ce7635b6efa824493df9ac2b67716a4c95c6
  Author: Nikolas Zimmermann <nzimmermann at igalia.com>
  Date:   2023-01-20 (Fri, 20 Jan 2023)

  Changed paths:
    M LayoutTests/platform/mac-ventura-wk2-lbse-text/TestExpectations
    M Source/WebCore/rendering/RenderLayerModelObject.cpp
    M Source/WebCore/rendering/RenderLayerModelObject.h
    M Source/WebCore/svg/SVGGraphicsElement.cpp

  Log Message:
  -----------
  [LBSE] Do not relayout on dynamic transform changes, if necessary.
https://bugs.webkit.org/show_bug.cgi?id=249141

Reviewed by Rob Buis.

The legacy SVG engine always had to perform relayouts when the transform
of an element changed (up to the containing block, stopping at RenderSVGRoot
boundary in case of mixed SVG/HTML documents). Container position and sizes
were affected by the transformations of the descendants. That's no longer the
case in LBSE, which follows CSS/HTML style of making transformations a paint
effect, not inducing costly relayouts.

However this only works if SVG <text> elements are not involved: SVG text
always needs a relayout, as the "screen font size scaling factor" depends on
the CTM of the transformed element (all transformations from target element
up to RenderSVGRoot enter the calculation).

Therefore add the necessary code to figure out if a relayout is unavoidable
('xScale()' / 'yScale()' of involved matrices changed --> relayout text).
For translations, etc. a relayout is unncessary, as the scaling factor cannot
change. That's the only optimization we can apply for text at present.

For all other shapes, images, etc. this is an important optimization.

Covered by existing tests, introduces one regression, marked in TestExpectations.
Currently this change Breaks svg/animations/list-wrapper-assertion.svg in LBSE,
webkit.org/b/249140 will fix it in a follow-up patch.

* LayoutTests/platform/mac-ventura-wk2-lbse-text/TestExpectations:
 Mark svg/animations/list-wrapper-assertion.svg as failing for the moment.
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::repaintOrRelayoutAfterSVGTransformChange):
Introduce helper function for SVG either update transform and repaint or relayout
* Source/WebCore/rendering/RenderLayerModelObject.h:
* Source/WebCore/svg/SVGGraphicsElement.cpp:
(WebCore::SVGGraphicsElement::svgAttributeChanged):
Use new repaintOrRelayoutAfterSVGTransformChange() method, when LBSE is activated.

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




More information about the webkit-changes mailing list