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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/run-after-display.js"></script>
3 <script>
4 if (window.testRunner) {
5 testRunner.dumpAsText();
6 testRunner.waitUntilDone();
7 window.onload = function() {
8 testRunner.displayAsyncThen(function() {
9 mutateTree();
10 testRunner.displayAsyncThen(function() {
11 testRunner.notifyDone();
12 });
13 });
14 };
15 } else {
16 window.onload = function() { setTimeout(mutateTree, 100); };
17 }
18 const svgNs = 'http://www.w3.org/2000/svg';
19 function buildPattern(patternId, refId) {
20 var pattern = document.createElementNS(svgNs, 'pattern');
21 var rect = pattern.appendChild(document.createElementNS(svgNs, 'rect'));
22 pattern.setAttribute('id', patternId);
23 pattern.setAttribute('width', 1);
24 pattern.setAttribute('height', 1);
25 rect.setAttribute('width', 100);
26 rect.setAttribute('height', 100);
27 rect.setAttribute('fill', 'url(#' + refId + ')');
28 return pattern;
29 }
30 function mutateTree() {
31 // Get reference to rect in pattern#p2 before inserting the pattern.
32 var p2rect = document.getElementsByTagName('rect')[1];
33
34 // Add a pattern#p3 and a reference to it from pattern#p2 to form a cycle.
35 var defs = document.querySelector('defs');
36 defs.appendChild(buildPattern('p3', 'p1'));
37 p2rect.setAttribute('fill', 'url(#p3)');
38 }
39 </script>
40 <p>PASS if no crash (stack overflow).</p>
41 <svg width="100" height="100">
42 <rect width="100" height="100" fill="url(#p1)"/>
43 <defs>
44 <pattern id="p2" width="1" height="1">
45 <rect width="100" height="100"/>
46 </pattern>
47 <pattern id="p1" width="1" height="1">
48 <rect fill="url(#p2)" width="100" height="100"/>
49 </pattern>
50 </defs>
51 </svg>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698