Title: [139153] trunk/LayoutTests
- Revision
- 139153
- Author
- [email protected]
- Date
- 2013-01-08 20:41:41 -0800 (Tue, 08 Jan 2013)
Log Message
[Shadow DOM] The MouseEvent offsetX and offsetY attributes must return the coordinates relative to the origin of the padding edge of the relative target after retargeting.
https://bugs.webkit.org/show_bug.cgi?id=104509
Reviewed by Dimitri Glazkov.
Adding a test for making sure that MouseEvent offsetX and offsetY arrributes are adjusted in retargeting.
* fast/dom/shadow/shadow-dom-mouse-event-adjust-offset-expected.txt: Added.
* fast/dom/shadow/shadow-dom-mouse-event-adjust-offset.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (139152 => 139153)
--- trunk/LayoutTests/ChangeLog 2013-01-09 04:35:45 UTC (rev 139152)
+++ trunk/LayoutTests/ChangeLog 2013-01-09 04:41:41 UTC (rev 139153)
@@ -1,3 +1,15 @@
+2013-01-08 Hayato Ito <[email protected]>
+
+ [Shadow DOM] The MouseEvent offsetX and offsetY attributes must return the coordinates relative to the origin of the padding edge of the relative target after retargeting.
+ https://bugs.webkit.org/show_bug.cgi?id=104509
+
+ Reviewed by Dimitri Glazkov.
+
+ Adding a test for making sure that MouseEvent offsetX and offsetY arrributes are adjusted in retargeting.
+
+ * fast/dom/shadow/shadow-dom-mouse-event-adjust-offset-expected.txt: Added.
+ * fast/dom/shadow/shadow-dom-mouse-event-adjust-offset.html: Added.
+
2013-01-08 Noel Gordon <[email protected]>
[chromium] Unreviewed gardening. jquery/event.html timeouts in release and debug.
Added: trunk/LayoutTests/fast/dom/shadow/shadow-dom-mouse-event-adjust-offset-expected.txt (0 => 139153)
--- trunk/LayoutTests/fast/dom/shadow/shadow-dom-mouse-event-adjust-offset-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-dom-mouse-event-adjust-offset-expected.txt 2013-01-09 04:41:41 UTC (rev 139153)
@@ -0,0 +1,15 @@
+Tests to ensure that MouseEvent's offsetX and offsetY are adjusted in re-targeting.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS eventRecords['parent']['offsetY'] is 5
+PASS eventRecords['shadow-host']['offsetY'] is 5 + 20
+PASS eventRecords['top']['offsetY'] is 5 + 20
+PASS eventRecords['parent']['offsetX'] is 80 / 2
+PASS eventRecords['shadow-host']['offsetX'] is 80 / 2 + 100
+PASS eventRecords['top']['offsetX'] is 80 / 2 + 100
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/shadow/shadow-dom-mouse-event-adjust-offset.html (0 => 139153)
--- trunk/LayoutTests/fast/dom/shadow/shadow-dom-mouse-event-adjust-offset.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-dom-mouse-event-adjust-offset.html 2013-01-09 04:41:41 UTC (rev 139153)
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="sandbox"></div>
+<pre id="console"></pre>
+<script>
+description("Tests to ensure that MouseEvent's offsetX and offsetY are adjusted in re-targeting.");
+
+function moveMouseOver(element)
+{
+ if (!window.eventSender || !window.internals)
+ return;
+
+ var x = element.offsetLeft + element.offsetWidth / 2;
+ var y = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+}
+
+var eventRecords = {};
+
+function recordEvent(event)
+{
+ var eventType = event.type
+ var eventRecord = {}
+ eventRecord['currentTarget'] = event.currentTarget.id
+ eventRecord['target'] = event.target.id
+ eventRecord['offsetX'] = event.offsetX;
+ eventRecord['offsetY'] = event.offsetY;
+ eventRecords[event.currentTarget.id] = eventRecord;
+}
+
+function addEventListeners(nodes)
+{
+ for (var i = 0; i < nodes.length; ++i) {
+ var node = getNodeInShadowTreeStack(nodes[i]);
+ node.addEventListener('mouseover', recordEvent, false);
+ }
+}
+
+function testMouseEventOffset()
+{
+ var sandbox = document.getElementById('sandbox');
+ sandbox.innerHTML = '';
+ sandbox.appendChild(
+ createDOM('div', {'id': 'top', 'style': 'padding-top: 77px;'},
+ createDOM('div', {'id': 'shadow-host', 'style': 'padding-left: 100px; padding-top: 20px'},
+ createShadowRoot(
+ createDOM('div', {'id': 'parent'},
+ createDOM('div', {'id': 'target', 'style': 'padding-top: 10px; width: 80px'}))))));
+ addEventListeners(['top', 'shadow-host', 'shadow-host/parent']);
+ sandbox.offsetLeft;
+ moveMouseOver(getNodeInShadowTreeStack('shadow-host/target'));
+
+ shouldBe("eventRecords['parent']['offsetY']", "5");
+ shouldBe("eventRecords['shadow-host']['offsetY']", "5 + 20");
+ shouldBe("eventRecords['top']['offsetY']", "5 + 20");
+
+ shouldBe("eventRecords['parent']['offsetX']", "80 / 2");
+ shouldBe("eventRecords['shadow-host']['offsetX']", "80 / 2 + 100");
+ shouldBe("eventRecords['top']['offsetX']", "80 / 2 + 100");
+}
+
+function test()
+{
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ testMouseEventOffset();
+}
+
+test();
+</script>
+<script src=""
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes