Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / pointer-events-image-css-transform.svg
blob20760f03a5471c7750772225138f7f8c3aa7d933
1 <?xml version="1.0"?>
2 <!-- This a 1-1 copy of pointer-events-image.svg tests with the addition of -webkit-transform -->
3 <svg xmlns="http://www.w3.org/2000/svg"
4 xmlns:xlink="http://www.w3.org/1999/xlink" onload="fillTestContent()">
5 <script type="text/javascript">
6 <![CDATA[
8 if (window.testRunner)
9 testRunner.waitUntilDone();
11 var visibleValues = [ 'visible', 'hidden' ];
12 var fillValues = ['none', 'orange' ];
13 var strokeValues = ['none', 'blue' ];
15 var pointerEventsValues = ['auto', 'visiblePainted', 'visibleFill', 'visibleStroke', 'visible', 'painted', 'fill', 'stroke', 'all', 'none'];
17 var leftEdge = 100;
18 var topEdge = 30;
20 var rectSpacing = 57;
22 var svgNS = "http://www.w3.org/2000/svg";
24 function clickHit(event, identifierString) {
25 var fillText = document.getElementById('fill-text' + identifierString);
26 fillText.textContent = 'HIT';
29 function fillTestContent() {
30 var xOffset = leftEdge;
31 var yOffset = topEdge;
33 var testContent = document.getElementById("test-content");
35 for (var pi = 0; pi < pointerEventsValues.length; pi++) {
36 var eventLabel = document.createElementNS(svgNS, 'text');
37 eventLabel.setAttribute('x', 0);
38 eventLabel.setAttribute('y', yOffset + 30);
39 eventLabel.textContent = pointerEventsValues[pi];
40 testContent.appendChild(eventLabel);
42 for (var vi = 0; vi < visibleValues.length; vi++) {
43 for (var fi = 0; fi < fillValues.length; fi++) {
44 for (var si = 0; si < strokeValues.length; si++) {
46 var identString = "_" + pi + "_" + vi + "_" + fi + "_" + si;
48 var img = document.createElementNS(svgNS, 'image');
49 img.setAttributeNS("http://www.w3.org/1999/xlink", 'href', 'resources/red-checker.png');
50 img.setAttribute('x', xOffset/2);
51 img.setAttribute('y', yOffset/2);
52 img.setAttribute('width', 25);
53 img.setAttribute('height', 25);
54 img.setAttribute('visibility', visibleValues[vi]);
55 img.setAttribute('fill', fillValues[fi]);
56 img.setAttribute('stroke', strokeValues[si]);
57 img.setAttribute('pointer-events', pointerEventsValues[pi]);
58 img.setAttribute('style', "transform: scale(2)");
59 img.setAttribute('onclick', 'clickHit(evt, "' + identString + '")');
61 testContent.appendChild(img);
63 var fillText = document.createElementNS(svgNS, 'text');
64 fillText.setAttribute('x', xOffset + 5);
65 fillText.setAttribute('y', yOffset + 20);
66 fillText.textContent = "miss";
67 fillText.setAttribute('id', 'fill-text' + identString);
68 fillText.setAttribute('pointer-events', 'none');
69 testContent.appendChild(fillText);
71 if (window.eventSender) {
72 // Fill click
73 eventSender.mouseMoveTo(xOffset + 30, yOffset + 30);
74 eventSender.mouseDown();
75 eventSender.mouseUp();
77 xOffset += rectSpacing;
81 xOffset = leftEdge;
82 yOffset += rectSpacing;
85 if (window.testRunner)
86 testRunner.notifyDone();
88 ]]>
89 </script>
91 <text x="110" y="20">Visibility: visible</text>
92 <text x="340" y="20">Visibility: hidden</text>
93 <g id="test-content"/>
94 </svg>