[webkit-changes] [WebKit/WebKit] d2c029: [LBSE] Pixel snapping logic is incorrect for SVG, ...

Nikolas Zimmermann noreply at github.com
Mon Sep 26 08:51:25 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2c0299eb83a36da49226c4c3696e8ae7382c39b
      https://github.com/WebKit/WebKit/commit/d2c0299eb83a36da49226c4c3696e8ae7382c39b
  Author: Nikolas Zimmermann <nzimmermann at igalia.com>
  Date:   2022-09-26 (Mon, 26 Sep 2022)

  Changed paths:
    A LayoutTests/svg/compositing/inline-svg-non-integer-position-display-block-composited-expected.html
    A LayoutTests/svg/compositing/inline-svg-non-integer-position-display-block-composited.html
    A LayoutTests/svg/compositing/inline-svg-non-integer-position-display-inline-composited-expected.html
    A LayoutTests/svg/compositing/inline-svg-non-integer-position-display-inline-composited.html
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp

  Log Message:
  -----------
  [LBSE] Pixel snapping logic is incorrect for SVG, when elements are composited
https://bugs.webkit.org/show_bug.cgi?id=245416

Reviewed by Rob Buis.

In bug webkit.org/b/244966 ("[LBSE] Outermost <svg> elements are not device-pixel aligned")
the rendering was adapted in such a way that the outermost <svg> element is the only element
in the SVG subtree that is pixel snapped, delivering consistent results between e.g. HTML
<div> elements and SVG <svg> elements, embedded in a CSS formatting context. The <div> will
get pixel snapped upon painting -- the same was enforced for the outermost <svg>, however
without propagating/accumulating sub-pixel errors for the descendant layers, since no pixel
snapping is applied within the SVG subtree.

When elements are composited another logic is used (RenderLayerBacking), and the device-pixel
alignment is applied for all SVG layers -- effectively breaking content. By fixing that, the
pixel snapping logic is consistent for all painting modes we have, no matter if the outer
<svg> is composited, or any of its descendants.

Added two new reftests covering LBSE + compositing + sub-pixel locations in different display modes.
Doesn't affect any other existing tests.

* LayoutTests/svg/compositing/inline-svg-non-integer-position-display-block-composited-expected.html: Added.
* LayoutTests/svg/compositing/inline-svg-non-integer-position-display-block-composited.html: Added.
* LayoutTests/svg/compositing/inline-svg-non-integer-position-display-inline-composited-expected.html: Added.
* LayoutTests/svg/compositing/inline-svg-non-integer-position-display-inline-composited.html: Added.
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::convertToLayerCoords const):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::snappedGraphicsLayer):
(WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::adjustOverflowControlsPositionRelativeToAncestor):
(WebCore::RenderLayerBacking::updateMaskingLayerGeometry):
(WebCore::RenderLayerBacking::updateContentsRects):
(WebCore::RenderLayerBacking::updateClippingStackLayerGeometry):
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):

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




More information about the webkit-changes mailing list