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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/getScreenCTM-ancestor-transform.html

Issue 2711503002: Compute a more correct "screen scope" transform for SVGSVGElement (Closed)
Patch Set: Tweak test Created 3 years, 10 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/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html » ('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>getScreenCTM: Outermost SVG element ancestor position/transform</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <body>
6 <script>
7 function to_array(matrix) {
8 return [ matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f ];
9 }
10
11 function assert_array_approx_equals(actual, expected) {
12 assert_equals(actual.length, expected.length);
13 for (let i = 0; i < expected.length; ++i)
14 assert_approx_equals(actual[i], expected[i], 0.0005);
15 }
16
17 function check_screen_ctm(document_data, expected_array) {
18 async_test(t => {
19 let blob = new Blob([ '<!DOCTYPE html>', document_data ], { type: 'text/html ' });
20 let iframe = document.createElement('iframe');
21 iframe.src = URL.createObjectURL(blob);
22 iframe.onload = t.step_func_done(() => {
23 var ctm = iframe.contentDocument.querySelector("rect").getScreenCTM();
24 iframe.remove();
25 assert_array_approx_equals(to_array(ctm), expected_array);
26 });
27 document.body.appendChild(iframe);
28 });
29 }
30
31 const COMMON_PAYLOAD = '<svg display="block"><rect width="100" height="100"/></s vg></div>';
32
33 check_screen_ctm('<div>' + COMMON_PAYLOAD,
34 [ 1, 0, 0, 1, 8, 8 ]);
35 check_screen_ctm('<div style="transform: translateX(100px)">' + COMMON_PAYLOAD,
36 [ 1, 0, 0, 1, 108, 8 ]);
37 check_screen_ctm('<div style="transform: translate(100px, 100px)">' + COMMON_PAY LOAD,
38 [ 1, 0, 0, 1, 108, 108 ]);
39 check_screen_ctm('<div style="transform: rotate(45deg); width: 300px;">' + COMMO N_PAYLOAD,
40 [ 0.707, 0.707, -0.707, 0.707, 104.967, -76.099 ]);
41 check_screen_ctm('<div style="transform: rotate(45deg) scale(10); width: 300px;" >' + COMMON_PAYLOAD,
42 [ 7.071, 7.071, -7.071, 7.071, -372.330, -1507.990 ]);
43 check_screen_ctm('<div style="height: 400px"></div><div style="transform: rotate (45deg); width: 300px;">' + COMMON_PAYLOAD,
44 [ 0.707, 0.707, -0.707, 0.707, 104.967, 400 + -76.099 ]);
45 check_screen_ctm('<div style="height: 400px"></div><div style="transform: rotate (45deg); width: 300px;">' + COMMON_PAYLOAD +
46 '<script>window.scrollBy(0, 200)<'+'/script>',
47 [ 0.707, 0.707, -0.707, 0.707, 104.967, -200 + 400 + -76.099 ]) ;
48 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698