Title: [118299] trunk
- Revision
- 118299
- Author
- [email protected]
- Date
- 2012-05-23 18:47:38 -0700 (Wed, 23 May 2012)
Log Message
Adjust a target node of a mouse event correctly when a distributed text node is clicked.
https://bugs.webkit.org/show_bug.cgi?id=86999
Reviewed by Dimitri Glazkov.
Source/WebCore:
Make EventHandler::updateMouseEventTargetNode() be aware of shadow dom subtree
so that an insertion point can receive an event when a distributed text node is clicked.
Tests: fast/dom/shadow/shadow-dom-event-dispatching.html
* page/EventHandler.cpp:
(WebCore::EventHandler::updateMouseEventTargetNode):
LayoutTests:
* fast/dom/shadow/shadow-dom-event-dispatching-expected.txt:
* fast/dom/shadow/shadow-dom-event-dispatching.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (118298 => 118299)
--- trunk/LayoutTests/ChangeLog 2012-05-24 01:40:28 UTC (rev 118298)
+++ trunk/LayoutTests/ChangeLog 2012-05-24 01:47:38 UTC (rev 118299)
@@ -1,3 +1,13 @@
+2012-05-23 Hayato Ito <[email protected]>
+
+ Adjust a target node of a mouse event correctly when a distributed text node is clicked.
+ https://bugs.webkit.org/show_bug.cgi?id=86999
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/shadow/shadow-dom-event-dispatching-expected.txt:
+ * fast/dom/shadow/shadow-dom-event-dispatching.html:
+
2012-05-23 Shinya Kawanaka <[email protected]>
[Shadow] drop event is not fired on nodes in Shadow DOM
Modified: trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-expected.txt (118298 => 118299)
--- trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-expected.txt 2012-05-24 01:40:28 UTC (rev 118298)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-expected.txt 2012-05-24 01:47:38 UTC (rev 118299)
@@ -276,6 +276,25 @@
mouseover
@top (target: top) (related: shadow-host)
+
+
+Composed Shadow Tree will be:
+DIV id=sandbox
+ DIV id=top
+ DIV id=shadow-host
+ #text
+
+
+Moving mouse from a distributed text node to top
+
+ mouseout
+ @content (target: content) (related: top)
+ @shadow-root (target: content) (related: top)
+ @shadow-host (target: shadow-host) (related: top)
+ @top (target: shadow-host) (related: top)
+
+ mouseover
+ @top (target: top) (related: shadow-host)
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching.html (118298 => 118299)
--- trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching.html 2012-05-24 01:40:28 UTC (rev 118298)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching.html 2012-05-24 01:47:38 UTC (rev 118299)
@@ -190,6 +190,22 @@
debug('\n\nComposed Shadow Tree will be:\n' + dumpComposedShadowTree(parent));
}
+function prepareDOMTree6(parent)
+{
+ // Makes sure an insertion point can receive a event when a distributed text node is clicked.
+ parent.appendChild(
+ createDOM('div', {'id': 'top'},
+ createDOM('div', {'id': 'shadow-host'},
+ createShadowRoot(
+ createDOM('content', {'id': 'content'})),
+ document.createTextNode('Text Node'))));
+ var shadowRoot = getNodeInShadowTreeStack('shadow-host/').id = 'shadow-root';
+ addEventListeners(['top', 'shadow-host', 'shadow-host/', 'shadow-host/content']);
+ parent.offsetLeft;
+ debug('\n\nComposed Shadow Tree will be:\n' + dumpComposedShadowTree(parent));
+}
+
+
function debugDispatchedEvent(eventType)
{
debug('\n ' + eventType);
@@ -261,6 +277,22 @@
moveMouseOver(document.getElementById('top'));
debugDispatchedEvent('mouseout');
debugDispatchedEvent('mouseover');
+
+ sandbox.innerHTML = '';
+ prepareDOMTree6(sandbox);
+
+ // Calculates the position of the text node.
+ var host = document.getElementById('shadow-host');
+ var x = host.offsetLeft + 5;
+ var y = host.offsetTop + defaultPaddingSize + 5;
+ debug('\n' + 'Moving mouse from a distributed text node to top');
+ eventSender.mouseMoveTo(x, y);
+ clearEventRecords();
+ moveMouseOver(document.getElementById('top'));
+ debugDispatchedEvent('mouseout');
+ debugDispatchedEvent('mouseover');
+
+ sandbox.innerHTML = '';
}
test();
Modified: trunk/Source/WebCore/ChangeLog (118298 => 118299)
--- trunk/Source/WebCore/ChangeLog 2012-05-24 01:40:28 UTC (rev 118298)
+++ trunk/Source/WebCore/ChangeLog 2012-05-24 01:47:38 UTC (rev 118299)
@@ -1,3 +1,18 @@
+2012-05-23 Hayato Ito <[email protected]>
+
+ Adjust a target node of a mouse event correctly when a distributed text node is clicked.
+ https://bugs.webkit.org/show_bug.cgi?id=86999
+
+ Reviewed by Dimitri Glazkov.
+
+ Make EventHandler::updateMouseEventTargetNode() be aware of shadow dom subtree
+ so that an insertion point can receive an event when a distributed text node is clicked.
+
+ Tests: fast/dom/shadow/shadow-dom-event-dispatching.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::updateMouseEventTargetNode):
+
2012-05-23 Shinya Kawanaka <[email protected]>
[Shadow] drop event is not fired on nodes in Shadow DOM
Modified: trunk/Source/WebCore/page/EventHandler.cpp (118298 => 118299)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-05-24 01:40:28 UTC (rev 118298)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-05-24 01:47:38 UTC (rev 118299)
@@ -31,6 +31,7 @@
#include "CachedImage.h"
#include "Chrome.h"
#include "ChromeClient.h"
+#include "ComposedShadowTreeWalker.h"
#include "Cursor.h"
#include "CursorList.h"
#include "Document.h"
@@ -2111,8 +2112,11 @@
result = m_capturingMouseEventsNode.get();
else {
// If the target node is a text node, dispatch on the parent node - rdar://4196646
- if (result && result->isTextNode())
- result = result->parentNode();
+ if (result && result->isTextNode()) {
+ ComposedShadowTreeWalker walker(result);
+ walker.parentIncludingInsertionPointAndShadowRoot();
+ result = walker.get();
+ }
}
m_nodeUnderMouse = result;
#if ENABLE(SVG)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes