Changeset 234683 in webkit
- Timestamp:
- Aug 7, 2018 5:55:51 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r234680 r234683 1 2018-08-07 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Allow href attribute without xlink on SVG elements 4 https://bugs.webkit.org/show_bug.cgi?id=153854 5 6 Reviewed by Dean Jackson. 7 8 * fast/selectors/any-link-basics-2-expected.txt: 9 * fast/selectors/any-link-basics-2.html: 10 Re-baseline this test because it was assuming the bare href should not 11 work for the SVG <a> element. 12 * svg/custom/href-svg-namespace-animate-expected.svg: Added. 13 * svg/custom/href-svg-namespace-animate.svg: Added. 14 * svg/custom/href-svg-namespace-dynamic-expected.svg: Added. 15 * svg/custom/href-svg-namespace-dynamic.svg: Added. 16 * svg/custom/href-svg-namespace-elements-expected.txt: Added. 17 * svg/custom/href-svg-namespace-elements.html: Added. 18 * svg/custom/href-svg-namespace-static-expected.svg: Added. 19 * svg/custom/href-svg-namespace.static-svg: Added. 20 1 21 2018-08-07 Ryosuke Niwa <rniwa@webkit.org> 2 22 -
trunk/LayoutTests/fast/selectors/any-link-basics-2-expected.txt
r175301 r234683 4 4 5 5 6 PASS document.querySelectorAll(":any-link").length is 2 16 PASS document.querySelectorAll(":any-link").length is 25 7 7 PASS document.querySelectorAll(":any-link")[0] is document.getElementById("target-tag-2") 8 8 PASS document.querySelectorAll(":any-link")[1] is document.getElementById("target-tag-3") … … 22 22 PASS document.querySelectorAll(":any-link")[15] is document.getElementById("target-tag-24") 23 23 PASS document.querySelectorAll(":any-link")[16] is document.getElementById("target-tag-25") 24 PASS document.querySelectorAll(":any-link")[17] is document.getElementById("target-tag-31") 25 PASS document.querySelectorAll(":any-link")[18] is document.getElementById("target-tag-32") 26 PASS document.querySelectorAll(":any-link")[19] is document.getElementById("target-tag-33") 27 PASS document.querySelectorAll(":any-link")[20] is document.getElementById("target-tag-34") 24 PASS document.querySelectorAll(":any-link")[17] is document.getElementById("target-tag-27") 25 PASS document.querySelectorAll(":any-link")[18] is document.getElementById("target-tag-28") 26 PASS document.querySelectorAll(":any-link")[19] is document.getElementById("target-tag-29") 27 PASS document.querySelectorAll(":any-link")[20] is document.getElementById("target-tag-30") 28 PASS document.querySelectorAll(":any-link")[21] is document.getElementById("target-tag-31") 29 PASS document.querySelectorAll(":any-link")[22] is document.getElementById("target-tag-32") 30 PASS document.querySelectorAll(":any-link")[23] is document.getElementById("target-tag-33") 31 PASS document.querySelectorAll(":any-link")[24] is document.getElementById("target-tag-34") 28 32 PASS getComputedStyle(document.getElementById("target-tag-1")).backgroundColor is "rgb(255, 255, 255)" 29 33 PASS getComputedStyle(document.getElementById("target-tag-2")).backgroundColor is "rgb(1, 2, 3)" … … 52 56 PASS getComputedStyle(document.getElementById("target-tag-25")).backgroundColor is "rgb(1, 2, 3)" 53 57 PASS getComputedStyle(document.getElementById("target-tag-26")).backgroundColor is "rgb(255, 255, 255)" 54 PASS getComputedStyle(document.getElementById("target-tag-27")).backgroundColor is "rgb( 255, 255, 255)"55 PASS getComputedStyle(document.getElementById("target-tag-28")).backgroundColor is "rgb( 255, 255, 255)"56 PASS getComputedStyle(document.getElementById("target-tag-29")).backgroundColor is "rgb( 255, 255, 255)"57 PASS getComputedStyle(document.getElementById("target-tag-30")).backgroundColor is "rgb( 255, 255, 255)"58 PASS getComputedStyle(document.getElementById("target-tag-27")).backgroundColor is "rgb(1, 2, 3)" 59 PASS getComputedStyle(document.getElementById("target-tag-28")).backgroundColor is "rgb(1, 2, 3)" 60 PASS getComputedStyle(document.getElementById("target-tag-29")).backgroundColor is "rgb(1, 2, 3)" 61 PASS getComputedStyle(document.getElementById("target-tag-30")).backgroundColor is "rgb(1, 2, 3)" 58 62 PASS getComputedStyle(document.getElementById("target-tag-31")).backgroundColor is "rgb(1, 2, 3)" 59 63 PASS getComputedStyle(document.getElementById("target-tag-32")).backgroundColor is "rgb(1, 2, 3)" -
trunk/LayoutTests/fast/selectors/any-link-basics-2.html
r175301 r234683 77 77 description('Test the basic matching of the :any-link selector.'); 78 78 79 shouldBe('document.querySelectorAll(":any-link").length', '21');80 81 79 // Query Selector. 82 80 var expectedIds = ['target-tag-2', … … 97 95 'target-tag-24', 98 96 'target-tag-25', 97 'target-tag-27', 98 'target-tag-28', 99 'target-tag-29', 100 'target-tag-30', 99 101 'target-tag-31', 100 102 'target-tag-32', 101 103 'target-tag-33', 102 104 'target-tag-34']; 105 106 shouldBe('document.querySelectorAll(":any-link").length', expectedIds.length.toString()); 103 107 104 108 for (var i = 0; i < expectedIds.length; ++i) … … 132 136 ['target-tag-25', 'rgb(1, 2, 3)'], 133 137 ['target-tag-26', 'rgb(255, 255, 255)'], 134 ['target-tag-27', 'rgb( 255, 255, 255)'],135 ['target-tag-28', 'rgb( 255, 255, 255)'],136 ['target-tag-29', 'rgb( 255, 255, 255)'],137 ['target-tag-30', 'rgb( 255, 255, 255)'],138 ['target-tag-27', 'rgb(1, 2, 3)'], 139 ['target-tag-28', 'rgb(1, 2, 3)'], 140 ['target-tag-29', 'rgb(1, 2, 3)'], 141 ['target-tag-30', 'rgb(1, 2, 3)'], 138 142 ['target-tag-31', 'rgb(1, 2, 3)'], 139 143 ['target-tag-32', 'rgb(1, 2, 3)'], -
trunk/Source/WebCore/ChangeLog
r234680 r234683 1 2018-08-07 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Allow href attribute without xlink on SVG elements 4 https://bugs.webkit.org/show_bug.cgi?id=153854 5 6 Reviewed by Dean Jackson. 7 8 SVG 2 has moved the href attribute from xlink namespace to svg namespace. 9 Instead of using xlink:href, svg:href should be used or simply use href 10 if the svg namespace is defined. 11 12 See https://www.w3.org/TR/SVG2/linking.html#XLinkRefAttrs. 13 14 For backward compatibility, xlink:href will be treated as an alias to href 15 till it is acceptable to completely remove the support for the deprecated 16 xlink:href. 17 18 Tests: svg/custom/href-svg-namespace-animate.svg 19 svg/custom/href-svg-namespace-dynamic.svg 20 svg/custom/href-svg-namespace-elements.html 21 svg/custom/href-svg-namespace-expected.svg 22 svg/custom/href-svg-namespace-static.svg 23 24 * dom/Element.cpp: 25 (WebCore::Element::absoluteLinkURL const): 26 * dom/Element.h: 27 (WebCore::Element::getAttribute const): This new template function with 28 template pack parameter QualifiedNames is added to return the first none 29 empty attribute value given a set of attributes' names. This should be 30 useful for deprecated attributes. When we decide to remove the support 31 for the deprecated attribute, all we need is to remove it as a parameter 32 to getAttribute(). In this case, the none template function will be called. 33 * dom/VisitedLinkState.cpp: 34 (WebCore::linkAttribute): 35 * html/parser/XSSAuditor.cpp: 36 (WebCore::XSSAuditor::filterScriptToken): 37 * svg/SVGAElement.cpp: 38 (WebCore::SVGAElement::isURLAttribute const): 39 * svg/SVGAltGlyphElement.cpp: 40 (WebCore::SVGAltGlyphElement::hasValidGlyphElements const): 41 * svg/SVGCursorElement.cpp: 42 * svg/SVGDocumentExtensions.cpp: 43 (WebCore::SVGDocumentExtensions::rebuildElements): 44 (WebCore::SVGDocumentExtensions::rebuildAllElementReferencesForTarget): 45 * svg/SVGElement.cpp: 46 (WebCore::SVGElement::animatableAttributeForName): 47 * svg/SVGFEImageElement.cpp: 48 * svg/SVGFilterElement.cpp: 49 * svg/SVGFontFaceUriElement.cpp: 50 (WebCore::SVGFontFaceUriElement::srcValue const): 51 (WebCore::SVGFontFaceUriElement::parseAttribute): 52 (WebCore::SVGFontFaceUriElement::loadFont): 53 * svg/SVGForeignObjectElement.cpp: 54 * svg/SVGGlyphRefElement.cpp: 55 (WebCore::SVGGlyphRefElement::hasValidGlyphElement const): 56 * svg/SVGGradientElement.cpp: 57 * svg/SVGImageElement.cpp: 58 (WebCore::SVGImageElement::imageSourceURL const): 59 * svg/SVGMPathElement.cpp: 60 * svg/SVGPatternElement.cpp: 61 * svg/SVGScriptElement.h: 62 * svg/SVGTRefElement.cpp: 63 * svg/SVGTextPathElement.cpp: 64 * svg/SVGURIReference.cpp: 65 (WebCore::SVGURIReference::registerAttributes): 66 (WebCore::SVGURIReference::parseAttribute): 67 * svg/SVGUseElement.cpp: 68 (WebCore::SVGUseElement::expandUseElementsInShadowTree const): 69 * svg/animation/SVGSMILElement.cpp: 70 (WebCore::SVGSMILElement::isSupportedAttribute): 71 (WebCore::SVGSMILElement::svgAttributeChanged): 72 * svg/svgattrs.in: 73 1 74 2018-08-07 Ryosuke Niwa <rniwa@webkit.org> 2 75 -
trunk/Source/WebCore/dom/Element.cpp
r234596 r234683 1473 1473 AtomicString linkAttribute; 1474 1474 if (hasTagName(SVGNames::aTag)) 1475 linkAttribute = getAttribute( XLinkNames::hrefAttr);1475 linkAttribute = getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); 1476 1476 else 1477 1477 linkAttribute = getAttribute(HTMLNames::hrefAttr); -
trunk/Source/WebCore/dom/Element.h
r233605 r234683 77 77 WEBCORE_EXPORT bool hasAttribute(const QualifiedName&) const; 78 78 WEBCORE_EXPORT const AtomicString& getAttribute(const QualifiedName&) const; 79 template<typename... QualifiedNames> 80 const AtomicString& getAttribute(const QualifiedName&, const QualifiedNames&...) const; 79 81 WEBCORE_EXPORT void setAttribute(const QualifiedName&, const AtomicString& value); 80 82 WEBCORE_EXPORT void setAttributeWithoutSynchronization(const QualifiedName&, const AtomicString& value); … … 818 820 } 819 821 822 template<typename... QualifiedNames> 823 inline const AtomicString& Element::getAttribute(const QualifiedName& name, const QualifiedNames&... names) const 824 { 825 const AtomicString& value = getAttribute(name); 826 if (!value.isEmpty()) 827 return value; 828 return getAttribute(names...); 829 } 830 820 831 } // namespace WebCore 821 832 -
trunk/Source/WebCore/dom/VisitedLinkState.cpp
r232178 r234683 34 34 #include "HTMLAnchorElement.h" 35 35 #include "Page.h" 36 #include "SVGNames.h" 36 37 #include "VisitedLinkStore.h" 37 38 #include "XLinkNames.h" … … 48 49 return &element.attributeWithoutSynchronization(HTMLNames::hrefAttr); 49 50 if (element.isSVGElement()) 50 return &element.getAttribute( XLinkNames::hrefAttr);51 return &element.getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); 51 52 return 0; 52 53 } -
trunk/Source/WebCore/html/parser/XSSAuditor.cpp
r234501 r234683 448 448 if (m_wasScriptTagFoundInRequest) { 449 449 didBlockScript |= eraseAttributeIfInjected(request, srcAttr, blankURL().string(), TruncationStyle::SrcLikeAttribute); 450 didBlockScript |= eraseAttributeIfInjected(request, SVGNames::hrefAttr, blankURL().string(), TruncationStyle::SrcLikeAttribute); 450 451 didBlockScript |= eraseAttributeIfInjected(request, XLinkNames::hrefAttr, blankURL().string(), TruncationStyle::SrcLikeAttribute); 451 452 } -
trunk/Source/WebCore/svg/SVGAElement.cpp
r234620 r234683 172 172 bool SVGAElement::isURLAttribute(const Attribute& attribute) const 173 173 { 174 return attribute.name().localName() == XLinkNames::hrefAttr|| SVGGraphicsElement::isURLAttribute(attribute);174 return SVGURIReference::isKnownAttribute(attribute.name()) || SVGGraphicsElement::isURLAttribute(attribute); 175 175 } 176 176 -
trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp
r234620 r234683 83 83 { 84 84 String target; 85 auto element = makeRefPtr(targetElementFromIRIString(getAttribute( XLinkNames::hrefAttr), document(), &target));85 auto element = makeRefPtr(targetElementFromIRIString(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr), document(), &target)); 86 86 87 87 if (is<SVGGlyphElement>(element)) { -
trunk/Source/WebCore/svg/SVGCursorElement.cpp
r234620 r234683 27 27 #include "SVGNames.h" 28 28 #include "SVGStringList.h" 29 #include "XLinkNames.h"30 29 #include <wtf/IsoMallocInlines.h> 31 30 #include <wtf/NeverDestroyed.h> -
trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp
r224615 r234683 36 36 #include "ScriptableDocumentParser.h" 37 37 #include "ShadowRoot.h" 38 #include "XLinkNames.h"39 38 #include <wtf/text/AtomicString.h> 40 39 … … 327 326 Vector<SVGElement*> shadowRebuildElements = WTFMove(m_rebuildElements); 328 327 for (auto* element : shadowRebuildElements) 329 element->svgAttributeChanged( XLinkNames::hrefAttr);328 element->svgAttributeChanged(SVGNames::hrefAttr); 330 329 } 331 330 … … 357 356 358 357 for (auto* element : elementsToRebuild) 359 element->svgAttributeChanged( XLinkNames::hrefAttr);358 element->svgAttributeChanged(SVGNames::hrefAttr); 360 359 } 361 360 -
trunk/Source/WebCore/svg/SVGElement.cpp
r234620 r234683 51 51 #include "SVGUseElement.h" 52 52 #include "ShadowRoot.h" 53 #include "XLinkNames.h"54 53 #include "XMLNames.h" 55 54 #include <wtf/Assertions.h> … … 855 854 &SVGNames::yChannelSelectorAttr.get(), 856 855 &SVGNames::zAttr.get(), 857 & XLinkNames::hrefAttr.get(),856 &SVGNames::hrefAttr.get(), 858 857 }; 859 858 HashMap<AtomicString, QualifiedName> map; -
trunk/Source/WebCore/svg/SVGFEImageElement.cpp
r234620 r234683 33 33 #include "SVGNames.h" 34 34 #include "SVGPreserveAspectRatioValue.h" 35 #include "XLinkNames.h"36 35 #include <wtf/IsoMallocInlines.h> 37 36 -
trunk/Source/WebCore/svg/SVGFilterElement.cpp
r234620 r234683 32 32 #include "SVGNames.h" 33 33 #include "SVGParserUtilities.h" 34 #include "XLinkNames.h"35 34 #include <wtf/IsoMallocInlines.h> 36 35 #include <wtf/NeverDestroyed.h> -
trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp
r229694 r234683 59 59 Ref<CSSFontFaceSrcValue> SVGFontFaceUriElement::srcValue() const 60 60 { 61 auto src = CSSFontFaceSrcValue::create(getAttribute( XLinkNames::hrefAttr));61 auto src = CSSFontFaceSrcValue::create(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr)); 62 62 AtomicString value(attributeWithoutSynchronization(formatAttr)); 63 63 src.get().setFormat(value.isEmpty() ? "svg" : value); // Default format … … 67 67 void SVGFontFaceUriElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 68 68 { 69 if (name == XLinkNames::hrefAttr)69 if (name == SVGNames::hrefAttr || name == XLinkNames::hrefAttr) 70 70 loadFont(); 71 71 else … … 102 102 m_cachedFont->removeClient(*this); 103 103 104 const AtomicString& href = getAttribute( XLinkNames::hrefAttr);104 const AtomicString& href = getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); 105 105 if (!href.isNull()) { 106 106 ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions(); -
trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp
r234620 r234683 28 28 #include "SVGLengthValue.h" 29 29 #include "SVGNames.h" 30 #include "XLinkNames.h"31 30 #include <wtf/Assertions.h> 32 31 #include <wtf/IsoMallocInlines.h> -
trunk/Source/WebCore/svg/SVGGlyphRefElement.cpp
r234620 r234683 51 51 // FIXME: We only support xlink:href so far. 52 52 // https://bugs.webkit.org/show_bug.cgi?id=64787 53 return is<SVGGlyphElement>(targetElementFromIRIString(getAttribute( XLinkNames::hrefAttr), document(), &glyphName));53 return is<SVGGlyphElement>(targetElementFromIRIString(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr), document(), &glyphName)); 54 54 } 55 55 -
trunk/Source/WebCore/svg/SVGGradientElement.cpp
r234620 r234683 33 33 #include "SVGTransformable.h" 34 34 #include "StyleResolver.h" 35 #include "XLinkNames.h"36 35 #include <wtf/IsoMallocInlines.h> 37 36 #include <wtf/NeverDestroyed.h> -
trunk/Source/WebCore/svg/SVGImageElement.cpp
r234620 r234683 168 168 const AtomicString& SVGImageElement::imageSourceURL() const 169 169 { 170 return getAttribute( XLinkNames::hrefAttr);170 return getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr); 171 171 } 172 172 -
trunk/Source/WebCore/svg/SVGMPathElement.cpp
r234620 r234683 27 27 #include "SVGNames.h" 28 28 #include "SVGPathElement.h" 29 #include "XLinkNames.h"30 29 31 30 namespace WebCore { -
trunk/Source/WebCore/svg/SVGPatternElement.cpp
r234620 r234683 39 39 #include "SVGStringList.h" 40 40 #include "SVGTransformable.h" 41 #include "XLinkNames.h"42 41 #include <wtf/IsoMallocInlines.h> 43 42 #include <wtf/NeverDestroyed.h> -
trunk/Source/WebCore/svg/SVGScriptElement.h
r234620 r234683 68 68 bool hasDeferAttribute() const final { return false; } 69 69 bool hasNoModuleAttribute() const final { return false; } 70 bool hasSourceAttribute() const final { return hasAttribute( XLinkNames::hrefAttr); }70 bool hasSourceAttribute() const final { return hasAttribute(SVGNames::hrefAttr) || hasAttribute(XLinkNames::hrefAttr); } 71 71 72 72 void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent(); } -
trunk/Source/WebCore/svg/SVGTRefElement.cpp
r234620 r234683 37 37 #include "StyleInheritedData.h" 38 38 #include "Text.h" 39 #include "XLinkNames.h"40 39 #include <wtf/IsoMallocInlines.h> 41 40 -
trunk/Source/WebCore/svg/SVGTextPathElement.cpp
r234620 r234683 27 27 #include "SVGDocumentExtensions.h" 28 28 #include "SVGNames.h" 29 #include "XLinkNames.h"30 29 #include <wtf/IsoMallocInlines.h> 31 30 #include <wtf/NeverDestroyed.h> -
trunk/Source/WebCore/svg/SVGURIReference.cpp
r234620 r234683 42 42 if (!registry.isEmpty()) 43 43 return; 44 registry.registerAttribute<SVGNames::hrefAttr, &SVGURIReference::m_href>(); 44 45 registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); 45 46 } … … 57 58 void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) 58 59 { 59 if ( name.matches(XLinkNames::hrefAttr))60 if (isKnownAttribute(name)) 60 61 m_href.setValue(value); 61 62 } -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r234620 r234683 481 481 replacementClone->removeAttribute(SVGNames::widthAttr); 482 482 replacementClone->removeAttribute(SVGNames::heightAttr); 483 replacementClone->removeAttribute(SVGNames::hrefAttr); 483 484 replacementClone->removeAttribute(XLinkNames::hrefAttr); 484 485 -
trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp
r234278 r234683 468 468 SVGNames::maxAttr, 469 469 SVGNames::attributeNameAttr, 470 SVGNames::hrefAttr, 470 471 XLinkNames::hrefAttr, 471 472 }); … … 520 521 else if (attrName == SVGNames::attributeNameAttr) 521 522 updateAttributeName(); 522 else if (attrName.matches( XLinkNames::hrefAttr)) {523 else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNames::hrefAttr)) { 523 524 InstanceInvalidationGuard guard(*this); 524 525 buildPendingResource(); -
trunk/Source/WebCore/svg/svgattrs.in
r191494 r234683 88 88 horiz-origin-x 89 89 horiz-origin-y 90 href 90 91 ideographic 91 92 image-rendering
Note: See TracChangeset
for help on using the changeset viewer.