Skip to content

Commit

Permalink
[Image-Orientation] Have ImageBitmap.width and .height report oriente…
Browse files Browse the repository at this point in the history
…d sizes

ImageBitmap has only width and height properties, forcing us to choose
one of oriented or unoriented values to report. Given oriented usage is
now the default, we'll change the reported sizes to match the used sizes.

A spec issue will be raised to add naturalWidth or orientedWidth so
that developers can get the data they want.

Also fix a broken path in drawImage-with-src-rect-ref.html

Bug: 1082451
Change-Id: I4dd59766769bbb7175d8216845f19f9122129e16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2198654
Auto-Submit: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#768689}
  • Loading branch information
schenney-chromium authored and chromium-wpt-export-bot committed May 14, 2020
1 parent ae1e2d5 commit e4d5929
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
function makeBlob() {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open("GET", '/css/css-images/image-orientation/support/exif-orientation-3-lr.jpg');
xhr.open("GET", '/css/css-images/image-orientation/support/exif-orientation-8-llo.jpg');
xhr.responseType = 'blob';
xhr.send();
xhr.onload = function() {
Expand All @@ -22,7 +22,7 @@
window.onload = function() {
var cfb = document.getElementById("canvasWithFileBitmap");
makeBlob().then(function(blob){createImageBitmap(blob).then(bitmap => {
cfb.getContext("2d").drawImage(bitmap, 0, 0);
cfb.getContext("2d").drawImage(bitmap, 0, 0, 150, 150 * bitmap.height / bitmap.width);
window.requestAnimationFrame(() => {
document.documentElement.removeAttribute("class");
});
Expand All @@ -32,6 +32,6 @@
</script>
</head>
<body>
<canvas id="canvasWithFileBitmap" width="300" height="300"></canvas>
<canvas id="canvasWithFileBitmap" width="150" height="300"></canvas>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</script>
</head>
<body>
<img id="img-element" src="../../../css/css-images/image-orientation/support/exif-orientation-3-lr.jpg">
<img id="img-element" src="/css/css-images/image-orientation/support/exif-orientation-3-lr.jpg">
<canvas id="bitmap-canvas"></canvas>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<title>createImageBitmap and drawImage from a blob with image orientation: from-image, reference</title>
</head>
<body>
<img id="img-element" src="/css/css-images/image-orientation/support/exif-orientation-3-lr.jpg">
<img id="img-element" style="width: 150px; height: 300px;" src="/css/css-images/image-orientation/support/exif-orientation-8-llo.jpg">
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</script>
</head>
<body>
<img id="img-element" src="../../../../css/css-images/image-orientation/support/exif-orientation-3-lr-pre-rotated.jpg">
<img id="img-element" src="/css/css-images/image-orientation/support/exif-orientation-3-lr-pre-rotated.jpg">
<canvas id="bitmap-canvas"></canvas>
</body>
</html>

0 comments on commit e4d5929

Please sign in to comment.