Index: third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-pattern.html |
diff --git a/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-pattern.html b/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-pattern.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0be91db00efcf25dce5f43abbe92712c03f6bc1b |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-pattern.html |
@@ -0,0 +1,61 @@ |
+<!DOCTYPE html> |
+<html> |
+<script src="../../resources/run-after-layout-and-paint.js"></script> |
+ |
+<style> |
+ canvas { transform: translateZ(0); } |
+ img, canvas { margin: 5px; width: 48% } |
+</style> |
+ |
+<body style="overflow: hidden"> |
+ <!-- The _blue_ sector of the <img> image should be at 12 o'clock. --> |
+ <img> |
+ <!-- The red sector of the <canvas> image should be at 12 o'clock. --> |
+ <canvas></canvas> |
+</body> |
+ |
+<script> |
+if (window.testRunner) { |
+ testRunner.dumpAsTextWithPixelResults(); |
+ testRunner.waitUntilDone(); |
+} |
+ |
+window.onload = function() { |
+ if (window.internals) |
+ internals.settings.setImageColorProfilesEnabled(true); |
+ |
+ var image = document.querySelector('img'); |
+ image.onload = function() { |
+ runAfterLayoutAndPaint(window.testRunner ? changeColorProfile : profileChanged); |
+ }; |
+ |
+ image.src = 'resources/red-at-12-oclock-with-color-profile.jpg'; |
+}; |
+ |
+function changeColorProfile() { |
+ window.testRunner.setColorProfile('whacked', profileChanged); |
+} |
+ |
+function profileChanged() { |
+ setTimeout(drawImagePatternToCanvas, 0); |
+} |
+ |
+function drawImagePatternToCanvas() { |
+ var canvas = document.querySelector('canvas'); |
+ var ctx = canvas.getContext('2d'); |
+ var pattern = ctx.createPattern(document.querySelector('img'), null); |
+ var scale = 0.1870; |
+ |
+ ctx.clearRect(0, 0, canvas.width = 300, canvas.height = 300); |
+ ctx.save(); |
+ ctx.scale(scale, scale); |
+ ctx.fillStyle = pattern; |
+ ctx.fillRect(0, 0, canvas.width / scale, canvas.height / scale); |
+ ctx.restore(); |
+ |
+ if (window.testRunner) |
+ window.testRunner.notifyDone(); |
+} |
+ |
+</script> |
+</html> |