Bug 1356674, only adjust arrow position in panel once, r=dao

This commit is contained in:
Neil Deakin 2017-10-04 11:10:18 -04:00
parent f5010781c8
commit 4251bca019
4 changed files with 29 additions and 31 deletions

View File

@ -17,18 +17,6 @@ const EXPECTED_APPMENU_OPEN_REFLOWS = [
],
},
{
stack: [
"get_alignmentPosition@chrome://global/content/bindings/popup.xml",
"adjustArrowPosition@chrome://global/content/bindings/popup.xml",
"onxblpopupshowing@chrome://global/content/bindings/popup.xml",
"openPopup@chrome://global/content/bindings/popup.xml",
"show/</<@chrome://browser/content/customizableui/panelUI.js",
],
times: 2, // This number should only ever go down - never up.
},
{
stack: [
"get_alignmentPosition@chrome://global/content/bindings/popup.xml",
@ -51,7 +39,7 @@ const EXPECTED_APPMENU_OPEN_REFLOWS = [
"openPopup@chrome://global/content/bindings/popup.xml",
],
times: 6, // This number should only ever go down - never up.
times: 7, // This number should only ever go down - never up.
},
];

View File

@ -92,7 +92,7 @@ function waitForPopupPositioned(actionFn, callback)
{
panel.addEventListener("popuppositioned", function listener() {
panel.removeEventListener("popuppositioned", listener, false);
callback();
SimpleTest.executeSoon(callback);
}, false);
actionFn();
}
@ -173,26 +173,38 @@ var tests = [
['simpleMoveToAnchorHorizontal', 'middle', function(next) {
openPopup("after_end", function() {
isArrowPositionedOn("right");
panel.moveToAnchor(anchor, "after_end", 20, 0);
// the anchor and the panel should have moved 20px right without flipping.
isArrowPositionedOn("right", 20);
panel.moveToAnchor(anchor, "after_end", -20, 0);
// the anchor and the panel should have moved 20px left without flipping.
isArrowPositionedOn("right", -20);
next();
waitForPopupPositioned(
() => { panel.moveToAnchor(anchor, "after_end", 20, 0); },
() => {
// the anchor and the panel should have moved 20px right without flipping.
isArrowPositionedOn("right", 20);
waitForPopupPositioned(
() => { panel.moveToAnchor(anchor, "after_end", -20, 0); },
() => {
// the anchor and the panel should have moved 20px left without flipping.
isArrowPositionedOn("right", -20);
next();
});
});
});
}],
['simpleMoveToAnchorVertical', 'middle', function(next) {
openPopup("start_after", function() {
isArrowPositionedOn("bottom");
panel.moveToAnchor(anchor, "start_after", 0, 20);
// the anchor and the panel should have moved 20px down without flipping.
isArrowPositionedOn("bottom", 20);
panel.moveToAnchor(anchor, "start_after", 0, -20);
// the anchor and the panel should have moved 20px up without flipping.
isArrowPositionedOn("bottom", -20);
next();
waitForPopupPositioned(
() => { panel.moveToAnchor(anchor, "start_after", 0, 20); },
() => {
// the anchor and the panel should have moved 20px down without flipping.
isArrowPositionedOn("bottom", 20);
waitForPopupPositioned(
() => { panel.moveToAnchor(anchor, "start_after", 0, -20) },
() => {
// the anchor and the panel should have moved 20px up without flipping.
isArrowPositionedOn("bottom", -20);
next();
});
});
});
}],

View File

@ -100,7 +100,7 @@ addEventListener("load", function() {
arrow.style.transition = "none";
// and off we go...
countReflows(testSimplePanel, 1).then(SimpleTest.finish);
countReflows(testSimplePanel, 0).then(SimpleTest.finish);
});
]]>
</script>

View File

@ -492,8 +492,6 @@
document.getAnonymousElementByAttribute(this, "anonid", "arrowbox")
.style.removeProperty("transform");
this.adjustArrowPosition();
if (this.getAttribute("animate") != "false") {
this.setAttribute("animate", "open");
// the animating attribute prevents user interaction during transition