From 6992635568402568375ed92cda896a79218e44c9 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Thu, 23 Jun 2022 13:26:25 -0700 Subject: [PATCH] Add new devicePixel ref test See comments in test for details --- resize-observer/create-pattern-data-url.js | 22 ++++ resize-observer/devicepixel2-ref.html | 21 ++++ resize-observer/devicepixel2.html | 129 +++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 resize-observer/create-pattern-data-url.js create mode 100644 resize-observer/devicepixel2-ref.html create mode 100644 resize-observer/devicepixel2.html diff --git a/resize-observer/create-pattern-data-url.js b/resize-observer/create-pattern-data-url.js new file mode 100644 index 00000000000000..d3634dc424b96c --- /dev/null +++ b/resize-observer/create-pattern-data-url.js @@ -0,0 +1,22 @@ +const patternSize = 4; + +export default function createPatternDataURL() { + const ctx = document.createElement('canvas').getContext('2d'); + ctx.canvas.width = patternSize; + ctx.canvas.height = patternSize; + + const b = [0, 0, 0, 255]; + const t = [0, 0, 0, 0]; + const r = [255, 0, 0, 255]; + const g = [0, 255, 0, 255]; + + const imageData = new ImageData(patternSize, patternSize); + imageData.data.set([ + b, t, t, r, + t, b, g, t, + t, r, b, t, + g, t, t, b, + ].flat()); + ctx.putImageData(imageData, 0, 0); + return {patternSize, dataURL: ctx.canvas.toDataURL()}; +} diff --git a/resize-observer/devicepixel2-ref.html b/resize-observer/devicepixel2-ref.html new file mode 100644 index 00000000000000..7674eb0ab835a1 --- /dev/null +++ b/resize-observer/devicepixel2-ref.html @@ -0,0 +1,21 @@ + + + + diff --git a/resize-observer/devicepixel2.html b/resize-observer/devicepixel2.html new file mode 100644 index 00000000000000..581fefa0a2645a --- /dev/null +++ b/resize-observer/devicepixel2.html @@ -0,0 +1,129 @@ + + + + + +
+ +