Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r222304 - REGRESSION(r191731): SVGPatternElement can only refer…
…ence another SVGPatternElement in the same SVG document https://bugs.webkit.org/show_bug.cgi?id=176221 Reviewed by Tim Horton. Source/WebCore: According to the specs: https://www.w3.org/TR/SVG11/filters.html#FilterElementHrefAttribute https://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementHrefAttribute https://www.w3.org/TR/SVG11/pservers.html#RadialGradientElementHrefAttribute https://www.w3.org/TR/SVG11/pservers.html#PatternElementHrefAttribute The xlink:href attribute of the SVG filter, gradient and pattern elements must reference another element within the current SVG of the same type. In r191731, the code of SVGPatternElement::collectPatternAttributes() was removed and replaced by RenderSVGResourcePattern::collectPatternAttributes() to avoid cyclic reference in the pattern element. The problem is the old code used to check whether the referenced element is<SVGPatternElement> before casting it. This code was not copied to the new function. So we now allow the SVGPatternElement to reference any SVG resource element. To fix this issue, we need to prevent SVGResources from chaining an incorrect type of element to the SVG filter, gradient and pattern elements. We also need to use the SVGResources for getting the referenced element when collecting the attributes for the gradient elements. SVGResources solves the cyclic referencing issue so there is no need to repeat the same code in many places. Also, from now on the SVGResources will have valid linked resource only. So casting the referenced element should always be valid. Tests: svg/custom/pattern-invalid-content-inheritance.svg * rendering/svg/RenderSVGResourcePattern.cpp: (WebCore::RenderSVGResourcePattern::collectPatternAttributes const): Asserts the linkedResource is of type RenderSVGResourcePattern. * rendering/svg/SVGResources.cpp: (WebCore::SVGResources::SVGResources): (WebCore::isChainableResource): Ensure that an SVG resource can reference only an SVG resource with the valid type. (WebCore::SVGResources::buildCachedResources): * rendering/svg/SVGResources.h: LayoutTests: * svg/custom/pattern-invalid-content-inheritance-expected.svg: Added. * svg/custom/pattern-invalid-content-inheritance.svg: Added.
- Loading branch information
1 parent
1c9a997
commit 26c2623
Showing
7 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
LayoutTests/svg/custom/pattern-invalid-content-inheritance-expected.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
LayoutTests/svg/custom/pattern-invalid-content-inheritance.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters