From 20fe8926e7a83c5d751cf873a47fdb9c8c381c39 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Fri, 31 Mar 2017 09:50:53 +0200 Subject: Added patch for mozbz#1348576 - enable e10s by default, Added patch for mozbz#1158076 - enable dark theme by pref --- firefox.spec | 14 +++- mozilla-1158076-1.patch | 51 ++++++++++++++ mozilla-1158076-2.patch | 184 ++++++++++++++++++++++++++++++++++++++++++++++++ mozilla-1348576.patch | 46 ++++++++++++ 4 files changed, 292 insertions(+), 3 deletions(-) create mode 100644 mozilla-1158076-1.patch create mode 100644 mozilla-1158076-2.patch create mode 100644 mozilla-1348576.patch diff --git a/firefox.spec b/firefox.spec index 37852d4..478d429 100644 --- a/firefox.spec +++ b/firefox.spec @@ -103,7 +103,7 @@ Summary: Mozilla Firefox Web browser Name: firefox Version: 52.0.2 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ Group: Applications/Internet @@ -153,7 +153,9 @@ Patch406: mozilla-256180.patch # Rebase Gtk3 widget code to latest trunk to # fix various rendering problems Patch407: widget-rebase.patch -Patch409: mozilla-1158076.patch +Patch410: mozilla-1348576.patch +Patch411: mozilla-1158076-1.patch +Patch412: mozilla-1158076-2.patch # Debian patches Patch500: mozilla-440908.patch @@ -319,7 +321,9 @@ cd %{tarballdir} # fix various rendering problems %patch407 -p1 -b .widget-rebase # Disabled due to rhbz#1435964 -#%patch409 -p1 -b .1158076 +%patch410 -p1 -b .1348576 +%patch411 -p1 -b .1158076-1 +%patch412 -p1 -b .1158076-2 # Debian extension patch %patch500 -p1 -b .440908 @@ -839,6 +843,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Fri Mar 31 2017 Martin Stransky - 52.0.2-2 +- Added patch for mozbz#1348576 - enable e10s by default +- Added patch for mozbz#1158076 - enable dark theme by pref + * Wed Mar 29 2017 Jan Horak - 52.0.2-1 - Update to 52.0.2 diff --git a/mozilla-1158076-1.patch b/mozilla-1158076-1.patch new file mode 100644 index 0000000..e409386 --- /dev/null +++ b/mozilla-1158076-1.patch @@ -0,0 +1,51 @@ +diff -up firefox-52.0.2/modules/libpref/init/all.js.1158076-1 firefox-52.0.2/modules/libpref/init/all.js +--- firefox-52.0.2/modules/libpref/init/all.js.1158076-1 2017-03-31 09:44:28.377647329 +0200 ++++ firefox-52.0.2/modules/libpref/init/all.js 2017-03-31 09:46:02.847234586 +0200 +@@ -4646,6 +4646,8 @@ pref("gfx.apitrace.enabled",false); + pref("gfx.content.use-native-pushlayer", true); + #ifdef MOZ_WIDGET_GTK + pref("gfx.xrender.enabled",false); ++pref("widget.chrome.allow-gtk-dark-theme", false); ++pref("widget.content.allow-gtk-dark-theme", false); + #endif + #endif + +diff -up firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp.1158076-1 firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp +--- firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp.1158076-1 2017-03-31 09:44:28.374647342 +0200 ++++ firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp 2017-03-31 09:44:35.125617758 +0200 +@@ -1134,16 +1134,27 @@ nsLookAndFeel::Init() + // with wrong color theme, see Bug 972382 + GtkSettings *settings = gtk_settings_get_for_screen(gdk_screen_get_default()); + +- // Disable dark theme because it interacts poorly with widget styling in +- // web content (see bug 1216658). +- // To avoid triggering reload of theme settings unnecessarily, only set the +- // setting when necessary. + const gchar* dark_setting = "gtk-application-prefer-dark-theme"; +- gboolean dark; +- g_object_get(settings, dark_setting, &dark, nullptr); ++ gboolean darkThemeDefault; ++ g_object_get(settings, dark_setting, &darkThemeDefault, nullptr); + +- if (dark && !PR_GetEnv("MOZ_ALLOW_GTK_DARK_THEME")) { +- g_object_set(settings, dark_setting, FALSE, nullptr); ++ // Dark themes interacts poorly with widget styling (see bug 1216658). ++ // We disable dark themes by default for all processes (chrome, web content) ++ // but allow user to overide it by prefs. ++ if (darkThemeDefault) { ++ bool allowDarkTheme; ++ if (XRE_IsContentProcess()) { ++ allowDarkTheme = ++ mozilla::Preferences::GetBool("widget.content.allow-gtk-dark-theme", ++ false); ++ } else { ++ allowDarkTheme = (PR_GetEnv("MOZ_ALLOW_GTK_DARK_THEME") != nullptr) || ++ mozilla::Preferences::GetBool("widget.chrome.allow-gtk-dark-theme", ++ false); ++ } ++ if (!allowDarkTheme) { ++ g_object_set(settings, dark_setting, FALSE, nullptr); ++ } + } + + // Scrollbar colors diff --git a/mozilla-1158076-2.patch b/mozilla-1158076-2.patch new file mode 100644 index 0000000..16079b3 --- /dev/null +++ b/mozilla-1158076-2.patch @@ -0,0 +1,184 @@ +diff --git a/widget/gtk/nsLookAndFeel.h b/widget/gtk/nsLookAndFeel.h +--- a/widget/gtk/nsLookAndFeel.h ++++ b/widget/gtk/nsLookAndFeel.h +@@ -76,13 +76,14 @@ protected: + nscolor sTextSelectedBackground; + nscolor sMozScrollbar; + #if (MOZ_WIDGET_GTK == 3) + nscolor sInfoBarText; + #endif + char16_t sInvisibleCharacter; + float sCaretRatio; + bool sMenuSupportsDrag; ++ bool mInitialized; + +- void Init(); ++ void EnsureInit(); + }; + + #endif + +diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp +--- a/widget/gtk/nsLookAndFeel.cpp ++++ b/widget/gtk/nsLookAndFeel.cpp +@@ -45,19 +45,19 @@ using mozilla::LookAndFeel; + (int)((c).blue*255), (int)((c).alpha*255))) + + nsLookAndFeel::nsLookAndFeel() + : nsXPLookAndFeel(), + #if (MOZ_WIDGET_GTK == 2) + mStyle(nullptr), + #endif + mDefaultFontCached(false), mButtonFontCached(false), +- mFieldFontCached(false), mMenuFontCached(false) ++ mFieldFontCached(false), mMenuFontCached(false), ++ mInitialized(false) + { +- Init(); + } + + nsLookAndFeel::~nsLookAndFeel() + { + #if (MOZ_WIDGET_GTK == 2) + g_object_unref(mStyle); + #endif + } +@@ -219,16 +219,18 @@ GetBorderColors(GtkStyleContext* aContex + *aDarkColor = GDK_RGBA_TO_NS_RGBA(darkColor); + return ret; + } + #endif + + nsresult + nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) + { ++ EnsureInit(); ++ + #if (MOZ_WIDGET_GTK == 3) + GdkRGBA gdk_color; + #endif + nsresult res = NS_OK; + + switch (aID) { + // These colors don't seem to be used for anything anymore in Mozilla + // (except here at least TextSelectBackground and TextSelectForeground) +@@ -670,16 +672,21 @@ nsLookAndFeel::GetIntImpl(IntID aID, int + break; + } + + res = nsXPLookAndFeel::GetIntImpl(aID, aResult); + if (NS_SUCCEEDED(res)) + return res; + res = NS_OK; + ++ // We use delayed initialization by EnsureInit() here ++ // to make sure mozilla::Preferences is available (Bug 115807). ++ // eIntID_UseAccessibilityTheme is requested before user preferences ++ // are read, and so EnsureInit(), which depends on preference values, ++ // is deliberately delayed until required. + switch (aID) { + case eIntID_CaretBlinkTime: + { + GtkSettings *settings; + gint blink_time; + gboolean blink; + + settings = gtk_settings_get_default (); +@@ -832,16 +839,17 @@ nsLookAndFeel::GetIntImpl(IntID aID, int + case eIntID_IMESelectedRawTextUnderlineStyle: + case eIntID_IMESelectedConvertedTextUnderline: + aResult = NS_STYLE_TEXT_DECORATION_STYLE_NONE; + break; + case eIntID_SpellCheckerUnderlineStyle: + aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY; + break; + case eIntID_MenuBarDrag: ++ EnsureInit(); + aResult = sMenuSupportsDrag; + break; + case eIntID_ScrollbarButtonAutoRepeatBehavior: + aResult = 1; + break; + case eIntID_SwipeAnimationEnabled: + aResult = 0; + break; +@@ -872,16 +880,17 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, + switch (aID) { + case eFloatID_IMEUnderlineRelativeSize: + aResult = 1.0f; + break; + case eFloatID_SpellCheckerUnderlineRelativeSize: + aResult = 1.0f; + break; + case eFloatID_CaretAspectRatio: ++ EnsureInit(); + aResult = sCaretRatio; + break; + default: + aResult = -1.0; + res = NS_ERROR_FAILURE; + } + return res; + } +@@ -1052,21 +1061,25 @@ nsLookAndFeel::GetFontImpl(FontID aID, n + } + + aFontName = *cachedFontName; + aFontStyle = *cachedFontStyle; + return true; + } + + void +-nsLookAndFeel::Init() ++nsLookAndFeel::EnsureInit() + { + GdkColor colorValue; + GdkColor *colorValuePtr; + ++ if (mInitialized) ++ return; ++ mInitialized = true; ++ + #if (MOZ_WIDGET_GTK == 2) + NS_ASSERTION(!mStyle, "already initialized"); + // GtkInvisibles come with a refcount that is not floating + // (since their initialization code calls g_object_ref_sink) and + // their destroy code releases that reference (which means they + // have to be explicitly destroyed, since calling unref enough + // to cause destruction would lead to *another* unref). + // However, this combination means that it's actually still ok +@@ -1445,16 +1458,17 @@ nsLookAndFeel::Init() + + gtk_widget_destroy(window); + } + + // virtual + char16_t + nsLookAndFeel::GetPasswordCharacterImpl() + { ++ EnsureInit(); + return sInvisibleCharacter; + } + + void + nsLookAndFeel::RefreshImpl() + { + nsXPLookAndFeel::RefreshImpl(); + +@@ -1463,15 +1477,15 @@ nsLookAndFeel::RefreshImpl() + mFieldFontCached = false; + mMenuFontCached = false; + + #if (MOZ_WIDGET_GTK == 2) + g_object_unref(mStyle); + mStyle = nullptr; + #endif + +- Init(); ++ mInitialized = false; + } + + bool + nsLookAndFeel::GetEchoPasswordImpl() { + return false; + } diff --git a/mozilla-1348576.patch b/mozilla-1348576.patch new file mode 100644 index 0000000..1b13847 --- /dev/null +++ b/mozilla-1348576.patch @@ -0,0 +1,46 @@ +diff -up firefox-52.0.2/browser/extensions/e10srollout/bootstrap.js.1348576 firefox-52.0.2/browser/extensions/e10srollout/bootstrap.js +--- firefox-52.0.2/browser/extensions/e10srollout/bootstrap.js.1348576 2017-03-31 09:36:20.070787199 +0200 ++++ firefox-52.0.2/browser/extensions/e10srollout/bootstrap.js 2017-03-31 09:38:09.211308920 +0200 +@@ -9,6 +9,7 @@ const {classes: Cc, interfaces: Ci, util + Cu.import("resource://gre/modules/Preferences.jsm"); + Cu.import("resource://gre/modules/Services.jsm"); + Cu.import("resource://gre/modules/UpdateUtils.jsm"); ++Cu.import("resource://gre/modules/AppConstants.jsm"); + + // The amount of people to be part of e10s + const TEST_THRESHOLD = { +@@ -23,6 +24,23 @@ const ADDON_ROLLOUT_POLICY = { + "esr" : "esrA", // WebExtensions and Addons with mpc=true + }; + ++if (AppConstants.RELEASE_OR_BETA) { ++ // Bug 1348576 - e10s is never enabled for non-official release builds ++ // This is hacky, but the problem it solves is the following: ++ // the e10s rollout is controlled by the channel name, which ++ // is the only way to distinguish between Beta and Release. ++ // However, non-official release builds (like the ones done by distros ++ // to ship Firefox on their package managers) do not set a value ++ // for the release channel, which gets them to the default value ++ // of.. (drumroll) "default". ++ // But we can't just always configure the same settings for the ++ // "default" channel because that's also the name that a locally ++ // built Firefox gets, and e10s is managed in a different way ++ // there (directly by prefs, on Nightly and Aurora). ++ TEST_THRESHOLD.default = TEST_THRESHOLD.release; ++ ADDON_ROLLOUT_POLICY.default = ADDON_ROLLOUT_POLICY.release; ++} ++ + const PREF_COHORT_SAMPLE = "e10s.rollout.cohortSample"; + const PREF_COHORT_NAME = "e10s.rollout.cohort"; + const PREF_E10S_OPTED_IN = "browser.tabs.remote.autostart"; +diff -up firefox-52.0.2/browser/extensions/e10srollout/install.rdf.in.1348576 firefox-52.0.2/browser/extensions/e10srollout/install.rdf.in +--- firefox-52.0.2/browser/extensions/e10srollout/install.rdf.in.1348576 2017-03-31 09:36:20.070787199 +0200 ++++ firefox-52.0.2/browser/extensions/e10srollout/install.rdf.in 2017-03-31 09:38:45.579149534 +0200 +@@ -11,6 +11,7 @@ + + e10srollout@mozilla.org + 1.9 ++ 1.9.1 + 2 + true + true -- cgit