Bug 1380065 - Disable arrow-panel animations if the cosmeticAnimations pref is set to false. r?sfoster
I tried out the patch that you had uploaded for feedback and wasn't able to reproduce the bug where the popup would reopen when clicking on the anchor. I did however have issues with getting the animation to properly disable when changing the pref through about:config. This patch works fine for me though, and also restores the value of animate=false if it was already on the popup before opening.
MozReview-Commit-ID: IvA2ySPPmeJ
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -384,16 +384,17 @@
</xul:box>
<xul:box class="panel-arrowcontent" xbl:inherits="side,align,dir,orient,pack" flex="1">
<children/>
</xul:box>
</xul:vbox>
</content>
<implementation>
<field name="_fadeTimer">null</field>
+ <field name="_previousAnimateAttrValue">null</field>
<method name="sizeTo">
<parameter name="aWidth"/>
<parameter name="aHeight"/>
<body>
<![CDATA[
this.popupBoxObject.sizeTo(aWidth, aHeight);
if (this.state == "open") {
this.adjustArrowPosition();
@@ -469,16 +470,24 @@
}
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="popupshowing" phase="target">
<![CDATA[
+ let animationsEnabled = Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled");
+ if (!animationsEnabled) {
+ this._previousAnimateAttrValue = this.getAttribute("animate");
+ this.setAttribute("animate", "false");
+ } else {
+ this._previousAnimateAttrValue = null;
+ }
+
var arrow = document.getAnonymousElementByAttribute(this, "anonid", "arrow");
arrow.hidden = this.anchorNode == null;
document.getAnonymousElementByAttribute(this, "anonid", "arrowbox")
.style.removeProperty("transform");
this.adjustArrowPosition();
if (this.getAttribute("animate") != "false") {
@@ -511,17 +520,20 @@
this.setAttribute("animate", "cancel");
}
</handler>
<handler event="popupshown" phase="target">
this.setAttribute("panelopen", "true");
</handler>
<handler event="popuphidden" phase="target">
this.removeAttribute("panelopen");
- if (this.getAttribute("animate") != "false") {
+
+ if (this._previousAnimateAttrValue == "false") {
+ this.setAttribute("animate", this._previousAnimateAttrValue);
+ } else {
this.removeAttribute("animate");
}
</handler>
<handler event="popuppositioned" phase="target">
this.adjustArrowPosition();
</handler>
</handlers>
</binding>