Bug 1744873 [wpt PR 31949] - Rename windowControlsOverlay.getBoundingClientRect->getTitlebarAreaRect, a=testonly

Automatic update from web-platform-tests
Rename windowControlsOverlay.getBoundingClientRect->getTitlebarAreaRect

This change renames the existing JS API for Window Controls Overlay
(WCO) from:
navigator.windowControlsOverlay.getBoundingClientRect()
to
navigator.windowControlsOverlay.getTitlebarAreaRect()

The new name addresses feedback about how the original API name was
misleading since windowControlsOverlay.getBoundingClientRect() actually
returns the available area *next to* the overlay.

The new name--getTitlebarAreaRect--matches the CSS environment
variables: `titlebar-area-x/y/width/height`

Bug: 1276216
Change-Id: I95e2bc680d124aaa69f0c12ea0ba41399b77185c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3319288
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Amanda Baker <ambake@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#949881}

--

wpt-commits: 4ca37709cc20798ffa7779d1709067db80036999
wpt-pr: 31949
This commit is contained in:
Amanda Baker 2021-12-09 16:19:39 +00:00 коммит произвёл moz-wptsync-bot
Родитель c9cb54a488
Коммит 631fe3067b
2 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -34,12 +34,12 @@
const w = getComputedStyle(windowControlsOverlayElementStyle).getPropertyValue('padding-right');
const y = getComputedStyle(windowControlsOverlayElementStyle).getPropertyValue('padding-top');
const h = getComputedStyle(windowControlsOverlayElementStyle).getPropertyValue('padding-bottom');
const boundingClientRect = navigator.windowControlsOverlay.getBoundingClientRect();
const boundingClientRect = navigator.windowControlsOverlay.getTitlebarAreaRect();
manual_test.step(() => {
assert_equals(x, boundingClientRect.x + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getBoundingClientRect().x');
assert_equals(y, boundingClientRect.y + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getBoundingClientRect().y');
assert_equals(w, boundingClientRect.width + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getBoundingClientRect().width');
assert_equals(h, boundingClientRect.height + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getBoundingClientRect().height');
assert_equals(x, boundingClientRect.x + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getTitlebarAreaRect().x');
assert_equals(y, boundingClientRect.y + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getTitlebarAreaRect().y');
assert_equals(w, boundingClientRect.width + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getTitlebarAreaRect().width');
assert_equals(h, boundingClientRect.height + 'px', 'CSS environment "titlebar-area-x" does not equal navigator.windowControlsOverlay.getTitlebarAreaRect().height');
});
manual_test.done();
}
@ -51,7 +51,7 @@
<body>
<h1>Description</h1>
<p>This test validates that when in "window-controls-overlay" mode, the 'titlebar-area-*' CSS environment variables
match the values returned by navigator.windowControlsOverlay.getBoundingClientRect().</p>
match the values returned by navigator.windowControlsOverlay.getTitlebarAreaRect().</p>
<h1>Manual Test Steps:</h1>
<p>
<ol>

Просмотреть файл

@ -19,21 +19,21 @@
}, 'visible should be false');
test(function(){
assert_idl_attribute(navigator.windowControlsOverlay, 'getBoundingClientRect');
}, 'getBoundingClientRect should be a method of the windowControlsOverlay object');
assert_idl_attribute(navigator.windowControlsOverlay, 'getTitlebarAreaRect');
}, 'getTitlebarAreaRect should be a method of the windowControlsOverlay object');
test(function(){
var rect = navigator.windowControlsOverlay.getBoundingClientRect();
var rect = navigator.windowControlsOverlay.getTitlebarAreaRect();
assert_true(rect instanceof DOMRect);
}, 'getBoundingClientRect return type should be DOMRect');
}, 'getTitlebarAreaRect return type should be DOMRect');
test(function(){
var rect = navigator.windowControlsOverlay.getBoundingClientRect();
var rect = navigator.windowControlsOverlay.getTitlebarAreaRect();
assert_equals(rect.x, 0);
assert_equals(rect.y, 0);
assert_equals(rect.width, 0);
assert_equals(rect.height, 0);
}, 'getBoundingClientRect should return a empty DOMRect');
}, 'getTitlebarAreaRect should return a empty DOMRect');
test(function(){
assert_idl_attribute(navigator.windowControlsOverlay, 'ongeometrychange');