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}
diff --git a/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html b/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html
index 2f06c5d..a49b4f6 100644
--- a/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html
+++ b/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html
@@ -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>
diff --git a/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.html b/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.html
index 0f7230e..9cff8d3 100644
--- a/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.html
+++ b/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.html
@@ -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');