diff --git a/complete.html b/complete.html index cf5ce9e8504..46fabbba897 100644 --- a/complete.html +++ b/complete.html @@ -7986,6 +7986,7 @@

2.7.5 Transferable objects<

2.7.6 Safe passing of structured data

+

When a user agent is required to obtain a structured clone of a value, optionally with a transfer map, it must run the following algorithm, which either returns a separate @@ -8074,7 +8075,7 @@

2.7.6 Safe passi
If input is an ImageData object

Let output be a newly constructed - ImageData object whose width and height attributes have values + ImageData object whose width, height, and resolution attributes have values equal to the corresponding attributes on input, and whose data attribute has the value obtained from invoking the internal structured cloning algorithm recursively with the value of the data attribute on input as the new "input" @@ -33233,6 +33234,7 @@

4.8.11.2 The 2D rendering context
interface ImageData { readonly attribute unsigned long width; readonly attribute unsigned long height; + readonly attribute double resolution; readonly attribute Uint8ClampedArray data; }; @@ -35620,9 +35622,10 @@
4.8.11.2.9 ImageBitmap - +

The ImageBitmap interface can be created from a number of other + image-representing types, including ImageData.

-

When a user agent is required to check the usability of the image +

When a user agent is required to check the usability of the image argument, where image is a CanvasImageSource object, the user agent must run these steps, which return either good, bad, or aborted:

@@ -37624,6 +37627,7 @@
4.8.11.2.15 Hit regions
4.8.11.2.16 Pixel manipulation
+
imagedata = context . createImageData(sw, sh)
@@ -37701,6 +37705,18 @@
4.8.11.2.16 Pixel manipu
+
imagedata . resolution
+ +
+ +

Returns the theoretical number of pixels in the ImageData object's data per + corresponding coordinate space unit. This value is automatically determined from the source + image when the ImageData object is created. It is only used to ensure that + ImageBitmap objects have the right pixel density when generated from + ImageData objects.

+ +
+
imagedata . data
@@ -37726,7 +37742,8 @@
4.8.11.2.16 Pixel manipu

Throws a NotSupportedError exception if any of the arguments are not finite.

-

Each pixel in the image data is mapped to one coordinate space unit on the bitmap.

+

Each pixel in the image data is mapped to one coordinate space unit on the bitmap, regardless + of the value of the resolution attribute.

@@ -37735,8 +37752,8 @@

4.8.11.2.16 Pixel manipu

Paints the data from the given ImageData object onto the bitmap, at the bitmap's - native pixel density. If a dirty rectangle is provided, only the pixels from that rectangle are - painted.

+ native pixel density (regardless of the value of the ImageData object's resolution attribute). If a dirty rectangle is provided, + only the pixels from that rectangle are painted.

The globalAlpha and globalCompositeOperation @@ -37758,23 +37775,21 @@

4.8.11.2.16 Pixel manipu objects.

When the createImageData() - method is invoked with two arguments sw and sh, it must return a new ImageData - object representing a rectangle with a width in equal to the - absolute magnitude of sw and a height equal to - the absolute magnitude of sh. When invoked with - a single imagedata argument, it must return a - new ImageData object representing a rectangle with the - same dimensions as the ImageData object passed as the - argument. The ImageData object returned must be filled - with transparent black.

+ method is invoked with two arguments sw and sh, it must + return a new ImageData object representing a rectangle with a width in equal to the + absolute magnitude of sw and a height equal to the absolute magnitude of sh, and with a 1.0 pixel density. When invoked with a single imagedata argument, it must return a new ImageData object representing + a rectangle with the same dimensions and pixel density as the ImageData object passed + as the argument. In either case, the ImageData object returned must be filled with + transparent black.

When the createImageDataHD() method is invoked (with its two arguments sw and sh) it must return a new ImageData object representing a rectangle with a width in equal to - the absolute magnitude of sw multiplied by scale and a - height equal to the absolute magnitude of sh multiplied by scale, where scale is the number of pixels in the scratch - bitmap per coordinate space units. The ImageData object returned must be - filled with transparent black.

+ the absolute magnitude of sw multiplied by scale, a height + equal to the absolute magnitude of sh multiplied by scale, + and a pixel density equal to scale, where scale is the + number of pixels in the scratch bitmap per coordinate space units. The + ImageData object returned must be filled with transparent black.

The getImageData(sx, sy, sw, sh) method must, if either the sw or sh arguments are zero, throw an @@ -37783,6 +37798,7 @@

4.8.11.2.16 Pixel manipu if the scratch bitmap's origin-clean flag is set to false, it must throw a SecurityError exception; + otherwise, it must return an ImageData object with width sw and height sh representing the scratch bitmap for the area of that bitmap denoted by the rectangle whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh), in the bitmap's coordinate space @@ -37790,7 +37806,7 @@
4.8.11.2.16 Pixel manipu the value of each pixel in the returned abject must be derived from the value(s) of the pixel(s) in the bitmap that correspond to the same coordinate. Pixels outside the scratch bitmap must be returned as transparent black. Pixels must be returned as non-premultiplied - alpha values.

+ alpha values. The pixel density of the object returned must be 1.0.

The getImageDataHD(sx, sy, sw, sh) method must, @@ -37804,13 +37820,17 @@

4.8.11.2.16 Pixel manipu multiplied by scale and height sh multiplied by scale representing the scratch bitmap for the area of that bitmap denoted by the rectangle whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh), in the bitmap's coordinate space units. Pixels outside the scratch bitmap must be returned as transparent black. - Pixels must be returned as non-premultiplied alpha values.

+ Pixels must be returned as non-premultiplied alpha values. The pixel density of the object + returned must be scale. For the purposes of this paragraph, scale is the number of pixels in the scratch bitmap per coordinate + space units.

+

New ImageData objects must be initialized so that their width attribute is set to the number of pixels per row in the image data, their height - attribute is set to the number of rows in the image data, and their + attribute is set to the number of rows in the image data, + their resolution is set to the object's pixel density, and their data attribute is initialized to a Uint8ClampedArray object. The Uint8ClampedArray object must use a Canvas Pixel @@ -73825,7 +73845,9 @@

7.6 Images

  • Create a new ImageBitmap object.

  • Let the ImageBitmap object's bitmap data be the image data given by the - ImageData object, cropped to the source rectangle.

  • + ImageData object, cropped to the source rectangle, using the value + ofd the object's resolution attribute as the + object's pixel density.
  • Return, but continue running these steps asynchronously.

  • diff --git a/index b/index index cf5ce9e8504..46fabbba897 100644 --- a/index +++ b/index @@ -7986,6 +7986,7 @@ interface Transferable { };

    2.7.6 Safe passing of structured data

    +

    When a user agent is required to obtain a structured clone of a value, optionally with a transfer map, it must run the following algorithm, which either returns a separate @@ -8074,7 +8075,7 @@ interface Transferable { };

    If input is an ImageData object

    Let output be a newly constructed - ImageData object whose width and height attributes have values + ImageData object whose width, height, and resolution attributes have values equal to the corresponding attributes on input, and whose data attribute has the value obtained from invoking the internal structured cloning algorithm recursively with the value of the data attribute on input as the new "input" @@ -33233,6 +33234,7 @@ dictionary HitRegionOptions { interface ImageData { readonly attribute unsigned long width; readonly attribute unsigned long height; + readonly attribute double resolution; readonly attribute Uint8ClampedArray data; }; @@ -35620,9 +35622,10 @@ try {

  • ImageBitmap
  • - +

    The ImageBitmap interface can be created from a number of other + image-representing types, including ImageData.

    -

    When a user agent is required to check the usability of the image +

    When a user agent is required to check the usability of the image argument, where image is a CanvasImageSource object, the user agent must run these steps, which return either good, bad, or aborted:

    @@ -37624,6 +37627,7 @@ partial dictionary MouseEventInit {
    4.8.11.2.16 Pixel manipulation
    +
    imagedata = context . createImageData(sw, sh)
    @@ -37701,6 +37705,18 @@ partial dictionary MouseEventInit {
    +
    imagedata . resolution
    + +
    + +

    Returns the theoretical number of pixels in the ImageData object's data per + corresponding coordinate space unit. This value is automatically determined from the source + image when the ImageData object is created. It is only used to ensure that + ImageBitmap objects have the right pixel density when generated from + ImageData objects.

    + +
    +
    imagedata . data
    @@ -37726,7 +37742,8 @@ partial dictionary MouseEventInit {

    Throws a NotSupportedError exception if any of the arguments are not finite.

    -

    Each pixel in the image data is mapped to one coordinate space unit on the bitmap.

    +

    Each pixel in the image data is mapped to one coordinate space unit on the bitmap, regardless + of the value of the resolution attribute.

    @@ -37735,8 +37752,8 @@ partial dictionary MouseEventInit {

    Paints the data from the given ImageData object onto the bitmap, at the bitmap's - native pixel density. If a dirty rectangle is provided, only the pixels from that rectangle are - painted.

    + native pixel density (regardless of the value of the ImageData object's resolution attribute). If a dirty rectangle is provided, + only the pixels from that rectangle are painted.

    The globalAlpha and globalCompositeOperation @@ -37758,23 +37775,21 @@ partial dictionary MouseEventInit { objects.

    When the createImageData() - method is invoked with two arguments sw and sh, it must return a new ImageData - object representing a rectangle with a width in equal to the - absolute magnitude of sw and a height equal to - the absolute magnitude of sh. When invoked with - a single imagedata argument, it must return a - new ImageData object representing a rectangle with the - same dimensions as the ImageData object passed as the - argument. The ImageData object returned must be filled - with transparent black.

    + method is invoked with two arguments sw and sh, it must + return a new ImageData object representing a rectangle with a width in equal to the + absolute magnitude of sw and a height equal to the absolute magnitude of sh, and with a 1.0 pixel density. When invoked with a single imagedata argument, it must return a new ImageData object representing + a rectangle with the same dimensions and pixel density as the ImageData object passed + as the argument. In either case, the ImageData object returned must be filled with + transparent black.

    When the createImageDataHD() method is invoked (with its two arguments sw and sh) it must return a new ImageData object representing a rectangle with a width in equal to - the absolute magnitude of sw multiplied by scale and a - height equal to the absolute magnitude of sh multiplied by scale, where scale is the number of pixels in the scratch - bitmap per coordinate space units. The ImageData object returned must be - filled with transparent black.

    + the absolute magnitude of sw multiplied by scale, a height + equal to the absolute magnitude of sh multiplied by scale, + and a pixel density equal to scale, where scale is the + number of pixels in the scratch bitmap per coordinate space units. The + ImageData object returned must be filled with transparent black.

    The getImageData(sx, sy, sw, sh) method must, if either the sw or sh arguments are zero, throw an @@ -37783,6 +37798,7 @@ partial dictionary MouseEventInit { if the scratch bitmap's origin-clean flag is set to false, it must throw a SecurityError exception; + otherwise, it must return an ImageData object with width sw and height sh representing the scratch bitmap for the area of that bitmap denoted by the rectangle whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh), in the bitmap's coordinate space @@ -37790,7 +37806,7 @@ partial dictionary MouseEventInit { the value of each pixel in the returned abject must be derived from the value(s) of the pixel(s) in the bitmap that correspond to the same coordinate. Pixels outside the scratch bitmap must be returned as transparent black. Pixels must be returned as non-premultiplied - alpha values.

    + alpha values. The pixel density of the object returned must be 1.0.

    The getImageDataHD(sx, sy, sw, sh) method must, @@ -37804,13 +37820,17 @@ partial dictionary MouseEventInit { multiplied by scale and height sh multiplied by scale representing the scratch bitmap for the area of that bitmap denoted by the rectangle whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh), in the bitmap's coordinate space units. Pixels outside the scratch bitmap must be returned as transparent black. - Pixels must be returned as non-premultiplied alpha values.

    + Pixels must be returned as non-premultiplied alpha values. The pixel density of the object + returned must be scale. For the purposes of this paragraph, scale is the number of pixels in the scratch bitmap per coordinate + space units.

    +

    New ImageData objects must be initialized so that their width attribute is set to the number of pixels per row in the image data, their height - attribute is set to the number of rows in the image data, and their + attribute is set to the number of rows in the image data, + their resolution is set to the object's pixel density, and their data attribute is initialized to a Uint8ClampedArray object. The Uint8ClampedArray object must use a Canvas Pixel @@ -73825,7 +73845,9 @@ interface ImageBitmapFactories {

  • Create a new ImageBitmap object.

  • Let the ImageBitmap object's bitmap data be the image data given by the - ImageData object, cropped to the source rectangle.

  • + ImageData object, cropped to the source rectangle, using the value + ofd the object's resolution attribute as the + object's pixel density.
  • Return, but continue running these steps asynchronously.

  • diff --git a/source b/source index fcd8b923691..eb91bce9f2a 100644 --- a/source +++ b/source @@ -7637,6 +7637,7 @@ interface Transferable { };

    Safe passing of structured data

    +

    When a user agent is required to obtain a structured clone of a value, optionally with a transfer map, it must run the following algorithm, which either returns a separate @@ -7737,8 +7738,9 @@ interface Transferable { };

    Let output be a newly constructed ImageData object whose width and height attributes have values + title="dom-imagedata-width">width, height, and resolution attributes have values equal to the corresponding attributes on input, and whose data attribute has the value @@ -35860,6 +35862,7 @@ dictionary HitRegionOptions { interface ImageData { readonly attribute unsigned long width; readonly attribute unsigned long height; + readonly attribute double resolution; readonly attribute Uint8ClampedArray data; }; @@ -38707,10 +38710,11 @@ try {

  • ImageBitmap
  • - - +

    The ImageBitmap interface can be created from a number of other + image-representing types, including ImageData.

    +

    When a user agent is required to check the usability of the image argument, where image is a CanvasImageSource object, the user agent must run these steps, which return either good, bad, or @@ -41118,6 +41122,7 @@ partial dictionary MouseEventInit {

    Pixel manipulation
    +
    @@ -41197,6 +41202,18 @@ partial dictionary MouseEventInit {
    +
    imagedata . resolution
    + +
    + +

    Returns the theoretical number of pixels in the ImageData object's data per + corresponding coordinate space unit. This value is automatically determined from the source + image when the ImageData object is created. It is only used to ensure that + ImageBitmap objects have the right pixel density when generated from + ImageData objects.

    + +
    +
    imagedata . data
    @@ -41223,7 +41240,8 @@ partial dictionary MouseEventInit {

    Throws a NotSupportedError exception if any of the arguments are not finite.

    -

    Each pixel in the image data is mapped to one coordinate space unit on the bitmap.

    +

    Each pixel in the image data is mapped to one coordinate space unit on the bitmap, regardless + of the value of the resolution attribute.

    @@ -41232,8 +41250,9 @@ partial dictionary MouseEventInit {

    Paints the data from the given ImageData object onto the bitmap, at the bitmap's - native pixel density. If a dirty rectangle is provided, only the pixels from that rectangle are - painted.

    + native pixel density (regardless of the value of the ImageData object's resolution attribute). If a dirty rectangle is provided, + only the pixels from that rectangle are painted.

    The globalAlpha and MouseEventInit { methods are used to instantiate new blank ImageData objects.

    -

    When the createImageData() - method is invoked with two arguments sw and sh, it must return a new ImageData - object representing a rectangle with a width in equal to the - absolute magnitude of sw and a height equal to - the absolute magnitude of sh. When invoked with - a single imagedata argument, it must return a - new ImageData object representing a rectangle with the - same dimensions as the ImageData object passed as the - argument. The ImageData object returned must be filled - with transparent black.

    +

    When the createImageData() + method is invoked with two arguments sw and sh, it must + return a new ImageData object representing a rectangle with a width in equal to the + absolute magnitude of sw and a height equal to the absolute magnitude of sh, and with a 1.0 pixel density. When invoked with a single imagedata argument, it must return a new ImageData object representing + a rectangle with the same dimensions and pixel density as the ImageData object passed + as the argument. In either case, the ImageData object returned must be filled with + transparent black.

    When the createImageDataHD() method is invoked (with its two arguments sw and sh) it must return a new ImageData object representing a rectangle with a width in equal to - the absolute magnitude of sw multiplied by scale and a - height equal to the absolute magnitude of sh multiplied by scale, where scale is the number of pixels in the scratch - bitmap per coordinate space units. The ImageData object returned must be - filled with transparent black.

    + the absolute magnitude of sw multiplied by scale, a height + equal to the absolute magnitude of sh multiplied by scale, + and a pixel density equal to scale, where scale is the + number of pixels in the scratch bitmap per coordinate space units. The + ImageData object returned must be filled with transparent black.

    The getImageData(sx, sy, sw, sh) method must, if @@ -41289,6 +41305,7 @@ partial dictionary MouseEventInit { if the scratch bitmap's origin-clean flag is set to false, it must throw a SecurityError exception; + otherwise, it must return an ImageData object with width sw and height sh representing the scratch bitmap for the area of that bitmap denoted by the rectangle whose corners are the four points (sx, MouseEventInit { the value of each pixel in the returned abject must be derived from the value(s) of the pixel(s) in the bitmap that correspond to the same coordinate. Pixels outside the scratch bitmap must be returned as transparent black. Pixels must be returned as non-premultiplied - alpha values.

    + alpha values. The pixel density of the object returned must be 1.0.

    The getImageDataHD(sx, sy, sw, sh) method must, @@ -41319,13 +41336,18 @@ partial dictionary MouseEventInit { title="">sy+sh), (sx, sy+sh), in the bitmap's coordinate space units. Pixels outside the scratch bitmap must be returned as transparent black. - Pixels must be returned as non-premultiplied alpha values.

    + Pixels must be returned as non-premultiplied alpha values. The pixel density of the object + returned must be scale. For the purposes of this paragraph, scale is the number of pixels in the scratch bitmap per coordinate + space units.

    +

    New ImageData objects must be initialized so that their width attribute is set to the number of pixels per row in the image data, their height - attribute is set to the number of rows in the image data, and their + attribute is set to the number of rows in the image data, + their resolution is set to the object's pixel density, and their data attribute is initialized to a Uint8ClampedArray object. The Uint8ClampedArray object must use a Canvas Pixel @@ -82835,7 +82857,9 @@ interface ImageBitmapFactories {

  • Create a new ImageBitmap object.

  • Let the ImageBitmap object's bitmap data be the image data given by the - ImageData object, cropped to the source rectangle.

  • + ImageData object, cropped to the source rectangle, using the value + ofd the object's resolution attribute as the + object's pixel density.

  • Return, but continue running these steps asynchronously.