haikuwebkit/LayoutTests/svg/custom/href-svg-namespace-static.svg

23 lines
1.1 KiB
XML
Raw Permalink Normal View History

Allow href attribute without xlink on SVG elements https://bugs.webkit.org/show_bug.cgi?id=153854 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-08-07 Reviewed by Dean Jackson. Source/WebCore: SVG 2 has moved the href attribute from xlink namespace to svg namespace. Instead of using xlink:href, svg:href should be used or simply use href if the svg namespace is defined. See https://www.w3.org/TR/SVG2/linking.html#XLinkRefAttrs. For backward compatibility, xlink:href will be treated as an alias to href till it is acceptable to completely remove the support for the deprecated xlink:href. Tests: svg/custom/href-svg-namespace-animate.svg svg/custom/href-svg-namespace-dynamic.svg svg/custom/href-svg-namespace-elements.html svg/custom/href-svg-namespace-expected.svg svg/custom/href-svg-namespace-static.svg * dom/Element.cpp: (WebCore::Element::absoluteLinkURL const): * dom/Element.h: (WebCore::Element::getAttribute const): This new template function with template pack parameter QualifiedNames is added to return the first none empty attribute value given a set of attributes' names. This should be useful for deprecated attributes. When we decide to remove the support for the deprecated attribute, all we need is to remove it as a parameter to getAttribute(). In this case, the none template function will be called. * dom/VisitedLinkState.cpp: (WebCore::linkAttribute): * html/parser/XSSAuditor.cpp: (WebCore::XSSAuditor::filterScriptToken): * svg/SVGAElement.cpp: (WebCore::SVGAElement::isURLAttribute const): * svg/SVGAltGlyphElement.cpp: (WebCore::SVGAltGlyphElement::hasValidGlyphElements const): * svg/SVGCursorElement.cpp: * svg/SVGDocumentExtensions.cpp: (WebCore::SVGDocumentExtensions::rebuildElements): (WebCore::SVGDocumentExtensions::rebuildAllElementReferencesForTarget): * svg/SVGElement.cpp: (WebCore::SVGElement::animatableAttributeForName): * svg/SVGFEImageElement.cpp: * svg/SVGFilterElement.cpp: * svg/SVGFontFaceUriElement.cpp: (WebCore::SVGFontFaceUriElement::srcValue const): (WebCore::SVGFontFaceUriElement::parseAttribute): (WebCore::SVGFontFaceUriElement::loadFont): * svg/SVGForeignObjectElement.cpp: * svg/SVGGlyphRefElement.cpp: (WebCore::SVGGlyphRefElement::hasValidGlyphElement const): * svg/SVGGradientElement.cpp: * svg/SVGImageElement.cpp: (WebCore::SVGImageElement::imageSourceURL const): * svg/SVGMPathElement.cpp: * svg/SVGPatternElement.cpp: * svg/SVGScriptElement.h: * svg/SVGTRefElement.cpp: * svg/SVGTextPathElement.cpp: * svg/SVGURIReference.cpp: (WebCore::SVGURIReference::registerAttributes): (WebCore::SVGURIReference::parseAttribute): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::expandUseElementsInShadowTree const): * svg/animation/SVGSMILElement.cpp: (WebCore::SVGSMILElement::isSupportedAttribute): (WebCore::SVGSMILElement::svgAttributeChanged): * svg/svgattrs.in: LayoutTests: * fast/selectors/any-link-basics-2-expected.txt: * fast/selectors/any-link-basics-2.html: Re-baseline this test because it was assuming the bare href should not work for the SVG <a> element. * svg/custom/href-svg-namespace-animate-expected.svg: Added. * svg/custom/href-svg-namespace-animate.svg: Added. * svg/custom/href-svg-namespace-dynamic-expected.svg: Added. * svg/custom/href-svg-namespace-dynamic.svg: Added. * svg/custom/href-svg-namespace-elements-expected.txt: Added. * svg/custom/href-svg-namespace-elements.html: Added. * svg/custom/href-svg-namespace-static-expected.svg: Added. * svg/custom/href-svg-namespace.static-svg: Added. Canonical link: https://commits.webkit.org/203506@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-08 00:55:51 +00:00
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="gradient1">
<stop offset="0%" stop-color="green" />
<stop offset="100%" stop-color="green" />
</linearGradient>
<linearGradient id="gradient2" x1="0%" y1="0%" x2="100%" y2="0%" href="#gradient1"/>
<pattern id="pattern1">
<rect width="100%" height="100%" fill="green"/>
</pattern>
<pattern id="pattern2" x="0" y="0" width="100" height="100" href="#pattern1"/>
<rect id="rect" width="100" height="100"/>
</defs>
<rect x="10" y="10" width="100" height="100" fill="url(#gradient2)" />
<rect x="120" y="10" width="100" height="100" fill="url(#pattern2)" />
<image x="230" y="10" width="100" height="100"
href="data:image/svg+xml;base64,
PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgI
DxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDBweCIgaGVpZ2h0PSIxMDBweCIgZmlsbD0iZ3JlZW4iLz4KPC9zdmc+"
/>
<use x="340" y="10" width="100" height="100" href="#rect" fill="green"/>
</svg>