Changeset 179467 in webkit
- Timestamp:
- Feb 1, 2015 7:22:57 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r179466 r179467 1 2015-01-31 Darin Adler <darin@apple.com> 2 3 Stop dispatching events with SVGElementInstance objects as their targets 4 https://bugs.webkit.org/show_bug.cgi?id=141108 5 6 Reviewed by Anders Carlsson. 7 8 Many tests are no longer relevant once we aren't doing this any more. 9 10 * platform/gtk/svg/custom/use-instanceRoot-event-bubbling-expected.png: Removed. 11 * platform/gtk/svg/custom/use-instanceRoot-modifications-expected.png: Removed. 12 * platform/gtk/svg/custom/use-instanceRoot-modifications-expected.txt: Removed. 13 * platform/ios-sim-deprecated/svg/custom/use-instanceRoot-modifications-expected.txt: Removed. 14 * platform/ios-simulator/svg/custom/use-instanceRoot-modifications-expected.txt: Removed. 15 * platform/mac-mountainlion/svg/custom/use-instanceRoot-modifications-expected.txt: Removed. 16 * platform/mac/svg/custom/use-instanceRoot-event-bubbling-expected.png: Removed. 17 * platform/mac/svg/custom/use-instanceRoot-modifications-expected.png: Removed. 18 * platform/mac/svg/custom/use-instanceRoot-modifications-expected.txt: Removed. 19 * svg/custom/use-instanceRoot-modifications.svg: Removed. 20 * svg/custom/use-instanceRoot-with-use-removed-expected.txt: Removed. 21 * svg/custom/use-instanceRoot-with-use-removed.svg: Removed. 22 23 * svg/custom/resources/use-instanceRoot-event-bubbling.js: Updated this test to expect 24 the events to be dispatched with the SVGUseElement as the target. I talked this over with 25 Sam Weinig and we decided this is good behavior for now, and it almost matches what the 26 spec says. Might be worth refining later. 27 * svg/custom/use-instanceRoot-event-bubbling-expected.txt: Updated expected results. 28 * svg/custom/use-instanceRoot-event-bubbling.xhtml: Tweaked the test a little. It still 29 could use improvement; it's like half a "repaint test", which is strange. 30 31 * svg/custom/use-event-retargeting-expected.txt: Added. Got this test from Blink. 32 * svg/custom/use-event-retargeting.html: Added. Ditto. 33 1 34 2015-02-01 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 35 -
trunk/LayoutTests/svg/custom/resources/use-instanceRoot-event-bubbling.js
r179391 r179467 1 description("Tests whet er SVG event bubbling works accross shadow trees.");1 description("Tests whether SVG event bubbling works across shadow trees."); 2 2 3 if (window.testRunner) 3 if (window.testRunner) { 4 4 testRunner.waitUntilDone(); 5 testRunner.dumpAsText(); 6 } 5 7 6 8 var svgNS = "http://www.w3.org/2000/svg"; … … 19 21 20 22 function eventHandler(evt, label) { 21 var targetId = evt.target. correspondingElement ? evt.target.correspondingElement.id : evt.target.id;22 var curTargetId = evt.currentTarget. correspondingElement ? evt.currentTarget.correspondingElement.id : evt.currentTarget.id;23 var targetId = evt.target.id; 24 var curTargetId = evt.currentTarget.id; 23 25 24 26 var phaseString = ""; … … 42 44 function finishTest() 43 45 { 44 successfullyParsed = true;45 46 46 document.getElementById("rectParent").setAttribute("fill", "green"); 47 shouldBeTrue("successfullyParsed");48 47 debug('<br /><span class="pass">TEST COMPLETE</span>'); 49 48 … … 60 59 case 1: 61 60 rect.onclick = function(evt) { eventHandler(evt, 1); }; 62 expected[0] = "[EventHandler 1] type: click phase: AT_TARGET target: [object SVG ElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rect)";61 expected[0] = "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)"; 63 62 testListeners(); 64 63 break; 65 64 case 2: 66 65 rectContainer.addEventListener("click", function(evt) { eventHandler(evt, 2) }, false); 67 expected[1] = "[EventHandler 2] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rectParent)";66 expected[1] = "[EventHandler 2] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)"; 68 67 testListeners(); 69 68 break; 70 69 case 3: 71 70 use.setAttribute("onclick", "eventHandler(evt, 3)"); 72 expected[2] = "[EventHandler 3] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGUseElement] (id: use)";71 expected[2] = "[EventHandler 3] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)"; 73 72 testListeners(); 74 73 break; 75 74 case 4: 76 75 useContainer.onclick = function(evt) { eventHandler(evt, 4) }; 77 expected[3] = "[EventHandler 4] type: click phase: BUBBLING target: [object SVG ElementInstance] (id: rect) currentTarget: [object SVGGElement] (id: useParent)";76 expected[3] = "[EventHandler 4] type: click phase: BUBBLING target: [object SVGUseElement] (id: use) currentTarget: [object SVGGElement] (id: useParent)"; 78 77 testListeners(); 79 78 break; … … 107 106 var rect = document.createElementNS(svgNS, "rect"); 108 107 rect.id = "rect"; 109 rect.style.fill = " red";108 rect.style.fill = "blue"; 110 109 rect.width.baseVal.value = 100; 111 110 rect.height.baseVal.value = 100; … … 122 121 useContainer.appendChild(use); 123 122 124 function repaintTest() { 125 if (window.testRunner) 126 testRunner.waitUntilDone(); 127 nextTest(); 128 } 123 nextTest(); -
trunk/LayoutTests/svg/custom/use-instanceRoot-event-bubbling-expected.txt
r37435 r179467 1 Tests whet er SVG event bubbling works accross shadow trees.1 Tests whether SVG event bubbling works across shadow trees. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rect)" 7 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rect)" 8 PASS msg is "[EventHandler 2] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rectParent)" 9 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rect)" 10 PASS msg is "[EventHandler 2] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rectParent)" 11 PASS msg is "[EventHandler 3] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGUseElement] (id: use)" 12 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rect)" 13 PASS msg is "[EventHandler 2] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGElementInstance] (id: rectParent)" 14 PASS msg is "[EventHandler 3] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGUseElement] (id: use)" 15 PASS msg is "[EventHandler 4] type: click phase: BUBBLING target: [object SVGElementInstance] (id: rect) currentTarget: [object SVGGElement] (id: useParent)" 16 PASS successfullyParsed is true 6 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 7 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 8 PASS msg is "[EventHandler 2] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 9 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 10 PASS msg is "[EventHandler 2] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 11 PASS msg is "[EventHandler 3] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 12 PASS msg is "[EventHandler 1] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 13 PASS msg is "[EventHandler 2] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 14 PASS msg is "[EventHandler 3] type: click phase: AT_TARGET target: [object SVGUseElement] (id: use) currentTarget: [object SVGUseElement] (id: use)" 15 PASS msg is "[EventHandler 4] type: click phase: BUBBLING target: [object SVGUseElement] (id: use) currentTarget: [object SVGGElement] (id: useParent)" 17 16 18 17 TEST COMPLETE -
trunk/LayoutTests/svg/custom/use-instanceRoot-event-bubbling.xhtml
r155284 r179467 2 2 <head> 3 3 <script>window.enablePixelTesting = true;</script> 4 <script src="../../resources/js-test-pre.js"></script> 5 <script src="../../fast/repaint/resources/repaint.js"></script> 4 <script src="../../resources/js-test-pre.js"/> 6 5 </head> 7 <body onload="runRepaintTest()">8 <p id="description" ></p>9 <div id="console" ></div>10 <script src="resources/use-instanceRoot-event-bubbling.js" ></script>6 <body> 7 <p id="description"/> 8 <div id="console"/> 9 <script src="resources/use-instanceRoot-event-bubbling.js"/> 11 10 </body> 12 11 </html> -
trunk/Source/WebCore/ChangeLog
r179463 r179467 1 2015-01-31 Darin Adler <darin@apple.com> 2 3 Stop dispatching events to with SVGElementInstance objects as their targets 4 https://bugs.webkit.org/show_bug.cgi?id=141108 5 6 Reviewed by Anders Carlsson. 7 8 Test: svg/custom/use-event-retargeting.html 9 10 * dom/EventDispatcher.cpp: 11 (WebCore::eventTargetRespectingTargetRules): Replaced the code that retargeted 12 events at SVGElementInstance objects with code that retargets them at the use 13 element instead. Also wrote the code in a simpler way. 14 1 15 2015-02-01 Zan Dobersek <zdobersek@igalia.com> 2 16 -
trunk/Source/WebCore/dom/EventDispatcher.cpp
r174225 r179467 207 207 { 208 208 if (is<PseudoElement>(referenceNode)) { 209 EventTarget* hostElement = downcast<PseudoElement>(referenceNode).hostElement(); 210 ASSERT(hostElement); 211 return *hostElement; 212 } 213 214 if (!referenceNode.isSVGElement() || !referenceNode.isInShadowTree()) 215 return referenceNode; 216 217 // Spec: The event handling for the non-exposed tree works as if the referenced element had been textually included 218 // as a deeply cloned child of the 'use' element, except that events are dispatched to the SVGElementInstance objects 219 auto& rootNode = referenceNode.treeScope().rootNode(); 220 Element* shadowHostElement = is<ShadowRoot>(rootNode) ? downcast<ShadowRoot>(rootNode).hostElement() : nullptr; 221 // At this time, SVG nodes are not supported in non-<use> shadow trees. 222 if (!shadowHostElement || !shadowHostElement->hasTagName(SVGNames::useTag)) 223 return referenceNode; 224 SVGUseElement& useElement = downcast<SVGUseElement>(*shadowHostElement); 225 if (SVGElementInstance* instance = useElement.instanceForShadowTreeElement(&referenceNode)) 226 return *instance; 209 ASSERT(downcast<PseudoElement>(referenceNode).hostElement()); 210 return *downcast<PseudoElement>(referenceNode).hostElement(); 211 } 212 213 // Events sent to elements inside an SVG use element's shadow tree go to the use element. 214 if (is<SVGElement>(referenceNode)) { 215 if (auto* useElement = downcast<SVGElement>(referenceNode).correspondingUseElement()) 216 return *useElement; 217 } 227 218 228 219 return referenceNode;
Note: See TracChangeset
for help on using the changeset viewer.