merge branch changes into default
authorWolfgang Rosenauer <wr@rosenauer.org>
Wed, 18 Jan 2017 22:06:23 +0100
changeset 934 b61e849fe451
parent 923 3cc9f17ca9bb (current diff)
parent 933 7f60766aae16 (diff)
child 935 9ae2b79d3bb1
merge branch changes into default
MozillaFirefox/mozilla-aarch64-48bit-va.patch
MozillaFirefox/mozilla-exclude-nametablecpp.patch
MozillaFirefox/mozilla-gtk3_20.patch
mozilla-aarch64-48bit-va.patch
mozilla-exclude-nametablecpp.patch
mozilla-gtk3_20.patch
--- a/MozillaFirefox/MozillaFirefox.changes	Mon Aug 01 14:45:11 2016 +0200
+++ b/MozillaFirefox/MozillaFirefox.changes	Wed Jan 18 22:06:23 2017 +0100
@@ -1,7 +1,233 @@
 -------------------------------------------------------------------
+Mon Dec 12 21:18:41 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 50.1.0 (boo#)
+
+-------------------------------------------------------------------
+Fri Dec  9 17:57:22 UTC 2016 - cgrobertson@novell.com
+
+- added patch mozilla-aarch64-startup-crash.patch (bsc#1011922)
+
+-------------------------------------------------------------------
+Thu Dec  1 02:49:45 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 50.0.2
+  * Firefox crashes with 3rd party Chinese IME when using IME text
+    (50.0.1)
+  security fixes (in 50.0.1): (boo#1012807)
+  * MFSA 2016-91
+    CVE-2016-9078: data: URL can inherit wrong origin after an
+                   HTTP redirect (bmo#1317641)
+  security fixes (in 50.0.2) (boo#1012964)
+  * MFSA 2016-92
+    CVE-2016-9079: Use-after-free in SVG Animation (bmo#1321066)
+
+-------------------------------------------------------------------
+Mon Nov 14 21:07:03 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 50.0 (boo#1009026)
+  * requires NSS 3.26.2
+  new features
+  * Updates to keyboard shortcuts
+    Set a preference to have Ctrl+Tab cycle through tabs in recently
+    used order
+    View a page in Reader Mode by using Ctrl+Alt+R
+  * Added option to Find in page that allows users to limit search to
+    whole words only
+  * Added download protection for a large number of executable file
+    types on Windows, Mac and Linux
+  * Fixed rendering of dashed and dotted borders with rounded corners
+    (border-radius)
+  * Added a built-in Emoji set for operating systems without native
+    Emoji fonts (Windows 8.0 and lower and Linux)
+  * Blocked versions of libavcodec older than 54.35.1
+  * additional locale
+  security fixes:
+  * MFSA 2016-89
+    CVE-2016-5296: Heap-buffer-overflow WRITE in rasterize_edges_1
+                   (bmo#1292443)
+    CVE-2016-5292: URL parsing causes crash (bmo#1288482)
+    CVE-2016-5293: Write to arbitrary file with updater and moz
+                   maintenance service using updater.log hardlink
+		   (Windows only) (bmo#1246945)
+    CVE-2016-5294: Arbitrary target directory for result files of
+                   update process (Windows only) (bmo#1246972)
+    CVE-2016-5297: Incorrect argument length checking in Javascript
+                   (bmo#1303678)
+    CVE-2016-9064: Addons update must verify IDs match between
+                   current and new versions (bmo#1303418)
+    CVE-2016-9065: Firefox for Android location bar spoofing usingfullscreen
+                   (Android only) (bmo#1306696)
+    CVE-2016-9066: Integer overflow leading to a buffer overflow in
+                   nsScriptLoadHandler (bmo#1299686)
+    CVE-2016-9067: heap-use-after-free in nsINode::ReplaceOrInsertBefore
+                   (bmo#1301777, bmo#1308922 (CVE-2016-9069))
+    CVE-2016-9068: heap-use-after-free in nsRefreshDriver (bmo#1302973)
+    CVE-2016-9072: 64-bit NPAPI sandbox isn't enabled on fresh profile
+                   (bmo#1300083) (Windows only)
+    CVE-2016-9075: WebExtensions can access the mozAddonManager API
+                   and use it to gain elevated privileges (bmo#1295324)
+    CVE-2016-9077: Canvas filters allow feDisplacementMaps to be applied
+                   to cross-origin images, allowing timing attacks on them
+		   (bmo#1298552)
+    CVE-2016-5291: Same-origin policy violation using local HTML file
+                    and saved shortcut file (bmo#1292159)
+    CVE-2016-5295: Mozilla Maintenance Service: Ability to read
+                   arbitrary files as SYSTEM (Windows only) (bmo#1247239)
+    CVE-2016-5298: SSL indicator can mislead the user about the real
+                   URL visited (bmo#1227538) (Android only)
+    CVE-2016-5299: Firefox AuthToken in broadcast protected with
+                   signature-level permission can be accessed by an
+		   application installed beforehand that defines the
+		   same permissions (bmo#1245791) (Android only)
+    CVE-2016-9061: API Key (glocation) in broadcast protected with
+                   signature-level permission can be accessed by an
+		   application installed beforehand that defines the
+		   same permissions (Android only) (bmo#1245795)
+    CVE-2016-9062: Private browsing browser traces (android) in
+                   browser.db and wal file (Android only) (bmo#1294438)
+    CVE-2016-9070: Sidebar bookmark can have reference to chrome window
+                   (bmo#1281071)
+    CVE-2016-9073: windows.create schema doesn't specify "format": "relativeUrl"
+                   (bmo#1289273)
+    CVE-2016-9074: Insufficient timing side-channel resistance in
+                   divSpoiler (bmo#1293334) (fixed via NSS 3.26.1)
+    CVE-2016-9076: select dropdown menu can be used for URL bar
+                   spoofing on e10s (bmo#1276976)
+    CVE-2016-9063: Possible integer overflow to fix inside XML_Parse
+                   in expat (bmo#1274777)
+    CVE-2016-9071: Probe browser history via HSTS/301 redirect + CSP
+                   (bmo#1285003)
+    CVE-2016-5289: Memory safety bugs fixed in Firefox 50
+    CVE-2016-5290: Memory safety bugs fixed in Firefox 50 and Firefox ESR 45.5
+- make aarch64 build more similar to x86_64 build (remove conditionals
+  that don't seem to be necessary anymore)
+
+-------------------------------------------------------------------
+Mon Oct 24 09:41:17 UTC 2016 - astieger@suse.com
+
+- Mozilla Firefox 49.0.2:
+  * CVE-2016-5287: Crash in nsTArray_base (bsc#1006475)
+  * CVE-2016-5288: Web content can read cache entries (bsc#1006476)
+  * Asynchronous rendering of the Flash plugins is now enabled by
+    default
+  * Change D3D9 default fallback preference to prevent graphical
+    artifacts
+  * Network issue prevents some users from seeing the Firefox UI on
+    startup
+  * Web compatibility issue with file uploads
+  * Web compatibility issue with Array.prototype.values
+  * Diagnostic information on timing for tab switching
+  * Fix a Canvas filters graphics issue affecting HTML5 apps
+
+-------------------------------------------------------------------
+Wed Oct 12 20:42:28 UTC 2016 - badshah400@gmail.com
+
+- Drop mozilla-gtk3_20.patch; obsoleted by Firefox version 49.0
+  and fixes have been incorporated by upstream.
+
+-------------------------------------------------------------------
+Fri Sep 23 20:36:39 UTC 2016 - astieger@suse.com
+
+- Mozilla Firefox 49.0.1:
+  * Mitigate a startup crash issue caused by Websense - bmo#1304783
+
+-------------------------------------------------------------------
+Tue Sep 20 07:09:52 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 49.0 (boo#999701)
+  new features
+  * Updated Firefox Login Manager to allow HTTPS pages to use saved
+    HTTP logins.
+  * Added features to Reader Mode that make it easier on the eyes and
+    the ears
+  * Improved video performance for users on systems that support
+    SSE3 without hardware acceleration
+  * Added context menu controls to HTML5 audio and video that let users
+    loops files or play files at 1.25x speed
+  * Improvements in about:memory reports for tracking font memory usage
+  security related
+  * MFSA 2016-85
+    CVE-2016-2827 (bmo#1289085) - Out-of-bounds read in
+    mozilla::net::IsValidReferrerPolicy
+    CVE-2016-5270 (bmo#1291016) - Heap-buffer-overflow in
+    nsCaseTransformTextRunFactory::TransformString
+    CVE-2016-5271 (bmo#1288946) - Out-of-bounds read in
+    PropertyProvider::GetSpacingInternal
+    CVE-2016-5272 (bmo#1297934) - Bad cast in nsImageGeometryMixin
+    CVE-2016-5273 (bmo#1280387) - crash in
+    mozilla::a11y::HyperTextAccessible::GetChildOffset
+    CVE-2016-5276 (bmo#1287721) - Heap-use-after-free in
+    mozilla::a11y::DocAccessible::ProcessInvalidationList
+    CVE-2016-5274 (bmo#1282076) - use-after-free in
+    nsFrameManager::CaptureFrameState
+    CVE-2016-5277 (bmo#1291665) - Heap-use-after-free in nsRefreshDriver::Tick
+    CVE-2016-5275 (bmo#1287316) - global-buffer-overflow in
+    mozilla::gfx::FilterSupport::ComputeSourceNeededRegions
+    CVE-2016-5278 (bmo#1294677) - Heap-buffer-overflow in
+    nsBMPEncoder::AddImageFrame
+    CVE-2016-5279 (bmo#1249522) - Full local path of files is available
+    to web pages after drag and drop
+    CVE-2016-5280 (bmo#1289970) - Use-after-free in
+    mozilla::nsTextNodeDirectionalityMap::RemoveElementFromMap
+    CVE-2016-5281 (bmo#1284690) - use-after-free in DOMSVGLength
+    CVE-2016-5282 (bmo#932335) - Don't allow content to request favicons
+    from non-whitelisted schemes
+    CVE-2016-5283 (bmo#928187) - <iframe src> fragment timing attack can
+    reveal cross-origin data
+    CVE-2016-5284 (bmo#1303127) - Add-on update site certificate pin expiration
+    CVE-2016-5256 - Memory safety bugs fixed in Firefox 49
+    CVE-2016-5257 - Memory safety bugs fixed in Firefox 49 and Firefox ESR 45.4
+- removed obsolete patches:
+  * mozilla-aarch64-48bit-va.patch
+  * mozilla-exclude-nametablecpp.patch
+  * mozilla-old_configure-bmo1282843.patch
+- added patch mozilla-skia-overflow.patch (bmo#1304114)
+- requires NSS 3.25
+
+-------------------------------------------------------------------
+Tue Aug 30 20:25:38 UTC 2016 - astieger@suse.com
+
+- Mozilla Firefox 48.0.2:
+  * Mitigate a startup crash issue caused on Windows (bmo#1291738)
+
+-------------------------------------------------------------------
+Sat Aug 20 10:58:26 UTC 2016 - astieger@suse.com
+
+- Mozilla Firefox 48.0.1:
+  * Fix an audio regression impacting some major websites
+    (bmo#1295296)
+  * Fix a top crash in the JavaScript engine (bmo#1290469)
+  * Fix a startup crash issue caused by Websense (bmo#1291738)
+  * Fix a different behavior with e10s / non-e10s on <select> and
+    mouse events (bmo#1291078)
+  * Fix a top crash caused by plugin issues (bmo#1264530)
+  * Fix a shutdown issue (bmo#1276920)
+  * Fix a crash in WebRTC
+
+-------------------------------------------------------------------
+Mon Aug 15 11:24:00 UTC 2016 - wr@rosenauer.org
+
+- added upstream patch so system plugins/extensions are correctly
+  loaded again on x86-64 (bmo#1282843)
+  (mozilla-old_configure-bmo1282843.patch)
+
+-------------------------------------------------------------------
+Fri Aug  5 13:47:12 UTC 2016 - pcerny@suse.com
+
+- Fix for possible buffer overrun (bsc#990856)
+  CVE-2016-6354 (bmo#1292534)
+  [mozilla-flex_buffer_overrun.patch]
+
+-------------------------------------------------------------------
+Wed Aug  3 03:38:47 UTC 2016 - badshah400@gmail.com
+
+- Update mozilla-gtk3_20.patch to latest version from Fedora.
+
+-------------------------------------------------------------------
 Mon Aug  1 12:37:05 UTC 2016 - wr@rosenauer.org
 
-- update to Firefox 48.0 (boo#)
+- update to Firefox 48.0 (boo#991809)
   * requires NSS 3.24
   * Process separation (e10s) is enabled for some of you
   * Add-ons that have not been verified and signed by Mozilla will not load
@@ -9,6 +235,57 @@
   * The media parser has been redeveloped using the Rust programming
     language
   * better Canvas performance with speedy Skia support
+  security fixes:
+  * MFSA 2016-62/CVE-2016-2835/CVE-2016-2836
+    Miscellaneous memory safety hazards
+  * MFSA 2016-63/CVE-2016-2830 (bmo#1255270)
+    Favicon network connection can persist when page is closed
+  * MFSA 2016-64/CVE-2016-2838 (bmo#1279814)
+    Buffer overflow rendering SVG with bidirectional content
+  * MFSA 2016-65/CVE-2016-2839 (bmo#1275339)
+    Cairo rendering crash due to memory allocation issue with FFmpeg 0.10
+  * MFSA 2016-66/CVE-2016-5251 (bmo#1255570)
+    Location bar spoofing via data URLs with malformed/invalid mediatypes
+  * MFSA 2016-67/CVE-2016-5252 (bmo#1268854)
+    Stack underflow during 2D graphics rendering
+  * MFSA 2016-68/CVE-2016-0718 (bmo#1236923)
+    Out-of-bounds read during XML parsing in Expat library
+  * MFSA 2016-69/CVE-2016-5253 (bmo#1246944)
+    Arbitrary file manipulation by local user through Mozilla updater
+    and callback application path parameter (Windows-only)
+  * MFSA 2016-70/CVE-2016-5254 (bmo#1266963)
+    Use-after-free when using alt key and toplevel menus
+  * MFSA 2016-71/CVE-2016-5255 (bmo#1212356)
+    Crash in incremental garbage collection in JavaScript
+  * MFSA 2016-72/CVE-2016-5258 (bmo#1279146)
+    Use-after-free in DTLS during WebRTC session shutdown
+  * MFSA 2016-73/CVE-2016-5259 (bmo#1282992)
+    Use-after-free in service workers with nested sync events
+  * MFSA 2016-74/CVE-2016-5260 (bmo#1280294)
+    Form input type change from password to text can store plain
+    text password in session restore file
+  * MFSA 2016-75/CVE-2016-5261 (bmo#1287266)
+    Integer overflow in WebSockets during data buffering
+  * MFSA 2016-76/CVE-2016-5262 (bmo#1277475)
+    Scripts on marquee tag can execute in sandboxed iframes
+  * MFSA 2016-77/CVE-2016-2837 (bmo#1274637)
+    Buffer overflow in ClearKey Content Decryption Module (CDM)
+    during video playback
+  * MFSA 2016-78/CVE-2016-5263 (bmo#1276897)
+    Type confusion in display transformation
+  * MFSA 2016-79/CVE-2016-5264 (bmo#1286183)
+    Use-after-free when applying SVG effects
+  * MFSA 2016-80/CVE-2016-5265 (bmo#1278013)
+    Same-origin policy violation using local HTML file and saved shortcut file
+  * MFSA 2016-81/CVE-2016-5266 (bmo#1226977)
+    Information disclosure and local file manipulation through drag and drop
+  * MFSA 2016-82/CVE-2016-5267 (bmo#1284372)
+    Addressbar spoofing with right-to-left characters on Firefox for Android
+    (Android only)
+  * MFSA 2016-83/CVE-2016-5268 (bmo#1253673)
+    Spoofing attack through text injection into internal error pages
+  * MFSA 2016-84/CVE-2016-5250 (bmo#1254688)
+    Information disclosure through Resource Timing API during page navigation
 - removed obsolete mozilla-gcc6.patch
 
 -------------------------------------------------------------------
--- a/MozillaFirefox/MozillaFirefox.spec	Mon Aug 01 14:45:11 2016 +0200
+++ b/MozillaFirefox/MozillaFirefox.spec	Wed Jan 18 22:06:23 2017 +0100
@@ -18,10 +18,10 @@
 
 
 # changed with every update
-%define major 48
-%define mainver %major.0
+%define major 50
+%define mainver %major.1.0
 %define update_channel release
-%define releasedate 20160730000000
+%define releasedate 20161212000000
 
 # PIE, full relro (x86_64 for now)
 %define build_hardened 1
@@ -54,10 +54,10 @@
 %define branding 1
 %endif
 %define localize 1
-%ifarch aarch64 ppc ppc64 ppc64le s390 s390x ia64 %arm
+%ifarch %ix86 x86_64
+%define crashreporter 1
+%else
 %define crashreporter 0
-%else
-%define crashreporter 1
 %endif
 
 Name:           %{pkgname}
@@ -75,7 +75,7 @@
 BuildRequires:  libproxy-devel
 BuildRequires:  makeinfo
 BuildRequires:  mozilla-nspr-devel >= 4.12
-BuildRequires:  mozilla-nss-devel >= 3.24
+BuildRequires:  mozilla-nss-devel >= 3.26.2
 BuildRequires:  nss-shared-helper-devel
 BuildRequires:  python-devel
 BuildRequires:  startup-notification-devel
@@ -144,15 +144,17 @@
 Patch8:         mozilla-openaes-decl.patch
 Patch10:        mozilla-no-stdcxx-check.patch
 Patch11:        mozilla-reduce-files-per-UnifiedBindings.patch
-Patch12:        mozilla-gtk3_20.patch
 Patch13:        mozilla-check_return.patch
-Patch15:        mozilla-exclude-nametablecpp.patch
-Patch16:        mozilla-aarch64-48bit-va.patch
+Patch14:        mozilla-skia-overflow.patch
 Patch17:        mozilla-binutils-visibility.patch
 # Firefox/browser
 Patch101:       firefox-kde.patch
 Patch102:       firefox-no-default-ualocale.patch
 Patch103:       firefox-branded-icons.patch
+# hotfix
+Patch150:       mozilla-flex_buffer_overrun.patch
+Patch200:       mozilla-aarch64-startup-crash.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires(post):   coreutils shared-mime-info desktop-file-utils
 Requires(postun): shared-mime-info desktop-file-utils
@@ -201,7 +203,7 @@
 %package translations-other
 Summary:        Extra translations for %{appname}
 Group:          System/Localization
-Provides:       locale(%{name}:ach;af;ak;as;ast;be;bg;bn_BD;bn_IN;br;bs;csb;cy;en_ZA;eo;es_MX;et;eu;fa;ff;fy_NL;ga_IE;gd;gl;gu_IN;he;hi_IN;hr;hy_AM;id;is;kk;km;kn;ku;lg;lij;lt;lv;mai;mk;ml;mr;nn_NO;nso;or;pa_IN;rm;ro;si;sk;sl;son;sq;sr;ta;ta_LK;te;th;tr;uk;uz;vi;zu)
+Provides:       locale(%{name}:ach;af;an;as;ast;az;be;bg;bn_BD;bn_IN;br;bs;cak;cy;dsb;en_ZA;eo;es_MX;et;eu;fa;ff;fy_NL;ga_IE;gd;gl;gn;gu_IN;he;hi_IN;hr;hsb;hy_AM;id;is;kk;km;kn;lij;lt;lv;mai;mk;ml;mr;ms;nn_NO;or;pa_IN;rm;ro;si;sk;sl;son;sq;sr;ta;te;th;tr;uk;uz;vi;xh)
 Requires:       %{name} = %{version}
 Obsoletes:      %{name}-translations < %{version}-%{release}
 
@@ -257,17 +259,15 @@
 %patch8 -p1
 %patch10 -p1
 %patch11 -p1
-%if 0%{?firefox_use_gtk3}
-%patch12 -p1
-%endif
 %patch13 -p1
-%patch15 -p1
-%patch16 -p1
+%patch14 -p1
 %patch17 -p1
 # Firefox
 %patch101 -p1
 %patch102 -p1
 %patch103 -p1
+%patch150 -p1
+%patch200 -p1
 
 %build
 # no need to add build time to binaries
@@ -320,6 +320,8 @@
 mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj
 . \$topsrcdir/browser/config/mozconfig
 ac_add_options --prefix=%{_prefix}
+ac_add_options --libdir=%{_libdir}
+ac_add_options --includedir=%{_includedir}
 ac_add_options --enable-release
 %if 0%{?firefox_use_gtk3}
 ac_add_options --enable-default-toolkit=cairo-gtk3
@@ -334,7 +336,7 @@
 ac_add_options --disable-optimize
 %endif
 %endif
-%ifarch ppc ppc64 ppc64le aarch64 %arm
+%ifarch ppc ppc64 ppc64le %arm
 ac_add_options --disable-elf-hack
 %endif
 ac_add_options --with-system-nspr
@@ -363,7 +365,7 @@
 ac_add_options --with-float-abi=hard
 ac_add_options --with-arch=armv7-a
 %endif
-%ifarch %arm aarch64 s390x
+%ifarch %arm s390x
 ac_add_options --disable-webrtc
 %endif
 EOF
@@ -583,6 +585,7 @@
 %{progdir}/*.so
 %{progdir}/icudt56l.dat
 %{progdir}/omni.ja
+%{progdir}/fonts/
 %{progdir}/platform.ini
 %{progdir}/plugin-container
 %if %crashreporter
--- a/MozillaFirefox/create-tar.sh	Mon Aug 01 14:45:11 2016 +0200
+++ b/MozillaFirefox/create-tar.sh	Wed Jan 18 22:06:23 2017 +0100
@@ -7,8 +7,8 @@
 
 CHANNEL="release"
 BRANCH="releases/mozilla-$CHANNEL"
-RELEASE_TAG="c1de04f39fa956cfce83f6065b0e709369215ed5"
-VERSION="48.0"
+RELEASE_TAG="8612c3320053b796678921f8f23358e3e9df997e"
+VERSION="50.1.0"
 
 # mozilla
 if [ -d mozilla ]; then
--- a/MozillaFirefox/l10n_changesets.txt	Mon Aug 01 14:45:11 2016 +0200
+++ b/MozillaFirefox/l10n_changesets.txt	Wed Jan 18 22:06:23 2017 +0100
@@ -1,92 +1,92 @@
-ach 9a0c8e338b70
-af 9347b8c9ba47
-an 1ecc480527e8
-ar ac8018039f0f
-as 39c28ddc51af
-ast 719f95e0804a
-az 58d1d9f5ebc6
-be b72077740aac
-bg 9f7507dd2b92
-bn-BD 1dac94619464
-bn-IN a2ea6b87d80d
-br d36eef485e1f
-bs cfee6f5b1e50
-ca 55814ed0a2ee
-cak 318aec440030
-cs 76c75ca48864
-cy 927c83f85620
-da f1eafef10b33
-de 3d5d819eedd7
-dsb 91c722147298
-el 22b959c9a739
-en-GB 595e192dd7a4
-en-ZA 52a936eeeea1
-eo 1928e5a7ee7d
-es-AR 4c9cfef714f5
-es-CL c34f36c5864f
-es-ES d069f54e79f2
-es-MX 198b582408f2
-et 0568132def4f
-eu 4a534a844d9b
-fa c64ea222eb3a
-ff 8373353b43c4
-fi 4133735f9efd
-fr 94568a74633b
-fy-NL c001da131ecd
-ga-IE 1665e942f19f
-gd b4f76dd70e9a
-gl c869caff337a
-gn 65b2894520b6
-gu-IN 6245b4309461
-he 1a14924e99aa
-hi-IN bba2a926e4f8
-hr 5e68406d5630
-hsb a9ba140dbbf2
-hu d78bc92a737a
-hy-AM 723627d1c0a4
-id d84757c01f40
-is e45ec009a0fc
-it f04290f688b9
-ja 7546335099a5
-ja-JP-mac 9ecf2e1d8ea0
-kk 188c4eac0a48
-km 339790840ac1
-kn a7e2c93d27ad
-ko cbaf8af7159e
-lij e9113fac3a93
-lt 70491a0f5ef0
-lv 918ea0cd0aca
-mai ce010a305377
-mk ffdf2a789185
-ml 1b85d75836cd
-mr a6fa1813c5c9
-ms 41bbf86ac0d9
-nb-NO 5155fd334299
-nl c6d2a72aec88
-nn-NO 3569b6691b3b
-or febd1b04dbfc
-pa-IN 6c5ed1be55fb
-pl 19563918fa48
-pt-BR ba6e3510ab03
-pt-PT 258b18a5c29b
-rm 5c20929daf23
-ro b1baa279bda4
-ru 622cafa42a39
+ach 72c548f97e82
+af 676daf929ded
+an 9c672ba38dae
+ar 6bd1cb920a48
+as 9710b1ce7a29
+ast 5a06502c9fc1
+az f12bc2c29510
+be 3c6fd4559f7f
+bg 7843a5e79d32
+bn-BD 3cbe5cfb0859
+bn-IN 578eacdbac9d
+br a16ed131653a
+bs 3425b8fcf1ab
+ca c6b4f835d64e
+cak 710c1faa7291
+cs e1f114f9588d
+cy 07118becc133
+da fbec55bbfd36
+de 20748e20ccf2
+dsb 4b8493859a20
+el 16fdb46a6a47
+en-GB e7242fb885cf
+en-ZA 118b4d922a17
+eo ae85ceef76b2
+es-AR a18a4b85f35f
+es-CL c5ff11d180da
+es-ES e841d9340b7c
+es-MX 2eaf1f216766
+et 8920752eaf5b
+eu eb3cb2d122eb
+fa e481522b74f8
+ff 88f5cd66688d
+fi b20587491f77
+fr 628920fcb9f1
+fy-NL 56f04c122d2a
+ga-IE ffbfd52e15d6
+gd 9f50ee991ed8
+gl e15306f877bf
+gn 68f844f4138a
+gu-IN 54ac9d906390
+he 7c087889358a
+hi-IN aea1bb23685c
+hr b0cc9aa34502
+hsb d7ea2d9d91ea
+hu 5106349d21dd
+hy-AM 3f5103ed23e2
+id 69b0d5120660
+is 8b6a14ea919f
+it ec06674eebb4
+ja 488fbb4070d9
+ja-JP-mac e120b04c4a90
+kk 60c09b46e90d
+km 00277d0045d3
+kn 0aff09069416
+ko 33cf1dd48c33
+lij 6a94ea30eef6
+lt 15947ce6f7ff
+lv 3a43a0e2c12c
+mai b43ac46bf163
+mk 0f98fd626df2
+ml b6b5a2b26a09
+mr 0c2a798af2d9
+ms a0a74230784a
+nb-NO 378c5b201531
+nl 750fcda42314
+nn-NO 444e256b7ed8
+or 5ac88ef59ea5
+pa-IN ab02b30c28ea
+pl cd84bd057189
+pt-BR dc5c8b030a57
+pt-PT 900fd62886bb
+rm b6416ed6a3a1
+ro 2e2e9b5a07f5
+ru 1d962dfc279e
 si 03a3b09a2203
-sk 342049b6b66a
-sl 6079300745a1
-son d135d14fa4ea
-sq bc47aefcea37
-sr 2b6454805bc1
-sv-SE 44ab4d9a6718
-ta 17f88001ad3b
-te 286ff9885ea2
-th b7e1170de8c9
-tr 13c52b19c0a1
-uk c84dad1572cf
-uz 1209fe62df1c
-vi 68ce305343a3
-xh 8466fb6c8797
-zh-CN 693cfbea8412
-zh-TW 380aaa88dbf5
+sk 4e8311d1d017
+sl b43e8e65c00e
+son 544d3eea9a59
+sq 25e86afe807e
+sr 233c45e5d423
+sv-SE 6b9266a60638
+ta 0256c1b190ce
+te 8565fd8f778a
+th e2b0b5a2dc9c
+tr 255e7e613fca
+uk e36fe69f4a3f
+uz 6d46754186ab
+vi 5c32df50f35d
+xh c96bc753a170
+zh-CN 411faa039900
+zh-TW e1416ff1b4d6
 
--- a/MozillaFirefox/mozilla-aarch64-48bit-va.patch	Mon Aug 01 14:45:11 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-../mozilla-aarch64-48bit-va.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-aarch64-startup-crash.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -0,0 +1,1 @@
+../mozilla-aarch64-startup-crash.patch
\ No newline at end of file
--- a/MozillaFirefox/mozilla-exclude-nametablecpp.patch	Mon Aug 01 14:45:11 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-../mozilla-exclude-nametablecpp.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-flex_buffer_overrun.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -0,0 +1,1 @@
+../mozilla-flex_buffer_overrun.patch
\ No newline at end of file
--- a/MozillaFirefox/mozilla-gtk3_20.patch	Mon Aug 01 14:45:11 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-../mozilla-gtk3_20.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-skia-overflow.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -0,0 +1,1 @@
+../mozilla-skia-overflow.patch
\ No newline at end of file
--- a/firefox-kde.patch	Mon Aug 01 14:45:11 2016 +0200
+++ b/firefox-kde.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -1,11 +1,11 @@
 # HG changeset patch
-# Parent  07e419c2bbc63c486d25fd8ce117abd10e9ebdba
+# Parent  2cb2f829aabd7e3efaa973a0a8cf99aca9605bdc
 
 diff --git a/browser/base/content/browser-kde.xul b/browser/base/content/browser-kde.xul
 new file mode 100644
 --- /dev/null
 +++ b/browser/base/content/browser-kde.xul
-@@ -0,0 +1,1174 @@
+@@ -0,0 +1,1200 @@
 +#filter substitution
 +<?xml version="1.0"?>
 +# -*- Mode: HTML -*-
@@ -16,9 +16,10 @@
 +
 +<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
++<?xml-stylesheet href="chrome://browser/content/usercontext/usercontext.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://devtools/skin/devtools-browser.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/skin/controlcenter/panel.css" type="text/css"?>
-+<?xml-stylesheet href="chrome://browser/skin/customizableui/panelUIOverlay.css" type="text/css"?>
++<?xml-stylesheet href="chrome://browser/skin/customizableui/panelUI.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/skin/browser-lightweightTheme.css" type="text/css"?>
 +
@@ -111,6 +112,12 @@
 +                hidden="true"
 +                oncommand="gBrowser.openNonRemoteWindow(TabContextMenu.contextTab);"/>
 +#endif
++      <menuseparator id="context_sendTabToDevice_separator" hidden="true"/>
++      <menu id="context_sendTabToDevice" label="&sendTabToDevice.label;"
++            accesskey="&sendTabToDevice.accesskey;" hidden="true">
++        <menupopup id="context_sendTabToDevicePopupMenu"
++                   onpopupshowing="gFxAccounts.populateSendTabToDevicesMenu(event.target, TabContextMenu.contextTab.linkedBrowser.currentURI.spec, TabContextMenu.contextTab.linkedBrowser.contentTitle);"/>
++      </menu>
 +      <menuseparator/>
 +      <menuitem id="context_reloadAllTabs" label="&reloadAllTabs.label;" accesskey="&reloadAllTabs.accesskey;"
 +                tbattr="tabbrowser-multiple-visible"
@@ -296,18 +303,6 @@
 +           noautofocus="true"
 +           position="topcenter topright"/>
 +
-+    <panel id="loop-notification-panel"
-+           class="loop-panel social-panel"
-+           type="arrow"
-+           hidden="true"
-+           noautofocus="true"/>
-+
-+    <panel id="loop-panel"
-+           class="loop-panel social-panel"
-+           type="arrow"
-+           orient="horizontal"
-+           hidden="true"/>
-+
 +    <menupopup id="toolbar-context-menu"
 +               onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator'));">
 +      <menuitem oncommand="gCustomizeMode.addToPanel(document.popupNode)"
@@ -388,9 +383,27 @@
 +#include browser-context.inc
 +    </menupopup>
 +
-+    <menupopup id="placesContext"/>
++    <menupopup id="placesContext">
++      <menuseparator id="placesContext_recentlyBookmarkedSeparator"
++                     ignoreitem="true"
++                     hidden="true"/>
++      <menuitem id="placesContext_hideRecentlyBookmarked"
++                label="&hideRecentlyBookmarked.label;"
++                accesskey="&hideRecentlyBookmarked.accesskey;"
++                oncommand="BookmarkingUI.hideRecentlyBookmarked();"
++                closemenu="single"
++                ignoreitem="true"
++                hidden="true"/>
++      <menuitem id="placesContext_showRecentlyBookmarked"
++                label="&showRecentlyBookmarked.label;"
++                accesskey="&showRecentlyBookmarked.accesskey;"
++                oncommand="BookmarkingUI.showRecentlyBookmarked();"
++                closemenu="single"
++                ignoreitem="true"
++                hidden="true"/>
++    </menupopup>
 +
-+    <panel id="ctrlTab-panel" class="KUI-panel" hidden="true" norestorefocus="true" level="top">
++    <panel id="ctrlTab-panel" hidden="true" norestorefocus="true" level="top">
 +      <hbox>
 +        <button class="ctrlTab-preview" flex="1"/>
 +        <button class="ctrlTab-preview" flex="1"/>
@@ -404,21 +417,6 @@
 +      </hbox>
 +    </panel>
 +
-+    <!-- Sync Panel -->
-+    <panel id="sync-start-panel" class="sync-panel" type="arrow" hidden="true"
-+           noautofocus="true" onclick="this.hidePopup();"
-+           flip="slide">
-+      <hbox class="sync-panel-outer">
-+        <image class="sync-panel-icon"/>
-+        <vbox class="sync-panel-inner">
-+          <description id="sync-start-panel-title"
-+                       value="&syncStartPanel2.heading;"/>
-+          <description id="sync-start-panel-subtitle"
-+                       value="&syncStartPanel2.subTitle;"/>
-+        </vbox>
-+      </hbox>
-+    </panel>
-+
 +    <!-- Bookmarks and history tooltip -->
 +    <tooltip id="bhTooltip"/>
 +
@@ -558,12 +556,11 @@
 +  <toolbox id="navigator-toolbox" mode="icons">
 +    <!-- Menu -->
 +    <toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
-+             defaultset="menubar-items"
 +             mode="icons" iconsize="small"
 +#ifdef MENUBAR_CAN_AUTOHIDE
 +             toolbarname="&menubarCmd.label;"
 +             accesskey="&menubarCmd.accesskey;"
-+#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
++#if defined(MOZ_WIDGET_GTK)
 +             autohide="true"
 +#endif
 +#endif
@@ -590,10 +587,9 @@
 +             iconsize="small"
 +             aria-label="&tabsToolbar.label;"
 +             context="toolbar-context-menu"
-+             defaultset="tabbrowser-tabs,new-tab-button,alltabs-button"
 +             collapsed="true">
 +
-+#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
++#if defined(MOZ_WIDGET_GTK)
 +      <hbox id="private-browsing-indicator"
 +            skipintoolbarset="true"/>
 +#endif
@@ -634,11 +630,16 @@
 +                    key="key_undoCloseTab"
 +                    label="&undoCloseTab.label;"
 +                    observes="History:UndoCloseTab"/>
-+          <menuseparator id="alltabs-popup-separator"/>
++          <menuseparator id="alltabs-popup-separator-1"/>
++          <menu id="alltabs_containersTab"
++                label="&newUserContext.label;">
++            <menupopup id="alltabs_containersMenuTab" />
++          </menu>
++          <menuseparator id="alltabs-popup-separator-2"/>
 +        </menupopup>
 +      </toolbarbutton>
 +
-+#if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
++#if !defined(MOZ_WIDGET_GTK)
 +      <hbox class="private-browsing-indicator" skipintoolbarset="true"/>
 +#endif
 +#ifdef CAN_DRAW_IN_TITLEBAR
@@ -657,21 +658,10 @@
 +#endif
 +    </toolbar>
 +
-+    <!--
-+           CAVEAT EMPTOR
-+           Should you need to add items to the toolbar here, make sure to also add them
-+           to the default placements of buttons in CustomizableUI.jsm, so the
-+           customization code doesn't get confused.
-+      -->
 +    <toolbar id="nav-bar"
 +             aria-label="&navbarCmd.label;"
 +             fullscreentoolbar="true" mode="icons" customizable="true"
 +             iconsize="small"
-+#ifdef MOZ_DEV_EDITION
-+             defaultset="urlbar-container,search-container,developer-button,bookmarks-menu-button,downloads-button,home-button,loop-button"
-+#else
-+             defaultset="urlbar-container,search-container,bookmarks-menu-button,downloads-button,home-button,loop-button"
-+#endif
 +             customizationtarget="nav-bar-customization-target"
 +             overflowable="true"
 +             overflowbutton="nav-bar-overflow-button"
@@ -715,46 +705,6 @@
 +                     pageproxystate="invalid"
 +                     onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
 +                     onblur="setTimeout(() => { document.getElementById('identity-box').style.MozUserFocus = ''; }, 0);">
-+              <box id="notification-popup-box" hidden="true" align="center">
-+                <image id="default-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.defaultNotificationAnchor.label;"/>
-+                <image id="geo-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.geolocationNotificationAnchor.label;"/>
-+                <image id="addons-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.addonsNotificationAnchor.label;"/>
-+                <image id="indexedDB-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.indexedDBNotificationAnchor.label;"/>
-+                <image id="login-fill-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.loginFillNotificationAnchor.label;"/>
-+                <image id="password-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.passwordNotificationAnchor.label;"/>
-+                <image id="plugins-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.pluginsNotificationAnchor.label;"/>
-+                <image id="web-notifications-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webNotsNotificationAnchor3.label;"/>
-+                <image id="webRTC-shareDevices-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webRTCShareDevicesNotificationAnchor.label;"/>
-+                <image id="webRTC-sharingDevices-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webRTCSharingDevicesNotificationAnchor.label;"/>
-+                <image id="webRTC-shareMicrophone-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webRTCShareMicrophoneNotificationAnchor.label;"/>
-+                <image id="webRTC-sharingMicrophone-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webRTCSharingMicrophoneNotificationAnchor.label;"/>
-+                <image id="webRTC-shareScreen-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webRTCShareScreenNotificationAnchor.label;"/>
-+                <image id="webRTC-sharingScreen-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webRTCSharingScreenNotificationAnchor.label;"/>
-+                <image id="pointerLock-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.pointerLockNotificationAnchor.label;"/>
-+                <image id="servicesInstall-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.servicesNotificationAnchor.label;"/>
-+                <image id="translate-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.translateNotificationAnchor.label;"/>
-+                <image id="translated-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.translatedNotificationAnchor.label;"/>
-+                <image id="eme-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.emeNotificationAnchor.label;"/>
-+              </box>
 +              <!-- Use onclick instead of normal popup= syntax since the popup
 +                   code fires onmousedown, and hence eats our favicon drag events.
 +                   We only add the identity-box button to the tab order when the location bar
@@ -768,6 +718,67 @@
 +                <image id="identity-icon"
 +                       consumeanchor="identity-box"
 +                       onclick="PageProxyClickHandler(event);"/>
++                <box id="blocked-permissions-container" align="center" tooltiptext="">
++                  <image data-permission-id="geo" class="notification-anchor-icon geo-icon blocked" role="button"
++                         aria-label="&urlbar.geolocationNotificationAnchor.label;"/>
++                  <image data-permission-id="desktop-notification" class="notification-anchor-icon desktop-notification-icon blocked" role="button"
++                         aria-label="&urlbar.webNotsNotificationAnchor3.label;"/>
++                  <image data-permission-id="camera" class="notification-anchor-icon camera-icon blocked" role="button"
++                         aria-label="&urlbar.webRTCShareDevicesNotificationAnchor.label;"/>
++                  <image data-permission-id="indexedDB" class="notification-anchor-icon indexedDB-icon blocked" role="button"
++                         aria-label="&urlbar.indexedDBNotificationAnchor.label;"/>
++                  <image data-permission-id="microphone" class="notification-anchor-icon microphone-icon blocked" role="button"
++                         aria-label="&urlbar.webRTCShareMicrophoneNotificationAnchor.label;"/>
++                  <image data-permission-id="screen" class="notification-anchor-icon screen-icon blocked" role="button"
++                         aria-label="&urlbar.webRTCShareScreenNotificationAnchor.label;"/>
++                  <image data-permission-id="pointerLock" class="notification-anchor-icon pointerLock-icon blocked" role="button"
++                         aria-label="&urlbar.pointerLockNotificationAnchor.label;"/>
++                </box>
++                <box id="notification-popup-box"
++                     hidden="true"
++                     tooltiptext=""
++                     onmouseover="document.getElementById('identity-icon').classList.add('no-hover');"
++                     onmouseout="document.getElementById('identity-icon').classList.remove('no-hover');"
++                     align="center">
++                  <image id="default-notification-icon" class="notification-anchor-icon" role="button"
++                         aria-label="&urlbar.defaultNotificationAnchor.label;"/>
++                  <image id="geo-notification-icon" class="notification-anchor-icon geo-icon" role="button"
++                         aria-label="&urlbar.geolocationNotificationAnchor.label;"/>
++                  <image id="addons-notification-icon" class="notification-anchor-icon install-icon" role="button"
++                         aria-label="&urlbar.addonsNotificationAnchor.label;"/>
++                  <image id="indexedDB-notification-icon" class="notification-anchor-icon indexedDB-icon" role="button"
++                         aria-label="&urlbar.indexedDBNotificationAnchor.label;"/>
++                  <image id="login-fill-notification-icon" class="notification-anchor-icon login-icon" role="button"
++                         aria-label="&urlbar.loginFillNotificationAnchor.label;"/>
++                  <image id="password-notification-icon" class="notification-anchor-icon login-icon" role="button"
++                         aria-label="&urlbar.passwordNotificationAnchor.label;"/>
++                  <image id="plugins-notification-icon" class="notification-anchor-icon plugin-icon" role="button"
++                         aria-label="&urlbar.pluginsNotificationAnchor.label;"/>
++                  <image id="web-notifications-notification-icon" class="notification-anchor-icon desktop-notification-icon" role="button"
++                         aria-label="&urlbar.webNotsNotificationAnchor3.label;"/>
++                  <image id="webRTC-shareDevices-notification-icon" class="notification-anchor-icon camera-icon" role="button"
++                         aria-label="&urlbar.webRTCShareDevicesNotificationAnchor.label;"/>
++                  <image id="webRTC-sharingDevices-notification-icon" class="notification-anchor-icon camera-icon in-use" role="button"
++                         aria-label="&urlbar.webRTCSharingDevicesNotificationAnchor.label;"/>
++                  <image id="webRTC-shareMicrophone-notification-icon" class="notification-anchor-icon microphone-icon" role="button"
++                         aria-label="&urlbar.webRTCShareMicrophoneNotificationAnchor.label;"/>
++                  <image id="webRTC-sharingMicrophone-notification-icon" class="notification-anchor-icon microphone-icon in-use" role="button"
++                         aria-label="&urlbar.webRTCSharingMicrophoneNotificationAnchor.label;"/>
++                  <image id="webRTC-shareScreen-notification-icon" class="notification-anchor-icon screen-icon" role="button"
++                         aria-label="&urlbar.webRTCShareScreenNotificationAnchor.label;"/>
++                  <image id="webRTC-sharingScreen-notification-icon" class="notification-anchor-icon screen-icon in-use" role="button"
++                         aria-label="&urlbar.webRTCSharingScreenNotificationAnchor.label;"/>
++                  <image id="pointerLock-notification-icon" class="notification-anchor-icon pointerLock-icon" role="button"
++                         aria-label="&urlbar.pointerLockNotificationAnchor.label;"/>
++                  <image id="servicesInstall-notification-icon" class="notification-anchor-icon service-icon" role="button"
++                         aria-label="&urlbar.servicesNotificationAnchor.label;"/>
++                  <image id="translate-notification-icon" class="notification-anchor-icon translation-icon" role="button"
++                         aria-label="&urlbar.translateNotificationAnchor.label;"/>
++                  <image id="translated-notification-icon" class="notification-anchor-icon translation-icon in-use" role="button"
++                         aria-label="&urlbar.translatedNotificationAnchor.label;"/>
++                  <image id="eme-notification-icon" class="notification-anchor-icon drm-icon" role="button"
++                         aria-label="&urlbar.emeNotificationAnchor.label;"/>
++                </box>
 +                <image id="tracking-protection-icon"/>
 +                <image id="connection-icon"/>
 +                <hbox id="identity-icon-labels">
@@ -789,7 +800,7 @@
 +                       hidden="true"
 +                       onclick="ReaderParent.buttonClick(event);"/>
 +              </hbox>
-+              <hbox id="userContext-icons">
++              <hbox id="userContext-icons" hidden="true">
 +                <label id="userContext-label"/>
 +                <image id="userContext-indicator"/>
 +              </hbox>
@@ -856,6 +867,11 @@
 +                      command="Browser:ShowAllBookmarks"
 +                      key="manBookmarkKb"/>
 +            <menuseparator/>
++            <menuitem label="&recentBookmarks.label;"
++                      id="BMB_recentBookmarks"
++                      disabled="true"
++                      class="menuitem-iconic subviewbutton"/>
++            <menuseparator/>
 +            <menu id="BMB_bookmarksToolbar"
 +                  class="menu-iconic bookmark-item subviewbutton"
 +                  label="&personalbarCmd.label;"
@@ -967,7 +983,6 @@
 +             mode="icons" iconsize="small"
 +             class="chromeclass-directories"
 +             context="toolbar-context-menu"
-+             defaultset="personal-bookmarks"
 +             toolbarname="&personalbarCmd.label;" accesskey="&personalbarCmd.accesskey;"
 +             collapsed="true"
 +             customizable="true">
@@ -1134,13 +1149,13 @@
 +#include ../../components/customizableui/content/customizeMode.inc.xul
 +  </deck>
 +
-+  <html:div id="fullscreen-warning" hidden="true">
-+    <html:div id="fullscreen-domain-text">
++  <html:div id="fullscreen-warning" class="pointerlockfswarning" hidden="true">
++    <html:div class="pointerlockfswarning-domain-text">
 +      &fullscreenWarning.beforeDomain.label;
-+      <html:span id="fullscreen-domain"/>
++      <html:span class="pointerlockfswarning-domain"/>
 +      &fullscreenWarning.afterDomain.label;
 +    </html:div>
-+    <html:div id="fullscreen-generic-text">
++    <html:div class="pointerlockfswarning-generic-text">
 +      &fullscreenWarning.generic.label;
 +    </html:div>
 +    <html:button id="fullscreen-exit-button"
@@ -1153,6 +1168,17 @@
 +    </html:button>
 +  </html:div>
 +
++  <html:div id="pointerlock-warning" class="pointerlockfswarning" hidden="true">
++    <html:div class="pointerlockfswarning-domain-text">
++      &pointerlockWarning.beforeDomain.label;
++      <html:span class="pointerlockfswarning-domain"/>
++      &pointerlockWarning.afterDomain.label;
++    </html:div>
++    <html:div class="pointerlockfswarning-generic-text">
++      &pointerlockWarning.generic.label;
++    </html:div>
++  </html:div>
++
 +  <vbox id="browser-bottombox" layer="true">
 +    <notificationbox id="global-notificationbox" notificationside="bottom"/>
 +  </vbox>
@@ -1183,7 +1209,7 @@
 diff --git a/browser/base/jar.mn b/browser/base/jar.mn
 --- a/browser/base/jar.mn
 +++ b/browser/base/jar.mn
-@@ -69,16 +69,18 @@ browser.jar:
+@@ -68,16 +68,18 @@ browser.jar:
          content/browser/aboutTabCrashed.css           (content/aboutTabCrashed.css)
          content/browser/aboutTabCrashed.js            (content/aboutTabCrashed.js)
          content/browser/aboutTabCrashed.xhtml         (content/aboutTabCrashed.xhtml)
@@ -1200,7 +1226,7 @@
          content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
          content/browser/browser-devedition.js         (content/browser-devedition.js)
          content/browser/browser-feeds.js              (content/browser-feeds.js)
-         content/browser/browser-fullScreen.js         (content/browser-fullScreen.js)
+         content/browser/browser-fullScreenAndPointerLock.js  (content/browser-fullScreenAndPointerLock.js)
          content/browser/browser-fullZoom.js           (content/browser-fullZoom.js)
 diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp
 --- a/browser/components/build/nsModule.cpp
@@ -1288,7 +1314,7 @@
      // when the user will select the default.  We refresh here periodically
      // in case the default changes. On other Windows OS's defaults can also
      // be set while the prefs are open.
-@@ -736,16 +742,27 @@ var gMainPane = {
+@@ -703,16 +709,27 @@ var gMainPane = {
      let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");
      alwaysCheckPref.value = true;
  
@@ -1631,7 +1657,7 @@
 diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
 --- a/browser/installer/package-manifest.in
 +++ b/browser/installer/package-manifest.in
-@@ -689,16 +689,17 @@
+@@ -674,16 +674,17 @@
  @RESPATH@/greprefs.js
  @RESPATH@/defaults/autoconfig/prefcalls.js
  @RESPATH@/browser/defaults/permissions
@@ -1643,9 +1669,9 @@
 +@BINPATH@/defaults/pref/kde.js
  
  ; Services (gre) prefs
- #ifdef MOZ_SERVICES_NOTIFICATIONS
- @RESPATH@/defaults/pref/services-notifications.js
- #endif
  @RESPATH@/defaults/pref/services-sync.js
  
  ; [Layout Engine Resources]
+ ; Style Sheets, Graphics and other Resources used by the layout engine.
+ @RESPATH@/res/EditorOverride.css
+ @RESPATH@/res/contenteditable.css
--- a/mozilla-aarch64-48bit-va.patch	Mon Aug 01 14:45:11 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-
-# HG changeset patch
-# User Zheng Xu <zheng.xu@linaro.org>
-# Date 1464657720 -7200
-# Node ID dfaafbaaa2919a033c4c0abdd5830f4ea413bed6
-# Parent  499f16ca85ec48d1896a1633730715f32bd62140
-Bug 1143022 - Manually mmap on arm64 to ensure high 17 bits are clear. r=ehoogeveen
-
-There might be 48-bit VA on arm64 depending on kernel configuration.
-Manually mmap heap memory to align with the assumption made by JS engine.
-
-diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp
---- a/js/src/gc/Memory.cpp
-+++ b/js/src/gc/Memory.cpp
-@@ -430,17 +430,17 @@ InitMemorySubsystem()
-     if (pageSize == 0)
-         pageSize = allocGranularity = size_t(sysconf(_SC_PAGESIZE));
- }
- 
- static inline void*
- MapMemoryAt(void* desired, size_t length, int prot = PROT_READ | PROT_WRITE,
-             int flags = MAP_PRIVATE | MAP_ANON, int fd = -1, off_t offset = 0)
- {
--#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__))
-+#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) || defined(__aarch64__)
-     MOZ_ASSERT(0xffff800000000000ULL & (uintptr_t(desired) + length - 1) == 0);
- #endif
-     void* region = mmap(desired, length, prot, flags, fd, offset);
-     if (region == MAP_FAILED)
-         return nullptr;
-     /*
-      * mmap treats the given address as a hint unless the MAP_FIXED flag is
-      * used (which isn't usually what you want, as this overrides existing
-@@ -480,16 +480,51 @@ MapMemory(size_t length, int prot = PROT
-      * as out of memory.
-      */
-     if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) {
-         if (munmap(region, length))
-             MOZ_ASSERT(errno == ENOMEM);
-         return nullptr;
-     }
-     return region;
-+#elif defined(__aarch64__)
-+   /*
-+    * There might be similar virtual address issue on arm64 which depends on
-+    * hardware and kernel configurations. But the work around is slightly
-+    * different due to the different mmap behavior.
-+    *
-+    * TODO: Merge with the above code block if this implementation works for
-+    * ia64 and sparc64.
-+    */
-+    const uintptr_t start = UINT64_C(0x0000070000000000);
-+    const uintptr_t end   = UINT64_C(0x0000800000000000);
-+    const uintptr_t step  = ChunkSize;
-+   /*
-+    * Optimization options if there are too many retries in practice:
-+    * 1. Examine /proc/self/maps to find an available address. This file is
-+    *    not always available, however. In addition, even if we examine
-+    *    /proc/self/maps, we may still need to retry several times due to
-+    *    racing with other threads.
-+    * 2. Use a global/static variable with lock to track the addresses we have
-+    *    allocated or tried.
-+    */
-+    uintptr_t hint;
-+    void* region = MAP_FAILED;
-+    for (hint = start; region == MAP_FAILED && hint + length <= end; hint += step) {
-+        region = mmap((void*)hint, length, prot, flags, fd, offset);
-+        if (region != MAP_FAILED) {
-+            if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) {
-+                if (munmap(region, length)) {
-+                    MOZ_ASSERT(errno == ENOMEM);
-+                }
-+                region = MAP_FAILED;
-+            }
-+        }
-+    }
-+    return region == MAP_FAILED ? nullptr : region;
- #else
-     void* region = MozTaggedAnonymousMmap(nullptr, length, prot, flags, fd, offset, "js-gc-heap");
-     if (region == MAP_FAILED)
-         return nullptr;
-     return region;
- #endif
- }
- 
-diff --git a/js/src/jsapi-tests/testGCAllocator.cpp b/js/src/jsapi-tests/testGCAllocator.cpp
---- a/js/src/jsapi-tests/testGCAllocator.cpp
-+++ b/js/src/jsapi-tests/testGCAllocator.cpp
-@@ -307,48 +307,72 @@ void* mapMemoryAt(void* desired, size_t 
- void* mapMemory(size_t length) { return nullptr; }
- void unmapPages(void* p, size_t size) { }
- 
- #elif defined(XP_UNIX)
- 
- void*
- mapMemoryAt(void* desired, size_t length)
- {
--#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__))
-+#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) || defined(__aarch64__)
-     MOZ_RELEASE_ASSERT(0xffff800000000000ULL & (uintptr_t(desired) + length - 1) == 0);
- #endif
-     void* region = mmap(desired, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-     if (region == MAP_FAILED)
-         return nullptr;
-     if (region != desired) {
-         if (munmap(region, length))
-             MOZ_RELEASE_ASSERT(errno == ENOMEM);
-         return nullptr;
-     }
-     return region;
- }
- 
- void*
- mapMemory(size_t length)
- {
--    void* hint = nullptr;
-+    int prot = PROT_READ | PROT_WRITE;
-+    int flags = MAP_PRIVATE | MAP_ANON;
-+    int fd = -1;
-+    off_t offset = 0;
-+    // The test code must be aligned with the implementation in gc/Memory.cpp.
- #if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__))
--    hint = (void*)0x0000070000000000ULL;
--#endif
--    void* region = mmap(hint, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-+    void* region = mmap((void*)0x0000070000000000, length, prot, flags, fd, offset);
-     if (region == MAP_FAILED)
-         return nullptr;
--#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__))
--    if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000ULL) {
-+    if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) {
-         if (munmap(region, length))
-             MOZ_RELEASE_ASSERT(errno == ENOMEM);
-         return nullptr;
-     }
-+    return region;
-+#elif defined(__aarch64__)
-+    const uintptr_t start = UINT64_C(0x0000070000000000);
-+    const uintptr_t end   = UINT64_C(0x0000800000000000);
-+    const uintptr_t step  = ChunkSize;
-+    uintptr_t hint;
-+    void* region = MAP_FAILED;
-+    for (hint = start; region == MAP_FAILED && hint + length <= end; hint += step) {
-+        region = mmap((void*)hint, length, prot, flags, fd, offset);
-+        if (region != MAP_FAILED) {
-+            if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) {
-+                if (munmap(region, length)) {
-+                    MOZ_RELEASE_ASSERT(errno == ENOMEM);
-+                }
-+                region = MAP_FAILED;
-+            }
-+        }
-+    }
-+    return region == MAP_FAILED ? nullptr : region;
-+#else
-+    void* region = mmap(nullptr, length, prot, flags, fd, offset);
-+    if (region == MAP_FAILED)
-+        return nullptr;
-+    return region;
- #endif
--    return region;
- }
- 
- void
- unmapPages(void* p, size_t size)
- {
-     if (munmap(p, size))
-         MOZ_RELEASE_ASSERT(errno == ENOMEM);
- }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-aarch64-startup-crash.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -0,0 +1,31 @@
+# HG changeset patch
+# Parent a5cfa3aa11a9d3391df49de6fc5a0e5232c12c10
+Bug 991344 - Rpi3: Firefox crashes after a few seconds of usage
+
+diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp
+--- a/netwerk/base/nsIOService.cpp
++++ b/netwerk/base/nsIOService.cpp
+@@ -830,17 +830,23 @@ nsIOService::NewChannelFromURIWithProxyF
+                 consoleService->LogStringMessage(NS_LITERAL_STRING(
+                     "Http channel implementation doesn't support nsIUploadChannel2. An extension has supplied a non-functional http protocol handler. This will break behavior and in future releases not work at all."
+                                                                    ).get());
+             }
+             gHasWarnedUploadChannel2 = true;
+         }
+     }
+ 
++#if defined(__aarch64__)
++    if (result) {
++        channel.forget(result);
++    }
++#else
+     channel.forget(result);
++#endif
+     return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
+                                               nsIURI* aProxyURI,
+                                               uint32_t aProxyFlags,
+                                               nsIDOMNode* aLoadingNode,
--- a/mozilla-exclude-nametablecpp.patch	Mon Aug 01 14:45:11 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-
-# HG changeset patch
-# User Jonathan Kew <jkew@mozilla.com>
-# Date 1463581374 -3600
-# Node ID 9c57b7cacffc57ec3919a2cf3b5ce861e0cf3842
-# Parent  ea7843420fe518b772c7b259d8ff47193fc5b79e
-Bug 1272647 - Exclude NameTable.cpp from unified compilation because #include <cmath> in other source files causes gcc6 compilation failure. r=bas
-
-diff --git a/gfx/graphite2/src/moz.build b/gfx/graphite2/src/moz.build
---- a/gfx/graphite2/src/moz.build
-+++ b/gfx/graphite2/src/moz.build
-@@ -40,30 +40,35 @@ UNIFIED_SOURCES += [
-     'gr_features.cpp',
-     'gr_font.cpp',
-     'gr_logging.cpp',
-     'gr_segment.cpp',
-     'gr_slot.cpp',
-     'Intervals.cpp',
-     'json.cpp',
-     'Justifier.cpp',
--    'NameTable.cpp',
-     'Pass.cpp',
-     'Position.cpp',
-     'SegCache.cpp',
-     'SegCacheEntry.cpp',
-     'SegCacheStore.cpp',
-     'Segment.cpp',
-     'Silf.cpp',
-     'Slot.cpp',
-     'Sparse.cpp',
-     'TtfUtil.cpp',
-     'UtfCodec.cpp',
- ]
- 
-+# Excluded from UNIFIED_SOURCES because <cmath> from other files breaks it,
-+# see bug 1272647.
-+SOURCES += [
-+    'NameTable.cpp',
-+]
-+
- # tell graphite2 not to export symbols, we'll be linking it directly with
- # thebes
- DEFINES['GRAPHITE2_STATIC'] = True
- 
- # We allow warnings for third-party code that can be updated from upstream.
- ALLOW_COMPILER_WARNINGS = True
- 
- FINAL_LIBRARY = 'gkmedias'
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-flex_buffer_overrun.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -0,0 +1,76 @@
+# HG changeset patch
+# Parent  c8e8364b303892fdb5a574b96411d2d8f699a15e
+Patch lexical parser files generated by flex which may be potentially
+exploitable in a buffer overrun. These seem to come from an upstream projects
+(CMU Sphinx and ANGLE) so it should be fixed there in the first place.
+
+CVE-2016-6354
+
+https://bugzilla.suse.com/show_bug.cgi?id=990856
+
+diff --git a/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp b/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp
+--- a/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp
++++ b/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp
+@@ -1375,17 +1375,17 @@ static int yy_get_next_buffer (yyscan_t 
+ 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ 		/* don't do the read, it's not guaranteed to return an EOF,
+ 		 * just force an EOF
+ 		 */
+ 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+ 
+ 	else
+ 		{
+-			yy_size_t num_to_read =
++			int num_to_read =
+ 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+ 
+ 		while ( num_to_read <= 0 )
+ 			{ /* Not enough room in the buffer - grow it. */
+ 
+ 			/* just a shorter name for the current buffer */
+ 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+ 
+diff --git a/gfx/angle/src/compiler/translator/glslang_lex.cpp b/gfx/angle/src/compiler/translator/glslang_lex.cpp
+--- a/gfx/angle/src/compiler/translator/glslang_lex.cpp
++++ b/gfx/angle/src/compiler/translator/glslang_lex.cpp
+@@ -2269,17 +2269,17 @@ static int yy_get_next_buffer (yyscan_t 
+ 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ 		/* don't do the read, it's not guaranteed to return an EOF,
+ 		 * just force an EOF
+ 		 */
+ 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+ 
+ 	else
+ 		{
+-			yy_size_t num_to_read =
++			int num_to_read =
+ 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+ 
+ 		while ( num_to_read <= 0 )
+ 			{ /* Not enough room in the buffer - grow it. */
+ 
+ 			/* just a shorter name for the current buffer */
+ 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+ 
+diff --git a/media/sphinxbase/src/libsphinxbase/lm/jsgf_scanner.c b/media/sphinxbase/src/libsphinxbase/lm/jsgf_scanner.c
+--- a/media/sphinxbase/src/libsphinxbase/lm/jsgf_scanner.c
++++ b/media/sphinxbase/src/libsphinxbase/lm/jsgf_scanner.c
+@@ -1242,17 +1242,17 @@ static int yy_get_next_buffer (yyscan_t 
+ 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ 		/* don't do the read, it's not guaranteed to return an EOF,
+ 		 * just force an EOF
+ 		 */
+ 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+ 
+ 	else
+ 		{
+-			yy_size_t num_to_read =
++			int num_to_read =
+ 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+ 
+ 		while ( num_to_read <= 0 )
+ 			{ /* Not enough room in the buffer - grow it. */
+ 
+ 			/* just a shorter name for the current buffer */
+ 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+ 
--- a/mozilla-gtk3_20.patch	Mon Aug 01 14:45:11 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1697 +0,0 @@
-diff -up firefox-46.0.1/widget/gtk/gtk3drawing.c.gtk3-20 firefox-46.0.1/widget/gtk/gtk3drawing.c
---- firefox-46.0.1/widget/gtk/gtk3drawing.c.gtk3-20	2016-05-03 07:31:12.000000000 +0200
-+++ firefox-46.0.1/widget/gtk/gtk3drawing.c	2016-05-20 15:05:08.750151522 +0200
-@@ -17,34 +17,86 @@
- 
- #include <math.h>
- 
-+#define MOZ_WIDGET_STYLES 4
-+
-+typedef struct {
-+    GtkWidget*            widget;
-+
-+    union {
-+        struct {
-+            GtkStyleContext*  style;
-+            GtkStyleContext*  styleSelection;
-+        } entry;
-+
-+        struct {
-+            GtkStyleContext*  style;
-+        } button;
-+
-+        struct {
-+            GtkStyleContext*  style;
-+            GtkStyleContext*  styleBackground;
-+        } tooltip;
-+
-+        struct {
-+            GtkStyleContext*  style;
-+            GtkStyleContext*  styleContents;
-+            GtkStyleContext*  styleTrough;
-+            GtkStyleContext*  styleSlider;
-+        } scroll;
-+
-+        struct {
-+            GtkStyleContext*  style;
-+            GtkStyleContext*  styleCheck;
-+            GtkStyleContext*  styleLabel;
-+        } check;
-+
-+        struct {
-+            GtkStyleContext*  style;
-+            GtkStyleContext*  styleTrough;
-+            GtkStyleContext*  styleProgress;
-+        } progress;
-+
-+        struct {
-+            GtkStyleContext*  style;
-+            GtkStyleContext*  styleEntry;
-+            GtkStyleContext*  styleButtonUp;
-+            GtkStyleContext*  styleButtonDown;
-+        } spin;
-+
-+        struct {
-+            GtkStyleContext*  style[MOZ_WIDGET_STYLES];
-+        } all;
-+    };
-+} MozGtkWidget;
-+
- static GtkWidget* gProtoWindow;
- static GtkWidget* gProtoLayout;
--static GtkWidget* gButtonWidget;
-+static MozGtkWidget gButton;
- static GtkWidget* gToggleButtonWidget;
- static GtkWidget* gButtonArrowWidget;
--static GtkWidget* gCheckboxWidget;
--static GtkWidget* gRadiobuttonWidget;
--static GtkWidget* gHorizScrollbarWidget;
--static GtkWidget* gVertScrollbarWidget;
--static GtkWidget* gSpinWidget;
-+static MozGtkWidget gCheckbox;
-+static MozGtkWidget gRadiobutton;
-+static MozGtkWidget gVertScrollbar;
-+static MozGtkWidget gHorizScrollbar;
-+static MozGtkWidget gSpin;
- static GtkWidget* gHScaleWidget;
- static GtkWidget* gVScaleWidget;
--static GtkWidget* gEntryWidget;
-+static MozGtkWidget gEntry;
- static GtkWidget* gComboBoxWidget;
- static GtkWidget* gComboBoxButtonWidget;
- static GtkWidget* gComboBoxArrowWidget;
- static GtkWidget* gComboBoxSeparatorWidget;
- static GtkWidget* gComboBoxEntryWidget;
--static GtkWidget* gComboBoxEntryTextareaWidget;
-+static MozGtkWidget gComboBoxEntryTextarea;
- static GtkWidget* gComboBoxEntryButtonWidget;
- static GtkWidget* gComboBoxEntryArrowWidget;
- static GtkWidget* gHandleBoxWidget;
- static GtkWidget* gToolbarWidget;
- static GtkWidget* gFrameWidget;
- static GtkWidget* gStatusbarWidget;
--static GtkWidget* gProgressWidget;
-+static MozGtkWidget gProgressBar;
- static GtkWidget* gTabWidget;
--static GtkWidget* gTooltipWidget;
-+static MozGtkWidget gTooltip;
- static GtkWidget* gMenuBarWidget;
- static GtkWidget* gMenuBarItemWidget;
- static GtkWidget* gMenuPopupWidget;
-@@ -78,6 +130,37 @@ static gboolean is_initialized;
- #define GTK_STATE_FLAG_CHECKED (1 << 11)
- #endif
- 
-+void moz_gtk_widget_free(MozGtkWidget *aMozWidget)
-+{
-+    // This was removed as a child of gProtoWindow
-+    if (aMozWidget->widget) {
-+        aMozWidget->widget = NULL;
-+    }
-+
-+    for(int i = 0; i < MOZ_WIDGET_STYLES; i++) {
-+        if (aMozWidget->all.style[i]) {
-+            g_object_unref(aMozWidget->all.style[i]);
-+            aMozWidget->all.style[i] = NULL;
-+        }
-+    }
-+}
-+
-+// TODO - weak dep!! (dlsym)
-+#if GTK_CHECK_VERSION(3, 19, 2)
-+#define moz_gtk_path_set_class_name    gtk_widget_path_iter_set_object_name
-+#else
-+#define moz_gtk_path_set_class_name    gtk_widget_path_iter_add_class
-+#endif
-+//gtk_widget_path_iter_get_state
-+
-+static void
-+moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
-+                         GtkBorder *border);
-+
-+static void
-+moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
-+                          GtkBorder *padding);
-+
- static GtkStateFlags
- GetStateFlagsFromGtkWidgetState(GtkWidgetState* state)
- {
-@@ -97,6 +180,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge
-     return stateFlags;
- }
- 
-+GtkStyleContext *
-+moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent)
-+{
-+  GtkWidgetPath *path;
-+  GtkStyleContext *context;
-+
-+  if (parent)
-+    path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
-+  else
-+    path = gtk_widget_path_new ();
-+
-+  gtk_widget_path_append_type (path, node->type);
-+  if (node->name)
-+    moz_gtk_path_set_class_name(path, -1, node->name);
-+  if (node->class1)
-+    gtk_widget_path_iter_add_class(path, -1, node->class1);
-+  if (node->class2)
-+    gtk_widget_path_iter_add_class(path, -1, node->class2);
-+
-+  context = gtk_style_context_new ();
-+  gtk_style_context_set_path (context, path);
-+  gtk_style_context_set_parent (context, parent);
-+
-+  if(!gtk_check_version(3, 14, 0)) {
-+      /* Unfortunately, we have to explicitly set the state again here
-+       * for it to take effect
-+       */
-+      gtk_style_context_set_state (context, gtk_widget_path_iter_get_state (path, -1));
-+  }
-+
-+  gtk_widget_path_unref (path);
-+
-+  return context;
-+}
-+
- /* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine
-    that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific
-    things they may want to do. */
-@@ -141,9 +259,16 @@ setup_widget_prototype(GtkWidget* widget
- static gint
- ensure_button_widget()
- {
--    if (!gButtonWidget) {
--        gButtonWidget = gtk_button_new_with_label("M");
--        setup_widget_prototype(gButtonWidget);
-+    if (!gButton.widget) {
-+        GtkCssNode path[] = { 
-+            { GTK_TYPE_BUTTON, "button", NULL, NULL }
-+        };
-+
-+        gButton.widget = gtk_button_new_with_label("M");
-+        setup_widget_prototype(gButton.widget);
-+        gtk_widget_show(gButton.widget);
-+
-+        gButton.button.style = moz_gtk_style_create(&path[0], NULL);
-     }
-     return MOZ_GTK_SUCCESS;
- }
-@@ -195,9 +320,21 @@ ensure_button_arrow_widget()
- static gint
- ensure_checkbox_widget()
- {
--    if (!gCheckboxWidget) {
--        gCheckboxWidget = gtk_check_button_new_with_label("M");
--        setup_widget_prototype(gCheckboxWidget);
-+   if (!gCheckbox.widget) {
-+        GtkCssNode path[] = {
-+           { GTK_TYPE_TOGGLE_BUTTON, "checkbutton", NULL, NULL },
-+           { G_TYPE_NONE, "check", NULL, NULL },
-+           { G_TYPE_NONE, "label", NULL, NULL }
-+        };
-+
-+        gCheckbox.widget = gtk_check_button_new_with_label("M");
-+        setup_widget_prototype(gCheckbox.widget);
-+
-+        gCheckbox.check.style = moz_gtk_style_create(&path[0], NULL);
-+        gCheckbox.check.styleCheck = moz_gtk_style_create(&path[1],
-+                                       gCheckbox.check.style);
-+        gCheckbox.check.styleLabel = moz_gtk_style_create(&path[2],
-+                                       gCheckbox.check.style);
-     }
-     return MOZ_GTK_SUCCESS;
- }
-@@ -205,9 +342,21 @@ ensure_checkbox_widget()
- static gint
- ensure_radiobutton_widget()
- {
--    if (!gRadiobuttonWidget) {
--        gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M");
--        setup_widget_prototype(gRadiobuttonWidget);
-+    if (!gRadiobutton.widget) {
-+        GtkCssNode path[] = {
-+           { GTK_TYPE_TOGGLE_BUTTON, "radiobutton", NULL, NULL },
-+           { G_TYPE_NONE, "radio", NULL, NULL },
-+           { G_TYPE_NONE, "label", NULL, NULL }
-+        };
-+
-+        gRadiobutton.widget = gtk_radio_button_new_with_label(NULL, "M");
-+        setup_widget_prototype(gRadiobutton.widget);
-+
-+        gRadiobutton.check.style = moz_gtk_style_create(&path[0], NULL);
-+        gRadiobutton.check.styleCheck = moz_gtk_style_create(&path[1],
-+                                          gRadiobutton.check.style);
-+        gRadiobutton.check.styleLabel = moz_gtk_style_create(&path[2],
-+                                          gRadiobutton.check.style);
-     }
-     return MOZ_GTK_SUCCESS;
- }
-@@ -215,25 +364,62 @@ ensure_radiobutton_widget()
- static gint
- ensure_scrollbar_widget()
- {
--    if (!gVertScrollbarWidget) {
--        gVertScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
--        setup_widget_prototype(gVertScrollbarWidget);
--    }
--    if (!gHorizScrollbarWidget) {
--        gHorizScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL);
--        setup_widget_prototype(gHorizScrollbarWidget);
--    }
-+    if (!gVertScrollbar.widget && !gHorizScrollbar.widget) {
-+        GtkCssNode path[] = {
-+            { GTK_TYPE_SCROLLBAR, "scrollbar", "horizontal", "bottom"},
-+            { GTK_TYPE_SCROLLBAR, "scrollbar", "vertical", "right" },
-+            { G_TYPE_NONE, "contents", NULL, NULL },
-+            { G_TYPE_NONE, "trough", NULL, NULL },
-+            { G_TYPE_NONE, "slider", NULL, NULL }
-+        };
-+
-+        gHorizScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL);
-+        setup_widget_prototype(gHorizScrollbar.widget);
-+
-+        gHorizScrollbar.scroll.style = moz_gtk_style_create(path, NULL);
-+        gHorizScrollbar.scroll.styleContents = moz_gtk_style_create(path+2, 
-+                                               gHorizScrollbar.scroll.style);
-+        gHorizScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3, 
-+                                               gHorizScrollbar.scroll.styleContents);
-+        gHorizScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4, 
-+                                               gHorizScrollbar.scroll.styleTrough);
-+
-+        gVertScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
-+        setup_widget_prototype(gVertScrollbar.widget);
-+
-+        gVertScrollbar.scroll.style = moz_gtk_style_create(path+1, NULL);
-+        gVertScrollbar.scroll.styleContents = moz_gtk_style_create(path+2, 
-+                                              gVertScrollbar.scroll.style);
-+        gVertScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3, 
-+                                              gVertScrollbar.scroll.styleContents);
-+        gVertScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4, 
-+                                              gVertScrollbar.scroll.styleTrough);
-+
-+     }
-     return MOZ_GTK_SUCCESS;
- }
- 
- static gint
- ensure_spin_widget()
- {
--  if (!gSpinWidget) {
--    gSpinWidget = gtk_spin_button_new(NULL, 1, 0);
--    setup_widget_prototype(gSpinWidget);
--  }
--  return MOZ_GTK_SUCCESS;
-+    if (!gSpin.widget) {
-+        GtkCssNode path[] = {
-+            { GTK_TYPE_SPIN_BUTTON, "spinbutton", "horizontal", NULL },
-+            { GTK_TYPE_SPIN_BUTTON, "spinbutton", "vertical", NULL },
-+            { GTK_TYPE_ENTRY, "entry", NULL, NULL },
-+            { G_TYPE_NONE, "button", "up", NULL },
-+            { G_TYPE_NONE, "button", "down", NULL }
-+        };
-+
-+        gSpin.widget = gtk_spin_button_new(NULL, 1, 0);
-+        setup_widget_prototype(gSpin.widget);
-+
-+        gSpin.spin.style = moz_gtk_style_create(path, NULL);
-+        gSpin.spin.styleButtonUp = moz_gtk_style_create(path+3, gSpin.spin.style);
-+        gSpin.spin.styleButtonDown = moz_gtk_style_create(path+4, gSpin.spin.style);
-+        gSpin.spin.styleEntry = moz_gtk_style_create(path+2, gSpin.spin.style);
-+    }
-+    return MOZ_GTK_SUCCESS;
- }
- 
- static gint
-@@ -253,9 +439,19 @@ ensure_scale_widget()
- static gint
- ensure_entry_widget()
- {
--    if (!gEntryWidget) {
--        gEntryWidget = gtk_entry_new();
--        setup_widget_prototype(gEntryWidget);
-+    if (!gEntry.widget) {
-+        GtkCssNode path[] = { 
-+            { GTK_TYPE_ENTRY, "entry", NULL, NULL },
-+            { G_TYPE_NONE, "selection", NULL, NULL }
-+        };
-+
-+        gEntry.widget = gtk_entry_new();
-+        setup_widget_prototype(gEntry.widget);
-+        gtk_widget_show(gEntry.widget);
-+
-+        gEntry.entry.style = moz_gtk_style_create(&path[0], NULL);
-+        gEntry.entry.styleSelection = moz_gtk_style_create(&path[1], 
-+                                                           gEntry.entry.style);
-     }
-     return MOZ_GTK_SUCCESS;
- }
-@@ -387,9 +583,9 @@ moz_gtk_get_combo_box_entry_inner_widget
-         g_object_add_weak_pointer(G_OBJECT(widget),
-                                   (gpointer) &gComboBoxEntryButtonWidget);
-     } else if (GTK_IS_ENTRY(widget)) {
--        gComboBoxEntryTextareaWidget = widget;
-+        gComboBoxEntryTextarea.widget = widget;
-         g_object_add_weak_pointer(G_OBJECT(widget),
--                                  (gpointer) &gComboBoxEntryTextareaWidget);
-+                                  (gpointer) &gComboBoxEntryTextarea.widget);
-     } else
-         return;
-     gtk_widget_realize(widget);
-@@ -411,7 +607,7 @@ ensure_combo_box_entry_widgets()
- {
-     GtkWidget* buttonChild;
- 
--    if (gComboBoxEntryTextareaWidget &&
-+    if (gComboBoxEntryTextarea.widget &&
-             gComboBoxEntryButtonWidget &&
-             gComboBoxEntryArrowWidget)
-         return MOZ_GTK_SUCCESS;
-@@ -427,9 +623,9 @@ ensure_combo_box_entry_widgets()
-                          moz_gtk_get_combo_box_entry_inner_widgets,
-                          NULL);
- 
--    if (!gComboBoxEntryTextareaWidget) {
-+    if (!gComboBoxEntryTextarea.widget) {
-         ensure_entry_widget();
--        gComboBoxEntryTextareaWidget = gEntryWidget;
-+        gComboBoxEntryTextarea.widget = gEntry.widget;
-     }
- 
-     if (gComboBoxEntryButtonWidget) {
-@@ -507,12 +703,18 @@ ensure_toolbar_separator_widget()
- static gint
- ensure_tooltip_widget()
- {
--    if (!gTooltipWidget) {
--        gTooltipWidget = gtk_window_new(GTK_WINDOW_POPUP);
--        GtkStyleContext* style = gtk_widget_get_style_context(gTooltipWidget);
--        gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
--        gtk_widget_realize(gTooltipWidget);
--        moz_gtk_set_widget_name(gTooltipWidget);
-+    if (!gTooltip.widget) {
-+        GtkCssNode path[] = { 
-+            { GTK_TYPE_TOOLTIP, "tooltip", NULL, NULL},
-+            { GTK_TYPE_TOOLTIP, "tooltip", "background", NULL},
-+        };
-+
-+        gTooltip.widget = gtk_window_new(GTK_WINDOW_POPUP);
-+        gtk_widget_realize(gTooltip.widget);
-+        moz_gtk_set_widget_name(gTooltip.widget);
-+
-+        gTooltip.tooltip.style = moz_gtk_style_create(&path[0], NULL);
-+        gTooltip.tooltip.styleBackground = moz_gtk_style_create(&path[1], NULL);
-     }
-     return MOZ_GTK_SUCCESS;
- }
-@@ -530,9 +732,21 @@ ensure_tab_widget()
- static gint
- ensure_progress_widget()
- {
--    if (!gProgressWidget) {
--        gProgressWidget = gtk_progress_bar_new();
--        setup_widget_prototype(gProgressWidget);
-+    if (!gProgressBar.widget) {
-+        GtkCssNode path[] = {
-+           { GTK_TYPE_LABEL, "progressbar", NULL, NULL },
-+           { G_TYPE_NONE, "trough", NULL, NULL },
-+           { G_TYPE_NONE, "progress", NULL, NULL },
-+        };
-+
-+        gProgressBar.widget = gtk_progress_bar_new();
-+        setup_widget_prototype(gProgressBar.widget);
-+
-+        gProgressBar.progress.style = moz_gtk_style_create(&path[0], NULL);
-+        gProgressBar.progress.styleTrough = moz_gtk_style_create(&path[1],
-+                                              gProgressBar.progress.style);
-+        gProgressBar.progress.styleProgress = moz_gtk_style_create(&path[2],
-+                                                gProgressBar.progress.styleTrough);
-     }
-     return MOZ_GTK_SUCCESS;
- }
-@@ -638,6 +852,11 @@ static gint
- ensure_check_menu_item_widget()
- {
-     if (!gCheckMenuItemWidget) {
-+        GtkCssNode path[] = {
-+           { GTK_TYPE_CHECK_MENU_ITEM, "menuitem", NULL, NULL },
-+           { G_TYPE_NONE, "check", NULL, NULL }
-+        };
-+
-         ensure_menu_popup_widget();
-         gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
-         gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
-@@ -752,7 +971,7 @@ moz_gtk_checkbox_get_metrics(gint* indic
- {
-     ensure_checkbox_widget();
- 
--    gtk_widget_style_get (gCheckboxWidget,
-+    gtk_widget_style_get (gCheckbox.widget,
-                           "indicator_size", indicator_size,
-                           "indicator_spacing", indicator_spacing,
-                           NULL);
-@@ -765,7 +984,7 @@ moz_gtk_radio_get_metrics(gint* indicato
- {
-     ensure_radiobutton_widget();
- 
--    gtk_widget_style_get (gRadiobuttonWidget,
-+    gtk_widget_style_get (gRadiobutton.widget,
-                           "indicator_size", indicator_size,
-                           "indicator_spacing", indicator_spacing,
-                           NULL);
-@@ -778,13 +997,13 @@ moz_gtk_get_focus_outline_size(gint* foc
- {
-     GtkBorder border;
-     GtkBorder padding;
--    GtkStyleContext *style;
-+    GtkStyleContext* style;
- 
-     ensure_entry_widget();
--    style = gtk_widget_get_style_context(gEntryWidget);
- 
--    gtk_style_context_get_border(style, 0, &border);
--    gtk_style_context_get_padding(style, 0, &padding);
-+    style = gEntry.entry.style;
-+    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
-+    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
-     *focus_h_width = border.left + padding.left;
-     *focus_v_width = border.top + padding.top;
-     return MOZ_GTK_SUCCESS;
-@@ -821,7 +1040,7 @@ moz_gtk_button_get_default_overflow(gint
-     GtkBorder* default_outside_border;
- 
-     ensure_button_widget();
--    gtk_widget_style_get(gButtonWidget,
-+    gtk_widget_style_get(gButton.widget,
-                          "default-outside-border", &default_outside_border,
-                          NULL);
- 
-@@ -844,7 +1063,7 @@ moz_gtk_button_get_default_border(gint*
-     GtkBorder* default_border;
- 
-     ensure_button_widget();
--    gtk_widget_style_get(gButtonWidget,
-+    gtk_widget_style_get(gButton.widget,
-                          "default-border", &default_border,
-                          NULL);
- 
-@@ -935,7 +1154,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
- 
-     if (state->focused) {
-         GtkBorder border;
--        gtk_style_context_get_border(style, state_flags, &border);
-+        moz_gtk_get_style_border(style, state_flags, &border);
-         x += border.left;
-         y += border.top;
-         width -= (border.left + border.right);
-@@ -956,15 +1175,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
-     gint indicator_size, indicator_spacing;
-     gint x, y, width, height;
-     gint focus_x, focus_y, focus_width, focus_height;
--    GtkWidget *w;
--    GtkStyleContext *style;
-+    MozGtkWidget *w;
- 
-     if (isradio) {
-         moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing);
--        w = gRadiobuttonWidget;
-+        w = &gRadiobutton;
-     } else {
-         moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing);
--        w = gCheckboxWidget;
-+        w = &gCheckbox;
-     }
- 
-     // XXX we should assert rect->height >= indicator_size too
-@@ -983,11 +1201,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
-     focus_width = width + 2 * indicator_spacing;
-     focus_height = height + 2 * indicator_spacing;
-   
--    style = gtk_widget_get_style_context(w);
--
--    gtk_widget_set_sensitive(w, !state->disabled);
--    gtk_widget_set_direction(w, direction);
--    gtk_style_context_save(style);
-+    gtk_widget_set_sensitive(w->widget, !state->disabled);
-+    gtk_widget_set_direction(w->widget, direction);
-+    gtk_style_context_save(w->check.styleCheck);
- 
-     if (selected)
-         state_flags |= checkbox_check_state;
-@@ -995,13 +1211,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
-     if (inconsistent)
-         state_flags |= GTK_STATE_FLAG_INCONSISTENT;
- 
--    gtk_style_context_set_state(style, state_flags);
-+    gtk_style_context_set_state(w->check.styleCheck, state_flags);
-+
-+    gtk_render_background(w->check.styleCheck, cr, x, y, width, height);
-+    gtk_render_frame(w->check.styleCheck, cr, x, y, width, height);
- 
-     if (isradio) {
--        gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
--        gtk_render_option(style, cr, x, y, width, height);
-+        gtk_render_option(w->check.styleCheck, cr, x, y, width, height);
-         if (state->focused) {
--            gtk_render_focus(style, cr, focus_x, focus_y,
-+            gtk_render_focus(w->check.styleCheck, cr, focus_x, focus_y,
-                             focus_width, focus_height);
-         }
-     }
-@@ -1010,15 +1228,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
-         * 'indeterminate' type on checkboxes. In GTK, the shadow type
-         * must also be changed for the state to be drawn.
-         */        
--        gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
--        gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), inconsistent);
--        gtk_render_check(style, cr, x, y, width, height);        
-+        gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(w->widget), inconsistent);
-+        gtk_render_check(w->check.styleCheck, cr, x, y, width, height);
-         if (state->focused) {
--            gtk_render_focus(style, cr, 
-+            gtk_render_focus(w->check.styleCheck, cr,
-                              focus_x, focus_y, focus_width, focus_height);
-         }
-     }
--    gtk_style_context_restore(style);
-+    gtk_style_context_restore(w->check.styleCheck);
- 
-     return MOZ_GTK_SUCCESS;
- }
-@@ -1035,8 +1252,8 @@ calculate_button_inner_rect(GtkWidget* b
-     style = gtk_widget_get_style_context(button);
- 
-     /* This mirrors gtkbutton's child positioning */
--    gtk_style_context_get_border(style, 0, &border);
--    gtk_style_context_get_padding(style, 0, &padding);
-+    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
-+    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
- 
-     inner_rect->x = rect->x + border.left + padding.left;
-     inner_rect->y = rect->y + padding.top + border.top;
-@@ -1099,9 +1316,9 @@ moz_gtk_scrollbar_button_paint(cairo_t *
-     ensure_scrollbar_widget();
- 
-     if (flags & MOZ_GTK_STEPPER_VERTICAL)
--        scrollbar = gVertScrollbarWidget;
-+        scrollbar = gVertScrollbar.widget;
-     else
--        scrollbar = gHorizScrollbarWidget;
-+        scrollbar = gHorizScrollbar.widget;
- 
-     gtk_widget_set_direction(scrollbar, direction);
- 
-@@ -1181,25 +1398,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
-                                GtkTextDirection direction)
- {
-     GtkStyleContext* style;
--    GtkScrollbar *scrollbar;
- 
-     ensure_scrollbar_widget();
- 
--    if (widget ==  MOZ_GTK_SCROLLBAR_HORIZONTAL)
--        scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
--    else
--        scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
--
--    gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
--    
-     if (flags & MOZ_GTK_TRACK_OPAQUE) {
-         style = gtk_widget_get_style_context(GTK_WIDGET(gProtoWindow));
-         gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
-     }
- 
--    style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar));
--    gtk_style_context_save(style);
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
-+     if (widget == MOZ_GTK_SCROLLBAR_HORIZONTAL) {
-+        gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction);
-+        style = gHorizScrollbar.scroll.style;
-+    }
-+    else {
-+        gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction);
-+        style = gVertScrollbar.scroll.style;
-+    }
- 
-     gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
-     gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
-@@ -1208,7 +1422,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
-         gtk_render_focus(style, cr,
-                          rect->x, rect->y, rect->width, rect->height);
-     }
--    gtk_style_context_restore(style);
-     return MOZ_GTK_SUCCESS;
- }
- 
-@@ -1220,24 +1433,20 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
- {
-     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
-     GtkStyleContext* style;
--    GtkScrollbar *scrollbar;
-     GtkBorder margin;
- 
-     ensure_scrollbar_widget();
- 
--    if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
--        scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
--    else
--        scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
--
--    gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
--
--    style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar));
--    gtk_style_context_save(style);
-+    if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) {
-+        style = gHorizScrollbar.scroll.styleSlider;
-+        gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction);
-+    }
-+    else {
-+        style = gVertScrollbar.scroll.styleSlider; 
-+        gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction);
-+    }
- 
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_SLIDER);
-     gtk_style_context_set_state(style, state_flags);
--
-     gtk_style_context_get_margin (style, state_flags, &margin);
- 
-     gtk_render_slider(style, cr,
-@@ -1248,8 +1457,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
-                      (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ?
-                      GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
- 
--    gtk_style_context_restore(style);
--
-     return MOZ_GTK_SUCCESS;
- }
- 
-@@ -1260,8 +1467,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta
-     GtkStyleContext* style;
- 
-     ensure_spin_widget();
--    gtk_widget_set_direction(gSpinWidget, direction);
--    style = gtk_widget_get_style_context(gSpinWidget);
-+    gtk_widget_set_direction(gSpin.widget, direction);
-+    style = gSpin.spin.style;
-     gtk_style_context_save(style);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
-     gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
-@@ -1280,11 +1487,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G
-     GtkStyleContext* style;
- 
-     ensure_spin_widget();
--    style = gtk_widget_get_style_context(gSpinWidget);
-+    style = gSpin.spin.style;
-     gtk_style_context_save(style);
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
-     gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
--    gtk_widget_set_direction(gSpinWidget, direction);
-+    gtk_widget_set_direction(gSpin.widget, direction);
- 
-     gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
-     gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
-@@ -1450,15 +1656,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec
- static gint
- moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
-                     GtkWidgetState* state,
--                    GtkWidget* widget, GtkTextDirection direction)
-+                    MozGtkWidget* w, GtkTextDirection direction)
- {
-     gint x = rect->x, y = rect->y, width = rect->width, height = rect->height;
--    GtkStyleContext* style;
-     int draw_focus_outline_only = state->depressed; // NS_THEME_FOCUS_OUTLINE
-+    GtkStyleContext* style = w->entry.style;
- 
--    gtk_widget_set_direction(widget, direction);
--
--    style = gtk_widget_get_style_context(widget);
-+    gtk_widget_set_direction(w->widget, direction);
- 
-     if (draw_focus_outline_only) {
-         // Inflate the given 'rect' with the focus outline size.
-@@ -1478,10 +1682,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
-      * textarea window uses gtk_paint_flat_box when exposed */
- 
-     /* This gets us a lovely greyish disabledish look */
--    gtk_widget_set_sensitive(widget, !state->disabled);
-+    gtk_widget_set_sensitive(w->widget, !state->disabled);
- 
-     gtk_style_context_save(style);
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_ENTRY);
-   
-     /* Now paint the shadow and focus border.
-      * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
-@@ -1531,7 +1734,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR
-     style = gtk_widget_get_style_context(gScrolledWindowWidget);
-     gtk_style_context_save(style);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME);    
--    gtk_style_context_get_border(style, state_flags, &border);
-+    moz_gtk_get_style_border(style, state_flags, &border);
-     xthickness = border.left;
-     ythickness = border.top;    
- 
-@@ -1702,7 +1905,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
-         if (direction == GTK_TEXT_DIR_LTR) {
-             GtkBorder padding;
-             GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
--            gtk_style_context_get_padding(style, state_flags, &padding);
-+            moz_gtk_get_style_padding(style, state_flags, &padding);
-             arrow_rect.x -= padding.left;
-         }
-         else
-@@ -1804,29 +2007,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk
-                         gboolean isradio, GtkTextDirection direction)
- {
-     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
--    GtkStyleContext* style;
--    GtkWidget *widget;
-+    MozGtkWidget *widget;
- 
-     if (isradio) {
-         ensure_radiobutton_widget();
--        widget = gRadiobuttonWidget;
-+        widget = &gRadiobutton;
-     } else {
-         ensure_checkbox_widget();
--        widget = gCheckboxWidget;
-+        widget = &gCheckbox;
-     }
--    gtk_widget_set_direction(widget, direction);
-+    gtk_widget_set_direction(widget->widget, direction);
- 
--    style = gtk_widget_get_style_context(widget);
--    gtk_style_context_save(style);
--    gtk_style_context_set_state(style, state_flags);
-+    gtk_style_context_save(widget->check.style);
-+    gtk_style_context_set_state(widget->check.style, state_flags);
-   
-     /* this is for drawing a prelight box */
-     if (state_flags & GTK_STATE_FLAG_PRELIGHT) {
--        gtk_render_background(style, cr,
-+        gtk_render_background(widget->check.style, cr,
-                               rect->x, rect->y, rect->width, rect->height);
-     }
-   
--    gtk_style_context_restore(style);
-+    gtk_style_context_restore(widget->check.style);
-   
-     return MOZ_GTK_SUCCESS;
- }
-@@ -1836,32 +2037,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr,
-                            GtkWidgetState* state, 
-                            gboolean isradio, GtkTextDirection direction)
- {
--    GtkStyleContext *style;
--    GtkWidget *widget;
-+    MozGtkWidget *widget;
- 
-     if (!state->focused)
-         return MOZ_GTK_SUCCESS;
- 
-     if (isradio) {
-         ensure_radiobutton_widget();
--        widget = gRadiobuttonWidget;
-+        widget = &gRadiobutton;
-     } else {
-         ensure_checkbox_widget();
--        widget = gCheckboxWidget;
--    }
--    style = gtk_widget_get_style_context(widget);
--    gtk_style_context_save(style);
--    if (isradio) {
--      gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
--    } else {
--      gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
-+        widget = &gCheckbox;
-     }
--    gtk_widget_set_direction(widget, direction);
-+    gtk_style_context_save(widget->check.styleLabel);
-+    gtk_widget_set_direction(widget->widget, direction);
- 
--    gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
--    gtk_render_focus(style, cr,
-+    gtk_style_context_set_state(widget->check.styleLabel, 
-+                                GetStateFlagsFromGtkWidgetState(state));
-+    gtk_render_focus(widget->check.styleLabel, cr,
-                     rect->x, rect->y, rect->width, rect->height);
--    gtk_style_context_restore(style);
-+    gtk_style_context_restore(widget->check.styleLabel);
- 
-     return MOZ_GTK_SUCCESS;
- }
-@@ -1922,7 +2117,7 @@ moz_gtk_toolbar_separator_paint(cairo_t
-                           rect->height * (end_fraction - start_fraction));
-     } else {
-         GtkBorder padding;
--        gtk_style_context_get_padding(style, 0, &padding);
-+        gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
-     
-         paint_width = padding.left;
-         if (paint_width > rect->width)
-@@ -1945,9 +2140,9 @@ moz_gtk_tooltip_paint(cairo_t *cr, GdkRe
-     GtkStyleContext* style;
- 
-     ensure_tooltip_widget();
--    gtk_widget_set_direction(gTooltipWidget, direction);
-+    gtk_widget_set_direction(gTooltip.widget, direction);
- 
--    style = gtk_widget_get_style_context(gTooltipWidget);
-+    style = gTooltip.tooltip.styleBackground;
-     gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
-     gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
-     return MOZ_GTK_SUCCESS;
-@@ -2006,18 +2201,13 @@ static gint
- moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
-                           GtkTextDirection direction)
- {
--    GtkStyleContext* style;
--
-     ensure_progress_widget();
--    gtk_widget_set_direction(gProgressWidget, direction);
-+    gtk_widget_set_direction(gProgressBar.widget, direction);
- 
--    style = gtk_widget_get_style_context(gProgressWidget);
--    gtk_style_context_save(style);
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
--    
--    gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
--    gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
--    gtk_style_context_restore(style);
-+    gtk_render_background(gProgressBar.progress.styleTrough, cr,
-+                          rect->x, rect->y, rect->width, rect->height);
-+    gtk_render_frame(gProgressBar.progress.styleTrough, cr,
-+                     rect->x, rect->y, rect->width, rect->height);
- 
-     return MOZ_GTK_SUCCESS;
- }
-@@ -2027,15 +2217,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
-                              GtkTextDirection direction,
-                              GtkThemeWidgetType widget)
- {
--    GtkStyleContext* style;
--
-     ensure_progress_widget();
--    gtk_widget_set_direction(gProgressWidget, direction);
--
--    style = gtk_widget_get_style_context(gProgressWidget);
--    gtk_style_context_save(style);
--    gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
-+    gtk_widget_set_direction(gProgressBar.widget, direction);
- 
-     if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
-         widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
-@@ -2074,12 +2257,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
-     // gtk_render_activity was used to render progress chunks on GTK versions
-     // before 3.13.7, see bug 1173907.
-     if (!gtk_check_version(3, 13, 7)) {
--      gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
--      gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
-+      gtk_render_background(gProgressBar.progress.styleProgress, cr,
-+                            rect->x, rect->y, rect->width, rect->height);
-+      gtk_render_frame(gProgressBar.progress.styleProgress, cr,
-+                       rect->x, rect->y, rect->width, rect->height);
-     } else {
--      gtk_render_activity(style, cr, rect->x, rect->y, rect->width, rect->height);
-+      gtk_render_activity(gProgressBar.progress.styleProgress, cr,
-+                          rect->x, rect->y, rect->width, rect->height);
-     }
--    gtk_style_context_restore(style);
- 
-     return MOZ_GTK_SUCCESS;
- }
-@@ -2096,7 +2281,7 @@ moz_gtk_get_tab_thickness(void)
- 
-     style = gtk_widget_get_style_context(gTabWidget);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK);
--    gtk_style_context_get_border(style, 0, &border);
-+    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
- 
-     if (border.top < 2)
-         return 2; /* some themes don't set ythickness correctly */
-@@ -2292,7 +2477,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
-       gtk_style_context_save(style);
-       moz_gtk_tab_prepare_style_context(style, flags);
- 
--      gtk_style_context_get_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
-+      moz_gtk_get_style_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
- 
-       focusRect.x += padding.left;
-       focusRect.width -= (padding.left + padding.right);
-@@ -2408,7 +2593,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t *
- }
- 
- static gint
--moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect,
-+moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state,
-                        GtkTextDirection direction)
- {
-     GtkStyleContext* style;
-@@ -2468,7 +2653,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr
-     border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
- 
-     style = gtk_widget_get_style_context(gMenuSeparatorWidget);
--    gtk_style_context_get_padding(style, 0, &padding);
-+    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
- 
-     x = rect->x + border_width;
-     y = rect->y + border_width;
-@@ -2521,7 +2706,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
-             item_widget = gMenuItemWidget;
-         }
-         style = gtk_widget_get_style_context(item_widget);
--        gtk_style_context_save(style);
-+// TODO - FIX!
-+//        gtk_style_context_save(style);
- 
-         if (flags & MOZ_TOPLEVEL_MENU_ITEM) {
-             gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
-@@ -2540,7 +2726,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
- 
-         gtk_render_background(style, cr, x, y, w, h);
-         gtk_render_frame(style, cr, x, y, w, h);
--        gtk_style_context_restore(style);
-+//        gtk_style_context_restore(style);
-     }
- 
-     return MOZ_GTK_SUCCESS;
-@@ -2556,7 +2742,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
- 
-     ensure_menu_item_widget();
-     gtk_widget_set_direction(gMenuItemWidget, direction);
--
-+/*
-+    state_flags |= (direction == GTK_TEXT_DIR_LTR) ? GTK_STATE_FLAG_DIR_LTR :
-+                                                     GTK_STATE_FLAG_DIR_RTL;
-+*/
-     style = gtk_widget_get_style_context(gMenuItemWidget);
-     gtk_style_context_save(style);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUITEM);
-@@ -2606,7 +2795,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c
-     }
-     
-     gtk_style_context_set_state(style, state_flags);
--    gtk_style_context_get_padding(style, state_flags, &padding);
-+    moz_gtk_get_style_padding(style, state_flags, &padding);
- 
-     offset = gtk_container_get_border_width(GTK_CONTAINER(gCheckMenuItemWidget)) +
-                                             padding.left + 2;
-@@ -2658,7 +2847,7 @@ moz_gtk_add_style_border(GtkStyleContext
- {
-     GtkBorder border;
- 
--    gtk_style_context_get_border(style, 0, &border);
-+    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
- 
-     *left += border.left;
-     *right += border.right;
-@@ -2667,12 +2856,22 @@ moz_gtk_add_style_border(GtkStyleContext
- }
- 
- static void
-+moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
-+                         GtkBorder *border)
-+{
-+    gtk_style_context_save(style);
-+    gtk_style_context_set_state(style, state_flags);
-+    gtk_style_context_get_border(style, gtk_style_context_get_state(style), border);
-+    gtk_style_context_restore(style);
-+}
-+
-+static void
- moz_gtk_add_style_padding(GtkStyleContext* style,
-                           gint* left, gint* top, gint* right, gint* bottom)
- {
-     GtkBorder padding;
- 
--    gtk_style_context_get_padding(style, 0, &padding);
-+    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
- 
-     *left += padding.left;
-     *right += padding.right;
-@@ -2680,6 +2879,16 @@ moz_gtk_add_style_padding(GtkStyleContex
-     *bottom += padding.bottom;
- }
- 
-+static void
-+moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
-+                          GtkBorder *padding)
-+{
-+    gtk_style_context_save(style);
-+    gtk_style_context_set_state(style, state_flags);
-+    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), padding);
-+    gtk_style_context_restore(style);
-+}
-+
- gint
- moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
-                           gint* right, gint* bottom, GtkTextDirection direction,
-@@ -2694,37 +2903,35 @@ moz_gtk_get_widget_border(GtkThemeWidget
-     case MOZ_GTK_TOOLBAR_BUTTON:
-         {
-             ensure_button_widget();
--            style = gtk_widget_get_style_context(gButtonWidget);
--
--            *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButtonWidget));
- 
--            if (widget == MOZ_GTK_TOOLBAR_BUTTON) {
--                gtk_style_context_save(style);
--                gtk_style_context_add_class(style, "image-button");
--            }
--              
--            moz_gtk_add_style_padding(style, left, top, right, bottom);
--                
--            if (widget == MOZ_GTK_TOOLBAR_BUTTON)
--                gtk_style_context_restore(style);
-+            *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButton.widget));
-+            moz_gtk_add_style_padding(gButton.button.style, left, top, right, bottom);
- 
-             // XXX: Subtract 1 pixel from the border to account for the added
-             // -moz-focus-inner border (Bug 1228281).
-             *left -= 1; *top -= 1; *right -= 1; *bottom -= 1;
--            moz_gtk_add_style_border(style, left, top, right, bottom);
-+            moz_gtk_add_style_border(gButton.button.style, left, top, right, bottom);
-+
-             return MOZ_GTK_SUCCESS;
-         }
-     case MOZ_GTK_ENTRY:
-         {
-             ensure_entry_widget();
--            style = gtk_widget_get_style_context(gEntryWidget);
- 
-             // XXX: Subtract 1 pixel from the padding to account for the default
-             // padding in forms.css. See bug 1187385.
-             *left = *top = *right = *bottom = -1;
--            moz_gtk_add_style_padding(style, left, top, right, bottom);
--            moz_gtk_add_style_border(style, left, top, right, bottom);
- 
-+            moz_gtk_add_style_padding(gEntry.entry.style, left, top, right, bottom);
-+            moz_gtk_add_style_border(gEntry.entry.style, left, top, right, bottom);
-+
-+            return MOZ_GTK_SUCCESS;
-+        }
-+    case MOZ_GTK_TOOLTIP:
-+        {
-+            ensure_tooltip_widget();
-+            moz_gtk_add_style_padding(gTooltip.tooltip.styleBackground, left, top, right, bottom);
-+            moz_gtk_add_style_border(gTooltip.tooltip.styleBackground, left, top, right, bottom);
-             return MOZ_GTK_SUCCESS;
-         }
-     case MOZ_GTK_TREEVIEW:
-@@ -2759,7 +2966,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
-         break;
-     case MOZ_GTK_DROPDOWN_ENTRY:
-         ensure_combo_box_entry_widgets();
--        w = gComboBoxEntryTextareaWidget;
-+        w = gComboBoxEntryTextarea.widget;
-         break;
-     case MOZ_GTK_DROPDOWN_ARROW:
-         ensure_combo_box_entry_widgets();
-@@ -2795,7 +3002,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
- 
-                 if (!wide_separators) {
-                     style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
--                    gtk_style_context_get_border(style, 0, &border);
-+                    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
-                     separator_width = border.left;
-                 }
-             }
-@@ -2814,14 +3021,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
-         w = gTabWidget;
-         break;
-     case MOZ_GTK_PROGRESSBAR:
--        ensure_progress_widget();
--        w = gProgressWidget;
--        break;
-+        {
-+            ensure_progress_widget();
-+            moz_gtk_add_style_border(gProgressBar.progress.styleTrough,
-+                                     left, top, right, bottom);
-+            return MOZ_GTK_SUCCESS;
-+        }
-     case MOZ_GTK_SPINBUTTON_ENTRY:
-     case MOZ_GTK_SPINBUTTON_UP:
-     case MOZ_GTK_SPINBUTTON_DOWN:
-         ensure_spin_widget();
--        w = gSpinWidget;
-+        w = gSpin.widget;
-         break;
-     case MOZ_GTK_SCALE_HORIZONTAL:
-         ensure_scale_widget();
-@@ -2840,12 +3050,13 @@ moz_gtk_get_widget_border(GtkThemeWidget
-         {
-             if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
-                 ensure_checkbox_widget();
--                w = gCheckboxWidget;
-+                w = gCheckbox.widget;
-+                style = gCheckbox.check.styleCheck;
-             } else {
-                 ensure_radiobutton_widget();
--                w = gRadiobuttonWidget;
-+                w = gRadiobutton.widget;
-+                style = gRadiobutton.check.styleCheck;
-             }
--            style = gtk_widget_get_style_context(w);
- 
-             *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
-             moz_gtk_add_style_border(style,
-@@ -2904,7 +3115,6 @@ moz_gtk_get_widget_border(GtkThemeWidget
-     case MOZ_GTK_MENUSEPARATOR:
-     /* These widgets have no borders.*/
-     case MOZ_GTK_SPINBUTTON:
--    case MOZ_GTK_TOOLTIP:
-     case MOZ_GTK_WINDOW:
-     case MOZ_GTK_RESIZER:
-     case MOZ_GTK_MENUARROW:
-@@ -2978,6 +3188,32 @@ moz_gtk_get_combo_box_entry_button_size(
- }
- 
- gint
-+moz_gtk_get_entry_height(gint* height)
-+{
-+    GtkRequisition requisition;
-+    ensure_entry_widget();
-+
-+    gtk_widget_get_preferred_size(gEntry.widget, NULL, &requisition);
-+    *height = requisition.height;
-+
-+    return MOZ_GTK_SUCCESS;
-+}
-+
-+
-+gint
-+moz_gtk_get_button_height(gint* height)
-+{
-+    GtkRequisition requisition;
-+    ensure_entry_widget();
-+
-+    gtk_widget_get_preferred_size(gButton.widget, NULL, &requisition);
-+    *height = requisition.height;
-+
-+    return MOZ_GTK_SUCCESS;
-+}
-+
-+
-+gint
- moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height)
- {
-     gint arrow_size;
-@@ -3030,7 +3266,7 @@ moz_gtk_get_toolbar_separator_width(gint
-                          "separator-width", &separator_width,
-                          NULL);
-     /* Just in case... */
--    gtk_style_context_get_border(style, 0, &border);
-+    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
-     *size = MAX(*size, (wide_separators ? separator_width : border.left));
-     return MOZ_GTK_SUCCESS;
- }
-@@ -3072,7 +3308,7 @@ moz_gtk_get_menu_separator_height(gint *
-     border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
- 
-     style = gtk_widget_get_style_context(gMenuSeparatorWidget);
--    gtk_style_context_get_padding(style, 0, &padding);
-+    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
- 
-     gtk_style_context_save(style);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
-@@ -3130,15 +3366,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro
- {
-     ensure_scrollbar_widget();
- 
--    gtk_widget_style_get (gHorizScrollbarWidget,
-+    gtk_widget_style_get (gHorizScrollbar.widget,
-                           "slider_width", &metrics->slider_width,
-                           "trough_border", &metrics->trough_border,
-                           "stepper_size", &metrics->stepper_size,
-                           "stepper_spacing", &metrics->stepper_spacing,
-                           NULL);
- 
--    metrics->min_slider_size = 
--        gtk_range_get_min_slider_size(GTK_RANGE(gHorizScrollbarWidget));
-+    if (!gtk_check_version(3,19,7)) {
-+        gtk_style_context_get(gVertScrollbar.scroll.styleSlider, 
-+                              gtk_style_context_get_state(gVertScrollbar.scroll.styleSlider), 
-+                              "min-height", &metrics->min_slider_size, NULL);
-+    } else {
-+        metrics->min_slider_size = 
-+            gtk_range_get_min_slider_size(GTK_RANGE(gVertScrollbar.widget));
-+    }
- 
-     return MOZ_GTK_SUCCESS;
- }
-@@ -3163,7 +3405,7 @@ moz_gtk_images_in_buttons()
-     GtkSettings* settings;
- 
-     ensure_button_widget();
--    settings = gtk_widget_get_settings(gButtonWidget);
-+    settings = gtk_widget_get_settings(gButton.widget);
- 
-     g_object_get(settings, "gtk-button-images", &result, NULL);
-     return result;
-@@ -3191,7 +3433,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
-         }
-         ensure_button_widget();
-         return moz_gtk_button_paint(cr, rect, state,
--                                    (GtkReliefStyle) flags, gButtonWidget,
-+                                    (GtkReliefStyle) flags, gButton.widget,
-                                     direction);
-         break;
-     case MOZ_GTK_CHECKBUTTON:
-@@ -3241,7 +3483,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
-     case MOZ_GTK_SPINBUTTON_ENTRY:
-         ensure_spin_widget();
-         return moz_gtk_entry_paint(cr, rect, state,
--                                   gSpinWidget, direction);
-+                                   &gSpin, direction);
-         break;
-     case MOZ_GTK_GRIPPER:
-         return moz_gtk_gripper_paint(cr, rect, state,
-@@ -3268,7 +3510,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
-     case MOZ_GTK_ENTRY:
-         ensure_entry_widget();
-         return moz_gtk_entry_paint(cr, rect, state,
--                                   gEntryWidget, direction);
-+                                   &gEntry, direction);
-         break;
-     case MOZ_GTK_DROPDOWN:
-         return moz_gtk_combo_box_paint(cr, rect, state, direction);
-@@ -3280,7 +3522,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
-     case MOZ_GTK_DROPDOWN_ENTRY:
-         ensure_combo_box_entry_widgets();
-         return moz_gtk_entry_paint(cr, rect, state,
--                                   gComboBoxEntryTextareaWidget, direction);
-+                                   &gComboBoxEntryTextarea, direction);
-         break;
-     case MOZ_GTK_CHECKBUTTON_CONTAINER:
-     case MOZ_GTK_RADIOBUTTON_CONTAINER:
-@@ -3332,7 +3574,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
-                                               (GtkArrowType) flags, direction);
-         break;
-     case MOZ_GTK_MENUBAR:
--        return moz_gtk_menu_bar_paint(cr, rect, direction);
-+        return moz_gtk_menu_bar_paint(cr, rect, state, direction);
-         break;
-     case MOZ_GTK_MENUPOPUP:
-         return moz_gtk_menu_popup_paint(cr, rect, direction);
-@@ -3383,7 +3625,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
- {
-     MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
-     ensure_scrollbar_widget();
--    return gHorizScrollbarWidget;
-+    return gVertScrollbar.widget;
- }
- 
- gboolean moz_gtk_has_scrollbar_buttons(void)
-@@ -3391,7 +3633,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v
-     gboolean backward, forward, secondary_backward, secondary_forward;
-     MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
-     ensure_scrollbar_widget();
--    gtk_widget_style_get (gHorizScrollbarWidget,
-+    gtk_widget_style_get (gHorizScrollbar.widget,
-                           "has-backward-stepper", &backward,
-                           "has-forward-stepper", &forward,
-                           "has-secondary-backward-stepper", &secondary_backward,
-@@ -3403,8 +3645,8 @@ gboolean moz_gtk_has_scrollbar_buttons(v
- gint
- moz_gtk_shutdown()
- {
--    if (gTooltipWidget)
--        gtk_widget_destroy(gTooltipWidget);
-+    moz_gtk_widget_free(&gTooltip);
-+
-     /* This will destroy all of our widgets */
-     if (gProtoWindow)
-         gtk_widget_destroy(gProtoWindow);
-@@ -3415,17 +3657,19 @@ moz_gtk_shutdown()
- 
-     gProtoWindow = NULL;
-     gProtoLayout = NULL;
--    gButtonWidget = NULL;
-+
-+    // MozWidgets
-+    moz_gtk_widget_free(&gButton);
-     gToggleButtonWidget = NULL;
-     gButtonArrowWidget = NULL;
--    gCheckboxWidget = NULL;
--    gRadiobuttonWidget = NULL;
--    gHorizScrollbarWidget = NULL;
--    gVertScrollbarWidget = NULL;
--    gSpinWidget = NULL;
-+    moz_gtk_widget_free(&gCheckbox);
-+    moz_gtk_widget_free(&gRadiobutton);
-+    moz_gtk_widget_free(&gHorizScrollbar);
-+    moz_gtk_widget_free(&gVertScrollbar);
-+    moz_gtk_widget_free(&gSpin);
-     gHScaleWidget = NULL;
-     gVScaleWidget = NULL;
--    gEntryWidget = NULL;
-+    moz_gtk_widget_free(&gEntry);
-     gComboBoxWidget = NULL;
-     gComboBoxButtonWidget = NULL;
-     gComboBoxSeparatorWidget = NULL;
-@@ -3433,14 +3677,13 @@ moz_gtk_shutdown()
-     gComboBoxEntryWidget = NULL;
-     gComboBoxEntryButtonWidget = NULL;
-     gComboBoxEntryArrowWidget = NULL;
--    gComboBoxEntryTextareaWidget = NULL;
-+    moz_gtk_widget_free(&gComboBoxEntryTextarea);
-     gHandleBoxWidget = NULL;
-     gToolbarWidget = NULL;
-     gStatusbarWidget = NULL;
-     gFrameWidget = NULL;
--    gProgressWidget = NULL;
-+    moz_gtk_widget_free(&gProgressBar);
-     gTabWidget = NULL;
--    gTooltipWidget = NULL;
-     gMenuBarWidget = NULL;
-     gMenuBarItemWidget = NULL;
-     gMenuPopupWidget = NULL;
-diff -up firefox-46.0.1/widget/gtk/gtkdrawing.h.gtk3-20 firefox-46.0.1/widget/gtk/gtkdrawing.h
---- firefox-46.0.1/widget/gtk/gtkdrawing.h.gtk3-20	2016-05-03 07:31:12.000000000 +0200
-+++ firefox-46.0.1/widget/gtk/gtkdrawing.h	2016-05-19 15:20:11.656519199 +0200
-@@ -67,6 +67,13 @@ typedef enum {
-   MOZ_GTK_TAB_SELECTED        = 1 << 10
- } GtkTabFlags;
- 
-+typedef struct {
-+  GType type;
-+  const gchar *name;
-+  const gchar *class1;
-+  const gchar *class2;
-+} GtkCssNode;
-+
- /** flags for menuitems **/
- typedef enum {
-   /* menuitem is part of the menubar */
-@@ -396,6 +403,9 @@ void
- moz_gtk_get_arrow_size(GtkThemeWidgetType widgetType,
-                        gint* width, gint* height);
- 
-+gint moz_gtk_get_entry_height(gint* height);
-+gint moz_gtk_get_button_height(gint* height);
-+
- /**
-  * Get the desired size of a toolbar separator
-  * size:    [OUT] the desired width
-@@ -466,6 +476,12 @@ gboolean moz_gtk_images_in_buttons(void)
-  */
- gboolean moz_gtk_has_scrollbar_buttons(void);
- 
-+
-+GtkStyleContext *
-+moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent);
-+
-+
-+
- #ifdef __cplusplus
- }
- #endif /* __cplusplus */
-diff -up firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c
---- firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c.gtk3-20	2016-05-03 07:31:12.000000000 +0200
-+++ firefox-46.0.1/widget/gtk/mozgtk/mozgtk.c	2016-05-20 10:40:19.442320669 +0200
-@@ -504,6 +504,11 @@ STUB(gtk_window_set_type_hint)
- STUB(gtk_window_set_wmclass)
- STUB(gtk_window_unfullscreen)
- STUB(gtk_window_unmaximize)
-+STUB(gtk_widget_get_preferred_height_and_baseline_for_width)
-+STUB(gtk_entry_get_text_area)
-+STUB(gtk_check_menu_item_get_type)
-+STUB(gtk_spin_button_get_type)
-+STUB(gtk_button_get_type)
- #endif
- 
- #ifdef GTK3_SYMBOLS
-@@ -581,6 +586,14 @@ STUB(gtk_color_chooser_get_type)
- STUB(gtk_color_chooser_set_rgba)
- STUB(gtk_color_chooser_get_rgba)
- STUB(gtk_color_chooser_set_use_alpha)
-+STUB(gtk_style_context_get_path)
-+STUB(gtk_widget_path_copy)
-+STUB(gtk_widget_path_iter_set_object_name)
-+STUB(gtk_widget_path_iter_add_class)
-+STUB(gtk_widget_path_iter_get_state)
-+STUB(gtk_style_context_set_parent)
-+STUB(gtk_widget_path_unref)
-+STUB(gtk_tooltip_get_type)
- #endif
- 
- #ifdef GTK2_SYMBOLS
-diff -up firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp
---- firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp.gtk3-20	2016-05-03 07:31:12.000000000 +0200
-+++ firefox-46.0.1/widget/gtk/nsLookAndFeel.cpp	2016-05-20 13:53:54.085049707 +0200
-@@ -353,14 +353,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI
-     case eColorID_activeborder:
-         // active window border
-         gtk_style_context_get_border_color(mBackgroundStyle, 
--                                           GTK_STATE_FLAG_NORMAL, &gdk_color);
-+                                           gtk_style_context_get_state(mBackgroundStyle), 
-+                                           &gdk_color);
-         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-         break;
-     case eColorID_inactiveborder:
-         // inactive window border
-+        gtk_style_context_save(mBackgroundStyle);
-+        gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE);
-         gtk_style_context_get_border_color(mBackgroundStyle, 
--                                           GTK_STATE_FLAG_INSENSITIVE, 
-+                                           gtk_style_context_get_state(mBackgroundStyle), 
-                                            &gdk_color);
-+        gtk_style_context_restore(mBackgroundStyle);
-         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-         break;
-     case eColorID_graytext: // disabled text in windows, menus, etc.
-@@ -369,9 +373,12 @@ nsLookAndFeel::NativeGetColor(ColorID aI
-         break;
-     case eColorID_inactivecaption:
-         // inactive window caption
-+        gtk_style_context_save(mBackgroundStyle);
-+        gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE);
-         gtk_style_context_get_background_color(mBackgroundStyle, 
--                                               GTK_STATE_FLAG_INSENSITIVE, 
-+                                               gtk_style_context_get_state(mBackgroundStyle), 
-                                                &gdk_color);
-+        gtk_style_context_restore(mBackgroundStyle);
-         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-         break;
- #endif
-@@ -497,13 +504,17 @@ nsLookAndFeel::NativeGetColor(ColorID aI
-     case eColorID__moz_buttondefault:
-       // default button border color
-         gtk_style_context_get_border_color(mButtonStyle, 
--                                           GTK_STATE_FLAG_NORMAL, &gdk_color);
-+                                           gtk_style_context_get_state(mButtonStyle),
-+                                           &gdk_color);
-         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-         break;
-     case eColorID__moz_buttonhoverface:
-+        gtk_style_context_save(mButtonStyle);
-+        gtk_style_context_set_state(mButtonStyle, GTK_STATE_FLAG_PRELIGHT);
-         gtk_style_context_get_background_color(mButtonStyle, 
--                                               GTK_STATE_FLAG_PRELIGHT, 
-+                                               gtk_style_context_get_state(mButtonStyle), 
-                                                &gdk_color);
-+        gtk_style_context_restore(mButtonStyle);
-         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-         break;
-     case eColorID__moz_buttonhovertext:
-@@ -1110,27 +1126,29 @@ nsLookAndFeel::Init()
-     style = create_context(path);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
--    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
-     sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
-     g_object_unref(style);
- 
-     // Window colors
-     style = create_context(path);
--    gtk_style_context_save(style);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
--    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
-     sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_restore(style);
-+    g_object_unref(style);
- 
-     // tooltip foreground and background
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
-+    GtkCssNode tooltipPath[] = { 
-+         { GTK_TYPE_TOOLTIP, "tooltip", NULL, NULL},
-+    };
-+    style = moz_gtk_style_create(tooltipPath, NULL);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-+    sInfoText = GDK_RGBA_TO_NS_RGBA(color);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
--    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
-     sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
--    sInfoText = GDK_RGBA_TO_NS_RGBA(color);
-     g_object_unref(style);
- 
-     // menu foreground & menu background
-@@ -1144,20 +1162,26 @@ nsLookAndFeel::Init()
-     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- 
-     style = gtk_widget_get_style_context(accel_label);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sMenuText = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
-+    gtk_style_context_save(style);
-+    gtk_style_context_set_state(style, GTK_STATE_FLAG_INSENSITIVE);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
-+    gtk_style_context_restore(style);
- 
-     style = gtk_widget_get_style_context(menu);
--    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
-     sMenuBackground = GDK_RGBA_TO_NS_RGBA(color);
- 
-     style = gtk_widget_get_style_context(menuitem);
--    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
-+    gtk_style_context_save(style);
-+    gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
-+    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
-     sMenuHover = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
-+    gtk_style_context_restore(style);
- 
-     g_object_unref(menu);
- #endif
-@@ -1266,44 +1290,54 @@ nsLookAndFeel::Init()
-             GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
-     }
- #else
-+    GtkCssNode labelPath[] = {
-+       { GTK_TYPE_LABEL, "label", "view", NULL },
-+       { G_TYPE_NONE, "selection", NULL, NULL }
-+    };
-+
-+    GtkStyleContext *styleLabel;
-+    GtkStyleContext *styleSelection;
-+    GtkBorder padding;
-+
-     // Text colors
--    style = gtk_widget_get_style_context(textView);
--    gtk_style_context_save(style);
--    gtk_style_context_add_class(style, GTK_STYLE_CLASS_VIEW);
--    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    styleLabel = moz_gtk_style_create(labelPath, NULL);
-+    styleSelection = moz_gtk_style_create(labelPath+1, styleLabel);
-+
-+    gtk_style_context_get_background_color(styleLabel, gtk_style_context_get_state(styleLabel), &color);
-     sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(styleLabel, gtk_style_context_get_state(styleLabel), &color);
-     sMozFieldText = GDK_RGBA_TO_NS_RGBA(color);
- 
-     // Selected text and background
--    gtk_style_context_get_background_color(style,
--        static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
--        &color);
-+    gtk_style_context_get_background_color(styleSelection, gtk_style_context_get_state(styleSelection), &color);
-     sTextSelectedBackground = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style,
--        static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
--        &color);
-+    gtk_style_context_get_color(styleSelection, gtk_style_context_get_state(styleSelection), &color);
-     sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_restore(style);
- 
-     // Button text, background, border
-     style = gtk_widget_get_style_context(label);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sButtonText = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
-+    gtk_style_context_save(style);
-+    gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
-+    gtk_style_context_restore(style);
- 
-     // Combobox text color
-     style = gtk_widget_get_style_context(comboboxLabel);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sComboBoxText = GDK_RGBA_TO_NS_RGBA(color);
- 
-     // Menubar text and hover text colors    
-     style = gtk_widget_get_style_context(menuBar);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sMenuBarText = GDK_RGBA_TO_NS_RGBA(color);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
-+    gtk_style_context_save(style);
-+    gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color);
-+    gtk_style_context_restore(style);
- 
-     // GTK's guide to fancy odd row background colors:
-     // 1) Check if a theme explicitly defines an odd row color
-@@ -1316,7 +1350,7 @@ nsLookAndFeel::Init()
-     // Get odd row background color
-     gtk_style_context_save(style);
-     gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD);
--    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
-     sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
-     gtk_style_context_restore(style);
- 
-@@ -1334,9 +1368,11 @@ nsLookAndFeel::Init()
-     gtk_container_add(GTK_CONTAINER(parent), infoBar);
-     gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
-     style = gtk_widget_get_style_context(infoBarLabel);
-+    gtk_style_context_save(style);
-     gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
--    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-+    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
-     sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
-+    gtk_style_context_restore(style);
- #endif
-     // Some themes have a unified menu bar, and support window dragging on it
-     gboolean supports_menubar_drag = FALSE;
-diff -up firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp
---- firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20	2016-05-03 07:31:12.000000000 +0200
-+++ firefox-46.0.1/widget/gtk/nsNativeThemeGTK.cpp	2016-05-19 15:20:11.658519202 +0200
-@@ -1567,9 +1567,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
-   case NS_THEME_RADIO_CONTAINER:
-   case NS_THEME_CHECKBOX_LABEL:
-   case NS_THEME_RADIO_LABEL:
--  case NS_THEME_BUTTON:
--  case NS_THEME_DROPDOWN:
--  case NS_THEME_TOOLBAR_BUTTON:
-   case NS_THEME_TREEVIEW_HEADER_CELL:
-     {
-       if (aWidgetType == NS_THEME_DROPDOWN) {
-@@ -1588,6 +1585,21 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
-       aResult->height += border.top + border.bottom;
-     }
-     break;
-+  case NS_THEME_BUTTON:
-+  case NS_THEME_DROPDOWN:
-+  case NS_THEME_TOOLBAR_BUTTON:
-+    {
-+        moz_gtk_get_button_height(&aResult->height);
-+    }
-+    break;
-+  case NS_THEME_FOCUS_OUTLINE:
-+  case NS_THEME_NUMBER_INPUT:
-+  case NS_THEME_TEXTFIELD:
-+  case NS_THEME_TEXTFIELD_MULTILINE:
-+    {
-+        moz_gtk_get_entry_height(&aResult->height);
-+    } 
-+    break;
-   case NS_THEME_TOOLBAR_SEPARATOR:
-     {
-       gint separator_width;
--- a/mozilla-kde.patch	Mon Aug 01 14:45:11 2016 +0200
+++ b/mozilla-kde.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent  972c67cdd5dd4463abbee60036b686d4cb78e616
+# Parent  6ff55468281e12a84adefb46b17acb60d9cea608
 Description: Add KDE integration to Firefox (toolkit parts)
 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
 Author: Lubos Lunak <lunak@suse.com>
@@ -27,7 +27,7 @@
  #include "prefread.h"
  #include "prefapi_private_data.h"
  
-@@ -1145,16 +1146,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
+@@ -1180,16 +1181,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
  
  static nsresult pref_LoadPrefsInDirList(const char *listId)
  {
@@ -62,7 +62,7 @@
      return NS_OK;
  
    bool hasMore;
-@@ -1170,17 +1189,17 @@ static nsresult pref_LoadPrefsInDirList(
+@@ -1205,17 +1224,17 @@ static nsresult pref_LoadPrefsInDirList(
  
      nsAutoCString leaf;
      path->GetNativeLeafName(leaf);
@@ -81,7 +81,7 @@
  {
    nsZipItemPtr<char> manifest(jarReader, name, true);
    NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
-@@ -1274,24 +1293,36 @@ static nsresult pref_InitInitialObjects(
+@@ -1309,24 +1328,36 @@ static nsresult pref_InitInitialObjects(
    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    static const char* specialFiles[] = {
  #if defined(XP_MACOSX)
@@ -141,7 +141,7 @@
  DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
  DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
  
- if CONFIG['GNU_CXX']:
+ FINAL_TARGET_PP_FILES += [
 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
 --- a/python/mozbuild/mozpack/chrome/flags.py
 +++ b/python/mozbuild/mozpack/chrome/flags.py
@@ -187,7 +187,7 @@
 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
 --- a/toolkit/components/downloads/moz.build
 +++ b/toolkit/components/downloads/moz.build
-@@ -60,15 +60,16 @@ if not CONFIG['MOZ_SUITE']:
+@@ -60,17 +60,18 @@ if not CONFIG['MOZ_SUITE']:
          'nsDownloadManagerUI.js',
          'nsDownloadManagerUI.manifest',
      ]
@@ -205,6 +205,8 @@
  DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True
  
  CXXFLAGS += CONFIG['TK_CFLAGS']
+ 
+ if CONFIG['GNU_CXX']:
 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
 --- a/toolkit/components/downloads/nsDownloadManager.cpp
 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
@@ -226,7 +228,7 @@
  #endif
  
  #ifdef MOZ_WIDGET_ANDROID
- #include "AndroidBridge.h"
+ #include "GeneratedJNIWrappers.h"
  #endif
  
 @@ -2719,16 +2723,25 @@ nsDownload::SetState(DownloadState aStat
@@ -276,7 +278,7 @@
 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
 --- a/toolkit/content/jar.mn
 +++ b/toolkit/content/jar.mn
-@@ -72,29 +72,33 @@ toolkit.jar:
+@@ -67,29 +67,33 @@ toolkit.jar:
     content/global/viewZoomOverlay.js
     content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
     content/global/bindings/browser.xml         (widgets/browser.xml)
@@ -782,7 +784,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/toolkit/content/widgets/preferences-kde.xml
-@@ -0,0 +1,1408 @@
+@@ -0,0 +1,1410 @@
 +<?xml version="1.0"?>
 +
 +<!DOCTYPE bindings [
@@ -952,6 +954,8 @@
 +      <field name="_constructed">false</field>
 +      <property name="instantApply">
 +        <getter>
++          if (this.getAttribute("instantApply") == "false")
++            return false;
 +          return this.getAttribute("instantApply") == "true" || this.preferences.instantApply;
 +        </getter>
 +      </property>
@@ -2288,13 +2292,13 @@
 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
 --- a/toolkit/xre/moz.build
 +++ b/toolkit/xre/moz.build
-@@ -48,17 +48,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
-     EXPORTS += ['nsQAppInstance.h']
-     SOURCES += [
-         '!moc_nsNativeAppSupportQt.cpp',
-         'nsNativeAppSupportQt.cpp',
-         'nsQAppInstance.cpp',
+@@ -39,17 +39,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
+         'updaterfileutils_osx.mm',
+     ]
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
+     UNIFIED_SOURCES += [
+         'nsNativeAppSupportDefault.cpp',
+         'UIKitDirProvider.mm',
      ]
  elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
 +    EXPORTS += ['nsKDEUtils.h']
@@ -2708,18 +2712,18 @@
 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
 --- a/uriloader/exthandler/moz.build
 +++ b/uriloader/exthandler/moz.build
-@@ -75,17 +75,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
- else:
-     # These files can't be built in unified mode because they redefine LOG.
+@@ -77,17 +77,19 @@ else:
      SOURCES += [
          osdir + '/nsOSHelperAppService.cpp',
      ]
+     if CONFIG['GNU_CXX']:
+         CXXFLAGS += ['-Wno-error=shadow']
  
  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
      UNIFIED_SOURCES += [
 +        'unix/nsCommonRegistry.cpp',
          'unix/nsGNOMERegistry.cpp',
-+        'unix/nsKDERegistry.cpp',
++	'unix/nsKDERegistry.cpp',
          'unix/nsMIMEInfoUnix.cpp',
      ]
  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
@@ -2728,7 +2732,7 @@
          'android/nsExternalSharingAppService.cpp',
          'android/nsExternalURLHandlerService.cpp',
          'android/nsMIMEInfoAndroid.cpp',
-@@ -129,16 +131,17 @@ include('/ipc/chromium/chromium-config.m
+@@ -123,16 +125,17 @@ include('/ipc/chromium/chromium-config.m
  
  FINAL_LIBRARY = 'xul'
  
@@ -2744,7 +2748,7 @@
      CXXFLAGS += CONFIG['TK_CFLAGS']
      CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
  
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'gtk3'):
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
      CXXFLAGS += CONFIG['TK_CFLAGS']
 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
 new file mode 100644
@@ -2972,13 +2976,12 @@
 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
-@@ -7,32 +7,35 @@
- #ifdef MOZ_WIDGET_QT
- #if (MOZ_ENABLE_CONTENTACTION)
- #include <contentaction/contentaction.h>
- #include "nsContentHandlerApp.h"
- #endif
- #endif
+@@ -1,50 +1,53 @@
+ /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+  *
+  * This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  
  #include "nsMIMEInfoUnix.h"
 -#include "nsGNOMERegistry.h"
@@ -2990,9 +2993,6 @@
  #ifdef MOZ_ENABLE_DBUS
  #include "nsDBusHandlerApp.h"
  #endif
- #ifdef MOZ_WIDGET_QT
- #include "nsMIMEInfoQt.h"
- #endif
 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
 +#include "nsKDEUtils.h"
 +#endif
@@ -3000,17 +3000,14 @@
  nsresult
  nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
  {
--  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
-+  nsresult rv = nsCommonRegistry::LoadURL(aURI);
+-  return nsGNOMERegistry::LoadURL(aURI);
++  return nsCommonRegistry::LoadURL(aURI);
+ }
  
- #ifdef MOZ_WIDGET_QT
-   if (NS_FAILED(rv)) {
-     rv = nsMIMEInfoQt::LoadUriInternal(aURI);
-   }
- #endif
- 
-   return rv;
-@@ -45,24 +48,24 @@ nsMIMEInfoUnix::GetHasDefaultHandler(boo
+ NS_IMETHODIMP
+ nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval)
+ {
+   // if mDefaultApplication is set, it means the application has been set from
    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
    // give the GNOME answer.
    if (mDefaultApplication)
@@ -3038,7 +3035,7 @@
  
    if (*_retval)
      return NS_OK;
-@@ -97,16 +100,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
+@@ -79,16 +82,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
      ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get()));
    if (action.isValid()) {
      action.trigger();
@@ -3273,8 +3270,8 @@
      GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  
    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
-   const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
-@@ -595,8 +615,235 @@ nsFilePicker::Done(GtkWidget* file_choos
+ 
+@@ -603,8 +623,235 @@ nsFilePicker::Done(GtkWidget* file_choos
    if (mCallback) {
      mCallback->Done(result);
      mCallback = nullptr;
@@ -3588,7 +3585,7 @@
  #pragma warning(disable:4996) // VC12+ deprecates GetVersionEx
    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
    if (GetVersionEx(&info)) {
-     nsTextFormatter::ssprintf(osVersion, MOZ_UTF16("%ld.%ld"),
+     nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
                                info.dwMajorVersion,
                                info.dwMinorVersion);
    }
@@ -3597,12 +3594,12 @@
  #elif defined(MOZ_WIDGET_COCOA)
    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
    SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
-   nsTextFormatter::ssprintf(osVersion, MOZ_UTF16("%ld.%ld"),
+   nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
                              majorVersion,
                              minorVersion);
 +  desktop = NS_LITERAL_STRING("macosx");
  #elif defined(MOZ_WIDGET_GTK)
-   nsTextFormatter::ssprintf(osVersion, MOZ_UTF16("%ld.%ld"),
+   nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
                              gtk_major_version,
                              gtk_minor_version);
 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
@@ -3612,7 +3609,7 @@
      mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION",
                                                             "RELEASE",
                                                             osVersion);
-     isTablet = mozilla::widget::GeckoAppShell::IsTablet();
+     isTablet = java::GeckoAppShell::IsTablet();
    }
 +  desktop = NS_LITERAL_STRING("android");
  #endif
@@ -3672,7 +3669,7 @@
 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
 --- a/xpcom/components/moz.build
 +++ b/xpcom/components/moz.build
-@@ -47,12 +47,13 @@ FINAL_LIBRARY = 'xul'
+@@ -44,12 +44,13 @@ FINAL_LIBRARY = 'xul'
  LOCAL_INCLUDES += [
      '!..',
      '../base',
--- a/mozilla-language.patch	Mon Aug 01 14:45:11 2016 +0200
+++ b/mozilla-language.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -1,23 +1,22 @@
 # HG changeset patch
 # User Wolfgang Rosenauer <wr@rosenauer.org>
 # Parent 5a29924228527f8882c83cf62d470963ea1ce62e
-# Parent  55b6ae7fd3ebf28f960031801f1948dfc1bd80d2
+# Parent  bf7b3a5853467b34f13465102a19b9c7c2524bd4
 Bug 583793 - Firefox interface language set to LANG, ignores LANGUAGE
 
 diff --git a/intl/locale/nsLocaleService.cpp b/intl/locale/nsLocaleService.cpp
 --- a/intl/locale/nsLocaleService.cpp
 +++ b/intl/locale/nsLocaleService.cpp
-@@ -122,16 +122,17 @@ nsLocaleService::nsLocaleService(void)
+@@ -114,16 +114,17 @@ nsLocaleService::nsLocaleService(void)
+     NS_ENSURE_SUCCESS_VOID(rv);
+ #endif
+ #if defined(XP_UNIX) && !defined(XP_MACOSX)
      RefPtr<nsLocale> resultLocale(new nsLocale());
      NS_ENSURE_TRUE_VOID(resultLocale);
  
- #ifdef MOZ_WIDGET_QT
-     const char* lang = QLocale::system().name().toUtf8();
- #else
      // Get system configuration
      const char* lang = getenv("LANG");
 +    const char* language = getenv("LANGUAGE");
- #endif
  
      nsAutoString xpLocale, platformLocale;
      nsAutoString category, category_platform;
@@ -25,7 +24,8 @@
  
      for( i = 0; i < LocaleListLength; i++ ) {
          nsresult result;
-@@ -158,16 +159,21 @@ nsLocaleService::nsLocaleService(void)
+         // setlocale( , "") evaluates LC_* and LANG
+@@ -149,16 +150,21 @@ nsLocaleService::nsLocaleService(void)
              } else {
                  CopyASCIItoUTF16(lang, platformLocale);
                  result = nsPosixLocale::GetXPLocale(lang, xpLocale);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-skia-overflow.patch	Wed Jan 18 22:06:23 2017 +0100
@@ -0,0 +1,32 @@
+# HG changeset patch
+# User Lee Salzman <lsalzman@mozilla.com>
+# Date 1474489725 14400
+#      Wed Sep 21 16:28:45 2016 -0400
+# Node ID 38a427a913b57080374b9966466b8f436ec39eb8
+# Parent  4dfd3f00543d1d7adc3f0f852e6f32fbca6f3420
+fix invalid Sk4f store to SkColor in SkPixmap::erase
+
+MozReview-Commit-ID: 840x1nXgYns
+
+diff --git a/gfx/skia/skia/src/core/SkPixmap.cpp b/gfx/skia/skia/src/core/SkPixmap.cpp
+--- a/gfx/skia/skia/src/core/SkPixmap.cpp
++++ b/gfx/skia/skia/src/core/SkPixmap.cpp
+@@ -221,17 +221,17 @@ bool SkPixmap::erase(const SkColor4f& or
+         pm = *this;
+     }
+ 
+     const SkColor4f color = origColor.pin();
+ 
+     if (kRGBA_F16_SkColorType != pm.colorType()) {
+         Sk4f c4 = Sk4f::Load(color.vec());
+         SkColor c;
+-        (c4 * Sk4f(255) + Sk4f(0.5f)).store(&c);
++        SkNx_cast<uint8_t>(c4 * Sk4f(255) + Sk4f(0.5f)).store(&c);
+         return pm.erase(c);
+     }
+ 
+     const uint64_t half4 = color.premul().toF16();
+     for (int y = 0; y < pm.height(); ++y) {
+         sk_memset64(pm.writable_addr64(0, y), half4, pm.width());
+     }
+     return true;
--- a/series	Mon Aug 01 14:45:11 2016 +0200
+++ b/series	Wed Jan 18 22:06:23 2017 +0100
@@ -9,13 +9,13 @@
 mozilla-openaes-decl.patch
 mozilla-no-stdcxx-check.patch
 mozilla-reduce-files-per-UnifiedBindings.patch
-#mozilla-gtk3_20.patch
 mozilla-check_return.patch
-mozilla-exclude-nametablecpp.patch
-mozilla-aarch64-48bit-va.patch
+mozilla-skia-overflow.patch
 mozilla-binutils-visibility.patch
+mozilla-aarch64-startup-crash.patch
 
 # Firefox patches
 firefox-kde.patch
 firefox-no-default-ualocale.patch
 firefox-branded-icons.patch
+mozilla-flex_buffer_overrun.patch