Enable ImageBitmap by default
The DOM interface is gated behind dom.imagebitmap.enabled, which is disabled by default.
Spec: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap
Known missing APIs:
- [x] close https://github.com/servo/servo/pull/34124
- [x] ImageOrientation default has been renamed from "none" to "from-image" https://github.com/servo/servo/pull/34149
- [ ] the interface should be serializable and transferrable
Test coverage:
- https://github.com/servo/servo/tree/main/tests/wpt/meta/html/canvas/element/manual/imagebitmap
We currently fail all tests because we never migrated the preference from the 2013 layout results.
To add to the "known issues":
window.createImageBitmapdoes not follow the spec. For example, we should crop to the source rectangle with formattingImageBitmapSourceis missing multiple variants becauseCanvasImageSourceis incomplete
I don't think all of these should block enabling the interface by default, but it's worth noting them down anyways
not done yet
@jdm, @sagudev <
There is requirement to support optional scaling on image bitmap creation (Step 7).
I didn't find any scaling function out of box in Servo (did I miss something?). I am planning to use third-party library for it. Are there are some restrictions with LICENSE? Smth else?
Candidates:
- Resize (https://crates.io/crates/resize) - single-threaded, simple
- Fast Image Resize (https://crates.io/crates/fast_image_resize) - single/multi-threaded, SIMD
- ????
It's not yet done. NEED to implement the following parts:
- Crop with formating
- Bitmap queue
- Remove from experimental feature
- Some minor issues...
There is requirement to support optional scaling on image bitmap creation (Step 7).
I didn't find any scaling function out of box in Servo (did I miss something?). I am planning to use third-party library for it. Are there are some restrictions with LICENSE? Smth else?
Candidates:
1. Resize (https://crates.io/crates/resize) - single-threaded, simple 2. Fast Image Resize (https://crates.io/crates/fast_image_resize) - single/multi-threaded, SIMD 3. ????
Licensing is the only restriction. If it passes test-tidy's license check them it works.
Maybe it's worth checking that library support all resizequality options.
FYI < I looked at three packages (image/resize/fast_image_resize) and decided to implement the ImageBitmap resize functionality based on the "image" package (already in dependencies), even if the "fast_image_resize" package would have better performance on large images (multi-threading/SIMD).
Porting from "image" to "fast_image_resize" could be done as a separate task (needs to test on different platforms and confirm performance improvements).
I propose to remove ImageBitmap from experimental feature list (dom.imagebitmap.enabled)
because at current moment almost all major tests are passed except specific CanvasImageSource tests
(vector HTMImageElement, bitmap/vector SVGImageElement) and EXIF image orientation.
WDYT?
You mean remove it from the experimental list and enable it by default? I agree!
Sounds good to me. I would also remove the preference entirely.