[LBSE] Paint <feImage> referenced elements through the layer tree - #71547
Merged
webkit-commit-queue merged 1 commit intoAug 18, 2026
Conversation
Collaborator
|
EWS run on current version of this PR (hash f6c217c) Details |
https://bugs.webkit.org/show_bug.cgi?id=321677 Reviewed by Rob Buis. SVGFEImageElement::imageBufferForEffect() draws the referenced element with SVGRenderingContext::renderSubtreeToContext(). That helper belongs to the legacy SVG engine and LBSE must not use it: it calls RenderElement::paint() directly, which skips every child that owns a RenderLayer, so any opacity, mask, filter or 3D transform below the referenced element was lost. Furthermore it uses calculateTransformationToOutermostCoordinateSystem(), which does not see the transforms kept on RenderLayers, most noticeable it misses the viewBox transform of the outermost <svg> element. Draw the element with RenderLayer::paintResourceLayerForSVG() instead, like <mask>, <clipPath>, <pattern> and <marker> content, and ask SVGTransformComputation for the buffer scale, fixing the problems. The feImage-referenced element needs a layer for that, so requiresLayerForSVGIntrinsicReasons() now assignes one to every element an <feImage> points to. Fixes several feImage-* tests under LBSE. Also add a new test that verifies layered descendants properly function under a feImage reference. * LayoutTests/platform/mac-tahoe-wk2-lbse-text/TestExpectations: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/filters-composite-02-b-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-filterUnits-objectBoundingBox-primitiveUnits-objectBoundingBox-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-filterUnits-objectBoundingBox-primitiveUnits-userSpaceOnUse-expected.png: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-filterUnits-objectBoundingBox-primitiveUnits-userSpaceOnUse-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-filterUnits-userSpaceOnUse-primitiveUnits-objectBoundingBox-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-filterUnits-userSpaceOnUse-primitiveUnits-userSpaceOnUse-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-late-indirect-update-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-multiple-targets-id-change-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-position-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-reference-invalidation-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-reference-svg-primitive-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-subregions-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-subregions-preseveAspectRatio-none-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-subregions-preseveAspectRatio-none-with-viewBox-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-add-to-document-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-attribute-change-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-changes-id-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-id-change-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-inline-style-change-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-property-change-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-reappend-to-document-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-remove-from-document-expected.txt: * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/filters/feImage-target-style-change-expected.txt: * LayoutTests/svg/filters/feImage-target-with-layered-descendants-expected.svg: Added. * LayoutTests/svg/filters/feImage-target-with-layered-descendants.svg: Added. * Source/WebCore/rendering/RenderLayer.h: * Source/WebCore/rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::requiresLayerForSVGIntrinsicReasons const): * Source/WebCore/rendering/RenderLayerSVGAdditions.cpp: (WebCore::RenderLayer::paintChildrenInDOMOrderForSVG): * Source/WebCore/svg/SVGElement.cpp: (WebCore::SVGElement::addReferencingElement): (WebCore::SVGElement::removeReferencingElement): (WebCore::SVGElement::invalidateLayerRequirementForFEImageReference): (WebCore::SVGElement::isReferencedByFEImage const): * Source/WebCore/svg/SVGElement.h: * Source/WebCore/svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::notifyFinished): (WebCore::SVGFEImageElement::imageBufferForEffect const): Canonical link: https://commits.webkit.org/319388@main
webkit-commit-queue
force-pushed
the
eng/LBSE-Paint-feImage-referenced-elements-through-the-layer-tree
branch
from
August 18, 2026 17:48
f6c217c to
6b3f8e7
Compare
Collaborator
|
Committed 319388@main (6b3f8e7): https://commits.webkit.org/319388@main Reviewed commits have been landed. Closing PR #71547 and removing active labels. |
nikolaszimmermann
deleted the
eng/LBSE-Paint-feImage-referenced-elements-through-the-layer-tree
branch
August 18, 2026 20:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
6b3f8e7
f6c217c