Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / svg / custom / pointer-events-image.svg
blob0cf6cb568401a2f67c846d35959cb2843d8aee24
1 <?xml version="1.0"?>
2 <svg xmlns="http://www.w3.org/2000/svg"
3 xmlns:xlink="http://www.w3.org/1999/xlink" onload="fillTestContent()">
4 <script type="text/javascript">
5 <![CDATA[
7 if (window.layoutTestController)
8 layoutTestController.waitUntilDone();
10 var visibleValues = [ 'visible', 'hidden' ];
11 var fillValues = ['none', 'orange' ];
12 var strokeValues = ['none', 'blue' ];
14 var pointerEventsValues = ['auto', 'visiblePainted', 'visibleFill', 'visibleStroke', 'visible', 'painted', 'fill', 'stroke', 'all', 'none'];
16 var leftEdge = 100;
17 var topEdge = 30;
19 var rectSpacing = 57;
21 var svgNS = "http://www.w3.org/2000/svg";
23 function clickHit(event, identifierString) {
24 var fillText = document.getElementById('fill-text' + identifierString);
25 fillText.textContent = 'HIT';
28 function fillTestContent() {
29 var xOffset = leftEdge;
30 var yOffset = topEdge;
32 var testContent = document.getElementById("test-content");
34 for (var pi = 0; pi < pointerEventsValues.length; pi++) {
35 var eventLabel = document.createElementNS(svgNS, 'text');
36 eventLabel.setAttribute('x', 0);
37 eventLabel.setAttribute('y', yOffset + 30);
38 eventLabel.textContent = pointerEventsValues[pi];
39 testContent.appendChild(eventLabel);
41 for (var vi = 0; vi < visibleValues.length; vi++) {
42 for (var fi = 0; fi < fillValues.length; fi++) {
43 for (var si = 0; si < strokeValues.length; si++) {
45 var identString = "_" + pi + "_" + vi + "_" + fi + "_" + si;
47 var img = document.createElementNS(svgNS, 'image');
48 img.setAttributeNS("http://www.w3.org/1999/xlink", 'href', 'resources/red-checker.png');
49 img.setAttribute('x', xOffset);
50 img.setAttribute('y', yOffset);
51 img.setAttribute('width', 50);
52 img.setAttribute('height', 50);
53 img.setAttribute('visibility', visibleValues[vi]);
54 img.setAttribute('fill', fillValues[fi]);
55 img.setAttribute('stroke', strokeValues[si]);
56 img.setAttribute('pointer-events', pointerEventsValues[pi]);
57 img.setAttribute('onclick', 'clickHit(evt, "' + identString + '")');
59 testContent.appendChild(img);
61 var fillText = document.createElementNS(svgNS, 'text');
62 fillText.setAttribute('x', xOffset + 5);
63 fillText.setAttribute('y', yOffset + 20);
64 fillText.textContent = "miss";
65 fillText.setAttribute('id', 'fill-text' + identString);
66 fillText.setAttribute('pointer-events', 'none');
67 testContent.appendChild(fillText);
69 if (window.eventSender) {
70 // Fill click
71 eventSender.mouseMoveTo(xOffset + 25, yOffset + 25);
72 eventSender.mouseDown();
73 eventSender.mouseUp();
75 xOffset += rectSpacing;
79 xOffset = leftEdge;
80 yOffset += rectSpacing;
83 if (window.layoutTestController)
84 layoutTestController.notifyDone();
86 ]]>
87 </script>
89 <text x="110" y="20">Visibility: visible</text>
90 <text x="340" y="20">Visibility: hidden</text>
91 <g id="test-content"/>
92 </svg>