diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml')
-rw-r--r-- | testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml new file mode 100644 index 0000000000..dd088aa396 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml @@ -0,0 +1,76 @@ +- name: 2d.scrollPathIntoView.basic + desc: scrollPathIntoView() works + canvasType: + ['HTMLCanvas'] + code: | + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; + window.scrollTo(0, 0); + + ctx.beginPath(); + ctx.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(); + var rect = canvas.getBoundingClientRect(); + @assert Math.round(rect.top) === -8; + @assert Math.round(rect.left) === 200; + +- name: 2d.scrollPathIntoView.verticalLR + desc: scrollPathIntoView() works in vertical-lr writing mode + canvasType: + ['HTMLCanvas'] + code: | + document.documentElement.style.cssText = 'writing-mode: vertical-lr'; + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; + window.scrollTo(0, 0); + + ctx.beginPath(); + ctx.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(); + var rect = canvas.getBoundingClientRect(); + @assert Math.round(rect.top) === 100; + @assert Math.round(rect.left) === -4; + +- name: 2d.scrollPathIntoView.verticalRL + desc: scrollPathIntoView() works in vertical-rl writing mode + canvasType: + ['HTMLCanvas'] + code: | + document.documentElement.style.cssText = 'writing-mode: vertical-rl'; + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; right: 200px; border: none;'; + window.scrollTo(0, 0); + + ctx.beginPath(); + ctx.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(); + var rect = canvas.getBoundingClientRect(); + var viewportWidth = document.scrollingElement.clientWidth; + var canvasWidth = canvas.width; + @assert Math.round(rect.top) === 100; + @assert Math.round(rect.right) === viewportWidth + (canvasWidth - 4 - 16); + +- name: 2d.scrollPathIntoView.path + desc: scrollPathIntoView() with path argument works + canvasType: + ['HTMLCanvas'] + code: | + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; + window.scrollTo(0, 0); + + var path = new Path2D(); + path.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(path); + var rect = canvas.getBoundingClientRect(); + @assert Math.round(rect.top) === -8; + @assert Math.round(rect.left) === 200; + |