Backed out 2 changesets (bug 1783500) for causing mochitest failures on test_menulist_keynav.xhtml CLOSED TREE

Backed out changeset 96ef708fe045 (bug 1783500)
Backed out changeset fc1e55745c43 (bug 1783500)
This commit is contained in:
Norisz Fay 2022-08-09 16:25:58 +03:00
Родитель f9cec0891a
Коммит da20c1940a
6 изменённых файлов: 12 добавлений и 57 удалений

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

@ -11,4 +11,3 @@ skip-if =
[browser_selectpopup_colors.js]
skip-if = os == "linux" # Bug 1329991 - test fails intermittently on Linux builds
[browser_selectpopup_searchfocus.js]
[browser_selectpopup_width.js]

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

@ -1,28 +0,0 @@
const PAGE = `
<!doctype html>
<select style="width: 600px">
<option>ABC</option>
<option>DEFG</option>
</select>
`;
add_task(async function() {
const url = "data:text/html," + encodeURI(PAGE);
await BrowserTestUtils.withNewTab(
{
gBrowser,
url,
},
async function(browser) {
let popupShownPromise = BrowserTestUtils.waitForSelectPopupShown(window);
await BrowserTestUtils.synthesizeMouseAtCenter("select", {}, browser);
let popup = await popupShownPromise;
let arrowSB = popup.shadowRoot.querySelector(".menupopup-arrowscrollbox");
is(
arrowSB.getBoundingClientRect().width,
600,
"Should be the right size"
);
}
);
});

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

@ -1451,6 +1451,9 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
// size will be 0.
nsRect anchorRect;
// Width of the parent, used when aSizedToPopup is true.
int32_t parentWidth = 0;
bool anchored = IsAnchored();
if (anchored || aSizedToPopup) {
// In order to deal with transforms, we need the root prescontext:
@ -1483,6 +1486,9 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
anchorRect = ComputeAnchorRect(rootPresContext, aAnchorFrame);
}
// The width is needed when aSizedToPopup is true
parentWidth = anchorRect.width;
}
// Set the popup's size to the preferred size. Below, this size will be
@ -1494,18 +1500,12 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
"preferred size of popup not set");
nsSize newSize = mPrefSize;
if (aSizedToPopup) {
nsMargin rawMargin;
if (StyleMargin()->GetMargin(rawMargin)) {
rawMargin.EnsureAtMost(nsMargin());
}
newSize.width = anchorRect.width - rawMargin.LeftRight();
newSize.width = parentWidth;
// If we're anchoring to a rect, and the rect is smaller than the
// preferred size of the popup, change its width accordingly.
if (mAnchorType == MenuPopupAnchorType_Rect) {
newSize.width = std::max(newSize.width, mPrefSize.width);
newSize.width = std::max(parentWidth, mPrefSize.width);
}
// Pref size is already constrained by LayoutPopup().
ConstrainSizeForWayland(newSize);
}

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

@ -145,20 +145,6 @@ function differentPressed()
}
}
function margins(el) {
let cs = getComputedStyle(el);
let result = {};
for (let side of ["top", "right", "bottom", "left"]) {
result[side] = parseFloat(cs.getPropertyValue("margin-" + side));
}
return result;
}
function leftRightNegativeMarginSum(el) {
let m = margins(el);
return Math.min(0, m.left) + Math.min(0, m.right);
}
function tabAndScroll()
{
list = $("list");
@ -176,7 +162,7 @@ function tabAndScroll()
list.appendItem("Item" + i, "item" + i);
}
list.open = true;
is(list.getBoundingClientRect().width, list.menupopup.getBoundingClientRect().width + leftRightNegativeMarginSum(list.menupopup),
is(list.getBoundingClientRect().width, list.menupopup.getBoundingClientRect().width,
"menu and popup width match");
var minScrollbarWidth = window.matchMedia("(-moz-overlay-scrollbars)").matches ? 0 : 3;
ok(list.getBoundingClientRect().width >= list.getItemAtIndex(0).getBoundingClientRect().width + minScrollbarWidth,

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

@ -36,9 +36,8 @@ function popupShown()
var popuprect = menulist.menupopup.getBoundingClientRect();
let marginLeft = parseFloat(getComputedStyle(menulist.menupopup).marginLeft);
let marginRight = parseFloat(getComputedStyle(menulist.menupopup).marginRight);
ok(isWithinHalfPixel(menurect.left + marginLeft, popuprect.left), `left position: ${menurect.left}, ${popuprect.left}`);
ok(isWithinHalfPixel(menurect.right - marginRight, popuprect.right), `right position: ${menurect.right}, ${popuprect.right}`);
ok(isWithinHalfPixel(menurect.left + marginLeft, popuprect.left), "left position");
ok(isWithinHalfPixel(menurect.right + marginLeft, popuprect.right), "right position");
let index = menulist.selectedIndex;
if (menulist.selectedItem && navigator.platform.includes("Mac")) {

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

@ -55,9 +55,8 @@ function checkSize()
var popuprect = menulist.menupopup.getBoundingClientRect();
let marginLeft = parseFloat(getComputedStyle(menulist.menupopup).marginLeft);
let marginRight = parseFloat(getComputedStyle(menulist.menupopup).marginRight);
ok(isWithinHalfPixel(menurect.left + marginLeft, popuprect.left), "left position " + gState);
ok(isWithinHalfPixel(menurect.right - marginRight, popuprect.right), "right position " + gState);
ok(isWithinHalfPixel(menurect.right + marginLeft, popuprect.right), "right position " + gState);
ok(Math.round(popuprect.right) - Math.round(popuprect.left) > 0, "height " + gState)
document.getElementById("menulist").open = false;
}