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

Side by Side Diff: LayoutTests/svg/custom/resources/use-instanceRoot-event-bubbling.js

Issue 323343004: [SVG2] The exposed event target should be the <use> element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase :P 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/custom/use-event-retargeting.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 window.testIsAsync = true; 1 window.testIsAsync = true;
2 description("Tests whether SVG event bubbling works across shadow trees."); 2 description("Tests whether SVG event bubbling works across shadow trees.");
3 3
4 var svgNS = "http://www.w3.org/2000/svg"; 4 var svgNS = "http://www.w3.org/2000/svg";
5 var xhtmlNS = "http://www.w3.org/1999/xhtml"; 5 var xhtmlNS = "http://www.w3.org/1999/xhtml";
6 var expected = new Array(4); 6 var expected = new Array(4);
7 var tests = 4; 7 var tests = 4;
8 var counter = 0; 8 var counter = 0;
9 var eventCounter = 0; 9 var eventCounter = 0;
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 function nextTest() 51 function nextTest()
52 { 52 {
53 eventCounter = 0; 53 eventCounter = 0;
54 ++counter; 54 ++counter;
55 55
56 switch (counter) { 56 switch (counter) {
57 case 1: 57 case 1:
58 rect.onclick = function(evt) { eventHandler(evt, 1); }; 58 rect.onclick = function(evt) { eventHandler(evt, 1); };
59 expected[0] = "[EventHandler 1] type: click phase: AT_TARGET target: [ob ject SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)"; 59 expected[0] = "[EventHandler 1] type: click phase: AT_TARGET target: [ob ject SVGRectElement] (id: rect) currentTarget: [object SVGRectElement] (id: rect )";
60 testListeners(); 60 testListeners();
61 break; 61 break;
62 case 2: 62 case 2:
63 rectContainer.addEventListener("click", function(evt) { eventHandler(evt , 2) }, false); 63 rectContainer.addEventListener("click", function(evt) { eventHandler(evt , 2) }, false);
64 expected[1] = "[EventHandler 2] type: click phase: AT_TARGET target: [ob ject SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)"; 64 expected[1] = "[EventHandler 2] type: click phase: BUBBLING target: [obj ect SVGRectElement] (id: rect) currentTarget: [object SVGGElement] (id: rectPare nt)";
65 testListeners(); 65 testListeners();
66 break; 66 break;
67 case 3: 67 case 3:
68 use.setAttribute("onclick", "eventHandler(evt, 3)"); 68 use.setAttribute("onclick", "eventHandler(evt, 3)");
69 expected[2] = "[EventHandler 3] type: click phase: AT_TARGET target: [ob ject SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)"; 69 expected[2] = "[EventHandler 3] type: click phase: AT_TARGET target: [ob ject SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)";
70 testListeners(); 70 testListeners();
71 break; 71 break;
72 case 4: 72 case 4:
73 useContainer.onclick = function(evt) { eventHandler(evt, 4) }; 73 useContainer.onclick = function(evt) { eventHandler(evt, 4) };
74 expected[3] = "[EventHandler 4] type: click phase: BUBBLING target: [obj ect SVGUseElement] (id: use) currentTarget: [object SVGGElement] (id: useParent) "; 74 expected[3] = "[EventHandler 4] type: click phase: BUBBLING target: [obj ect SVGUseElement] (id: use) currentTarget: [object SVGGElement] (id: useParent) ";
(...skipping 21 matching lines...) Expand all
96 // Create defs section 96 // Create defs section
97 var defs = document.createElementNS(svgNS, "defs"); 97 var defs = document.createElementNS(svgNS, "defs");
98 svg.appendChild(defs); 98 svg.appendChild(defs);
99 99
100 var rectContainer = document.createElementNS(svgNS, "g"); 100 var rectContainer = document.createElementNS(svgNS, "g");
101 rectContainer.id = "rectParent"; 101 rectContainer.id = "rectParent";
102 defs.appendChild(rectContainer); 102 defs.appendChild(rectContainer);
103 103
104 var rect = document.createElementNS(svgNS, "rect"); 104 var rect = document.createElementNS(svgNS, "rect");
105 rect.id = "rect"; 105 rect.id = "rect";
106 rect.style.fill = "red"; 106 rect.style.fill = "blue";
107 rect.width.baseVal.value = 100; 107 rect.width.baseVal.value = 100;
108 rect.height.baseVal.value = 100; 108 rect.height.baseVal.value = 100;
109 rectContainer.appendChild(rect); 109 rectContainer.appendChild(rect);
110 110
111 // Create content section 111 // Create content section
112 var useContainer = document.createElementNS(svgNS, "g"); 112 var useContainer = document.createElementNS(svgNS, "g");
113 useContainer.id = "useParent"; 113 useContainer.id = "useParent";
114 svg.appendChild(useContainer); 114 svg.appendChild(useContainer);
115 115
116 var use = document.createElementNS(svgNS, "use"); 116 var use = document.createElementNS(svgNS, "use");
117 use.id = "use"; 117 use.id = "use";
118 use.href.baseVal = "#rectParent"; 118 use.href.baseVal = "#rectParent";
119 useContainer.appendChild(use); 119 useContainer.appendChild(use);
120 120
121 function repaintTest() { 121 function repaintTest() {
122 nextTest(); 122 nextTest();
123 } 123 }
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/custom/use-event-retargeting.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698