servo icon indicating copy to clipboard operation
servo copied to clipboard

Enable ImageBitmap by default

Open jdm opened this issue 1 year ago • 7 comments

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.

jdm avatar Nov 02 '24 08:11 jdm

To add to the "known issues":

I don't think all of these should block enabling the interface by default, but it's worth noting them down anyways

simonwuelker avatar Nov 05 '24 10:11 simonwuelker

not done yet

sagudev avatar May 27 '25 07:05 sagudev

@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:

  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. ????

tharkum avatar Jun 09 '25 11:06 tharkum

It's not yet done. NEED to implement the following parts:

  1. Crop with formating
  2. Bitmap queue
  3. Remove from experimental feature
  4. Some minor issues...

tharkum avatar Jun 09 '25 15:06 tharkum

@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:

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.

jdm avatar Jun 09 '25 16:06 jdm

Maybe it's worth checking that library support all resizequality options.

sagudev avatar Jun 09 '25 16:06 sagudev

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).

tharkum avatar Jun 11 '25 13:06 tharkum

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?

tharkum avatar Jul 11 '25 13:07 tharkum

You mean remove it from the experimental list and enable it by default? I agree!

jdm avatar Jul 11 '25 14:07 jdm

Sounds good to me. I would also remove the preference entirely.

mrobinson avatar Jul 12 '25 00:07 mrobinson