Bug 1007283 - Enable arrow panel animations on Linux. r?jaws draft
authorDão Gottwald <dao@mozilla.com>
Wed, 19 Jul 2017 23:16:19 +0200
changeset 611513 377e1c1483a6f3f45272c99f754d9cffa819e75f
parent 611299 a1ea69a3a0a760036e047f6ff89897aa7ffd4e53
child 638189 b552de188d19708d6741311a1912218e479dbb9e
push id69251
push userdgottwald@mozilla.com
push dateWed, 19 Jul 2017 21:16:44 +0000
reviewersjaws
bugs1007283
milestone56.0a1
Bug 1007283 - Enable arrow panel animations on Linux. r?jaws MozReview-Commit-ID: BUL3NWpsKll
browser/base/content/browser.css
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsXULPopupManager.cpp
toolkit/content/tests/chrome/test_arrowpanel.xul
toolkit/content/xul.css
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -1166,17 +1166,17 @@ toolbarpaletteitem[place="palette"] > #d
   -moz-window-transform-origin: 20px bottom;
 }
 
 #BMB_bookmarksPopup[arrowposition="before_end"]:-moz-locale-dir(ltr),
 #BMB_bookmarksPopup[arrowposition="before_start"]:-moz-locale-dir(rtl) {
   -moz-window-transform-origin: calc(100% - 20px) bottom;
 }
 
-%elifndef MOZ_WIDGET_GTK
+%else
 
 #BMB_bookmarksPopup {
   transform: scale(.4);
   opacity: 0;
   transition-property: transform, opacity;
   transition-duration: 0.15s;
   transition-timing-function: ease-out;
 }
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -577,28 +577,26 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayou
   if (mIsOpenChanged) {
     mIsOpenChanged = false;
 
     // Make sure the current selection in a menulist is visible.
     if (IsMenuList() && mCurrentMenu) {
       EnsureMenuItemIsVisible(mCurrentMenu);
     }
 
-#ifndef MOZ_WIDGET_GTK
     // If the animate attribute is set to open, check for a transition and wait
     // for it to finish before firing the popupshown event.
     if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::animate,
                               nsGkAtoms::open, eCaseMatters) &&
         nsLayoutUtils::HasCurrentTransitions(this)) {
       mPopupShownDispatcher = new nsXULPopupShownEvent(mContent, pc);
       mContent->AddSystemEventListener(NS_LITERAL_STRING("transitionend"),
                                        mPopupShownDispatcher, false, false);
       return;
     }
-#endif
 
     // If there are no transitions, fire the popupshown event right away.
     nsCOMPtr<nsIRunnable> event = new nsXULPopupShownEvent(GetContent(), pc);
     mContent->OwnerDoc()->Dispatch("nsXULPopupShownEvent",
                                    TaskCategory::Other,
                                    event.forget());
   }
 
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -1601,19 +1601,17 @@ nsXULPopupManager::FirePopupHidingEvent(
       popupFrame->SetPopupState(ePopupShown);
     }
     else {
       // If the popup has an animate attribute and it is not set to false, check
       // if it has a closing transition and wait for it to finish. The transition
       // may still occur either way, but the view will be hidden and you won't be
       // able to see it. If there is a next popup, indicating that mutliple popups
       // are rolling up, don't wait and hide the popup right away since the effect
-      // would likely be undesirable. Transitions are currently disabled on Linux
-      // due to rendering issues on certain configurations.
-#ifndef MOZ_WIDGET_GTK
+      // would likely be undesirable.
       if (!aNextPopup && aPopup->HasAttr(kNameSpaceID_None, nsGkAtoms::animate)) {
         // If animate="false" then don't transition at all. If animate="cancel",
         // only show the transition if cancelling the popup or rolling up.
         // Otherwise, always show the transition.
         nsAutoString animate;
         aPopup->GetAttr(kNameSpaceID_None, nsGkAtoms::animate, animate);
 
         if (!animate.EqualsLiteral("false") &&
@@ -1628,17 +1626,16 @@ nsXULPopupManager::FirePopupHidingEvent(
           if (nsLayoutUtils::HasCurrentTransitions(popupFrame)) {
             RefPtr<TransitionEnder> ender = new TransitionEnder(aPopup, aDeselectMenu);
             aPopup->AddSystemEventListener(NS_LITERAL_STRING("transitionend"),
                                            ender, false, false);
             return;
           }
         }
       }
-#endif
 
       HidePopupCallback(aPopup, popupFrame, aNextPopup, aLastPopup,
                         aPopupType, aDeselectMenu);
     }
   }
 }
 
 bool
--- a/toolkit/content/tests/chrome/test_arrowpanel.xul
+++ b/toolkit/content/tests/chrome/test_arrowpanel.xul
@@ -175,41 +175,37 @@ function* nextTest()
     $("bottomleft").setAttribute("right", "15");
     $("bottomright").setAttribute("left", "15");
     $("topleft").removeAttribute("left");
     $("topright").removeAttribute("right");
     $("bottomleft").removeAttribute("left");
     $("bottomright").removeAttribute("right");
   }
 
-  // Test that a transition occurs when opening or closing the popup. The transition is
-  // disabled on Linux.
-  if (navigator.platform.indexOf("Linux") == -1) {
-    function transitionEnded(event) {
-      if ($("animatepanel").state != "open") {
-        is($("animatepanel").state, "showing", "state is showing during transitionend");
-        ok(!animatedPopupShown, "popupshown not fired yet")
-      } else {
-        is($("animatepanel").state, "open", "state is open after transitionend");
-        ok(animatedPopupShown, "popupshown now fired")
-        SimpleTest.executeSoon(() => runNextTest.next());
-      }
+  function transitionEnded(event) {
+    if ($("animatepanel").state != "open") {
+      is($("animatepanel").state, "showing", "state is showing during transitionend");
+      ok(!animatedPopupShown, "popupshown not fired yet")
+    } else {
+      is($("animatepanel").state, "open", "state is open after transitionend");
+      ok(animatedPopupShown, "popupshown now fired")
+      SimpleTest.executeSoon(() => runNextTest.next());
     }
+  }
 
-    // Check that the transition occurs for an arrow panel with animate="true"
-    window.addEventListener("transitionend", transitionEnded, false);
-    $("animatepanel").openPopup($("topleft"), "after_start", 0, 0, false, false, null, "start");
-    is($("animatepanel").state, "showing", "state is showing");
-    yield;
-    window.removeEventListener("transitionend", transitionEnded, false);
+  // Check that the transition occurs for an arrow panel with animate="true"
+  window.addEventListener("transitionend", transitionEnded, false);
+  $("animatepanel").openPopup($("topleft"), "after_start", 0, 0, false, false, null, "start");
+  is($("animatepanel").state, "showing", "state is showing");
+  yield;
+  window.removeEventListener("transitionend", transitionEnded, false);
 
-    synthesizeKey("VK_ESCAPE", { });
-    ok(!animatedPopupHidden, "animated popup not hidden yet");
-    yield;
-  }
+  synthesizeKey("VK_ESCAPE", { });
+  ok(!animatedPopupHidden, "animated popup not hidden yet");
+  yield;
 
   SimpleTest.finish()
 }
 
 function setScale(win, scale)
 {
   var wn = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
               .getInterface(Components.interfaces.nsIWebNavigation);
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -503,17 +503,17 @@ panel[arrowposition="start_before"]:-moz
   -moz-window-transform-origin: left 20px;
 }
 
 panel[arrowposition="end_after"]:-moz-locale-dir(ltr),
 panel[arrowposition="start_after"]:-moz-locale-dir(rtl) {
   -moz-window-transform-origin: left calc(100% - 20px);
 }
 
-%elifndef MOZ_WIDGET_GTK
+%else
 
 panel[type="arrow"]:not([animate="false"]) {
   transform: scale(.4);
   opacity: 0;
   transition-property: transform, opacity;
   transition-duration: 0.15s;
   transition-timing-function: ease-out;
 }