In RTL overflow
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-PASS: event at (112, 62) hit abs-box at offset (32, 37)
-PASS: event at (157, 32) hit rel-box at offset (22, 24)
-PASS: event at (410, 30) hit fixed-box at offset (10, 10)
-PASS: event at (36, 272) hit with-bordertopextra at offset (4, 4)
-FAIL: event at (639, 207) expected to hit in-columns at (35, 5) but hit in-columns at (35, 15)
-PASS: event at (563, 410) hit inside-overflow at offset (7, 6)
-PASS: event at (112, 369) hit transformed at offset (11, 16)
+PASS: event hit abs-box at offset (32, 37)
+PASS: event hit rel-box at offset (22, 24)
+PASS: event hit fixed-box at offset (10, 10)
+PASS: event hit with-bordertopextra at offset (4, 4)
+PASS: event hit in-columns at offset (35, 5)
+PASS: event hit inside-overflow at offset (7, 6)
+PASS: event hit transformed at offset (11, 16)
if (!window.testRunner)
document.body.addEventListener('mousemove', mousemoved, false);
- dispatchEvent(112, 62, 'abs-box', 32, 37);
- dispatchEvent(157, 32, 'rel-box', 22, 24);
- dispatchEvent(410, 30, 'fixed-box', 10, 10);
- dispatchEvent(36, 272, 'with-bordertopextra', 4, 4);
- dispatchEvent(639, 207, 'in-columns', 35, 5);
- dispatchEvent(563, 410, 'inside-overflow', 7, 6);
- dispatchEvent(112, 369, 'transformed', 11, 16);
+ var offsetX = 32;
+ var offsetY = 37;
+ var positions = sumPositions(document.getElementById('abs-box'));
+ var clientX = positions.offsetLeft - positions.scrollLeft + offsetX;
+ var clientY = positions.offsetTop - positions.scrollTop + offsetY;
+ dispatchEvent(clientX, clientY, 'abs-box', offsetX, offsetY);
+
+ offsetX = 22;
+ offsetY = 24;
+ positions = sumPositions(document.getElementById('rel-box'));
+ clientX = positions.offsetLeft + positions.clientLeft - positions.scrollLeft + offsetX;
+ clientY = positions.offsetTop + positions.clientLeft - positions.scrollTop + offsetY;
+ dispatchEvent(clientX, clientY, 'rel-box', offsetX, offsetY);
+
+ offsetX = 10;
+ offsetY = 10;
+ positions = sumPositions(document.getElementById('fixed-box'));
+ clientX = positions.offsetLeft + offsetX;
+ clientY = positions.offsetTop + offsetY;
+ dispatchEvent(clientX, clientY, 'fixed-box', offsetX, offsetY);
+
+ offsetX = 4;
+ offsetY = 4;
+ positions = sumPositions(document.getElementById('with-bordertopextra'));
+ clientX = positions.offsetLeft - positions.scrollLeft + offsetX;
+ clientY = positions.offsetTop - positions.scrollTop + offsetY;
+ dispatchEvent(clientX, clientY, 'with-bordertopextra', offsetX, offsetY);
+
+ offsetX = 35;
+ offsetY = 5;
+ positions = sumPositions(document.getElementById('in-columns'));
+ clientX = positions.offsetLeft + positions.clientLeft - positions.scrollLeft + offsetX;
+ clientY = positions.offsetTop + positions.clientTop - positions.scrollTop + offsetY;
+ dispatchEvent(clientX, clientY, 'in-columns', offsetX, offsetY);
+
+ offsetX = 7;
+ offsetY = 6;
+ positions = sumPositions(document.getElementById('inside-overflow'));
+ clientY = positions.offsetTop + positions.clientTop - positions.scrollTop + offsetY;
+
+ var content = document.getElementById('overflow-contents');
+ positions = sumPositions(content);
+ var inside = document.getElementById('inside-overflow');
+ var borderLeft = 2;
+ clientX = positions.offsetLeft + borderLeft + content.clientWidth - inside.clientWidth - window.scrollX + offsetX;
+ dispatchEvent(clientX, clientY, 'inside-overflow', offsetX, offsetY);
+
+ offsetX = 11;
+ offsetY = 16;
+ positions = sumPositions(document.getElementById('transformed'));
+ var sin20 = Math.sin(-20 * Math.PI / 180);
+ var cos20 = Math.cos(-20 * Math.PI / 180);
+ clientX = positions.offsetLeft + positions.clientLeft - positions.scrollLeft + 100 + Math.round(100 - (100 - offsetX) * cos20 - (60 - offsetY) * sin20);
+ clientY = positions.offsetTop + positions.clientTop - positions.scrollTop + 50 + Math.round(60 + (100 - offsetX) * sin20 - (60 - offsetY) * cos20);
+ dispatchEvent(clientX, clientY, 'transformed', offsetX, offsetY);
if (window.testRunner)
testRunner.notifyDone();
}
+ function sumPositions(element)
+ {
+ var offsetLeft = 0;
+ var offsetTop = 0;
+ var clientLeft = 0;
+ var clientTop = 0;
+ var scrollLeft = 0;
+ var scrollTop = 0;
+ while (element) {
+ offsetLeft += element.offsetLeft;
+ offsetTop += element.offsetTop;
+ clientLeft += element.clientLeft;
+ clientTop += element.clientTop;
+ scrollLeft += element.scrollLeft;
+ scrollTop += element.scrollTop;
+ element = element.offsetParent;
+ }
+ return { 'offsetLeft': offsetLeft, 'offsetTop': offsetTop, 'clientLeft': clientLeft, 'clientTop': clientTop, 'scrollLeft': scrollLeft, 'scrollTop': scrollTop };
+ }
+
function dispatchEvent(clientX, clientY, expectedElementID, expectedOffsetX, expectedOffsetY)
{
var ev = document.createEvent("MouseEvent");
if (element.id == event.expectedElement &&
event.offsetX == event.expectedOffsetX &&
event.offsetY == event.expectedOffsetY)
- result = 'PASS: event at (' + event.clientX + ', ' + event.clientY + ') hit ' + element.id + ' at offset (' + event.offsetX + ', ' + event.offsetY + ')';
+ result = 'PASS: event hit ' + element.id + ' at offset (' + event.offsetX + ', ' + event.offsetY + ')';
else
result = 'FAIL: event at (' + event.clientX + ', ' + event.clientY + ') expected to hit ' + event.expectedElement + ' at (' + event.expectedOffsetX + ', ' + event.expectedOffsetY + ') but hit ' + element.id + ' at (' + event.offsetX + ', ' + event.offsetY + ')';
+++ /dev/null
-Absolute position
-Relative position
-Fixed position
-First Second
-This cell has borderTopExtra
-Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
-Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-In columns
-Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-
-Div with transform
-Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-
-In RTL overflow
-Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-
-PASS: event at (112, 62) hit abs-box at offset (32, 37)
-FAIL: event at (157, 32) expected to hit rel-box at (22, 24) but hit rel-box at (22, 22)
-PASS: event at (410, 30) hit fixed-box at offset (10, 10)
-FAIL: event at (36, 272) expected to hit with-bordertopextra at (4, 4) but hit filler at (56, 372)
-FAIL: event at (639, 207) expected to hit in-columns at (35, 5) but hit in-columns at (34, 5)
-FAIL: event at (563, 410) expected to hit inside-overflow at (7, 6) but hit overflow-contents at (163, 112)
-FAIL: event at (112, 369) expected to hit transformed at (11, 16) but hit transformed at (7, 2)
-