WebKit Bugzilla
Attachment 346742 Details for
Bug 153854
: Allow href attribute without xlink on SVG elements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-153854-20180807163338.patch (text/plain), 45.33 KB, created by
Said Abou-Hallawa
on 2018-08-07 16:33:38 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-07 16:33:38 PDT
Size:
45.33 KB
patch
obsolete
>Subversion Revision: 234620 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index dd29f46a74d9e81bf2fd0d9326c53b9319689196..a7b06112a1e4714e78b74b5cc37439a7bf9dc18e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,76 @@ >+2018-08-07 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Allow href attribute without xlink on SVG elements >+ https://bugs.webkit.org/show_bug.cgi?id=153854 >+ >+ Reviewed by Dean Jackson. >+ >+ 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: >+ > 2018-08-06 Said Abou-Hallawa <sabouhallawa@apple.com> > > Remove the SVG elements' attributes macros >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index 8870d2dffd129b766e1a4a1c78d629f4c69a278c..69e6f90c1693dd7749384c2c7e2db719c7b3d206 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -1472,7 +1472,7 @@ URL Element::absoluteLinkURL() const > > AtomicString linkAttribute; > if (hasTagName(SVGNames::aTag)) >- linkAttribute = getAttribute(XLinkNames::hrefAttr); >+ linkAttribute = getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); > else > linkAttribute = getAttribute(HTMLNames::hrefAttr); > >diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h >index 842a2080e6649e15030fc48e6fbd0ad9bd0545cb..183c3fd117c2427fcca573ffee7951b94f15d02e 100644 >--- a/Source/WebCore/dom/Element.h >+++ b/Source/WebCore/dom/Element.h >@@ -76,6 +76,8 @@ public: > > WEBCORE_EXPORT bool hasAttribute(const QualifiedName&) const; > WEBCORE_EXPORT const AtomicString& getAttribute(const QualifiedName&) const; >+ template<typename... QualifiedNames> >+ const AtomicString& getAttribute(const QualifiedName&, const QualifiedNames&...) const; > WEBCORE_EXPORT void setAttribute(const QualifiedName&, const AtomicString& value); > WEBCORE_EXPORT void setAttributeWithoutSynchronization(const QualifiedName&, const AtomicString& value); > void setSynchronizedLazyAttribute(const QualifiedName&, const AtomicString& value); >@@ -817,6 +819,15 @@ inline void Element::setHasFocusWithin(bool flag) > invalidateStyleForSubtree(); > } > >+template<typename... QualifiedNames> >+inline const AtomicString& Element::getAttribute(const QualifiedName& name, const QualifiedNames&... names) const >+{ >+ const AtomicString& value = getAttribute(name); >+ if (!value.isEmpty()) >+ return value; >+ return getAttribute(names...); >+} >+ > } // namespace WebCore > > SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Element) >diff --git a/Source/WebCore/dom/VisitedLinkState.cpp b/Source/WebCore/dom/VisitedLinkState.cpp >index 43564c1693bf8cf03d54b2e2785219d78e85974f..c49c3681fbf21a616dcfffc9e9766aa3fe896df6 100644 >--- a/Source/WebCore/dom/VisitedLinkState.cpp >+++ b/Source/WebCore/dom/VisitedLinkState.cpp >@@ -33,6 +33,7 @@ > #include "Frame.h" > #include "HTMLAnchorElement.h" > #include "Page.h" >+#include "SVGNames.h" > #include "VisitedLinkStore.h" > #include "XLinkNames.h" > >@@ -47,7 +48,7 @@ inline static const AtomicString* linkAttribute(const Element& element) > if (element.isHTMLElement()) > return &element.attributeWithoutSynchronization(HTMLNames::hrefAttr); > if (element.isSVGElement()) >- return &element.getAttribute(XLinkNames::hrefAttr); >+ return &element.getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); > return 0; > } > >diff --git a/Source/WebCore/html/parser/XSSAuditor.cpp b/Source/WebCore/html/parser/XSSAuditor.cpp >index 2ac8a2a9760d99d2801b4698811cb919b8a47919..71928c7cea8e14f044de49f9d01384730aaa2ceb 100644 >--- a/Source/WebCore/html/parser/XSSAuditor.cpp >+++ b/Source/WebCore/html/parser/XSSAuditor.cpp >@@ -447,6 +447,7 @@ bool XSSAuditor::filterScriptToken(const FilterTokenRequest& request) > bool didBlockScript = false; > if (m_wasScriptTagFoundInRequest) { > didBlockScript |= eraseAttributeIfInjected(request, srcAttr, blankURL().string(), TruncationStyle::SrcLikeAttribute); >+ didBlockScript |= eraseAttributeIfInjected(request, SVGNames::hrefAttr, blankURL().string(), TruncationStyle::SrcLikeAttribute); > didBlockScript |= eraseAttributeIfInjected(request, XLinkNames::hrefAttr, blankURL().string(), TruncationStyle::SrcLikeAttribute); > } > >diff --git a/Source/WebCore/svg/SVGAElement.cpp b/Source/WebCore/svg/SVGAElement.cpp >index cc3c09f763b602429d69f2e828e1f0f5fc7efb1b..ca9cdf06b9b8258d63c824b94f87c415b5566061 100644 >--- a/Source/WebCore/svg/SVGAElement.cpp >+++ b/Source/WebCore/svg/SVGAElement.cpp >@@ -171,7 +171,7 @@ bool SVGAElement::supportsFocus() const > > bool SVGAElement::isURLAttribute(const Attribute& attribute) const > { >- return attribute.name().localName() == XLinkNames::hrefAttr || SVGGraphicsElement::isURLAttribute(attribute); >+ return SVGURIReference::isKnownAttribute(attribute.name()) || SVGGraphicsElement::isURLAttribute(attribute); > } > > bool SVGAElement::isMouseFocusable() const >diff --git a/Source/WebCore/svg/SVGAltGlyphElement.cpp b/Source/WebCore/svg/SVGAltGlyphElement.cpp >index 782b245ad1b118fdca695b651f75cf15e2e294a5..9b2c7eb87a1448bf0a1a911036357c0c7cf58ce2 100644 >--- a/Source/WebCore/svg/SVGAltGlyphElement.cpp >+++ b/Source/WebCore/svg/SVGAltGlyphElement.cpp >@@ -82,7 +82,7 @@ RenderPtr<RenderElement> SVGAltGlyphElement::createElementRenderer(RenderStyle&& > bool SVGAltGlyphElement::hasValidGlyphElements(Vector<String>& glyphNames) const > { > String target; >- auto element = makeRefPtr(targetElementFromIRIString(getAttribute(XLinkNames::hrefAttr), document(), &target)); >+ auto element = makeRefPtr(targetElementFromIRIString(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr), document(), &target)); > > if (is<SVGGlyphElement>(element)) { > glyphNames.append(target); >diff --git a/Source/WebCore/svg/SVGCursorElement.cpp b/Source/WebCore/svg/SVGCursorElement.cpp >index 8dd70f2bee8ab8ac245bb402d93318178dc27fd5..cd808c9984b599b0a457954faf42ea3fd93da14e 100644 >--- a/Source/WebCore/svg/SVGCursorElement.cpp >+++ b/Source/WebCore/svg/SVGCursorElement.cpp >@@ -26,7 +26,6 @@ > #include "Document.h" > #include "SVGNames.h" > #include "SVGStringList.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >diff --git a/Source/WebCore/svg/SVGDocumentExtensions.cpp b/Source/WebCore/svg/SVGDocumentExtensions.cpp >index 65e246d97788a92c1463bd15a811c719a1a189e0..4ec1a8c85cb4512456a368a33a04735a2898e3c8 100644 >--- a/Source/WebCore/svg/SVGDocumentExtensions.cpp >+++ b/Source/WebCore/svg/SVGDocumentExtensions.cpp >@@ -35,7 +35,6 @@ > #include "SVGSVGElement.h" > #include "ScriptableDocumentParser.h" > #include "ShadowRoot.h" >-#include "XLinkNames.h" > #include <wtf/text/AtomicString.h> > > namespace WebCore { >@@ -326,7 +325,7 @@ void SVGDocumentExtensions::rebuildElements() > { > Vector<SVGElement*> shadowRebuildElements = WTFMove(m_rebuildElements); > for (auto* element : shadowRebuildElements) >- element->svgAttributeChanged(XLinkNames::hrefAttr); >+ element->svgAttributeChanged(SVGNames::hrefAttr); > } > > void SVGDocumentExtensions::clearTargetDependencies(SVGElement& referencedElement) >@@ -356,7 +355,7 @@ void SVGDocumentExtensions::rebuildAllElementReferencesForTarget(SVGElement& ref > elementsToRebuild.uncheckedAppend(element); > > for (auto* element : elementsToRebuild) >- element->svgAttributeChanged(XLinkNames::hrefAttr); >+ element->svgAttributeChanged(SVGNames::hrefAttr); > } > > void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* referencedElement) >diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp >index 1b7214bf990991007be412beb082c55cf6da76fd..fd59656dc8d1f3912f1a6c5707d9fe50655f708a 100644 >--- a/Source/WebCore/svg/SVGElement.cpp >+++ b/Source/WebCore/svg/SVGElement.cpp >@@ -50,7 +50,6 @@ > #include "SVGTitleElement.h" > #include "SVGUseElement.h" > #include "ShadowRoot.h" >-#include "XLinkNames.h" > #include "XMLNames.h" > #include <wtf/Assertions.h> > #include <wtf/HashMap.h> >@@ -854,7 +853,7 @@ QualifiedName SVGElement::animatableAttributeForName(const AtomicString& localNa > &SVGNames::yAttr.get(), > &SVGNames::yChannelSelectorAttr.get(), > &SVGNames::zAttr.get(), >- &XLinkNames::hrefAttr.get(), >+ &SVGNames::hrefAttr.get(), > }; > HashMap<AtomicString, QualifiedName> map; > for (auto& name : names) { >diff --git a/Source/WebCore/svg/SVGFEImageElement.cpp b/Source/WebCore/svg/SVGFEImageElement.cpp >index 3a41928a28ed01e72b6fdf87fbbb46c733907c75..db7ef12e3faaac9a6326c0b3fe98400ee1692ab8 100644 >--- a/Source/WebCore/svg/SVGFEImageElement.cpp >+++ b/Source/WebCore/svg/SVGFEImageElement.cpp >@@ -32,7 +32,6 @@ > #include "RenderSVGResource.h" > #include "SVGNames.h" > #include "SVGPreserveAspectRatioValue.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { >diff --git a/Source/WebCore/svg/SVGFilterElement.cpp b/Source/WebCore/svg/SVGFilterElement.cpp >index f5a208a6a20e8084da6a209144df0fb0364b437a..781ce0630562c3f4244d0f627c618121bbcd1c25 100644 >--- a/Source/WebCore/svg/SVGFilterElement.cpp >+++ b/Source/WebCore/svg/SVGFilterElement.cpp >@@ -31,7 +31,6 @@ > #include "SVGFilterPrimitiveStandardAttributes.h" > #include "SVGNames.h" > #include "SVGParserUtilities.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >diff --git a/Source/WebCore/svg/SVGFontFaceUriElement.cpp b/Source/WebCore/svg/SVGFontFaceUriElement.cpp >index affaea45ce52edb36e82061e4666572ae7229c20..57cb2db59a477dec45c5bfffd369ebe84c5bb4d0 100644 >--- a/Source/WebCore/svg/SVGFontFaceUriElement.cpp >+++ b/Source/WebCore/svg/SVGFontFaceUriElement.cpp >@@ -58,7 +58,7 @@ SVGFontFaceUriElement::~SVGFontFaceUriElement() > > Ref<CSSFontFaceSrcValue> SVGFontFaceUriElement::srcValue() const > { >- auto src = CSSFontFaceSrcValue::create(getAttribute(XLinkNames::hrefAttr)); >+ auto src = CSSFontFaceSrcValue::create(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr)); > AtomicString value(attributeWithoutSynchronization(formatAttr)); > src.get().setFormat(value.isEmpty() ? "svg" : value); // Default format > return src; >@@ -66,7 +66,7 @@ Ref<CSSFontFaceSrcValue> SVGFontFaceUriElement::srcValue() const > > void SVGFontFaceUriElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { >- if (name == XLinkNames::hrefAttr) >+ if (name == SVGNames::hrefAttr || name == XLinkNames::hrefAttr) > loadFont(); > else > SVGElement::parseAttribute(name, value); >@@ -101,7 +101,7 @@ void SVGFontFaceUriElement::loadFont() > if (m_cachedFont) > m_cachedFont->removeClient(*this); > >- const AtomicString& href = getAttribute(XLinkNames::hrefAttr); >+ const AtomicString& href = getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); > if (!href.isNull()) { > ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions(); > options.contentSecurityPolicyImposition = isInUserAgentShadowTree() ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck; >diff --git a/Source/WebCore/svg/SVGForeignObjectElement.cpp b/Source/WebCore/svg/SVGForeignObjectElement.cpp >index 0492077230e93632cf6b9ae6563c50035f511830..006a77311a858398f79e6aefee876f0fbb18d476 100644 >--- a/Source/WebCore/svg/SVGForeignObjectElement.cpp >+++ b/Source/WebCore/svg/SVGForeignObjectElement.cpp >@@ -27,7 +27,6 @@ > #include "RenderSVGResource.h" > #include "SVGLengthValue.h" > #include "SVGNames.h" >-#include "XLinkNames.h" > #include <wtf/Assertions.h> > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> >diff --git a/Source/WebCore/svg/SVGGlyphRefElement.cpp b/Source/WebCore/svg/SVGGlyphRefElement.cpp >index 24cdd40e829345d3938cb491f0987782ab879131..91544171f727bd1a12621c0564f5e4db77d8ec6a 100644 >--- a/Source/WebCore/svg/SVGGlyphRefElement.cpp >+++ b/Source/WebCore/svg/SVGGlyphRefElement.cpp >@@ -50,7 +50,7 @@ bool SVGGlyphRefElement::hasValidGlyphElement(String& glyphName) const > { > // FIXME: We only support xlink:href so far. > // https://bugs.webkit.org/show_bug.cgi?id=64787 >- return is<SVGGlyphElement>(targetElementFromIRIString(getAttribute(XLinkNames::hrefAttr), document(), &glyphName)); >+ return is<SVGGlyphElement>(targetElementFromIRIString(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr), document(), &glyphName)); > } > > static float parseFloat(const AtomicString& value) >diff --git a/Source/WebCore/svg/SVGGradientElement.cpp b/Source/WebCore/svg/SVGGradientElement.cpp >index d65e0f87d430a7416a8812348fdc78f3cfec9b82..d5814f28175b200629e825ebd02d1899566b488c 100644 >--- a/Source/WebCore/svg/SVGGradientElement.cpp >+++ b/Source/WebCore/svg/SVGGradientElement.cpp >@@ -32,7 +32,6 @@ > #include "SVGTransformListValues.h" > #include "SVGTransformable.h" > #include "StyleResolver.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >diff --git a/Source/WebCore/svg/SVGImageElement.cpp b/Source/WebCore/svg/SVGImageElement.cpp >index f93937736ed60bcdc59b06e1f83ad03f9f36a0e2..055992764c63ed2351f267eb853df4f58d0c1ae3 100644 >--- a/Source/WebCore/svg/SVGImageElement.cpp >+++ b/Source/WebCore/svg/SVGImageElement.cpp >@@ -167,7 +167,7 @@ Node::InsertedIntoAncestorResult SVGImageElement::insertedIntoAncestor(Insertion > > const AtomicString& SVGImageElement::imageSourceURL() const > { >- return getAttribute(XLinkNames::hrefAttr); >+ return getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); > } > > void SVGImageElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const >diff --git a/Source/WebCore/svg/SVGMPathElement.cpp b/Source/WebCore/svg/SVGMPathElement.cpp >index 93c8d4357b0f42092a4b3b8ed3c49de0bee720f2..d17c5917640997d9259878cfef14f212953fefc0 100644 >--- a/Source/WebCore/svg/SVGMPathElement.cpp >+++ b/Source/WebCore/svg/SVGMPathElement.cpp >@@ -26,7 +26,6 @@ > #include "SVGDocumentExtensions.h" > #include "SVGNames.h" > #include "SVGPathElement.h" >-#include "XLinkNames.h" > > namespace WebCore { > >diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp >index 172d6c6ebdd3e39fb9f91be895bd2ec9a4ce7025..700f26b6a1a4204e11665f4bdfe4b45a3661c18d 100644 >--- a/Source/WebCore/svg/SVGPatternElement.cpp >+++ b/Source/WebCore/svg/SVGPatternElement.cpp >@@ -38,7 +38,6 @@ > #include "SVGRenderSupport.h" > #include "SVGStringList.h" > #include "SVGTransformable.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >diff --git a/Source/WebCore/svg/SVGScriptElement.h b/Source/WebCore/svg/SVGScriptElement.h >index 5264571facdb02670278a5646f6e44ede21490a5..f8ced22a327281b0118035a9b71807f15a815d28 100644 >--- a/Source/WebCore/svg/SVGScriptElement.h >+++ b/Source/WebCore/svg/SVGScriptElement.h >@@ -67,7 +67,7 @@ private: > bool hasAsyncAttribute() const final { return false; } > bool hasDeferAttribute() const final { return false; } > bool hasNoModuleAttribute() const final { return false; } >- bool hasSourceAttribute() const final { return hasAttribute(XLinkNames::hrefAttr); } >+ bool hasSourceAttribute() const final { return hasAttribute(SVGNames::hrefAttr) || hasAttribute(XLinkNames::hrefAttr); } > > void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent(); } > >diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp >index 26becb225c75ea9284e74afa029e2fbbd00b636d..3047daf8407401ed329182ce656772756d54b7dc 100644 >--- a/Source/WebCore/svg/SVGTRefElement.cpp >+++ b/Source/WebCore/svg/SVGTRefElement.cpp >@@ -36,7 +36,6 @@ > #include "ScriptDisallowedScope.h" > #include "StyleInheritedData.h" > #include "Text.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { >diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp >index f922dabcbeeb796def296f1ad4f9a51d9a86ddad..e9a7005c2693f63d1bf1e173aa7fe51c2805c0ff 100644 >--- a/Source/WebCore/svg/SVGTextPathElement.cpp >+++ b/Source/WebCore/svg/SVGTextPathElement.cpp >@@ -26,7 +26,6 @@ > #include "RenderSVGTextPath.h" > #include "SVGDocumentExtensions.h" > #include "SVGNames.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >diff --git a/Source/WebCore/svg/SVGURIReference.cpp b/Source/WebCore/svg/SVGURIReference.cpp >index 9cb4da0ec5973efc4c3c761be73d457189693b22..68504aa84f26cb193ff35fa08b0a4f6d1e55fc2c 100644 >--- a/Source/WebCore/svg/SVGURIReference.cpp >+++ b/Source/WebCore/svg/SVGURIReference.cpp >@@ -41,6 +41,7 @@ void SVGURIReference::registerAttributes() > auto& registry = attributeRegistry(); > if (!registry.isEmpty()) > return; >+ registry.registerAttribute<SVGNames::hrefAttr, &SVGURIReference::m_href>(); > registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); > } > >@@ -56,7 +57,7 @@ bool SVGURIReference::isKnownAttribute(const QualifiedName& attributeName) > > void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) > { >- if (name.matches(XLinkNames::hrefAttr)) >+ if (isKnownAttribute(name)) > m_href.setValue(value); > } > >diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp >index f12c7d0a88ede0c15cb1a5833ab9aecdd5e47f1a..f7e234429515adfc67c36048c20b8888fcbb6dc0 100644 >--- a/Source/WebCore/svg/SVGUseElement.cpp >+++ b/Source/WebCore/svg/SVGUseElement.cpp >@@ -480,6 +480,7 @@ void SVGUseElement::expandUseElementsInShadowTree() const > replacementClone->removeAttribute(SVGNames::yAttr); > replacementClone->removeAttribute(SVGNames::widthAttr); > replacementClone->removeAttribute(SVGNames::heightAttr); >+ replacementClone->removeAttribute(SVGNames::hrefAttr); > replacementClone->removeAttribute(XLinkNames::hrefAttr); > > if (target) >diff --git a/Source/WebCore/svg/animation/SVGSMILElement.cpp b/Source/WebCore/svg/animation/SVGSMILElement.cpp >index 0601e5c335525bc045aebbb9d39b4bd86f76e421..f50861324ee1f4afdf4853c16d26b07ff789fb79 100644 >--- a/Source/WebCore/svg/animation/SVGSMILElement.cpp >+++ b/Source/WebCore/svg/animation/SVGSMILElement.cpp >@@ -467,6 +467,7 @@ bool SVGSMILElement::isSupportedAttribute(const QualifiedName& attrName) > SVGNames::minAttr, > SVGNames::maxAttr, > SVGNames::attributeNameAttr, >+ SVGNames::hrefAttr, > XLinkNames::hrefAttr, > }); > return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >@@ -519,7 +520,7 @@ void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) > m_cachedMax = invalidCachedTime; > else if (attrName == SVGNames::attributeNameAttr) > updateAttributeName(); >- else if (attrName.matches(XLinkNames::hrefAttr)) { >+ else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNames::hrefAttr)) { > InstanceInvalidationGuard guard(*this); > buildPendingResource(); > } else if (isConnected()) { >diff --git a/Source/WebCore/svg/svgattrs.in b/Source/WebCore/svg/svgattrs.in >index c7561c2b5a46b5d275d63d96694f17182f97837e..8a356f01fbc3a4520da96148e4a5ae553d2b266f 100644 >--- a/Source/WebCore/svg/svgattrs.in >+++ b/Source/WebCore/svg/svgattrs.in >@@ -87,6 +87,7 @@ height > horiz-adv-x > horiz-origin-x > horiz-origin-y >+href > ideographic > image-rendering > in >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a3efe6616dd4d710095374c8db27234775c73008..313de9c8ea8f1ee4bef653ad7d1298947b88f341 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,23 @@ >+2018-08-07 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Allow href attribute without xlink on SVG elements >+ https://bugs.webkit.org/show_bug.cgi?id=153854 >+ >+ Reviewed by Dean Jackson. >+ >+ * 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. >+ > 2018-08-06 Ryosuke Niwa <rniwa@webkit.org> > > fast/custom-elements/custom-element-registry-wrapper-should-stay-alive.html always timeouts on debug bots >diff --git a/LayoutTests/fast/selectors/any-link-basics-2-expected.txt b/LayoutTests/fast/selectors/any-link-basics-2-expected.txt >index 132af57b5114c993628838e10577642ca223ceb0..d855f734e469d16509d59f71861d356c876fd43e 100644 >--- a/LayoutTests/fast/selectors/any-link-basics-2-expected.txt >+++ b/LayoutTests/fast/selectors/any-link-basics-2-expected.txt >@@ -3,7 +3,7 @@ Test the basic matching of the :any-link selector. > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > > >-PASS document.querySelectorAll(":any-link").length is 21 >+PASS document.querySelectorAll(":any-link").length is 25 > PASS document.querySelectorAll(":any-link")[0] is document.getElementById("target-tag-2") > PASS document.querySelectorAll(":any-link")[1] is document.getElementById("target-tag-3") > PASS document.querySelectorAll(":any-link")[2] is document.getElementById("target-tag-4") >@@ -21,10 +21,14 @@ PASS document.querySelectorAll(":any-link")[13] is document.getElementById("targ > PASS document.querySelectorAll(":any-link")[14] is document.getElementById("target-tag-23") > PASS document.querySelectorAll(":any-link")[15] is document.getElementById("target-tag-24") > PASS document.querySelectorAll(":any-link")[16] is document.getElementById("target-tag-25") >-PASS document.querySelectorAll(":any-link")[17] is document.getElementById("target-tag-31") >-PASS document.querySelectorAll(":any-link")[18] is document.getElementById("target-tag-32") >-PASS document.querySelectorAll(":any-link")[19] is document.getElementById("target-tag-33") >-PASS document.querySelectorAll(":any-link")[20] is document.getElementById("target-tag-34") >+PASS document.querySelectorAll(":any-link")[17] is document.getElementById("target-tag-27") >+PASS document.querySelectorAll(":any-link")[18] is document.getElementById("target-tag-28") >+PASS document.querySelectorAll(":any-link")[19] is document.getElementById("target-tag-29") >+PASS document.querySelectorAll(":any-link")[20] is document.getElementById("target-tag-30") >+PASS document.querySelectorAll(":any-link")[21] is document.getElementById("target-tag-31") >+PASS document.querySelectorAll(":any-link")[22] is document.getElementById("target-tag-32") >+PASS document.querySelectorAll(":any-link")[23] is document.getElementById("target-tag-33") >+PASS document.querySelectorAll(":any-link")[24] is document.getElementById("target-tag-34") > PASS getComputedStyle(document.getElementById("target-tag-1")).backgroundColor is "rgb(255, 255, 255)" > PASS getComputedStyle(document.getElementById("target-tag-2")).backgroundColor is "rgb(1, 2, 3)" > PASS getComputedStyle(document.getElementById("target-tag-3")).backgroundColor is "rgb(1, 2, 3)" >@@ -51,10 +55,10 @@ PASS getComputedStyle(document.getElementById("target-tag-23")).backgroundColor > PASS getComputedStyle(document.getElementById("target-tag-24")).backgroundColor is "rgb(1, 2, 3)" > PASS getComputedStyle(document.getElementById("target-tag-25")).backgroundColor is "rgb(1, 2, 3)" > PASS getComputedStyle(document.getElementById("target-tag-26")).backgroundColor is "rgb(255, 255, 255)" >-PASS getComputedStyle(document.getElementById("target-tag-27")).backgroundColor is "rgb(255, 255, 255)" >-PASS getComputedStyle(document.getElementById("target-tag-28")).backgroundColor is "rgb(255, 255, 255)" >-PASS getComputedStyle(document.getElementById("target-tag-29")).backgroundColor is "rgb(255, 255, 255)" >-PASS getComputedStyle(document.getElementById("target-tag-30")).backgroundColor is "rgb(255, 255, 255)" >+PASS getComputedStyle(document.getElementById("target-tag-27")).backgroundColor is "rgb(1, 2, 3)" >+PASS getComputedStyle(document.getElementById("target-tag-28")).backgroundColor is "rgb(1, 2, 3)" >+PASS getComputedStyle(document.getElementById("target-tag-29")).backgroundColor is "rgb(1, 2, 3)" >+PASS getComputedStyle(document.getElementById("target-tag-30")).backgroundColor is "rgb(1, 2, 3)" > PASS getComputedStyle(document.getElementById("target-tag-31")).backgroundColor is "rgb(1, 2, 3)" > PASS getComputedStyle(document.getElementById("target-tag-32")).backgroundColor is "rgb(1, 2, 3)" > PASS getComputedStyle(document.getElementById("target-tag-33")).backgroundColor is "rgb(1, 2, 3)" >diff --git a/LayoutTests/fast/selectors/any-link-basics-2.html b/LayoutTests/fast/selectors/any-link-basics-2.html >index 0436b29104d5f71a8abf002a0248f3811a1d9c67..6ae652d67fe93b675d001e764af78552ec2627ea 100644 >--- a/LayoutTests/fast/selectors/any-link-basics-2.html >+++ b/LayoutTests/fast/selectors/any-link-basics-2.html >@@ -76,8 +76,6 @@ > <script> > description('Test the basic matching of the :any-link selector.'); > >-shouldBe('document.querySelectorAll(":any-link").length', '21'); >- > // Query Selector. > var expectedIds = ['target-tag-2', > 'target-tag-3', >@@ -96,11 +94,17 @@ var expectedIds = ['target-tag-2', > 'target-tag-23', > 'target-tag-24', > 'target-tag-25', >+ 'target-tag-27', >+ 'target-tag-28', >+ 'target-tag-29', >+ 'target-tag-30', > 'target-tag-31', > 'target-tag-32', > 'target-tag-33', > 'target-tag-34']; > >+shouldBe('document.querySelectorAll(":any-link").length', expectedIds.length.toString()); >+ > for (var i = 0; i < expectedIds.length; ++i) > shouldBe('document.querySelectorAll(":any-link")[' + i + ']', 'document.getElementById("' + expectedIds[i] + '")'); > >@@ -131,10 +135,10 @@ var expectedStyles = [['target-tag-1', 'rgb(255, 255, 255)'], > ['target-tag-24', 'rgb(1, 2, 3)'], > ['target-tag-25', 'rgb(1, 2, 3)'], > ['target-tag-26', 'rgb(255, 255, 255)'], >- ['target-tag-27', 'rgb(255, 255, 255)'], >- ['target-tag-28', 'rgb(255, 255, 255)'], >- ['target-tag-29', 'rgb(255, 255, 255)'], >- ['target-tag-30', 'rgb(255, 255, 255)'], >+ ['target-tag-27', 'rgb(1, 2, 3)'], >+ ['target-tag-28', 'rgb(1, 2, 3)'], >+ ['target-tag-29', 'rgb(1, 2, 3)'], >+ ['target-tag-30', 'rgb(1, 2, 3)'], > ['target-tag-31', 'rgb(1, 2, 3)'], > ['target-tag-32', 'rgb(1, 2, 3)'], > ['target-tag-33', 'rgb(1, 2, 3)'], >diff --git a/LayoutTests/svg/custom/href-svg-namespace-animate-expected.svg b/LayoutTests/svg/custom/href-svg-namespace-animate-expected.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..877ad9900cd633eed38b15fd3010d628b3481df4 >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-animate-expected.svg >@@ -0,0 +1,6 @@ >+<svg xmlns="http://www.w3.org/2000/svg"> >+ <rect x="10" y="10" width="100" height="100" fill="green" /> >+ <rect x="120" y="10" width="100" height="100" fill="green" /> >+ <rect x="230" y="10" width="100" height="100" fill="green" /> >+ <rect x="340" y="10" width="100" height="100" fill="green" /> >+</svg> >diff --git a/LayoutTests/svg/custom/href-svg-namespace-animate.svg b/LayoutTests/svg/custom/href-svg-namespace-animate.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..d22937183cb66ab01194ed95d854e961339c57fd >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-animate.svg >@@ -0,0 +1,35 @@ >+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> >+ <defs> >+ <rect id="red" width="100" height="100" fill="red"/> >+ <rect id="green" width="100" height="100" fill="green"/> >+ </defs> >+ <use x="10" y="10" width="100" height="100"> >+ <animate attributeName="xlink:href" from="#red" dur="50ms" to="#green" fill="freeze"/> >+ </use> >+ <use x="120" y="10" width="100" height="100" xlink:href="#red"> >+ <animate attributeName="xlink:href" from="#red" dur="60ms" to="#green" fill="freeze"/> >+ </use> >+ <use x="230" y="10" width="100" height="100"> >+ <animate attributeName="href" from="#red" dur="70ms" to="#green" fill="freeze"/> >+ </use> >+ <use x="340" y="10" width="100" height="100" href="#red"> >+ <animate attributeName="href" from="#red" dur="80ms" to="#green" fill="freeze"/> >+ </use> >+ <script> >+ if (window.testRunner) >+ testRunner.waitUntilDone(); >+ >+ var elements = document.querySelectorAll("animate"); >+ var count = elements.length; >+ >+ for (var i = count; i--; ) >+ elements[i].addEventListener("endEvent", endAnimate, false); >+ >+ function endAnimate() { >+ if (--count === 0) { >+ if (window.testRunner) >+ testRunner.notifyDone(); >+ } >+ } >+ </script> >+</svg> >diff --git a/LayoutTests/svg/custom/href-svg-namespace-dynamic-expected.svg b/LayoutTests/svg/custom/href-svg-namespace-dynamic-expected.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..877ad9900cd633eed38b15fd3010d628b3481df4 >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-dynamic-expected.svg >@@ -0,0 +1,6 @@ >+<svg xmlns="http://www.w3.org/2000/svg"> >+ <rect x="10" y="10" width="100" height="100" fill="green" /> >+ <rect x="120" y="10" width="100" height="100" fill="green" /> >+ <rect x="230" y="10" width="100" height="100" fill="green" /> >+ <rect x="340" y="10" width="100" height="100" fill="green" /> >+</svg> >diff --git a/LayoutTests/svg/custom/href-svg-namespace-dynamic.svg b/LayoutTests/svg/custom/href-svg-namespace-dynamic.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..9aac548539094c3978eb871a43d3bc50c2c736ef >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-dynamic.svg >@@ -0,0 +1,17 @@ >+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> >+ <defs> >+ <rect id="red" width="100" height="100" fill="red"/> >+ <rect id="green" width="100" height="100" fill="green"/> >+ </defs> >+ <use x="10" y="10" width="100" height="100" href="#red" /> >+ <use x="120" y="10" width="100" height="100" href="#red" /> >+ <use x="230" y="10" width="100" height="100" xmlns:href="#red" /> >+ <use x="340" y="10" width="100" height="100" xmlns:href="#red" /> >+ <script> >+ var elements = document.querySelectorAll("use"); >+ elements[0].setAttribute("href", "#green"); >+ elements[1].href.baseVal = "#green"; >+ elements[2].setAttribute("href", "#green"); >+ elements[3].href.baseVal = "#green"; >+ </script> >+</svg> >diff --git a/LayoutTests/svg/custom/href-svg-namespace-elements-expected.txt b/LayoutTests/svg/custom/href-svg-namespace-elements-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..85118d7ad801da7ae074f625688868c67e56aa12 >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-elements-expected.txt >@@ -0,0 +1,90 @@ >+Ensures the svg href attribute can work without having to be prefixed by the xlink namespace. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS window.element.tagName is "a" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "www.webkit.org" >+PASS window.element.getAttribute('href') is "www.webkit.org" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "www.build.webkit.org" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "www.build.webkit.org" >+PASS window.element.href.baseVal is "www.build.webkit.org" >+PASS window.element.tagName is "feImage" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "resources/red-checker.png" >+PASS window.element.getAttribute('href') is "resources/red-checker.png" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "resources/green-checker.png" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "resources/green-checker.png" >+PASS window.element.href.baseVal is "resources/green-checker.png" >+PASS window.element.tagName is "filter" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "base-filter-1" >+PASS window.element.getAttribute('href') is "base-filter-1" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "base-filter-2" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "base-filter-2" >+PASS window.element.href.baseVal is "base-filter-2" >+PASS window.element.tagName is "image" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "resources/red-checker.png" >+PASS window.element.getAttribute('href') is "resources/red-checker.png" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "resources/green-checker.png" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "resources/green-checker.png" >+PASS window.element.href.baseVal is "resources/green-checker.png" >+PASS window.element.tagName is "linearGradient" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "#base-linear-gradient-1" >+PASS window.element.getAttribute('href') is "#base-linear-gradient-1" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "#base-linear-gradient-2" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "#base-linear-gradient-2" >+PASS window.element.href.baseVal is "#base-linear-gradient-2" >+PASS window.element.tagName is "pattern" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "#base-pattern-1" >+PASS window.element.getAttribute('href') is "#base-pattern-1" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "#base-pattern-2" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "#base-pattern-2" >+PASS window.element.href.baseVal is "#base-pattern-2" >+PASS window.element.tagName is "radialGradient" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "#base-radial-gradient-1" >+PASS window.element.getAttribute('href') is "#base-radial-gradient-1" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "#base-radial-gradient-2" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "#base-radial-gradient-2" >+PASS window.element.href.baseVal is "#base-radial-gradient-2" >+PASS window.element.tagName is "textPath" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "#text-path-1" >+PASS window.element.getAttribute('href') is "#text-path-1" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "#text-path-2" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "#text-path-2" >+PASS window.element.href.baseVal is "#text-path-2" >+PASS window.element.tagName is "use" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is "#red-rect" >+PASS window.element.getAttribute('href') is "#red-rect" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttribute('href') is "#green-rect" >+PASS window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href') is null >+PASS window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href') is null >+PASS window.element.getAttribute('href') is "#green-rect" >+PASS window.element.href.baseVal is "#green-rect" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/svg/custom/href-svg-namespace-elements.html b/LayoutTests/svg/custom/href-svg-namespace-elements.html >new file mode 100644 >index 0000000000000000000000000000000000000000..01b8263ab61cf8a22623befe577db4d93aa5dcb3 >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-elements.html >@@ -0,0 +1,42 @@ >+<head> >+ <script src="../../resources/js-test-pre.js"></script> >+</head> >+<body> >+ <script> >+ description("Ensures the svg href attribute can work without having to be prefixed by the xlink namespace."); >+ >+ var tagHrefTable = [ >+ { tagName: "a", xlinkValue: "www.webkit.org", svgValue: "www.build.webkit.org" }, >+ { tagName: "feImage", xlinkValue: "resources/red-checker.png", svgValue: "resources/green-checker.png" }, >+ { tagName: "filter", xlinkValue: "base-filter-1", svgValue: "base-filter-2" }, >+ { tagName: "image", xlinkValue: "resources/red-checker.png", svgValue: "resources/green-checker.png" }, >+ { tagName: "linearGradient", xlinkValue: "#base-linear-gradient-1", svgValue: "#base-linear-gradient-2" }, >+ { tagName: "pattern", xlinkValue: "#base-pattern-1", svgValue: "#base-pattern-2" }, >+ { tagName: "radialGradient", xlinkValue: "#base-radial-gradient-1", svgValue: "#base-radial-gradient-2" }, >+ { tagName: "textPath", xlinkValue: "#text-path-1", svgValue: "#text-path-2" }, >+ { tagName: "use", xlinkValue: "#red-rect", svgValue: "#green-rect" }, >+ ]; >+ >+ tagHrefTable.forEach(function(tagHref) { >+ window.element = document.createElementNS("http://www.w3.org/2000/svg", tagHref.tagName); >+ shouldBeEqualToString("window.element.tagName", tagHref.tagName); >+ >+ window.element.setAttributeNS("http://www.w3.org/1999/xlink", "href", tagHref.xlinkValue); >+ shouldBeEqualToString("window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href')", tagHref.xlinkValue); >+ shouldBeEqualToString("window.element.getAttribute('href')", tagHref.xlinkValue); >+ window.element.removeAttributeNS('http://www.w3.org/1999/xlink', "href"); >+ >+ window.element.setAttributeNS("http://www.w3.org/2000/svg", "href", tagHref.svgValue); >+ shouldBeNull("window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href')"); >+ shouldBeEqualToString("window.element.getAttribute('href')", tagHref.svgValue); >+ window.element.removeAttributeNS("http://www.w3.org/2000/svg", "href"); >+ >+ window.element.setAttribute("href", tagHref.svgValue); >+ shouldBeNull("window.element.getAttributeNS('http://www.w3.org/1999/xlink', 'href')"); >+ shouldBeNull("window.element.getAttributeNS('http://www.w3.org/2000/svg', 'href')"); >+ shouldBeEqualToString("window.element.getAttribute('href')", tagHref.svgValue); >+ shouldBeEqualToString("window.element.href.baseVal", tagHref.svgValue); >+ }); >+ </script> >+ <script src="../../resources/js-test-post.js"></script> >+</body> >diff --git a/LayoutTests/svg/custom/href-svg-namespace-static-expected.svg b/LayoutTests/svg/custom/href-svg-namespace-static-expected.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..877ad9900cd633eed38b15fd3010d628b3481df4 >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-static-expected.svg >@@ -0,0 +1,6 @@ >+<svg xmlns="http://www.w3.org/2000/svg"> >+ <rect x="10" y="10" width="100" height="100" fill="green" /> >+ <rect x="120" y="10" width="100" height="100" fill="green" /> >+ <rect x="230" y="10" width="100" height="100" fill="green" /> >+ <rect x="340" y="10" width="100" height="100" fill="green" /> >+</svg> >diff --git a/LayoutTests/svg/custom/href-svg-namespace-static.svg b/LayoutTests/svg/custom/href-svg-namespace-static.svg >new file mode 100644 >index 0000000000000000000000000000000000000000..741faf73bed4f70e509a60743eb3ed9acb04f71a >--- /dev/null >+++ b/LayoutTests/svg/custom/href-svg-namespace-static.svg >@@ -0,0 +1,22 @@ >+<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>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 153854
:
346680
|
346685
|
346690
|
346714
|
346725
| 346742