Bug 1291457 - On Mac, use -moz-window-opacity and -moz-window-transform for the panel animations. r?dao
MozReview-Commit-ID: 86NXigOihj3
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -1049,17 +1049,64 @@ toolbarpaletteitem[place="palette"] > #d
-moz-appearance: none;
-moz-binding: url("chrome://browser/content/places/menu.xml#places-popup-arrow");
background: transparent;
border: none;
/* The popup inherits -moz-image-region from the button, must reset it */
-moz-image-region: auto;
}
-%ifndef MOZ_WIDGET_GTK
+%ifdef MOZ_WIDGET_COCOA
+
+/* On Mac, use the properties "-moz-window-transform" and "-moz-window-opacity"
+ instead of "transform" and "opacity" for these animations.
+ The -moz-window* properties apply to the whole window including the window's
+ shadow, and they don't affect the window's "shape", so the system doesn't
+ have to recompute the shadow shape during the animation. This makes them a
+ lot faster. In fact, Gecko no longer triggers shadow shape recomputations
+ for repaints.
+ These properties are not implemented on other platforms. */
+#BMB_bookmarksPopup {
+ -moz-window-transform: scale(.4);
+ -moz-window-opacity: 0;
+ transition-property: -moz-window-transform, -moz-window-opacity;
+ transition-duration: 0.15s;
+ transition-timing-function: ease-out;
+}
+
+#BMB_bookmarksPopup[animate="open"] {
+ -moz-window-transform: none;
+ -moz-window-opacity: 1.0;
+}
+
+#BMB_bookmarksPopup[animate="cancel"] {
+ -moz-window-transform: none;
+}
+
+#BMB_bookmarksPopup[arrowposition="after_start"]:-moz-locale-dir(ltr),
+#BMB_bookmarksPopup[arrowposition="after_end"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: 20px top;
+}
+
+#BMB_bookmarksPopup[arrowposition="after_end"]:-moz-locale-dir(ltr),
+#BMB_bookmarksPopup[arrowposition="after_start"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: calc(100% - 20px) top;
+}
+
+#BMB_bookmarksPopup[arrowposition="before_start"]:-moz-locale-dir(ltr),
+#BMB_bookmarksPopup[arrowposition="before_end"]:-moz-locale-dir(rtl) {
+ -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
#BMB_bookmarksPopup {
transform: scale(.4);
opacity: 0;
transition-property: transform, opacity;
transition-duration: 0.15s;
transition-timing-function: ease-out;
}
@@ -1087,17 +1134,16 @@ toolbarpaletteitem[place="palette"] > #d
#BMB_bookmarksPopup[arrowposition="before_end"]:-moz-locale-dir(rtl) {
transform-origin: 20px bottom;
}
#BMB_bookmarksPopup[arrowposition="before_end"]:-moz-locale-dir(ltr),
#BMB_bookmarksPopup[arrowposition="before_start"]:-moz-locale-dir(rtl) {
transform-origin: calc(100% - 20px) bottom;
}
-
%endif
/* Customize mode */
#navigator-toolbox,
#browser-bottombox,
#content-deck {
transition-property: margin-left, margin-right;
transition-duration: 200ms;
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -438,17 +438,84 @@ tooltip {
white-space: pre-wrap;
margin-top: 21px;
}
panel[type="arrow"] {
-moz-binding: url("chrome://global/content/bindings/popup.xml#arrowpanel");
}
-%ifndef MOZ_WIDGET_GTK
+%ifdef MOZ_WIDGET_COCOA
+
+/* On Mac, use the properties "-moz-window-transform" and "-moz-window-opacity"
+ instead of "transform" and "opacity" for these animations.
+ The -moz-window* properties apply to the whole window including the window's
+ shadow, and they don't affect the window's "shape", so the system doesn't
+ have to recompute the shadow shape during the animation. This makes them a
+ lot faster. In fact, Gecko no longer triggers shadow shape recomputations
+ for repaints.
+ These properties are not implemented on other platforms. */
+panel[type="arrow"]:not([animate="false"]) {
+ -moz-window-transform: scale(.4);
+ -moz-window-opacity: 0;
+ transition-property: -moz-window-transform, -moz-window-opacity;
+ transition-duration: 0.15s;
+ transition-timing-function: ease-out;
+}
+
+panel[type="arrow"][animate="open"] {
+ -moz-window-transform: none;
+ -moz-window-opacity: 1.0;
+}
+
+panel[type="arrow"][animate="cancel"] {
+ -moz-window-transform: none;
+}
+
+panel[arrowposition="after_start"]:-moz-locale-dir(ltr),
+panel[arrowposition="after_end"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: 20px top;
+}
+
+panel[arrowposition="after_end"]:-moz-locale-dir(ltr),
+panel[arrowposition="after_start"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: calc(100% - 20px) top;
+}
+
+panel[arrowposition="before_start"]:-moz-locale-dir(ltr),
+panel[arrowposition="before_end"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: 20px bottom;
+}
+
+panel[arrowposition="before_end"]:-moz-locale-dir(ltr),
+panel[arrowposition="before_start"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: calc(100% - 20px) bottom;
+}
+
+panel[arrowposition="start_before"]:-moz-locale-dir(ltr),
+panel[arrowposition="end_before"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: right 20px;
+}
+
+panel[arrowposition="start_after"]:-moz-locale-dir(ltr),
+panel[arrowposition="end_after"]:-moz-locale-dir(rtl) {
+ -moz-window-transform-origin: right calc(100% - 20px);
+}
+
+panel[arrowposition="end_before"]:-moz-locale-dir(ltr),
+panel[arrowposition="start_before"]:-moz-locale-dir(rtl) {
+ -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
panel[type="arrow"]:not([animate="false"]) {
transform: scale(.4);
opacity: 0;
transition-property: transform, opacity;
transition-duration: 0.15s;
transition-timing-function: ease-out;
}