Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Nested use of same SVG resource fails
https://bugs.webkit.org/show_bug.cgi?id=130127 Reviewed by Said Abou-Hallawa. Merge https://src.chromium.org/viewvc/blink?view=revision&revision=175129 * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-1-expected.txt: Added. * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-1.html: Added. * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-2-expected.txt: Added. * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-2.html: Added. * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-3-expected.txt: Added. * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-3.html: Added. * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4-expected.txt: Added. * LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4.html: Added. * LayoutTests/svg/custom/pattern-directly-and-indirectly-referenced-expected.svg: Added. * LayoutTests/svg/custom/pattern-directly-and-indirectly-referenced.svg: Added. * LayoutTests/svg/custom/pattern-false-resource-cycle-expected.html: Added. * LayoutTests/svg/custom/pattern-false-resource-cycle.html: Added. * LayoutTests/svg/custom/pattern-within-other-pattern-expected.html: Added. * LayoutTests/svg/custom/pattern-within-other-pattern.html: Added. * Source/WebCore/rendering/svg/SVGResourcesCycleSolver.cpp: (WebCore::SVGResourcesCycleSolver::SVGResourcesCycleSolver): Deleted. (WebCore::SVGResourcesCycleSolver::resourceContainsCycles): (WebCore::SVGResourcesCycleSolver::resolveCycles): (WebCore::SVGResourcesCycleSolver::breakCycle): * Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h: (WebCore::SVGResourcesCycleSolver::SVGResourcesCycleSolver): Canonical link: https://commits.webkit.org/264618@main
- Loading branch information
Showing
17 changed files
with
287 additions
and
158 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-1-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PASS if no crash (stack overflow). | ||
|
||
|
32 changes: 32 additions & 0 deletions
32
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-1.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
window.onload = function() { | ||
testRunner.display(); | ||
mutateTree(); | ||
testRunner.display(); | ||
testRunner.notifyDone(); | ||
}; | ||
} else { | ||
window.onload = function() { setTimeout(mutateTree, 100); }; | ||
} | ||
function mutateTree() { | ||
// A reference from the 'rect' to the pattern cycle. | ||
document.getElementsByTagName('rect')[0].setAttribute('fill', 'url(#p1)'); | ||
} | ||
</script> | ||
<p>PASS if no crash (stack overflow).</p> | ||
<svg width="100" height="100"> | ||
<rect width="100" height="100"/> | ||
<pattern id="p3" width="1" height="1"> | ||
<rect fill="url(#p1)" width="100" height="100"/> | ||
</pattern> | ||
<pattern id="p2" width="1" height="1"> | ||
<rect fill="url(#p3)" width="100" height="100"/> | ||
</pattern> | ||
<pattern id="p1" width="1" height="1"> | ||
<rect fill="url(#p2)" width="100" height="100"/> | ||
</pattern> | ||
</svg> |
3 changes: 3 additions & 0 deletions
3
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-2-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PASS if no crash (stack overflow). | ||
|
||
|
32 changes: 32 additions & 0 deletions
32
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-2.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
window.onload = function() { | ||
testRunner.display(); | ||
mutateTree(); | ||
testRunner.display(); | ||
testRunner.notifyDone(); | ||
}; | ||
} else { | ||
window.onload = function() { setTimeout(mutateTree, 100); }; | ||
} | ||
function mutateTree() { | ||
// Add a reference from the rect in pattern#p3 to form a cycle. | ||
document.getElementsByTagName('rect')[1].setAttribute('fill', 'url(#p1)'); | ||
} | ||
</script> | ||
<p>PASS if no crash (stack overflow).</p> | ||
<svg width="100" height="100"> | ||
<rect width="100" height="100" fill="url(#p1)"/> | ||
<pattern id="p3" width="1" height="1"> | ||
<rect width="100" height="100"/> | ||
</pattern> | ||
<pattern id="p2" width="1" height="1"> | ||
<rect fill="url(#p3)" width="100" height="100"/> | ||
</pattern> | ||
<pattern id="p1" width="1" height="1"> | ||
<rect fill="url(#p2)" width="100" height="100"/> | ||
</pattern> | ||
</svg> |
3 changes: 3 additions & 0 deletions
3
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-3-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PASS if no crash (stack overflow). | ||
|
||
|
40 changes: 40 additions & 0 deletions
40
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-3.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
window.onload = function() { | ||
testRunner.display(); | ||
mutateTree(); | ||
testRunner.display(); | ||
testRunner.notifyDone(); | ||
}; | ||
} else { | ||
window.onload = function() { setTimeout(mutateTree, 100); }; | ||
} | ||
const svgNs = 'http://www.w3.org/2000/svg'; | ||
function buildPattern(patternId, refId) { | ||
var pattern = document.createElementNS(svgNs, 'pattern'); | ||
var rect = pattern.appendChild(document.createElementNS(svgNs, 'rect')); | ||
pattern.setAttribute('id', patternId); | ||
pattern.setAttribute('width', 1); | ||
pattern.setAttribute('height', 1); | ||
rect.setAttribute('width', 100); | ||
rect.setAttribute('height', 100); | ||
rect.setAttribute('fill', 'url(#' + refId + ')'); | ||
return pattern; | ||
} | ||
function mutateTree() { | ||
// Build a three-step pattern cycle in a detached | ||
// subtree and then insert it at load. | ||
var defs = document.createElementNS(svgNs, 'defs'); | ||
defs.appendChild(buildPattern('p3', 'p1')); | ||
defs.appendChild(buildPattern('p2', 'p3')); | ||
defs.appendChild(buildPattern('p1', 'p2')); | ||
document.querySelector('svg').appendChild(defs); | ||
} | ||
</script> | ||
<p>PASS if no crash (stack overflow).</p> | ||
<svg width="100" height="100"> | ||
<rect width="100" height="100" fill="url(#p1)"/> | ||
</svg> |
3 changes: 3 additions & 0 deletions
3
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PASS if no crash (stack overflow). | ||
|
||
|
49 changes: 49 additions & 0 deletions
49
LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/run-after-display.js"></script> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
window.onload = function() { | ||
testRunner.display(); | ||
mutateTree(); | ||
testRunner.display(); | ||
testRunner.notifyDone(); | ||
}; | ||
} else { | ||
window.onload = function() { setTimeout(mutateTree, 100); }; | ||
} | ||
const svgNs = 'http://www.w3.org/2000/svg'; | ||
function buildPattern(patternId, refId) { | ||
var pattern = document.createElementNS(svgNs, 'pattern'); | ||
var rect = pattern.appendChild(document.createElementNS(svgNs, 'rect')); | ||
pattern.setAttribute('id', patternId); | ||
pattern.setAttribute('width', 1); | ||
pattern.setAttribute('height', 1); | ||
rect.setAttribute('width', 100); | ||
rect.setAttribute('height', 100); | ||
rect.setAttribute('fill', 'url(#' + refId + ')'); | ||
return pattern; | ||
} | ||
function mutateTree() { | ||
// Get reference to rect in pattern#p2 before inserting the pattern. | ||
var p2rect = document.getElementsByTagName('rect')[1]; | ||
|
||
// Add a pattern#p3 and a reference to it from pattern#p2 to form a cycle. | ||
var defs = document.querySelector('defs'); | ||
defs.appendChild(buildPattern('p3', 'p1')); | ||
p2rect.setAttribute('fill', 'url(#p3)'); | ||
} | ||
</script> | ||
<p>PASS if no crash (stack overflow).</p> | ||
<svg width="100" height="100"> | ||
<rect width="100" height="100" fill="url(#p1)"/> | ||
<defs> | ||
<pattern id="p2" width="1" height="1"> | ||
<rect width="100" height="100"/> | ||
</pattern> | ||
<pattern id="p1" width="1" height="1"> | ||
<rect fill="url(#p2)" width="100" height="100"/> | ||
</pattern> | ||
</defs> | ||
</svg> |
12 changes: 12 additions & 0 deletions
12
LayoutTests/svg/custom/pattern-directly-and-indirectly-referenced-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-directly-and-indirectly-referenced.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
LayoutTests/svg/custom/pattern-false-resource-cycle-expected.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<svg> | ||
<clipPath id="c1"> | ||
<rect width="100" height="100"/> | ||
</clipPath> | ||
<pattern id="p1" width="1" height="1"> | ||
<rect width="100" height="100" fill="green"/> | ||
</pattern> | ||
<rect width="100" height="100" fill="url(#p1)" clip-path="url(#c1)"/> | ||
</svg> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<svg> | ||
<clipPath id="c1"> | ||
<rect width="100" height="100"/> | ||
</clipPath> | ||
<pattern id="p1" width="1" height="1"> | ||
<rect width="100" height="100" fill="green"/> | ||
<clipPath id="c2" clip-path="url(#c1)"> | ||
<rect width="100" height="100"/> | ||
</clipPath> | ||
</pattern> | ||
<rect width="100" height="100" fill="url(#p1)" clip-path="url(#c1)"/> | ||
</svg> |
7 changes: 7 additions & 0 deletions
7
LayoutTests/svg/custom/pattern-within-other-pattern-expected.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE html> | ||
<svg width="100" height="100"> | ||
<pattern id="p" width="1" height="1"> | ||
<rect width="100" height="100" fill="green"/> | ||
</pattern> | ||
<rect width="100" height="100" fill="url(#p)"/> | ||
</svg> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<svg width="100" height="100"> | ||
<pattern id="outer" width="1" height="1"> | ||
<pattern id="inner" width="1" height="1"> | ||
<rect width="100" height="100" fill="url(#outer)"/> | ||
</pattern> | ||
<rect width="100" height="100" fill="green"/> | ||
</pattern> | ||
<rect width="100" height="100" fill="url(#inner)"/> | ||
</svg> |
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
Oops, something went wrong.