Bug 1479135 [X11] disable WebRender for popus on X11/non-composited screens, r=jhorak"

Differential Revision: https://phabricator.services.mozilla.com/D98318
This commit is contained in:
Martin Stransky 2020-12-03 10:50:07 +00:00
Родитель 85785a1f0c
Коммит f7c40422f5
2 изменённых файлов: 23 добавлений и 10 удалений

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

@ -505,6 +505,8 @@ nsWindow::nsWindow() {
mWindowScaleFactorChanged = true;
mWindowScaleFactor = 1;
mCompositedScreen = gdk_screen_is_composited(gdk_screen_get_default());
}
nsWindow::~nsWindow() {
@ -910,7 +912,18 @@ void nsWindow::SetParent(nsIWidget* aNewParent) {
}
}
bool nsWindow::WidgetTypeSupportsAcceleration() { return !IsSmallPopup(); }
bool nsWindow::WidgetTypeSupportsAcceleration() {
if (IsSmallPopup()) {
return false;
}
// Workaround for Bug 1479135
// We draw transparent popups on non-compositing screens by SW as we don't
// implement X shape masks in WebRender.
if (mWindowType == eWindowType_popup) {
return mCompositedScreen;
}
return true;
}
void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) {
MOZ_ASSERT(aNewParent, "null widget");
@ -4034,6 +4047,7 @@ void nsWindow::OnCompositedChanged() {
// Update CSD after the change in alpha visibility. This only affects
// system metrics, not other theme shenanigans.
NotifyThemeChanged(ThemeChangeKind::MediaQueriesOnly);
mCompositedScreen = gdk_screen_is_composited(gdk_screen_get_default());
}
void nsWindow::OnScaleChanged(GtkAllocation* aAllocation) {
@ -4183,8 +4197,7 @@ bool nsWindow::IsToplevelWindowTransparent() {
static bool transparencyConfigured = false;
if (!transparencyConfigured) {
GdkScreen* screen = gdk_screen_get_default();
if (gdk_screen_is_composited(screen)) {
if (gdk_screen_is_composited(gdk_screen_get_default())) {
// Some Gtk+ themes use non-rectangular toplevel windows. To fully
// support such themes we need to make toplevel window transparent
// with ARGB visual.
@ -4422,9 +4435,9 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
(popupNeedsAlphaVisual || toplevelNeedsAlphaVisual)) {
// We're running on composited screen so we can use alpha visual
// for both toplevel and popups.
GdkScreen* screen = gtk_widget_get_screen(mShell);
if (gdk_screen_is_composited(screen)) {
GdkVisual* visual = gdk_screen_get_rgba_visual(screen);
if (mCompositedScreen) {
GdkVisual* visual =
gdk_screen_get_rgba_visual(gtk_widget_get_screen(mShell));
if (visual) {
gtk_widget_set_visual(mShell, visual);
mHasAlphaVisual = true;
@ -5960,8 +5973,7 @@ gboolean FullscreenTransitionData::TimeoutCallback(gpointer aData) {
/* virtual */
bool nsWindow::PrepareForFullscreenTransition(nsISupports** aData) {
GdkScreen* screen = gtk_widget_get_screen(mShell);
if (!gdk_screen_is_composited(screen)) {
if (!mCompositedScreen) {
return false;
}
*aData = do_AddRef(new FullscreenTransitionWindow(mShell)).take();
@ -7928,8 +7940,8 @@ bool nsWindow::HideTitlebarByDefault() {
hideTitlebar = true;
// Don't hide titlebar when we can't draw round corners.
GdkScreen* screen = gdk_screen_get_default();
if (!gdk_screen_is_composited(screen) && !TitlebarCanUseShapeMask()) {
if (gdk_screen_is_composited(gdk_screen_get_default()) &&
!TitlebarCanUseShapeMask()) {
hideTitlebar = false;
return hideTitlebar;
}

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

@ -469,6 +469,7 @@ class nsWindow final : public nsBaseWidget {
#endif
bool mWindowScaleFactorChanged;
int mWindowScaleFactor;
bool mCompositedScreen;
private:
void DestroyChildWindows();