Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4.html

Issue 303693009: Make SVGResourcesCycleSolver check for cycles beyond one level (and more) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add dynamic tests. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4.html
diff --git a/LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4.html b/LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4.html
new file mode 100644
index 0000000000000000000000000000000000000000..45f066a90e15ee676ac1920723888d05402388b2
--- /dev/null
+++ b/LayoutTests/svg/custom/pattern-3-step-cycle-dynamic-4.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src="../../resources/run-after-display.js"></script>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ window.onload = function() {
+ testRunner.displayAsyncThen(function() {
+ mutateTree();
+ testRunner.displayAsyncThen(function() {
+ 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>

Powered by Google App Engine
This is Rietveld 408576698