commit 632ec351ec6fda3a7d97e1ff60f25c81c587c0e0
parent f0060ade3b03e9c4cfde180e3fac50ade2a42b46
Author: Sam Foster <sfoster@mozilla.com>
Date: Fri, 12 Dec 2025 16:36:42 +0000
Bug 1983318 - Expect some pixel snapping on urlbar bottom border in the flicker tests. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D276006
Diffstat:
3 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/browser/base/content/test/performance/browser_startup_flicker.js b/browser/base/content/test/performance/browser_startup_flicker.js
@@ -22,6 +22,7 @@ add_task(async function () {
let alreadyFocused = false;
let inRange = (val, min, max) => min <= val && val <= max;
let tabBoundingRect = undefined;
+ let urlbarBoundingRect = undefined;
for (let i = 1; i < frames.length; ++i) {
let frame = frames[i],
previousFrame = frames[i - 1];
@@ -59,6 +60,17 @@ add_task(async function () {
);
},
},
+ {
+ name: "Pixel snapping on urlbar bottom border on MacOS & Windows",
+ condition(r) {
+ if (!urlbarBoundingRect) {
+ urlbarBoundingRect = document
+ .getElementById("urlbar")
+ .getBoundingClientRect();
+ }
+ return rectMatchesBottomBorder(r, urlbarBoundingRect);
+ },
+ },
];
let rectText = `${rect.toSource()}, window width: ${width}`;
diff --git a/browser/base/content/test/performance/browser_windowopen.js b/browser/base/content/test/performance/browser_windowopen.js
@@ -50,6 +50,7 @@ add_task(async function () {
let alreadyFocused = false;
let inRange = (val, min, max) => min <= val && val <= max;
let tabBoundingRect = undefined;
+ let urlbarBoundingRect = undefined;
let expectations = {
expectedReflows: EXPECTED_REFLOWS,
frames: {
@@ -98,6 +99,17 @@ add_task(async function () {
},
},
{
+ name: "Pixel snapping on urlbar bottom border on MacOS & Windows",
+ condition(r) {
+ if (!urlbarBoundingRect) {
+ urlbarBoundingRect = document
+ .getElementById("urlbar")
+ .getBoundingClientRect();
+ }
+ return rectMatchesBottomBorder(r, urlbarBoundingRect);
+ },
+ },
+ {
name: "Initial bookmark icon appearing after startup",
condition: r =>
r.w == 16 &&
diff --git a/browser/base/content/test/performance/head.js b/browser/base/content/test/performance/head.js
@@ -1083,3 +1083,17 @@ function isLikelyFocusChange(rects, frame) {
}
return false;
}
+
+// See if the rect might match the coordinates of the bottom-border of an element
+// given its DOMRect.
+function rectMatchesBottomBorder(r, domRect) {
+ return (
+ r.h <= 2 &&
+ r.x1 >= domRect.x &&
+ r.x1 < domRect.x + domRect.width &&
+ r.x2 > domRect.x &&
+ r.x2 <= domRect.x + domRect.width &&
+ r.y1 >= domRect.bottom - 1.5 &&
+ r.y2 <= domRect.bottom + 1.5
+ );
+}