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

Unified Diff: LayoutTests/fast/hidpi/resources/svg_canvas_helper.js

Issue 25105004: Use srcset's resource pixel density to determine intrinsic size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleantests
Patch Set: Fixed crash+rebased Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/hidpi/resources/srcset-helper.js ('k') | LayoutTests/fast/hidpi/resources/svg_tests.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/hidpi/resources/svg_canvas_helper.js
diff --git a/LayoutTests/fast/hidpi/resources/svg_canvas_helper.js b/LayoutTests/fast/hidpi/resources/svg_canvas_helper.js
new file mode 100644
index 0000000000000000000000000000000000000000..6da130242a80d0878a39f55e4c06ef57a7aea155
--- /dev/null
+++ b/LayoutTests/fast/hidpi/resources/svg_canvas_helper.js
@@ -0,0 +1,20 @@
+function printSizes(imageId, outputId) {
+ var image = document.getElementById(imageId);
+ image.addEventListener('load', function() {
+ var output = document.getElementById(outputId);
+ output.innerHTML = 'image stats: '
+ + 'size(' + image.width + ',' + image.height + '), '
+ + 'naturalSize(' + image.naturalWidth + ',' + image.naturalHeight + ')<br/>'
+ + 'image codes: '
+ + image.outerHTML.replace(/</g, "&lt;").replace(/>/g, "&gt;");
+ });
+}
+
+function drawCanvas(imageId, canvasId, canvasWidth, canvasHeight) {
+ var image = document.getElementById(imageId);
+ var canvas = document.getElementById(canvasId);
+ canvas.width = canvasWidth;
+ canvas.height = canvasHeight;
+ var context = canvas.getContext('2d');
+ context.drawImage(image, 0, 0);
+}
« no previous file with comments | « LayoutTests/fast/hidpi/resources/srcset-helper.js ('k') | LayoutTests/fast/hidpi/resources/svg_tests.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698