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

Side by Side Diff: third_party/WebKit/LayoutTests/images/color-profile-drag-image.html

Issue 2938543003: Remove almost all Javascript calls to setColorProfile (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <script src="../resources/run-after-layout-and-paint.js"></script> 3 <script src="../resources/run-after-layout-and-paint.js"></script>
4 4
5 <style> 5 <style>
6 img, canvas { margin: 5px; width: 48% } 6 img, canvas { margin: 5px; width: 48% }
7 </style> 7 </style>
8 8
9 <body style="overflow: hidden"> 9 <body style="overflow: hidden">
10 <!-- The _blue_ sector of the <img> image should be at 12 o'clock. --> 10 <!-- The _blue_ sector of the <img> image should be at 12 o'clock. -->
11 <img> 11 <img>
12 <!-- The red sector of the <canvas> image should be at 12 o'clock. --> 12 <!-- The red sector of the <canvas> image should be at 12 o'clock. -->
13 <canvas></canvas> 13 <canvas></canvas>
14 </body> 14 </body>
15 15
16 <script> 16 <script>
17 if (window.testRunner) { 17 if (window.testRunner) {
18 // The pixel result will be the drag image. The blue sector if the 18 // The pixel result will be the drag image. The blue sector if the
19 // drag image should be at 12 o'clock. 19 // drag image should be at 12 o'clock.
20 testRunner.dumpDragImage(); 20 testRunner.dumpDragImage();
21 } 21 }
22 22
23 window.onload = function() { 23 window.onload = function() {
24 if (window.testRunner) 24 if (window.testRunner)
25 testRunner.waitUntilDone(); 25 testRunner.waitUntilDone();
26 26
27 var image = document.querySelector('img'); 27 var image = document.querySelector('img');
28 image.onload = function() { 28 image.onload = function() {
29 runAfterLayoutAndPaint(window.testRunner ? changeColorProfile : profileChang ed); 29 runAfterLayoutAndPaint(drawImagePatternToCanvas);
30 }; 30 };
31 31
32 image.src = 'resources/red-at-12-oclock-with-color-profile.jpg'; 32 image.src = 'resources/red-at-12-oclock-with-color-profile.jpg';
33 }; 33 };
34 34
35 function changeColorProfile() {
36 window.testRunner.setColorProfile('colorSpin', profileChanged);
37 }
38
39 function profileChanged() {
40 setTimeout(drawImagePatternToCanvas, 0);
41 }
42
43 function drawImagePatternToCanvas() { 35 function drawImagePatternToCanvas() {
44 var canvas = document.querySelector('canvas'); 36 var canvas = document.querySelector('canvas');
45 var ctx = canvas.getContext('2d'); 37 var ctx = canvas.getContext('2d');
46 var pattern = ctx.createPattern(document.querySelector('img'), null); 38 var pattern = ctx.createPattern(document.querySelector('img'), null);
47 var scale = 0.1870; 39 var scale = 0.1870;
48 40
49 ctx.clearRect(0, 0, canvas.width = 300, canvas.height = 300); 41 ctx.clearRect(0, 0, canvas.width = 300, canvas.height = 300);
50 ctx.save(); 42 ctx.save();
51 ctx.scale(scale, scale); 43 ctx.scale(scale, scale);
52 ctx.fillStyle = pattern; 44 ctx.fillStyle = pattern;
(...skipping 19 matching lines...) Expand all
72 eventSender.mouseMoveTo(x + 100, y + 100); 64 eventSender.mouseMoveTo(x + 100, y + 100);
73 eventSender.mouseUp(); 65 eventSender.mouseUp();
74 } 66 }
75 67
76 if (window.testRunner) 68 if (window.testRunner)
77 setTimeout(function() { window.testRunner.notifyDone() }, 100); 69 setTimeout(function() { window.testRunner.notifyDone() }, 100);
78 } 70 }
79 71
80 </script> 72 </script>
81 </html> 73 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698