Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/offsetX-offsetY-svg.html

Issue 2124283002: Use the outermost SVG as base when computing offsetX/Y for SVG elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>MouseEvent.offsetX/offsetY for an SVG element is always relative to the o utermost &lt;svg> CSS layout box</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <style>
6 svg {
7 border: 10px solid blue;
8 border-width: 20px 40px 30px 10px;
9 }
10 </style>
11 <svg width="400" height="400" viewBox="0 0 400000 400000">
12 <rect x="40000" y="60000" width="80000" height="80000" fill="blue"/>
13 <rect x="160000" y="180000" width="80000" height="80000" fill="blue" stroke="l ightblue" stroke-width="10000"/>
14 </svg>
15 <script>
16 function check_offset(test, element, clientX, clientY, expectedOffsetX, expected OffsetY) {
17 element.onclick = test.step_func(function(event) {
18 assert_equals(event.offsetX, expectedOffsetX, 'offsetX');
19 assert_equals(event.offsetY, expectedOffsetY, 'offsetY');
20 });
21 var mouseEvent = new MouseEvent('click', { clientX: clientX, clientY: client Y });
22 element.dispatchEvent(mouseEvent);
23 }
24
25 test(function(t) {
26 var rects = document.querySelectorAll('rect');
27 var svgBoundingRect = document.querySelector('svg').getBoundingClientRect();
28 var offsetBase = { x: svgBoundingRect.left + 10, y: svgBoundingRect.top + 20 };
29 check_offset(t, rects[0], offsetBase.x + 80, offsetBase.y + 100, 80, 100);
30 check_offset(t, rects[1], offsetBase.x + 200, offsetBase.y + 220, 200, 220);
31 });
32 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698