haikuwebkit/LayoutTests/fast/shadow-dom/svg-radial-gradient-href-in...

28 lines
798 B
HTML
Raw Permalink Normal View History

SVG use element inside a shadow tree cannot reference an element in the same tree https://bugs.webkit.org/show_bug.cgi?id=174977 <rdar://problem/33665636> Reviewed by Zalan Bujtas. Source/WebCore: Make fragment URL references used by SVGelements within a shadow tree to refer to other elements in the same shadow tree. To do this, this patch makes targetElementFromIRIString take a TreeScope instead of a Document, and updates its call sites. This patch updates the most uses of targetElementFromIRIString except CSS cursor image, altGraph, and glyphRef since the cursor image isn't really a SVG feature, and there aren't really real world use cases in which altGraph and glyphRef are used within shadow trees. Tests: fast/shadow-dom/svg-animate-href-change-in-shadow-tree.html fast/shadow-dom/svg-animate-href-in-shadow-tree.html fast/shadow-dom/svg-feimage-href-in-shadow-tree.html fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree.html fast/shadow-dom/svg-mpath-href-change-in-shadow-tree.html fast/shadow-dom/svg-mpath-href-in-shadow-tree.html fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree.html fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html fast/shadow-dom/svg-text-path-href-in-shadow-tree.html fast/shadow-dom/svg-thref-href-change-in-shadow-tree.html fast/shadow-dom/svg-thref-href-in-shadow-tree.html fast/shadow-dom/svg-use-href-change-in-shadow-tree.html fast/shadow-dom/svg-use-href-in-shadow-tree.html * accessibility/AccessibilitySVGElement.cpp: (WebCore::AccessibilitySVGElement::targetForUseElement const): * css/CSSCursorImageValue.cpp: * rendering/svg/RenderSVGTextPath.cpp: (WebCore::RenderSVGTextPath::layoutPath const): * svg/SVGAltGlyphElement.cpp: (WebCore::SVGAltGlyphElement::hasValidGlyphElements const): * svg/SVGFEImageElement.cpp: (WebCore::SVGFEImageElement::buildPendingResource): (WebCore::SVGFEImageElement::build): * svg/SVGGlyphRefElement.cpp: (WebCore::SVGGlyphRefElement::hasValidGlyphElement const): * svg/SVGLinearGradientElement.cpp: (WebCore::SVGLinearGradientElement::collectGradientAttributes): * svg/SVGMPathElement.cpp: (WebCore::SVGMPathElement::buildPendingResource): (WebCore::SVGMPathElement::pathElement): * svg/SVGRadialGradientElement.cpp: (WebCore::SVGRadialGradientElement::collectGradientAttributes): * svg/SVGTRefElement.cpp: (WebCore::SVGTRefElement::buildPendingResource): * svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::buildPendingResource): * svg/SVGURIReference.cpp: (WebCore::SVGURIReference::targetElementFromIRIString): * svg/SVGURIReference.h: * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::updateShadowTree): (WebCore::SVGUseElement::findTarget const): * svg/animation/SVGSMILElement.cpp: (WebCore::SVGSMILElement::buildPendingResource): (WebCore::SVGSMILElement::insertedIntoAncestor): * svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::FEImage): (WebCore::FEImage::createWithIRIReference): (WebCore::FEImage::referencedRenderer const): * svg/graphics/filters/SVGFEImage.h: LayoutTests: Added tests for specifying a fragment URL to refer to other elements within shadow trees. This patch doesn't add a test for updating a fragment URL of linearGradient and radialGradient since it doesn't work at all even outside shadow trees. See webkit.org/b/191934. * fast/shadow-dom/svg-animate-href-change-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-animate-href-change-in-shadow-tree.html: Added. * fast/shadow-dom/svg-animate-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-animate-href-in-shadow-tree.html: Added. * fast/shadow-dom/svg-feimage-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-feimage-href-in-shadow-tree.html: Added. * fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree.html: Added. * fast/shadow-dom/svg-mpath-href-change-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-mpath-href-change-in-shadow-tree.html: Added. * fast/shadow-dom/svg-mpath-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-mpath-href-in-shadow-tree.html: Added. * fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree.html: Added. * fast/shadow-dom/svg-text-path-href-change-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html: Added. * fast/shadow-dom/svg-text-path-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-text-path-href-in-shadow-tree.html: Added. * fast/shadow-dom/svg-thref-href-change-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-thref-href-change-in-shadow-tree.html: Added. * fast/shadow-dom/svg-thref-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-thref-href-in-shadow-tree.html: Added. * fast/shadow-dom/svg-use-href-change-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-use-href-change-in-shadow-tree.html: Added. * fast/shadow-dom/svg-use-href-in-shadow-tree-expected.html: Added. * fast/shadow-dom/svg-use-href-in-shadow-tree.html: Added. Canonical link: https://commits.webkit.org/206690@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-26 22:48:08 +00:00
<!DOCTYPE html>
<html>
<body>
<p>Test passes if you see a single 100px by 100px green box below.</p>
<div id="host" style="width: 100px; height: 100px;"></div>
<svg>
<radialGradient id="gradient">
<stop offset="0%" stop-color="red" />
</radialGradient>
</svg>
<template>
<svg viewbox="0 0 100 100">
<radialGradient id="gradient">
<stop offset="0%" stop-color="green" />
</radialGradient>
<radialGradient id="gradientUse" fill="red" href="#gradient"></radialGradient>
<rect id="rect" width="100" height="100" fill="url(#gradientUse)">
</svg>
</template>
<script>
const shadowRoot = host.attachShadow({mode: 'closed'});
shadowRoot.appendChild(document.querySelector('template').content.cloneNode(true));
</script>
</body>
</html>