Changeset 238524 in webkit
- Timestamp:
- Nov 26, 2018, 2:48:08 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 26 added
- 19 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/shadow-dom/svg-animate-href-change-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-animate-href-change-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-animate-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-animate-href-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-feimage-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-feimage-href-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-mpath-href-change-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-mpath-href-change-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-mpath-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-mpath-href-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-text-path-href-change-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-text-path-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-text-path-href-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-thref-href-change-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-thref-href-change-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-thref-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-thref-href-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-use-href-change-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-use-href-change-in-shadow-tree.html (added)
-
LayoutTests/fast/shadow-dom/svg-use-href-in-shadow-tree-expected.html (added)
-
LayoutTests/fast/shadow-dom/svg-use-href-in-shadow-tree.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/accessibility/AccessibilitySVGElement.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSCursorImageValue.cpp (modified) (1 diff)
-
Source/WebCore/rendering/svg/RenderSVGTextPath.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGAltGlyphElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGFEImageElement.cpp (modified) (2 diffs)
-
Source/WebCore/svg/SVGGlyphRefElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGLinearGradientElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGMPathElement.cpp (modified) (2 diffs)
-
Source/WebCore/svg/SVGRadialGradientElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGTRefElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGTextPathElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGURIReference.cpp (modified) (3 diffs)
-
Source/WebCore/svg/SVGURIReference.h (modified) (1 diff)
-
Source/WebCore/svg/SVGUseElement.cpp (modified) (2 diffs)
-
Source/WebCore/svg/animation/SVGSMILElement.cpp (modified) (3 diffs)
-
Source/WebCore/svg/graphics/filters/SVGFEImage.cpp (modified) (3 diffs)
-
Source/WebCore/svg/graphics/filters/SVGFEImage.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238522 r238524 1 2018-11-24 Ryosuke Niwa <rniwa@webkit.org> 2 3 SVG use element inside a shadow tree cannot reference an element in the same tree 4 https://bugs.webkit.org/show_bug.cgi?id=174977 5 <rdar://problem/33665636> 6 7 Reviewed by Zalan Bujtas. 8 9 Added tests for specifying a fragment URL to refer to other elements within shadow trees. 10 11 This patch doesn't add a test for updating a fragment URL of linearGradient and radialGradient 12 since it doesn't work at all even outside shadow trees. See webkit.org/b/191934. 13 14 * fast/shadow-dom/svg-animate-href-change-in-shadow-tree-expected.html: Added. 15 * fast/shadow-dom/svg-animate-href-change-in-shadow-tree.html: Added. 16 * fast/shadow-dom/svg-animate-href-in-shadow-tree-expected.html: Added. 17 * fast/shadow-dom/svg-animate-href-in-shadow-tree.html: Added. 18 * fast/shadow-dom/svg-feimage-href-in-shadow-tree-expected.html: Added. 19 * fast/shadow-dom/svg-feimage-href-in-shadow-tree.html: Added. 20 * fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree-expected.html: Added. 21 * fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree.html: Added. 22 * fast/shadow-dom/svg-mpath-href-change-in-shadow-tree-expected.html: Added. 23 * fast/shadow-dom/svg-mpath-href-change-in-shadow-tree.html: Added. 24 * fast/shadow-dom/svg-mpath-href-in-shadow-tree-expected.html: Added. 25 * fast/shadow-dom/svg-mpath-href-in-shadow-tree.html: Added. 26 * fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree-expected.html: Added. 27 * fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree.html: Added. 28 * fast/shadow-dom/svg-text-path-href-change-in-shadow-tree-expected.html: Added. 29 * fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html: Added. 30 * fast/shadow-dom/svg-text-path-href-in-shadow-tree-expected.html: Added. 31 * fast/shadow-dom/svg-text-path-href-in-shadow-tree.html: Added. 32 * fast/shadow-dom/svg-thref-href-change-in-shadow-tree-expected.html: Added. 33 * fast/shadow-dom/svg-thref-href-change-in-shadow-tree.html: Added. 34 * fast/shadow-dom/svg-thref-href-in-shadow-tree-expected.html: Added. 35 * fast/shadow-dom/svg-thref-href-in-shadow-tree.html: Added. 36 * fast/shadow-dom/svg-use-href-change-in-shadow-tree-expected.html: Added. 37 * fast/shadow-dom/svg-use-href-change-in-shadow-tree.html: Added. 38 * fast/shadow-dom/svg-use-href-in-shadow-tree-expected.html: Added. 39 * fast/shadow-dom/svg-use-href-in-shadow-tree.html: Added. 40 1 41 2018-11-26 Daniel Bates <dabates@apple.com> 2 42 -
trunk/Source/WebCore/ChangeLog
r238523 r238524 1 2018-11-24 Ryosuke Niwa <rniwa@webkit.org> 2 3 SVG use element inside a shadow tree cannot reference an element in the same tree 4 https://bugs.webkit.org/show_bug.cgi?id=174977 5 <rdar://problem/33665636> 6 7 Reviewed by Zalan Bujtas. 8 9 Make fragment URL references used by SVGelements within a shadow tree to refer to other elements 10 in the same shadow tree. To do this, this patch makes targetElementFromIRIString take a TreeScope 11 instead of a Document, and updates its call sites. 12 13 This patch updates the most uses of targetElementFromIRIString except CSS cursor image, altGraph, 14 and glyphRef since the cursor image isn't really a SVG feature, and there aren't really real world 15 use cases in which altGraph and glyphRef are used within shadow trees. 16 17 Tests: fast/shadow-dom/svg-animate-href-change-in-shadow-tree.html 18 fast/shadow-dom/svg-animate-href-in-shadow-tree.html 19 fast/shadow-dom/svg-feimage-href-in-shadow-tree.html 20 fast/shadow-dom/svg-linear-gradient-href-in-shadow-tree.html 21 fast/shadow-dom/svg-mpath-href-change-in-shadow-tree.html 22 fast/shadow-dom/svg-mpath-href-in-shadow-tree.html 23 fast/shadow-dom/svg-radial-gradient-href-in-shadow-tree.html 24 fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html 25 fast/shadow-dom/svg-text-path-href-in-shadow-tree.html 26 fast/shadow-dom/svg-thref-href-change-in-shadow-tree.html 27 fast/shadow-dom/svg-thref-href-in-shadow-tree.html 28 fast/shadow-dom/svg-use-href-change-in-shadow-tree.html 29 fast/shadow-dom/svg-use-href-in-shadow-tree.html 30 31 * accessibility/AccessibilitySVGElement.cpp: 32 (WebCore::AccessibilitySVGElement::targetForUseElement const): 33 * css/CSSCursorImageValue.cpp: 34 * rendering/svg/RenderSVGTextPath.cpp: 35 (WebCore::RenderSVGTextPath::layoutPath const): 36 * svg/SVGAltGlyphElement.cpp: 37 (WebCore::SVGAltGlyphElement::hasValidGlyphElements const): 38 * svg/SVGFEImageElement.cpp: 39 (WebCore::SVGFEImageElement::buildPendingResource): 40 (WebCore::SVGFEImageElement::build): 41 * svg/SVGGlyphRefElement.cpp: 42 (WebCore::SVGGlyphRefElement::hasValidGlyphElement const): 43 * svg/SVGLinearGradientElement.cpp: 44 (WebCore::SVGLinearGradientElement::collectGradientAttributes): 45 * svg/SVGMPathElement.cpp: 46 (WebCore::SVGMPathElement::buildPendingResource): 47 (WebCore::SVGMPathElement::pathElement): 48 * svg/SVGRadialGradientElement.cpp: 49 (WebCore::SVGRadialGradientElement::collectGradientAttributes): 50 * svg/SVGTRefElement.cpp: 51 (WebCore::SVGTRefElement::buildPendingResource): 52 * svg/SVGTextPathElement.cpp: 53 (WebCore::SVGTextPathElement::buildPendingResource): 54 * svg/SVGURIReference.cpp: 55 (WebCore::SVGURIReference::targetElementFromIRIString): 56 * svg/SVGURIReference.h: 57 * svg/SVGUseElement.cpp: 58 (WebCore::SVGUseElement::updateShadowTree): 59 (WebCore::SVGUseElement::findTarget const): 60 * svg/animation/SVGSMILElement.cpp: 61 (WebCore::SVGSMILElement::buildPendingResource): 62 (WebCore::SVGSMILElement::insertedIntoAncestor): 63 * svg/graphics/filters/SVGFEImage.cpp: 64 (WebCore::FEImage::FEImage): 65 (WebCore::FEImage::createWithIRIReference): 66 (WebCore::FEImage::referencedRenderer const): 67 * svg/graphics/filters/SVGFEImage.h: 68 1 69 2018-11-26 Truitt Savell <tsavell@apple.com> 2 70 -
trunk/Source/WebCore/accessibility/AccessibilitySVGElement.cpp
r238452 r238524 66 66 href = getAttribute(HTMLNames::hrefAttr); 67 67 68 auto target = SVGURIReference::targetElementFromIRIString(href, use. document());68 auto target = SVGURIReference::targetElementFromIRIString(href, use.treeScope()); 69 69 if (!target.element) 70 70 return nullptr; -
trunk/Source/WebCore/css/CSSCursorImageValue.cpp
r238452 r238524 65 65 } 66 66 67 // FIXME: Should this function take a TreeScope instead? 67 68 SVGCursorElement* CSSCursorImageValue::updateCursorElement(const Document& document) 68 69 { -
trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp
r238452 r238524 47 47 Path RenderSVGTextPath::layoutPath() const 48 48 { 49 auto target = SVGURIReference::targetElementFromIRIString(textPathElement().href(), document());49 auto target = SVGURIReference::targetElementFromIRIString(textPathElement().href(), textPathElement().treeScope()); 50 50 if (!is<SVGPathElement>(target.element)) 51 51 return Path(); -
trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp
r238452 r238524 82 82 bool SVGAltGlyphElement::hasValidGlyphElements(Vector<String>& glyphNames) const 83 83 { 84 // No need to support altGlyph referencing another node inside a shadow tree. 84 85 auto target = targetElementFromIRIString(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr), document()); 85 86 -
trunk/Source/WebCore/svg/SVGFEImageElement.cpp
r238452 r238524 95 95 return; 96 96 97 auto target = SVGURIReference::targetElementFromIRIString(href(), document());97 auto target = SVGURIReference::targetElementFromIRIString(href(), treeScope()); 98 98 if (!target.element) { 99 99 if (target.identifier.isEmpty()) … … 190 190 if (m_cachedImage) 191 191 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(renderer()), preserveAspectRatio()); 192 return FEImage::createWithIRIReference(filter, document(), href(), preserveAspectRatio());192 return FEImage::createWithIRIReference(filter, treeScope(), href(), preserveAspectRatio()); 193 193 } 194 194 -
trunk/Source/WebCore/svg/SVGGlyphRefElement.cpp
r238452 r238524 51 51 // FIXME: We only support xlink:href so far. 52 52 // https://bugs.webkit.org/show_bug.cgi?id=64787 53 // No need to support glyphRef referencing another node inside a shadow tree. 53 54 auto target = targetElementFromIRIString(getAttribute(SVGNames::hrefAttr, XLinkNames::hrefAttr), document()); 54 55 glyphName = target.identifier; -
trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp
r238452 r238524 150 150 while (true) { 151 151 // Respect xlink:href, take attributes from referenced element 152 auto target = SVGURIReference::targetElementFromIRIString(current->href(), document());152 auto target = SVGURIReference::targetElementFromIRIString(current->href(), treeScope()); 153 153 if (is<SVGGradientElement>(target.element)) { 154 154 current = downcast<SVGGradientElement>(*target.element); -
trunk/Source/WebCore/svg/SVGMPathElement.cpp
r238452 r238524 56 56 return; 57 57 58 auto target = SVGURIReference::targetElementFromIRIString(href(), document());58 auto target = SVGURIReference::targetElementFromIRIString(href(), treeScope()); 59 59 if (!target.element) { 60 60 // Do not register as pending if we are already pending this resource. … … 122 122 RefPtr<SVGPathElement> SVGMPathElement::pathElement() 123 123 { 124 auto target = targetElementFromIRIString(href(), document());124 auto target = targetElementFromIRIString(href(), treeScope()); 125 125 if (is<SVGPathElement>(target.element)) 126 126 return downcast<SVGPathElement>(target.element.get()); -
trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp
r238452 r238524 162 162 while (true) { 163 163 // Respect xlink:href, take attributes from referenced element 164 auto target = SVGURIReference::targetElementFromIRIString(current->href(), document());164 auto target = SVGURIReference::targetElementFromIRIString(current->href(), treeScope()); 165 165 if (is<SVGGradientElement>(target.element)) { 166 166 current = downcast<SVGGradientElement>(target.element.get()); -
trunk/Source/WebCore/svg/SVGTRefElement.cpp
r238452 r238524 231 231 return; 232 232 233 auto target = SVGURIReference::targetElementFromIRIString(href(), document());233 auto target = SVGURIReference::targetElementFromIRIString(href(), treeScope()); 234 234 if (!target.element) { 235 235 if (target.identifier.isEmpty()) -
trunk/Source/WebCore/svg/SVGTextPathElement.cpp
r238464 r238524 144 144 return; 145 145 146 auto target = SVGURIReference::targetElementFromIRIString(href(), document());146 auto target = SVGURIReference::targetElementFromIRIString(href(), treeScope()); 147 147 if (!target.element) { 148 148 // Do not register as pending if we are already pending this resource. -
trunk/Source/WebCore/svg/SVGURIReference.cpp
r238452 r238524 88 88 } 89 89 90 auto SVGURIReference::targetElementFromIRIString(const String& iri, const Document& document, RefPtr<Document> externalDocument) -> TargetElementResult90 auto SVGURIReference::targetElementFromIRIString(const String& iri, const TreeScope& treeScope, RefPtr<Document> externalDocument) -> TargetElementResult 91 91 { 92 92 // If there's no fragment identifier contained within the IRI string, we can't lookup an element. … … 100 100 return { }; 101 101 102 auto& document = treeScope.documentScope(); 102 103 auto url = document.completeURL(iri); 103 104 if (externalDocument) { … … 111 112 return { nullptr, WTFMove(id) }; 112 113 113 return { document.getElementById(id), WTFMove(id) };114 return { treeScope.getElementById(id), WTFMove(id) }; 114 115 } 115 116 -
trunk/Source/WebCore/svg/SVGURIReference.h
r238452 r238524 47 47 String identifier; 48 48 }; 49 static TargetElementResult targetElementFromIRIString(const String&, const Document&, RefPtr<Document> externalDocument = nullptr);49 static TargetElementResult targetElementFromIRIString(const String&, const TreeScope&, RefPtr<Document> externalDocument = nullptr); 50 50 51 51 static bool isExternalURIReference(const String& uri, const Document& document) -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r238452 r238524 238 238 document().removeSVGUseElement(*this); 239 239 240 // FIXME: Enable SVG use elements in shadow trees.241 if (isInShadowTree())242 return;243 244 240 String targetID; 245 241 auto* target = findTarget(&targetID); … … 411 407 auto& original = correspondingElement ? downcast<SVGUseElement>(*correspondingElement) : *this; 412 408 413 auto targetResult = targetElementFromIRIString(original.href(), original. document(), original.externalDocument());409 auto targetResult = targetElementFromIRIString(original.href(), original.treeScope(), original.externalDocument()); 414 410 if (targetID) { 415 411 *targetID = WTFMove(targetResult.identifier); -
trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp
r238452 r238524 41 41 #include "SVGSVGElement.h" 42 42 #include "SVGURIReference.h" 43 #include "SVGUseElement.h" 43 44 #include "XLinkNames.h" 44 45 #include <wtf/IsoMallocInlines.h> … … 185 186 target = parentElement(); 186 187 else { 187 auto result = SVGURIReference::targetElementFromIRIString(href.string(), document());188 auto result = SVGURIReference::targetElementFromIRIString(href.string(), treeScope()); 188 189 target = WTFMove(result.element); 189 190 id = WTFMove(result.identifier); … … 266 267 267 268 // Verify we are not in <use> instance tree. 268 ASSERT(!isInShadowTree() );269 ASSERT(!isInShadowTree() || !is<SVGUseElement>(shadowHost())); 269 270 270 271 updateAttributeName(); -
trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp
r238452 r238524 39 39 : FilterEffect(filter) 40 40 , m_image(image) 41 , m_document(nullptr)42 41 , m_preserveAspectRatio(preserveAspectRatio) 43 42 { 44 43 } 45 44 46 FEImage::FEImage(Filter& filter, Document& document, const String& href, const SVGPreserveAspectRatioValue& preserveAspectRatio)45 FEImage::FEImage(Filter& filter, TreeScope& treeScope, const String& href, const SVGPreserveAspectRatioValue& preserveAspectRatio) 47 46 : FilterEffect(filter) 48 , m_ document(&document)47 , m_treeScope(&treeScope) 49 48 , m_href(href) 50 49 , m_preserveAspectRatio(preserveAspectRatio) … … 57 56 } 58 57 59 Ref<FEImage> FEImage::createWithIRIReference(Filter& filter, Document& document, const String& href, const SVGPreserveAspectRatioValue& preserveAspectRatio)58 Ref<FEImage> FEImage::createWithIRIReference(Filter& filter, TreeScope& treeScope, const String& href, const SVGPreserveAspectRatioValue& preserveAspectRatio) 60 59 { 61 return adoptRef(*new FEImage(filter, document, href, preserveAspectRatio));60 return adoptRef(*new FEImage(filter, treeScope, href, preserveAspectRatio)); 62 61 } 63 62 … … 81 80 RenderElement* FEImage::referencedRenderer() const 82 81 { 83 if (!m_ document)82 if (!m_treeScope) 84 83 return nullptr; 85 auto target = SVGURIReference::targetElementFromIRIString(m_href, *m_ document);84 auto target = SVGURIReference::targetElementFromIRIString(m_href, *m_treeScope); 86 85 if (!is<SVGElement>(target.element)) 87 86 return nullptr; -
trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h
r225366 r238524 35 35 public: 36 36 static Ref<FEImage> createWithImage(Filter&, RefPtr<Image>, const SVGPreserveAspectRatioValue&); 37 static Ref<FEImage> createWithIRIReference(Filter&, Document&, const String&, const SVGPreserveAspectRatioValue&);37 static Ref<FEImage> createWithIRIReference(Filter&, TreeScope&, const String&, const SVGPreserveAspectRatioValue&); 38 38 39 39 private: 40 40 virtual ~FEImage() = default; 41 41 FEImage(Filter&, RefPtr<Image>, const SVGPreserveAspectRatioValue&); 42 FEImage(Filter&, Document&, const String&, const SVGPreserveAspectRatioValue&);42 FEImage(Filter&, TreeScope&, const String&, const SVGPreserveAspectRatioValue&); 43 43 44 44 const char* filterName() const final { return "FEImage"; } … … 54 54 RefPtr<Image> m_image; 55 55 56 // m_ documentwill never be a dangling reference. See https://bugs.webkit.org/show_bug.cgi?id=9924357 Document* m_document;56 // m_treeScope will never be a dangling reference. See https://bugs.webkit.org/show_bug.cgi?id=99243 57 TreeScope* m_treeScope { nullptr }; 58 58 String m_href; 59 59 SVGPreserveAspectRatioValue m_preserveAspectRatio;
Note:
See TracChangeset
for help on using the changeset viewer.