summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firefox.spec12
-rw-r--r--mozilla-1623060.patch264
-rw-r--r--mozilla-1623106.patch73
3 files changed, 348 insertions, 1 deletions
diff --git a/firefox.spec b/firefox.spec
index 3964ab5..1c3383f 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -118,7 +118,7 @@ ExcludeArch: s390x
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 74.0
-Release: 8%{?nss_tag}%{?dist}
+Release: 11%{?nss_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@@ -184,10 +184,12 @@ Patch417: bug1375074-save-restore-x28.patch
Patch422: mozilla-1580174-webrtc-popup.patch
Patch423: mozilla-1620973.patch
Patch424: mozilla-1615098.patch
+Patch425: mozilla-1623106.patch
# Wayland specific upstream patches
Patch574: firefox-pipewire.patch
Patch575: mozilla-1609538.patch
+Patch576: mozilla-1623060.patch
# PGO/LTO patches
Patch600: pgo.patch
@@ -385,6 +387,7 @@ This package contains results of tests executed during build.
#%patch241 -p1 -b .kiosk-workaround
%patch423 -p1 -b .1620973
%patch424 -p1 -b .1615098
+%patch425 -p1 -b .1623106
%patch402 -p1 -b .1196777
%ifarch %{arm}
@@ -394,6 +397,7 @@ This package contains results of tests executed during build.
# Wayland specific upstream patches
%patch574 -p1 -b .firefox-pipewire
%patch575 -p1 -b .mozilla-1609538
+%patch576 -p1 -b .mozilla-1623060
# PGO patches
%patch600 -p1 -b .pgo
@@ -960,6 +964,12 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
+* Tue Mar 17 2020 Martin Stransky <stransky@redhat.com> - 74.0-11
+- Added fix for mozbz#1623106
+
+* Tue Mar 17 2020 Martin Stransky <stransky@redhat.com> - 74.0-9
+- Added fix for mozbz#1623060
+
* Tue Mar 17 2020 Jan Grulich <jgrulich@redhat.com> - 74-0-8
- Add support for window sharing
diff --git a/mozilla-1623060.patch b/mozilla-1623060.patch
new file mode 100644
index 0000000..a5d9057
--- /dev/null
+++ b/mozilla-1623060.patch
@@ -0,0 +1,264 @@
+diff -up firefox-74.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1623060 firefox-74.0/widget/gtk/nsWaylandDisplay.cpp
+--- firefox-74.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1623060 2020-03-17 14:19:04.394231493 +0100
++++ firefox-74.0/widget/gtk/nsWaylandDisplay.cpp 2020-03-17 14:23:47.445480363 +0100
+@@ -26,15 +26,12 @@ namespace widget {
+ #define DMABUF_BASIC_PREF "widget.wayland_dmabuf_basic_compositor.enabled"
+ // Enable dmabuf for WebGL backend
+ #define DMABUF_WEBGL_PREF "widget.wayland_dmabuf_webgl.enabled"
+-// See WindowSurfaceWayland::RenderingCacheMode for details.
+-#define CACHE_MODE_PREF "widget.wayland_cache_mode"
+
+ bool nsWaylandDisplay::sIsDMABufEnabled = false;
+ int nsWaylandDisplay::sIsDMABufPrefTextState = false;
+ int nsWaylandDisplay::sIsDMABufPrefBasicCompositorState = false;
+ int nsWaylandDisplay::sIsDMABufPrefWebGLState = false;
+ bool nsWaylandDisplay::sIsDMABufConfigured = false;
+-int nsWaylandDisplay::sRenderingCacheModePref = -1;
+ bool nsWaylandDisplay::sIsPrefLoaded = false;
+
+ wl_display* WaylandDisplayGetWLDisplay(GdkDisplay* aGdkDisplay) {
+@@ -423,7 +420,6 @@ nsWaylandDisplay::nsWaylandDisplay(wl_di
+ sIsDMABufPrefBasicCompositorState =
+ Preferences::GetBool(DMABUF_BASIC_PREF, false);
+ sIsDMABufPrefWebGLState = Preferences::GetBool(DMABUF_WEBGL_PREF, false);
+- sRenderingCacheModePref = Preferences::GetInt(CACHE_MODE_PREF, 0);
+ sIsPrefLoaded = true;
+ }
+
+diff -up firefox-74.0/widget/gtk/nsWaylandDisplay.h.mozilla-1623060 firefox-74.0/widget/gtk/nsWaylandDisplay.h
+--- firefox-74.0/widget/gtk/nsWaylandDisplay.h.mozilla-1623060 2020-03-17 14:19:04.394231493 +0100
++++ firefox-74.0/widget/gtk/nsWaylandDisplay.h 2020-03-17 14:22:49.867838072 +0100
+@@ -91,9 +91,6 @@ class nsWaylandDisplay {
+ static bool IsDMABufTexturesEnabled();
+ static bool IsDMABufWebGLEnabled();
+
+- // See WindowSurfaceWayland::CacheMode for details.
+- int GetRenderingCacheModePref() { return sRenderingCacheModePref; };
+-
+ private:
+ bool ConfigureGbm();
+
+@@ -121,8 +118,7 @@ class nsWaylandDisplay {
+ static int sIsDMABufPrefTextState;
+ static int sIsDMABufPrefBasicCompositorState;
+ static int sIsDMABufPrefWebGLState;
+- static bool sIsDMABufConfigured;
+- static int sRenderingCacheModePref;
++ static bool sIsDMABufConfigured;
+ static bool sIsPrefLoaded;
+ };
+
+diff -up firefox-74.0/widget/gtk/nsWindow.cpp.mozilla-1623060 firefox-74.0/widget/gtk/nsWindow.cpp
+--- firefox-74.0/widget/gtk/nsWindow.cpp.mozilla-1623060 2020-03-17 14:19:04.393231499 +0100
++++ firefox-74.0/widget/gtk/nsWindow.cpp 2020-03-17 14:19:04.395231487 +0100
+@@ -7839,3 +7839,15 @@ void nsWindow::SetEGLNativeWindowSize(
+
+ nsWindow* nsWindow::GetFocusedWindow() { return gFocusWindow; }
+ #endif
++
++LayoutDeviceIntRect nsWindow::GetMozContainerSize() {
++ LayoutDeviceIntRect size(0, 0, 0, 0);
++ if (mContainer) {
++ GtkAllocation allocation;
++ gtk_widget_get_allocation(GTK_WIDGET(mContainer), &allocation);
++ int scale = GdkScaleFactor();
++ size.width = allocation.width * scale;
++ size.height = allocation.height * scale;
++ }
++ return size;
++}
+diff -up firefox-74.0/widget/gtk/nsWindow.h.mozilla-1623060 firefox-74.0/widget/gtk/nsWindow.h
+--- firefox-74.0/widget/gtk/nsWindow.h.mozilla-1623060 2020-03-09 14:10:19.000000000 +0100
++++ firefox-74.0/widget/gtk/nsWindow.h 2020-03-17 14:19:04.395231487 +0100
+@@ -291,6 +291,7 @@ class nsWindow final : public nsBaseWidg
+ int32_t aVertical) override;
+
+ MozContainer* GetMozContainer() { return mContainer; }
++ LayoutDeviceIntRect GetMozContainerSize();
+ // GetMozContainerWidget returns the MozContainer even for undestroyed
+ // descendant windows
+ GtkWidget* GetMozContainerWidget();
+diff -up firefox-74.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1623060 firefox-74.0/widget/gtk/WindowSurfaceWayland.cpp
+--- firefox-74.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1623060 2020-03-09 14:10:19.000000000 +0100
++++ firefox-74.0/widget/gtk/WindowSurfaceWayland.cpp 2020-03-17 14:19:04.394231493 +0100
+@@ -527,9 +527,6 @@ WindowSurfaceWayland::WindowSurfaceWayla
+ mShmBackupBuffer[i] = nullptr;
+ mDMABackupBuffer[i] = nullptr;
+ }
+- mRenderingCacheMode = static_cast<RenderingCacheMode>(
+- mWaylandDisplay->GetRenderingCacheModePref());
+- LOGWAYLAND(("WindowSurfaceWayland Cache mode %d\n", mRenderingCacheMode));
+ }
+
+ WindowSurfaceWayland::~WindowSurfaceWayland() {
+@@ -650,14 +647,13 @@ WindowBackBuffer* WindowSurfaceWayland::
+ LOGWAYLAND(
+ ("WindowSurfaceWayland::NewWaylandBuffer [%p] Requested buffer [%d "
+ "x %d] DMABuf %d\n",
+- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height,
+- aUseDMABufBackend));
++ (void*)this, mWidgetRect.width, mWidgetRect.height, aUseDMABufBackend));
+
+ mWaylandBuffer = WaylandBufferFindAvailable(
+- mBufferScreenRect.width, mBufferScreenRect.height, aUseDMABufBackend);
++ mWidgetRect.width, mWidgetRect.height, aUseDMABufBackend);
+ if (!mWaylandBuffer) {
+- mWaylandBuffer = CreateWaylandBuffer(
+- mBufferScreenRect.width, mBufferScreenRect.height, aUseDMABufBackend);
++ mWaylandBuffer = CreateWaylandBuffer(mWidgetRect.width, mWidgetRect.height,
++ aUseDMABufBackend);
+ }
+
+ return mWaylandBuffer;
+@@ -667,7 +663,7 @@ WindowBackBuffer* WindowSurfaceWayland::
+ LOGWAYLAND(
+ ("WindowSurfaceWayland::GetWaylandBufferRecent [%p] Requested buffer [%d "
+ "x %d]\n",
+- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height));
++ (void*)this, mWidgetRect.width, mWidgetRect.height));
+
+ // There's no buffer created yet, create a new one for partial screen updates.
+ if (!mWaylandBuffer) {
+@@ -679,10 +675,9 @@ WindowBackBuffer* WindowSurfaceWayland::
+ return nullptr;
+ }
+
+- if (mWaylandBuffer->IsMatchingSize(mBufferScreenRect.width,
+- mBufferScreenRect.height)) {
+- LOGWAYLAND((" Size is ok, use the buffer [%d x %d]\n",
+- mBufferScreenRect.width, mBufferScreenRect.height));
++ if (mWaylandBuffer->IsMatchingSize(mWidgetRect.width, mWidgetRect.height)) {
++ LOGWAYLAND((" Size is ok, use the buffer [%d x %d]\n", mWidgetRect.width,
++ mWidgetRect.height));
+ return mWaylandBuffer;
+ }
+
+@@ -697,7 +692,7 @@ WindowBackBuffer* WindowSurfaceWayland::
+ LOGWAYLAND(
+ ("WindowSurfaceWayland::GetWaylandBufferWithSwitch [%p] Requested buffer "
+ "[%d x %d]\n",
+- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height));
++ (void*)this, mWidgetRect.width, mWidgetRect.height));
+
+ // There's no buffer created yet or actual buffer is attached, get a new one.
+ // Use DMABuf for fullscreen updates only.
+@@ -706,18 +701,21 @@ WindowBackBuffer* WindowSurfaceWayland::
+ }
+
+ // Reuse existing buffer
+- LOGWAYLAND((" Reuse buffer with resize [%d x %d]\n",
+- mBufferScreenRect.width, mBufferScreenRect.height));
++ LOGWAYLAND((" Reuse buffer with resize [%d x %d]\n", mWidgetRect.width,
++ mWidgetRect.height));
+
+ // OOM here, just return null to skip this frame.
+- if (!mWaylandBuffer->Resize(mBufferScreenRect.width,
+- mBufferScreenRect.height)) {
++ if (!mWaylandBuffer->Resize(mWidgetRect.width, mWidgetRect.height)) {
+ return nullptr;
+ }
+ return mWaylandBuffer;
+ }
+
+ already_AddRefed<gfx::DrawTarget> WindowSurfaceWayland::LockWaylandBuffer() {
++ // Allocated wayland buffer must match widget size, otherwise wayland
++ // compositor is confused and may produce various rendering artifacts.
++ mWidgetRect = mWindow->GetMozContainerSize();
++
+ // mCanSwitchWaylandBuffer set means we're getting buffer for fullscreen
+ // update. We can use DMABuf and we can get a new buffer for drawing.
+ WindowBackBuffer* buffer = mCanSwitchWaylandBuffer
+@@ -858,12 +856,12 @@ already_AddRefed<gfx::DrawTarget> Window
+ LOGWAYLAND((" windowRedraw = %d\n", windowRedraw));
+
+ #if MOZ_LOGGING
+- if (!(mBufferScreenRect == lockedScreenRect)) {
++ if (!(mLockedScreenRect == lockedScreenRect)) {
+ LOGWAYLAND((" screen size changed\n"));
+ }
+ #endif
+
+- if (!(mBufferScreenRect == lockedScreenRect)) {
++ if (!(mLockedScreenRect == lockedScreenRect)) {
+ // Screen (window) size changed and we still have some painting pending
+ // for the last window size. That can happen when window is resized.
+ // We can't commit them any more as they're for former window size, so
+@@ -878,17 +876,21 @@ already_AddRefed<gfx::DrawTarget> Window
+ // as it produces artifacts.
+ return nullptr;
+ }
+- mBufferScreenRect = lockedScreenRect;
++ mLockedScreenRect = lockedScreenRect;
+ }
+
+- if (mRenderingCacheMode == CACHE_ALL) {
+- mDrawToWaylandBufferDirectly = windowRedraw;
+- } else if (mRenderingCacheMode == CACHE_MISSING) {
++ LayoutDeviceIntRect size = mWindow->GetMozContainerSize();
++
++ // We can draw directly only when widget has the same size as wl_buffer
++ mDrawToWaylandBufferDirectly = (size.width == mLockedScreenRect.width &&
++ size.height == mLockedScreenRect.height);
++
++ // We can draw directly only when we redraw significant part of the window
++ // to avoid flickering.
++ if (mDrawToWaylandBufferDirectly) {
+ mDrawToWaylandBufferDirectly =
+ windowRedraw || (lockSize.width * 3 > lockedScreenRect.width &&
+ lockSize.height * 3 > lockedScreenRect.height);
+- } else {
+- mDrawToWaylandBufferDirectly = true;
+ }
+
+ if (mDrawToWaylandBufferDirectly) {
+@@ -903,11 +905,6 @@ already_AddRefed<gfx::DrawTarget> Window
+ }
+ }
+
+- // Any caching is disabled and we don't have any back buffer available.
+- if (mRenderingCacheMode == CACHE_NONE) {
+- return nullptr;
+- }
+-
+ // We do indirect drawing because there isn't any front buffer available.
+ // Do indirect drawing to mImageSurface which is commited to wayland
+ // wl_buffer by DrawDelayedImageCommits() later.
+@@ -1151,7 +1148,7 @@ void WindowSurfaceWayland::Commit(const
+ ("WindowSurfaceWayland::Commit [%p] damage size [%d, %d] -> [%d x %d]"
+ "screenSize [%d x %d]\n",
+ (void*)this, lockSize.x, lockSize.y, lockSize.width, lockSize.height,
+- mBufferScreenRect.width, mBufferScreenRect.height));
++ mLockedScreenRect.width, mLockedScreenRect.height));
+ LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n",
+ mDrawToWaylandBufferDirectly));
+ }
+diff -up firefox-74.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1623060 firefox-74.0/widget/gtk/WindowSurfaceWayland.h
+--- firefox-74.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1623060 2020-03-09 14:10:18.000000000 +0100
++++ firefox-74.0/widget/gtk/WindowSurfaceWayland.h 2020-03-17 14:19:04.394231493 +0100
+@@ -261,8 +261,14 @@ class WindowSurfaceWayland : public Wind
+ nsWindow* mWindow;
+ // Buffer screen rects helps us understand if we operate on
+ // the same window size as we're called on WindowSurfaceWayland::Lock().
+- // mBufferScreenRect is window size when our wayland buffer was allocated.
+- LayoutDeviceIntRect mBufferScreenRect;
++ // mLockedScreenRect is window size when our wayland buffer was allocated.
++ LayoutDeviceIntRect mLockedScreenRect;
++
++ // WidgetRect is an actual size of mozcontainer widget. It can be
++ // different than mLockedScreenRect during resize when mBounds are updated
++ // immediately but actual GtkWidget size is updated asynchronously
++ // (see Bug 1489463).
++ LayoutDeviceIntRect mWidgetRect;
+ nsWaylandDisplay* mWaylandDisplay;
+
+ // Actual buffer (backed by wl_buffer) where all drawings go into.
+@@ -327,9 +333,6 @@ class WindowSurfaceWayland : public Wind
+
+ bool mIsMainThread;
+
+- // Image caching strategy, see RenderingCacheMode for details.
+- RenderingCacheMode mRenderingCacheMode;
+-
+ static bool UseDMABufBackend();
+ static bool mUseDMABufInitialized;
+ static bool mUseDMABuf;
diff --git a/mozilla-1623106.patch b/mozilla-1623106.patch
new file mode 100644
index 0000000..354d918
--- /dev/null
+++ b/mozilla-1623106.patch
@@ -0,0 +1,73 @@
+changeset: 521156:e856a981e2be
+tag: tip
+parent: 521144:5bfecf5aff6d
+user: Martin Stransky <stransky@redhat.com>
+date: Tue Mar 17 21:22:44 2020 +0100
+files: widget/gtk/nsWindow.cpp
+description:
+Bug 1623106 [Linux/Gtk] Don't use window resize workaround for Gtk >= 3.24, r?jhorak
+
+We have a workaround for https://gitlab.gnome.org/GNOME/gtk/issues/1044 which is already fixed
+in Gtk 3.24 and causes resize regression there so let's remove it.
+
+Differential Revision: https://phabricator.services.mozilla.com/D67387
+
+
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -2739,16 +2739,18 @@ void nsWindow::OnContainerUnrealize() {
+ }
+ }
+
+ void nsWindow::OnSizeAllocate(GtkAllocation* aAllocation) {
+ LOG(("nsWindow::OnSizeAllocate [%p] %d,%d -> %d x %d\n", (void*)this,
+ aAllocation->x, aAllocation->y, aAllocation->width,
+ aAllocation->height));
+
++ mBoundsAreValid = true;
++
+ LayoutDeviceIntSize size = GdkRectToDevicePixels(*aAllocation).Size();
+ if (mBounds.Size() == size) {
+ // We were already resized at nsWindow::OnConfigureEvent() so skip it.
+ return;
+ }
+
+ // Invalidate the new part of the window now for the pending paint to
+ // minimize background flashes (GDK does not do this for external resizes
+@@ -3524,23 +3526,27 @@ void nsWindow::OnWindowStateEvent(GtkWid
+ // maximized state, we hide the GDK_WINDOW_STATE_MAXIMIZED change from
+ // gtk_window_state_event() so as to trick GTK into using the values from
+ // gtk_window_resize() in its configure request.
+ //
+ // We instead notify gtk_window_state_event() of the maximized state change
+ // once the window is shown.
+ //
+ // See https://gitlab.gnome.org/GNOME/gtk/issues/1044
+- if (!mIsShown) {
+- aEvent->changed_mask = static_cast<GdkWindowState>(
+- aEvent->changed_mask & ~GDK_WINDOW_STATE_MAXIMIZED);
+- } else if (aEvent->changed_mask & GDK_WINDOW_STATE_WITHDRAWN &&
+- aEvent->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) {
+- aEvent->changed_mask = static_cast<GdkWindowState>(
+- aEvent->changed_mask | GDK_WINDOW_STATE_MAXIMIZED);
++ //
++ // This is fixed in Gtk 3.24+
++ if (gtk_check_version(3, 24, 0) != nullptr) {
++ if (!mIsShown) {
++ aEvent->changed_mask = static_cast<GdkWindowState>(
++ aEvent->changed_mask & ~GDK_WINDOW_STATE_MAXIMIZED);
++ } else if (aEvent->changed_mask & GDK_WINDOW_STATE_WITHDRAWN &&
++ aEvent->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) {
++ aEvent->changed_mask = static_cast<GdkWindowState>(
++ aEvent->changed_mask | GDK_WINDOW_STATE_MAXIMIZED);
++ }
+ }
+
+ // This is a workaround for https://gitlab.gnome.org/GNOME/gtk/issues/1395
+ // Gtk+ controls window active appearance by window-state-event signal.
+ if (mDrawInTitlebar && (aEvent->changed_mask & GDK_WINDOW_STATE_FOCUSED)) {
+ // Emulate what Gtk+ does at gtk_window_state_event().
+ // We can't check GTK_STATE_FLAG_BACKDROP directly as it's set by Gtk+
+ // *after* this window-state-event handler.
+
bgstack15