servo/components/script_bindings/webidls/ImageBitmap.webidl
Andrei Volykhin 4ee348a202
imagebitmap: Add 'none' image orientation option (#37634)
The 'none' image orientation option was temporarily deprecated (in 2022)
according to HTML specification with the remark about going to be reused
with
a different meaning in future as the same semantics as CSS 'none'
image-orientation.

https://html.spec.whatwg.org/multipage/#dom-imagebitmapoptions-imageorientation-none
https://www.w3.org/TR/css-images-3/#valdef-image-orientation-none

Official MDN documentation added it back with new meaning (in 2024),
but it wasn't added back to HTML specification (still pending).

https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap#none

At current moment this option is poor supported on all major browsers,
but there are some
existed WPT tests (ImageBitmap/WebGL) which are actively use it in
createImageBitmap() options.

Chromium (supported):
- stable: same as 'from-image' (but with deprecation warning)
- experimental: ignoring any orientation metadata

Firefox (supported as default option):
- stable: ignoring any orientation metadata ('from-image' do the same)

Testing: Improvements and fails (expects 'from-image' behaviour from
'none' option) in the following tests
-
html/canvas/element/manual/imagebitmap/createImageBitmap-exif-orientation_none.html
- webgl/tests/conformance/textures/misc/exif-orientation.html

Fixes (partialy): #34112

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-25 07:20:12 +00:00

35 lines
1.3 KiB
Text

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://html.spec.whatwg.org/multipage/#imagebitmap
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA.
* You are granted a license to use, reproduce and create derivative works of this document.
*/
[Exposed=(Window,Worker), Serializable, Transferable, Pref="dom_imagebitmap_enabled"]
interface ImageBitmap {
readonly attribute unsigned long width;
readonly attribute unsigned long height;
undefined close();
};
typedef (CanvasImageSource or
Blob or
ImageData) ImageBitmapSource;
enum ImageOrientation { "from-image", "flipY", "none" };
enum PremultiplyAlpha { "none", "premultiply", "default" };
enum ColorSpaceConversion { "none", "default" };
enum ResizeQuality { "pixelated", "low", "medium", "high" };
dictionary ImageBitmapOptions {
ImageOrientation imageOrientation = "from-image";
PremultiplyAlpha premultiplyAlpha = "default";
ColorSpaceConversion colorSpaceConversion = "default";
[EnforceRange] unsigned long resizeWidth;
[EnforceRange] unsigned long resizeHeight;
ResizeQuality resizeQuality = "low";
};