Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1aa99d7546d2e0a6a3efb1fa652cfa450ebc45ff
      
https://github.com/WebKit/WebKit/commit/1aa99d7546d2e0a6a3efb1fa652cfa450ebc45ff
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/coords-viewattr-01-b-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/filters-example-01-b-expected.txt
    A 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/painting-marker-03-f-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt
    A 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/container-opacity-clip-viewBox-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/container-opacity-clip-viewBox-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Discrete-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Gamma-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Linear-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Table-expected.txt
    A 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-marker-and-object-creation-expected.png
    A 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-marker-creation-expected.png
    A 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/marker-default-width-height-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/preserve-aspect-ratio-syntax-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/preserve-aspect-ratio-syntax-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/relative-sized-inner-svg-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/relative-sized-use-on-symbol-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/relative-sized-use-without-attributes-on-symbol-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/root-container-opacity-clip-viewBox-expected.txt
    A 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/shapes-supporting-markers-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/text-rotated-gradient-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-in-symbol-with-offset-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-svg-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-svg1-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-svg2-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-symbol-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-symbol1-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-symbol2-expected.txt
    A 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/viewbox-syntax-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/viewbox-syntax-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/text/text-viewbox-rescale-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/text/zoom-coords-viewattr-01-b-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/text/zoom-coords-viewattr-01-b-expected.txt
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayer.h
    M Source/WebCore/rendering/RenderLayerSVGAdditions.cpp
    M Source/WebCore/rendering/svg/RenderSVGContainer.cpp
    M Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
    M Source/WebCore/rendering/svg/RenderSVGModelObject.h
    M Source/WebCore/rendering/svg/RenderSVGModelObjectInlines.h
    M Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp
    M Source/WebCore/rendering/svg/SVGBoundingBoxComputation.h

  Log Message:
  -----------
  [LBSE] Fix viewport clipping issues
https://bugs.webkit.org/show_bug.cgi?id=322219

Reviewed by Simon Fraser.

A nested <svg> and a <marker> clip their content to their viewport, and we apply
that clip even when the whole content is already inside it. Nothing pixel-snaps
the clip for them, because rendererNeedsPixelSnapping() opts every SVG renderer
below the outermost <svg> out. The viewport border can therefore fall between
two device pixels, and content drawn exactly on it loses part of its outer edge.
In svg/custom/viewbox-syntax.svg that is the red stroke around each nested
<svg>. A marker viewport does the same to its content, in painting-marker-03-f,
marker-default-width-height, shapes-supporting-markers and the two
js-late-marker tests. All of them have subtle pixel test failures, compared
to the legacy SVG engine.

The fix is to not apply a clip that removes nothing, but just causes undesired
side effects. To achieve this the existing overflow clip handling in LBSE
was overhauled: overflowClipRect() keeps returning the rectangle itself, the way
RenderBox does, for whoever needs to intersect a rectangle against it, currently
SVGBoundingBoxComputation::handleRootOrContainer() and
RenderSVGModelObject::updateCachedVisualOverflowRect(). The painting paths now
query overflowClipRectForPainting() instead, which returns the infinite 
rectangle
as long as the content stays inside the viewport, and overflowClipRect() 
otherwise.

Rebaseline a few tests that gain the restored edge or no longer show clip
annotations in the render tree dumps, covered by existing tests.

* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/coords-viewattr-01-b-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/filters-example-01-b-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/painting-marker-03-f-expected.png:
 Added.
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/container-opacity-clip-viewBox-expected.png:
 Added.
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/container-opacity-clip-viewBox-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Discrete-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Gamma-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Linear-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/feComponentTransfer-Table-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-marker-and-object-creation-expected.png:
 Added.
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-marker-creation-expected.png:
 Added.
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/marker-default-width-height-expected.png:
 Added.
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/preserve-aspect-ratio-syntax-expected.png:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/preserve-aspect-ratio-syntax-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/relative-sized-inner-svg-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/relative-sized-use-on-symbol-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/relative-sized-use-without-attributes-on-symbol-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/root-container-opacity-clip-viewBox-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/shapes-supporting-markers-expected.png:
 Added.
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/text-rotated-gradient-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-in-symbol-with-offset-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-svg-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-svg1-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-svg2-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-symbol-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-symbol1-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-transfer-width-height-properties-to-symbol2-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/viewbox-syntax-expected.png:
 Added.
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/viewbox-syntax-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/text/text-viewbox-rescale-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.png:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/text/zoom-coords-viewattr-01-b-expected.png:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/zoom/text/zoom-coords-viewattr-01-b-expected.txt:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerSVGAdditions.cpp:
(WebCore::RenderLayer::appendChildrenInDOMOrderForSVG):
* Source/WebCore/rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::paint):
* Source/WebCore/rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::requiresLayer const):
(WebCore::RenderSVGModelObject::overflowClipRectForPainting const):
* Source/WebCore/rendering/svg/RenderSVGModelObject.h:
(WebCore::RenderSVGModelObject::locationOffsetEquivalent const):
(WebCore::RenderSVGModelObject::visualOverflowRectEquivalent const):
(WebCore::RenderSVGModelObject::cachedVisualOverflowRectIfAvailable const):
(WebCore::RenderSVGModelObject::updateCachedVisualOverflowRect const):
(WebCore::RenderSVGModelObject::overflowClipRectForChildLayers):
(WebCore::RenderSVGModelObject::updateCachedVisualOverflowRect): Deleted.
* Source/WebCore/rendering/svg/RenderSVGModelObjectInlines.h:
(WebCore::RenderSVGModelObject::clipsSubtree):
* Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp:
(WebCore::SVGBoundingBoxComputation::handleRootOrContainer const):
(WebCore::computeVisualOverflowRectWithOptions):
(WebCore::SVGBoundingBoxComputation::computeVisualOverflowRect):
(WebCore::SVGBoundingBoxComputation::computeVisualOverflowRectIgnoringViewportClip):
* Source/WebCore/rendering/svg/SVGBoundingBoxComputation.h:

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



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

Reply via email to