You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for device-pixel-content-box-size w3c#3554 (w3c#4476)
Authors need a way to get the content box size in integral physical pixels. This allows for the correct sizing of the backing store of a canvas to match the snapped CSS size and prevents moire patterns that arise when the sizes are mismatched.
Currently authors could use devicePixelRatio and rounding in order to approximate this, but due to implementation differences in pixel snapping, can still get the wrong answer. Additionally, this can be affected by position changes which authors cannot currently hook into in a reasonable manner.
4. Set |this|.{{ResizeObserverEntry/contentBoxSize}} slot to result of <a href="#calculate-box-size">
265
287
computing size given |target| and observedBox of "content-box"</a>.
266
288
267
-
5. Set |this|.{{ResizeObserverEntry/contentRect}} to logical |this|.{{ResizeObserverEntry/contentBoxSize}}.
289
+
5. Set |this|.{{ResizeObserverEntry/devicePixelContentBoxSize}} slot to result of <a href="#calculate-box-size">
290
+
computing size given |target| and observedBox of "device-pixel-content-box"</a>.
291
+
292
+
6. Set |this|.{{ResizeObserverEntry/contentRect}} to logical |this|.{{ResizeObserverEntry/contentBoxSize}} given |target| and observedBox of "content-box".
268
293
269
-
6. If |target| is not an SVG element do these steps:
294
+
7. If |target| is not an SVG element do these steps:
270
295
271
296
1. Set |this|.|contentRect|.top to |target|.<a>padding top</a>.
272
297
273
298
2. Set |this|.|contentRect|.left to |target|.<a>padding left</a>.
274
299
275
-
7. If |target| is an SVG element do these steps:
300
+
8. If |target| is an SVG element do these steps:
276
301
277
302
1. Set |this|.|contentRect|.top and |this|.contentRect.left to 0.
278
303
@@ -448,6 +473,8 @@ run these steps:
448
473
449
474
2. Matching size is |entry|.{{ResizeObserverEntry/contentBoxSize}} if |observation|.{{ResizeObservation/observedBox}} is "content-box"
450
475
476
+
3. Matching size is |entry|.{{ResizeObserverEntry/devicePixelContentBoxSize}} if |observation|.{{ResizeObservation/observedBox}} is "device-pixel-content-box"
477
+
451
478
4. Set |targetDepth| to the result of <a>calculate depth for node</a> for |observation|.{{ResizeObservation/target}}.
452
479
453
480
5. Set |shallowestTargetDepth| to |targetDepth| if |targetDepth| < |shallowestTargetDepth|
@@ -505,6 +532,12 @@ To <dfn>calculate box size</dfn>, given |target| and |observedBox|, run these st
505
532
506
533
2. Set |computedSize|.blockSize to target's <a>content area</a> block length.
507
534
535
+
2. If |observedBox| is "device-pixel-content-box"
536
+
537
+
1. Set |computedSize|.inlineSize to target's <a>content area</a> inline length, in integral device pixels.
538
+
539
+
2. Set |computedSize|.blockSize to target's <a>content area</a> block length, in integral device pixels.
0 commit comments