Diff
Modified: trunk/LayoutTests/ChangeLog (93183 => 93184)
--- trunk/LayoutTests/ChangeLog 2011-08-17 00:55:27 UTC (rev 93183)
+++ trunk/LayoutTests/ChangeLog 2011-08-17 00:57:31 UTC (rev 93184)
@@ -1,3 +1,18 @@
+2011-08-16 Hayato Ito <[email protected]>
+
+ Implement proper handling of events which happen in children of shadow hosts.
+ https://bugs.webkit.org/show_bug.cgi?id=66285
+
+ Reviewed by Dimitri Glazkov.
+
+ Fix the issue where a shadow host stops an event propagation if an
+ event happens at the children of shadow hosts, outside of the shadow root.
+
+ * fast/dom/shadow/details-summary-mouseover-expected.txt: Removed.
+ * fast/dom/shadow/details-summary-mouseover.html: Removed.
+ * fast/dom/shadow/shadow-contents-event-expected.txt: Added.
+ * fast/dom/shadow/shadow-contents-event.html: Added.
+
2011-08-16 Wyatt Carss <[email protected]>
win-wk2 needs updated baselines for some editing tests
Deleted: trunk/LayoutTests/fast/dom/shadow/details-summary-mouseover-expected.txt (93183 => 93184)
--- trunk/LayoutTests/fast/dom/shadow/details-summary-mouseover-expected.txt 2011-08-17 00:55:27 UTC (rev 93183)
+++ trunk/LayoutTests/fast/dom/shadow/details-summary-mouseover-expected.txt 2011-08-17 00:57:31 UTC (rev 93184)
@@ -1,11 +0,0 @@
-Tests to ensure that moving mouse from 'summary' to 'details' should not crash. Note that 'details' is a shadow host and has a 'summary' element as a immediate child elment. There is no shadow root between them.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-summary
-details
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fast/dom/shadow/details-summary-mouseover.html (93183 => 93184)
--- trunk/LayoutTests/fast/dom/shadow/details-summary-mouseover.html 2011-08-17 00:55:27 UTC (rev 93183)
+++ trunk/LayoutTests/fast/dom/shadow/details-summary-mouseover.html 2011-08-17 00:57:31 UTC (rev 93184)
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<p id="description"></p>
-<div id="sandbox">
- <details open id="details" style="height: 200px">
- <summary id="summary">summary</summary>
- details
- </details>
-</div>
-<pre id="console"></pre>
-<script>
-description("Tests to ensure that moving mouse from 'summary' to 'details' should not crash. "
- + "Note that 'details' is a shadow host and has a 'summary' element as a immediate child elment. "
- + "There is no shadow root between them.");
-
-function moveMouseOver(element)
-{
- if (!window.eventSender)
- return;
- var x = element.offsetLeft + element.offsetWidth / 2;
- var y = element.offsetTop + element.offsetHeight / 2;
- eventSender.mouseMoveTo(x, y);
-}
-
-function test()
-{
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
- moveMouseOver(document.getElementById('summary'));
- moveMouseOver(document.getElementById('details'));
-}
-
-test();
-
-var successfullyParsed = true;
-</script>
-<script src=""
-</body>
-</html>
Added: trunk/LayoutTests/fast/dom/shadow/shadow-contents-event-expected.txt (0 => 93184)
--- trunk/LayoutTests/fast/dom/shadow/shadow-contents-event-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-contents-event-expected.txt 2011-08-17 00:57:31 UTC (rev 93184)
@@ -0,0 +1,19 @@
+Tests to ensure that moving mouse from 'summary' to 'details' should dispatch events correctly. Note that 'details' is a shadow host and has a 'summary' element as a immediate child element. There is no shadow root between them.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+summary
+details
+
+Moving mouse from summary to details
+PASS dispatchedEvent("mouseover") is ["details(<-summary)(@details)", "details(<-summary)(@sandbox)"]
+PASS dispatchedEvent("mouseout") is ["summary(<-details)(@summary)", "summary(<-details)(@details)", "summary(<-details)(@sandbox)"]
+
+Moving mouse from details to summary
+PASS dispatchedEvent("mouseover") is ["summary(<-details)(@summary)", "summary(<-details)(@details)", "summary(<-details)(@sandbox)"]
+PASS dispatchedEvent("mouseout") is ["details(<-summary)(@details)", "details(<-summary)(@sandbox)"]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/shadow/shadow-contents-event.html (0 => 93184)
--- trunk/LayoutTests/fast/dom/shadow/shadow-contents-event.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-contents-event.html 2011-08-17 00:57:31 UTC (rev 93184)
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="sandbox">
+ <details open id="details" style="height: 200px">
+ <summary id="summary">summary</summary>
+ details
+ </details>
+</div>
+<pre id="console"></pre>
+<script>
+description("Tests to ensure that moving mouse from 'summary' to 'details' should dispatch events correctly. "
+ + "Note that 'details' is a shadow host and has a 'summary' element as a immediate child element. "
+ + "There is no shadow root between them.");
+
+function moveMouseOver(element)
+{
+ if (!window.eventSender)
+ return;
+ var x = element.offsetLeft + element.offsetWidth / 2;
+ var y = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+}
+
+var eventRecords = {};
+
+function clearEventRecords()
+{
+ eventRecords = {};
+}
+
+function dispatchedEvent(eventType)
+{
+ var events = eventRecords[eventType];
+ if (!events)
+ return [];
+ return events;
+}
+
+function recordEvent(event)
+{
+ var eventType = event.type
+ if (!eventRecords[eventType]) {
+ eventRecords[eventType] = []
+ }
+ // Records each event in the following format per event type:
+ // eventRecords[eventType] = ['target.id(<-relatedTarget.id)(@currentTarget.id)',,,]
+ // * RelatedTarget and currentTarget may be omitted if they are not defined.
+ // A new event is pushed back to the array of its event type.
+ var eventString = '';
+ eventString += event.target.id;
+ if (event.relatedTarget)
+ eventString += '(<-' + event.relatedTarget.id + ')';
+ if (event.currentTarget)
+ eventString += '(@' + event.currentTarget.id + ')';
+ eventRecords[eventType].push(eventString);
+}
+
+function moveMouse(oldElementId, newElementId)
+{
+ debug('\n' + 'Moving mouse from ' + oldElementId + ' to ' + newElementId);
+ moveMouseOver(document.getElementById(oldElementId));
+ clearEventRecords();
+ moveMouseOver(document.getElementById(newElementId));
+}
+
+function test()
+{
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+ var ids = ['sandbox', 'details', 'summary'];
+ for (var i = 0; i < ids.length; ++i) {
+ var element = document.getElementById(ids[i]);
+ element.addEventListener('mouseover', recordEvent, false);
+ element.addEventListener('mouseout', recordEvent, false);
+ }
+
+ moveMouse('summary', 'details');
+ shouldBe('dispatchedEvent("mouseover")', '["details(<-summary)(@details)", "details(<-summary)(@sandbox)"]');
+ shouldBe('dispatchedEvent("mouseout")', '["summary(<-details)(@summary)", "summary(<-details)(@details)", "summary(<-details)(@sandbox)"]');
+
+ moveMouse('details', 'summary');
+ shouldBe('dispatchedEvent("mouseover")', '["summary(<-details)(@summary)", "summary(<-details)(@details)", "summary(<-details)(@sandbox)"]');
+ shouldBe('dispatchedEvent("mouseout")', '["details(<-summary)(@details)", "details(<-summary)(@sandbox)"]');
+}
+
+test();
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (93183 => 93184)
--- trunk/Source/WebCore/ChangeLog 2011-08-17 00:55:27 UTC (rev 93183)
+++ trunk/Source/WebCore/ChangeLog 2011-08-17 00:57:31 UTC (rev 93184)
@@ -1,3 +1,18 @@
+2011-08-16 Hayato Ito <[email protected]>
+
+ Implement proper handling of events which happen in children of shadow hosts.
+ https://bugs.webkit.org/show_bug.cgi?id=66285
+
+ Reviewed by Dimitri Glazkov.
+
+ Fix the issue where a shadow host stops an event propagation if an
+ event happens at the children of shadow hosts, outside of the shadow root.
+
+ Test: fast/dom/shadow/shadow-contents-event.html
+
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::adjustToShadowBoundaries):
+
2011-08-16 Per-Erik Brodin <[email protected]>
Make it possible to explicitly prevent a preflight via ThreadableLoaderOptions
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (93183 => 93184)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2011-08-17 00:55:27 UTC (rev 93183)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2011-08-17 00:57:31 UTC (rev 93184)
@@ -165,9 +165,9 @@
// The relatedTarget is an ancestor or shadowHost of the target.
// FIXME: Remove the first check once conversion to new shadow DOM is complete <http://webkit.org/b/48698>
if (m_node->shadowHost() == relatedTarget.get() || isShadowHost(relatedTarget.get())) {
- lowestCommonBoundary = targetAncestor;
- if (targetAncestor - 1 >= m_ancestors.begin() && isShadowRootOrSVGShadowRoot((targetAncestor - 1)->node()))
- lowestCommonBoundary = targetAncestor - 1;
+ Vector<EventContext>::const_iterator relatedTargetChild = targetAncestor - 1;
+ if (relatedTargetChild >= m_ancestors.begin() && isShadowRootOrSVGShadowRoot(relatedTargetChild->node()))
+ lowestCommonBoundary = relatedTargetChild;
}
} else if ((*firstDivergentBoundary) == m_node.get()) {
// Since ancestors does not contain target itself, we must account