Title: [118298] trunk
Revision
118298
Author
[email protected]
Date
2012-05-23 18:40:28 -0700 (Wed, 23 May 2012)

Log Message

[Shadow] drop event is not fired on nodes in Shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=85774

Reviewed by Dimitri Glazkov.

Source/WebCore:

EventHander::updateDragAndDrop re-targets an event to a shadow ancestor node,
however it should be done by adjusting event target. So we don't need to have it.

Tests: fast/dom/shadow/drop-event-for-input-in-shadow.html
       fast/dom/shadow/drop-event-in-shadow.html

* page/EventHandler.cpp:
(WebCore::EventHandler::updateDragAndDrop):

LayoutTests:

Confirms drop event is fired on div and input in Shadow DOM.

* fast/dom/shadow/drop-event-for-input-in-shadow-expected.txt: Added.
* fast/dom/shadow/drop-event-for-input-in-shadow.html: Added.
* fast/dom/shadow/drop-event-in-shadow-expected.txt: Added.
* fast/dom/shadow/drop-event-in-shadow.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118297 => 118298)


--- trunk/LayoutTests/ChangeLog	2012-05-24 01:31:06 UTC (rev 118297)
+++ trunk/LayoutTests/ChangeLog	2012-05-24 01:40:28 UTC (rev 118298)
@@ -1,3 +1,17 @@
+2012-05-23  Shinya Kawanaka  <[email protected]>
+
+        [Shadow] drop event is not fired on nodes in Shadow DOM
+        https://bugs.webkit.org/show_bug.cgi?id=85774
+
+        Reviewed by Dimitri Glazkov.
+
+        Confirms drop event is fired on div and input in Shadow DOM.
+
+        * fast/dom/shadow/drop-event-for-input-in-shadow-expected.txt: Added.
+        * fast/dom/shadow/drop-event-for-input-in-shadow.html: Added.
+        * fast/dom/shadow/drop-event-in-shadow-expected.txt: Added.
+        * fast/dom/shadow/drop-event-in-shadow.html: Added.
+
 2012-05-23  Emil A Eklund  <[email protected]>
 
         REGRESSION (115573): Incorrect rounding of margins for floats

Added: trunk/LayoutTests/fast/dom/shadow/drop-event-for-input-in-shadow-expected.txt (0 => 118298)


--- trunk/LayoutTests/fast/dom/shadow/drop-event-for-input-in-shadow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/drop-event-for-input-in-shadow-expected.txt	2012-05-24 01:40:28 UTC (rev 118298)
@@ -0,0 +1,2 @@
+PASS: drop event is fired.
+

Added: trunk/LayoutTests/fast/dom/shadow/drop-event-for-input-in-shadow.html (0 => 118298)


--- trunk/LayoutTests/fast/dom/shadow/drop-event-for-input-in-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/drop-event-for-input-in-shadow.html	2012-05-24 01:40:28 UTC (rev 118298)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div id="host"></div>
+<pre id="console"></pre>
+
+<script>
+function createInput(name) {
+    var div = document.createElement('input');
+    div.style.width = '100px';
+    div.style.height = '100px';
+
+    div.addEventListener('drop', function(e) {
+        debug('PASS: drop event is fired.');
+    });
+
+    return div;
+}
+
+var shadowRoot = new WebKitShadowRoot(host);
+var shadowInput = createInput('shadow');
+shadowRoot.appendChild(shadowInput);
+
+eventSender.beginDragWithFiles(["../resources/apple.gif"]);
+mouseMoveToElem(shadowInput);
+eventSender.mouseUp();
+
+var successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/drop-event-in-shadow-expected.txt (0 => 118298)


--- trunk/LayoutTests/fast/dom/shadow/drop-event-in-shadow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/drop-event-in-shadow-expected.txt	2012-05-24 01:40:28 UTC (rev 118298)
@@ -0,0 +1,2 @@
+PASS: drop event is fired.
+

Added: trunk/LayoutTests/fast/dom/shadow/drop-event-in-shadow.html (0 => 118298)


--- trunk/LayoutTests/fast/dom/shadow/drop-event-in-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/drop-event-in-shadow.html	2012-05-24 01:40:28 UTC (rev 118298)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div id="host"></div>
+<pre id="console"></pre>
+
+<script>
+function createBox(name) {
+    var div = document.createElement('div');
+    div.style.width = '100px';
+    div.style.height = '100px';
+
+    div.addEventListener('drop', function(e) {
+        debug('PASS: drop event is fired.');
+    });
+
+    return div;
+}
+
+var shadowRoot = new WebKitShadowRoot(host);
+var shadowDiv = createBox('shadow');
+shadowRoot.appendChild(shadowDiv);
+
+eventSender.beginDragWithFiles(["../resources/apple.gif"]);
+mouseMoveToElem(shadowDiv);
+eventSender.mouseUp();
+
+var successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (118297 => 118298)


--- trunk/Source/WebCore/ChangeLog	2012-05-24 01:31:06 UTC (rev 118297)
+++ trunk/Source/WebCore/ChangeLog	2012-05-24 01:40:28 UTC (rev 118298)
@@ -1,3 +1,19 @@
+2012-05-23  Shinya Kawanaka  <[email protected]>
+
+        [Shadow] drop event is not fired on nodes in Shadow DOM
+        https://bugs.webkit.org/show_bug.cgi?id=85774
+
+        Reviewed by Dimitri Glazkov.
+
+        EventHander::updateDragAndDrop re-targets an event to a shadow ancestor node,
+        however it should be done by adjusting event target. So we don't need to have it.
+
+        Tests: fast/dom/shadow/drop-event-for-input-in-shadow.html
+               fast/dom/shadow/drop-event-in-shadow.html
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::updateDragAndDrop):
+
 2012-05-23  Emil A Eklund  <[email protected]>
 
         REGRESSION (115573): Incorrect rounding of margins for floats

Modified: trunk/Source/WebCore/page/EventHandler.cpp (118297 => 118298)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-05-24 01:31:06 UTC (rev 118297)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-05-24 01:40:28 UTC (rev 118298)
@@ -1977,8 +1977,6 @@
     RefPtr<Node> newTarget = targetNode(mev);
     if (newTarget && newTarget->isTextNode())
         newTarget = newTarget->parentNode();
-    if (newTarget)
-        newTarget = newTarget->shadowAncestorNode();
 
     if (m_dragTarget != newTarget) {
         // FIXME: this ordering was explicitly chosen to match WinIE. However,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to