summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--firefox.spec57
-rw-r--r--mozilla-1436242.patch56
-rw-r--r--mozilla-1438131.patch1558
-rw-r--r--mozilla-1438136.patch34
-rw-r--r--mozilla-1441743.patch336
-rw-r--r--mozilla-1460603.patch46
-rw-r--r--mozilla-1460605-1.patch40
-rw-r--r--mozilla-1460605-2.patch292
-rw-r--r--mozilla-1460810.patch30
-rw-r--r--mozilla-1461306.patch33
-rw-r--r--mozilla-1462622.patch36
-rw-r--r--mozilla-1462642.patch183
-rw-r--r--mozilla-1463753.patch127
-rw-r--r--mozilla-1464808.patch31
-rw-r--r--mozilla-1464823.patch27
-rw-r--r--mozilla-1465371.patch59
-rw-r--r--mozilla-1466473.patch42
-rw-r--r--mozilla-1468670.patch102
-rw-r--r--rb244010.patch149
-rw-r--r--rb244012.patch44
-rw-r--r--rb245262.patch29
-rw-r--r--rb246410.patch314
-rw-r--r--rb255772.patch23
-rw-r--r--sources4
25 files changed, 12 insertions, 3642 deletions
diff --git a/.gitignore b/.gitignore
index fe02370..6996b96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -306,3 +306,5 @@ firefox-3.6.4.source.tar.bz2
/firefox-langpacks-61.0.1-20180710.tar.xz
/firefox-langpacks-61.0.2-20180809.tar.xz
/firefox-61.0.2.source.tar.xz
+/firefox-langpacks-62.0-20180828.tar.xz
+/firefox-62.0.source.tar.xz
diff --git a/firefox.spec b/firefox.spec
index ea3fd3d..d848120 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -102,13 +102,13 @@
Summary: Mozilla Firefox Web browser
Name: firefox
-Version: 61.0.2
-Release: 3%{?pre_tag}%{?dist}
+Version: 62.0
+Release: 1%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://hg.mozilla.org/releases/mozilla-release/archive/firefox-%{version}%{?pre_version}.source.tar.xz
%if %{build_langpacks}
-Source1: firefox-langpacks-%{version}%{?pre_version}-20180809.tar.xz
+Source1: firefox-langpacks-%{version}%{?pre_version}-20180828.tar.xz
%endif
Source10: firefox-mozconfig
Source12: firefox-redhat-default-prefs.js
@@ -159,37 +159,15 @@ Patch414: mozilla-1435212-ffmpeg-4.0.patch
Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
Patch416: mozilla-1424422.patch
Patch417: bug1375074-save-restore-x28.patch
-Patch418: mozilla-1436242.patch
Patch419: rb244676.patch
Patch420: rb246462.patch
Patch421: complete-csd-window-offset-mozilla-1457691.patch
# Wayland specific upstream patches
-Patch450: mozilla-1438131.patch
-Patch451: mozilla-1438136.patch
-Patch452: mozilla-1460603.patch
-Patch453: mozilla-1460605-1.patch
-Patch454: mozilla-1460605-2.patch
-Patch455: mozilla-1460810.patch
-Patch456: mozilla-1461306.patch
-Patch457: mozilla-1462622.patch
-Patch458: mozilla-1462642.patch
-Patch459: mozilla-1463753.patch
-Patch560: rb244010.patch
-Patch561: rb244012.patch
-Patch562: rb246410.patch
-Patch563: rb245262.patch
-Patch564: mozilla-1464808.patch
-Patch565: mozilla-1464823.patch
-Patch566: mozilla-1466473.patch
Patch567: mozilla-1444437.patch
-Patch568: mozilla-1441743.patch
-Patch569: mozilla-1465371.patch
Patch570: mozilla-1467125.patch
-Patch571: mozilla-1468670.patch
Patch572: mozilla-1467128.patch
-Patch573: rb255772.patch
# Debian patches
Patch500: mozilla-440908.patch
@@ -356,7 +334,7 @@ This package contains results of tests executed during build.
%patch219 -p2 -b .rhbz-1173156
%patch221 -p2 -b .fedora-ua
%patch224 -p1 -b .1170092
-%patch225 -p1 -b .1005640-accept-lang
+#%patch225 -p1 -b .1005640-accept-lang
#ARM run-time patch
%ifarch aarch64
%patch226 -p1 -b .1354671
@@ -370,7 +348,6 @@ This package contains results of tests executed during build.
%endif
#%patch416 -p1 -b .1424422
#%patch417 -p1 -b .bug1375074-save-restore-x28
-%patch418 -p1 -b .mozilla-1436242
%patch419 -p1 -b .rb244676
%patch420 -p1 -b .rb246462
@@ -383,30 +360,9 @@ This package contains results of tests executed during build.
# Wayland specific upstream patches
%if %{?wayland_backend}
-%patch453 -p1 -b .mozilla-1460605-1
-%patch454 -p1 -b .mozilla-1460605-2
-%patch455 -p1 -b .mozilla-1460810
-%patch456 -p1 -b .mozilla-1461306
-%patch457 -p1 -b .mozilla-1462622
-%patch451 -p1 -b .mozilla-1438136
-%patch450 -p1 -b .mozilla-1438131
-%patch459 -p1 -b .mozilla-1463753
-%patch458 -p1 -b .mozilla-1462642
-%patch452 -p1 -b .mozilla-1460603
-%patch560 -p1 -b .rb244010
-%patch561 -p1 -b .rb244012
-%patch562 -p1 -b .rb246410
-%patch563 -p1 -b .rb245262
-%patch564 -p1 -b .mozilla-1464808
-%patch565 -p1 -b .mozilla-1464823
-%patch566 -p1 -b .mozilla-1466473
-%patch567 -p1 -b .mozilla-1444437
-%patch568 -p1 -b .mozilla-1441743
-%patch569 -p1 -b .mozilla-1465371
+#%patch567 -p1 -b .mozilla-1444437 -fix
%patch570 -p1 -b .mozilla-1467125
-%patch571 -p1 -b .mozilla-1468670
%patch572 -p1 -b .mozilla-1467128
-%patch573 -p1 -b .rb255772
%endif
%{__rm} -f .mozconfig
@@ -936,6 +892,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
+* Tue Aug 28 2018 Martin Stransky <stransky@redhat.com> - 62.0-1
+- Update to 62.0
+
* Wed Aug 15 2018 Ondrej Zoder <ozoder@redhat.com> - 61.0.2-3
- Added patches for mozbz#1427700 and mozbz#1463809
diff --git a/mozilla-1436242.patch b/mozilla-1436242.patch
deleted file mode 100644
index 570b7c5..0000000
--- a/mozilla-1436242.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-
-# HG changeset patch
-# User Jed Davis <jld@mozilla.com>
-# Date 1526943705 21600
-# Node ID 6bb3adfa15c6877f7874429462dad88f8c978c4f
-# Parent 4c71c8454879c841871ecf3afb7dbdc96bad97fc
-Bug 1436242 - Avoid undefined behavior in IPC fd-passing code. r=froydnj
-
-MozReview-Commit-ID: 3szIPUssgF5
-
-diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
---- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-+++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-@@ -418,20 +418,37 @@ bool Channel::ChannelImpl::ProcessIncomi
- const int* fds;
- unsigned num_fds;
- unsigned fds_i = 0; // the index of the first unused descriptor
-
- if (input_overflow_fds_.empty()) {
- fds = wire_fds;
- num_fds = num_wire_fds;
- } else {
-- const size_t prev_size = input_overflow_fds_.size();
-- input_overflow_fds_.resize(prev_size + num_wire_fds);
-- memcpy(&input_overflow_fds_[prev_size], wire_fds,
-- num_wire_fds * sizeof(int));
-+ // This code may look like a no-op in the case where
-+ // num_wire_fds == 0, but in fact:
-+ //
-+ // 1. wire_fds will be nullptr, so passing it to memcpy is
-+ // undefined behavior according to the C standard, even though
-+ // the memcpy length is 0.
-+ //
-+ // 2. prev_size will be an out-of-bounds index for
-+ // input_overflow_fds_; this is undefined behavior according to
-+ // the C++ standard, even though the element only has its
-+ // pointer taken and isn't accessed (and the corresponding
-+ // operation on a C array would be defined).
-+ //
-+ // UBSan makes #1 a fatal error, and assertions in libstdc++ do
-+ // the same for #2 if enabled.
-+ if (num_wire_fds > 0) {
-+ const size_t prev_size = input_overflow_fds_.size();
-+ input_overflow_fds_.resize(prev_size + num_wire_fds);
-+ memcpy(&input_overflow_fds_[prev_size], wire_fds,
-+ num_wire_fds * sizeof(int));
-+ }
- fds = &input_overflow_fds_[0];
- num_fds = input_overflow_fds_.size();
- }
-
- // The data for the message we're currently reading consists of any data
- // stored in incoming_message_ followed by data in input_buf_ (followed by
- // other messages).
-
-
diff --git a/mozilla-1438131.patch b/mozilla-1438131.patch
deleted file mode 100644
index e77186d..0000000
--- a/mozilla-1438131.patch
+++ /dev/null
@@ -1,1558 +0,0 @@
-
-# HG changeset patch
-# User Martin Stransky <stransky@redhat.com>
-# Date 1522937803 -7200
-# Node ID 7e4166e13b3ec513ef3003527df601adf85f654b
-# Parent bf4962739d38ac21ba6ba216fa61f572e7976354
-Bug 1438131 - Implement Drop on Wayland, r=jhorak
-
-This patch implements Drop operation on Wayland/Gtk+. That's because drop operations are part
-of clipboard on Wayland and we use our own paste clipboard handler on Wayland (Bug 1282015).
-
-Wayland drop data are provided by wl_data_device_listener, it provides us drag and drop callbacks
-which we route to nsDragService module.
-
-MozReview-Commit-ID: 9uGYPg9YF6P
-
-diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
---- a/widget/gtk/nsClipboardWayland.cpp
-+++ b/widget/gtk/nsClipboardWayland.cpp
-@@ -18,16 +18,17 @@
- #include "nsPrimitiveHelpers.h"
- #include "nsIServiceManager.h"
- #include "nsImageToPixbuf.h"
- #include "nsStringStream.h"
- #include "nsIObserverService.h"
- #include "mozilla/Services.h"
- #include "mozilla/RefPtr.h"
- #include "mozilla/TimeStamp.h"
-+#include "nsDragService.h"
-
- #include "imgIContainer.h"
-
- #include <gtk/gtk.h>
- #include <poll.h>
- #include <sys/epoll.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -41,16 +42,54 @@
- const char*
- nsRetrievalContextWayland::sTextMimeTypes[TEXT_MIME_TYPES_NUM] =
- {
- "text/plain;charset=utf-8",
- "UTF8_STRING",
- "COMPOUND_TEXT"
- };
-
-+static inline GdkDragAction
-+wl_to_gdk_actions(uint32_t dnd_actions)
-+{
-+ GdkDragAction actions = GdkDragAction(0);
-+
-+ if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
-+ actions = GdkDragAction(actions|GDK_ACTION_COPY);
-+ if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
-+ actions = GdkDragAction(actions|GDK_ACTION_MOVE);
-+
-+ return actions;
-+}
-+
-+static inline uint32_t
-+gdk_to_wl_actions(GdkDragAction action)
-+{
-+ uint32_t dnd_actions = 0;
-+
-+ if (action & (GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_PRIVATE))
-+ dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
-+ if (action & GDK_ACTION_MOVE)
-+ dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
-+
-+ return dnd_actions;
-+}
-+
-+static GtkWidget*
-+get_gtk_widget_for_wl_surface(struct wl_surface *surface)
-+{
-+ GdkWindow *gdkParentWindow =
-+ static_cast<GdkWindow*>(wl_surface_get_user_data(surface));
-+
-+ gpointer user_data = nullptr;
-+ gdk_window_get_user_data(gdkParentWindow, &user_data);
-+
-+ return GTK_WIDGET(user_data);
-+}
-+
- void
- DataOffer::AddMIMEType(const char *aMimeType)
- {
- GdkAtom atom = gdk_atom_intern(aMimeType, FALSE);
- mTargetMIMETypes.AppendElement(atom);
- }
-
- GdkAtom*
-@@ -150,44 +189,99 @@ WaylandDataOffer::RequestDataTransfer(co
- if (mWaylandDataOffer) {
- wl_data_offer_receive(mWaylandDataOffer, aMimeType, fd);
- return true;
- }
-
- return false;
- }
-
-+void
-+WaylandDataOffer::DragOfferAccept(const char* aMimeType, uint32_t aTime)
-+{
-+ wl_data_offer_accept(mWaylandDataOffer, aTime, aMimeType);
-+}
-+
-+/* We follow logic of gdk_wayland_drag_context_commit_status()/gdkdnd-wayland.c
-+ * here.
-+ */
-+void
-+WaylandDataOffer::SetDragStatus(GdkDragAction aAction, uint32_t aTime)
-+{
-+ uint32_t dnd_actions = gdk_to_wl_actions(aAction);
-+ uint32_t all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY |
-+ WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
-+
-+ wl_data_offer_set_actions(mWaylandDataOffer, all_actions, dnd_actions);
-+
-+ /* Workaround Wayland D&D architecture here. To get the data_device_drop()
-+ signal (which routes to nsDragService::GetData() call) we need to
-+ accept at least one mime type before data_device_leave().
-+
-+ Real wl_data_offer_accept() for actualy requested data mime type is
-+ called from nsDragService::GetData().
-+ */
-+ if (mTargetMIMETypes[0]) {
-+ wl_data_offer_accept(mWaylandDataOffer, aTime,
-+ gdk_atom_name(mTargetMIMETypes[0]));
-+ }
-+}
-+
-+void
-+WaylandDataOffer::SetSelectedDragAction(uint32_t aWaylandAction)
-+{
-+ mSelectedDragAction = aWaylandAction;
-+}
-+
-+GdkDragAction
-+WaylandDataOffer::GetSelectedDragAction()
-+{
-+ return wl_to_gdk_actions(mSelectedDragAction);
-+}
-+
- static void
- data_offer_offer (void *data,
- struct wl_data_offer *wl_data_offer,
- const char *type)
- {
- auto *offer = static_cast<DataOffer*>(data);
- offer->AddMIMEType(type);
- }
-
-+/* Advertise all available drag and drop actions from source.
-+ * We don't use that but follow gdk_wayland_drag_context_commit_status()
-+ * from gdkdnd-wayland.c here.
-+ */
- static void
- data_offer_source_actions(void *data,
- struct wl_data_offer *wl_data_offer,
- uint32_t source_actions)
- {
- }
-
-+/* Advertise recently selected drag and drop action by compositor, based
-+ * on source actions and user choice (key modifiers, etc.).
-+ */
- static void
- data_offer_action(void *data,
- struct wl_data_offer *wl_data_offer,
- uint32_t dnd_action)
- {
-+ auto *offer = static_cast<WaylandDataOffer*>(data);
-+ offer->SetSelectedDragAction(dnd_action);
- }
-
- /* wl_data_offer callback description:
- *
- * data_offer_offer - Is called for each MIME type available at wl_data_offer.
-- * data_offer_source_actions - Exposes all available D&D actions.
-- * data_offer_action - Expose one actually selected D&D action.
-+ * data_offer_source_actions - This event indicates the actions offered by
-+ * the data source.
-+ * data_offer_action - This event indicates the action selected by
-+ * the compositor after matching the source/destination
-+ * side actions.
- */
- static const struct wl_data_offer_listener data_offer_listener = {
- data_offer_offer,
- data_offer_source_actions,
- data_offer_action
- };
-
- WaylandDataOffer::WaylandDataOffer(wl_data_offer* aWaylandDataOffer)
-@@ -241,92 +335,203 @@ PrimaryDataOffer::PrimaryDataOffer(gtk_p
-
- PrimaryDataOffer::~PrimaryDataOffer(void)
- {
- if(mPrimaryDataOffer) {
- gtk_primary_selection_offer_destroy(mPrimaryDataOffer);
- }
- }
-
-+NS_IMPL_ISUPPORTS(nsWaylandDragContext, nsISupports);
-+
-+nsWaylandDragContext::nsWaylandDragContext(WaylandDataOffer* aDataOffer,
-+ wl_display *aDisplay)
-+ : mDataOffer(aDataOffer)
-+ , mDisplay(aDisplay)
-+ , mTime(0)
-+ , mGtkWidget(nullptr)
-+ , mX(0)
-+ , mY(0)
-+{
-+}
-+
- void
--nsRetrievalContextWayland::RegisterDataOffer(wl_data_offer *aWaylandDataOffer)
-+nsWaylandDragContext::DropDataEnter(GtkWidget* aGtkWidget, uint32_t aTime,
-+ nscoord aX, nscoord aY)
-+{
-+ mTime = aTime;
-+ mGtkWidget = aGtkWidget;
-+ mX = aX;
-+ mY = aY;
-+}
-+
-+void
-+nsWaylandDragContext::DropMotion(uint32_t aTime, nscoord aX, nscoord aY)
-+{
-+ mTime = aTime;
-+ mX = aX;
-+ mY = aY;
-+}
-+
-+void
-+nsWaylandDragContext::GetLastDropInfo(uint32_t *aTime, nscoord *aX, nscoord *aY)
-+{
-+ *aTime = mTime;
-+ *aX = mX;
-+ *aY = mY;
-+}
-+
-+void
-+nsWaylandDragContext::SetDragStatus(GdkDragAction aAction)
-+{
-+ mDataOffer->SetDragStatus(aAction, mTime);
-+}
-+
-+GdkDragAction
-+nsWaylandDragContext::GetSelectedDragAction()
-+{
-+ return mDataOffer->GetSelectedDragAction();
-+}
-+
-+GList*
-+nsWaylandDragContext::GetTargets()
-+{
-+ int targetNums;
-+ GdkAtom *atoms = mDataOffer->GetTargets(&targetNums);
-+
-+ GList* targetList = nullptr;
-+ for (int i = 0; i < targetNums; i++) {
-+ targetList = g_list_append(targetList, GDK_ATOM_TO_POINTER(atoms[i]));
-+ }
-+
-+ return targetList;
-+}
-+
-+char*
-+nsWaylandDragContext::GetData(const char* aMimeType, uint32_t* aContentLength)
-+{
-+ mDataOffer->DragOfferAccept(aMimeType, mTime);
-+ return mDataOffer->GetData(mDisplay, aMimeType, aContentLength);
-+}
-+
-+void
-+nsRetrievalContextWayland::RegisterNewDataOffer(wl_data_offer *aWaylandDataOffer)
- {
- DataOffer* dataOffer =
- static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
- aWaylandDataOffer));
-+ MOZ_ASSERT(dataOffer == nullptr,
-+ "Registered WaylandDataOffer already exists. Wayland protocol error?");
-+
- if (!dataOffer) {
- dataOffer = new WaylandDataOffer(aWaylandDataOffer);
- g_hash_table_insert(mActiveOffers, aWaylandDataOffer, dataOffer);
- }
- }
-
- void
--nsRetrievalContextWayland::RegisterDataOffer(
-+nsRetrievalContextWayland::RegisterNewDataOffer(
- gtk_primary_selection_offer *aPrimaryDataOffer)
- {
- DataOffer* dataOffer =
- static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
- aPrimaryDataOffer));
-+ MOZ_ASSERT(dataOffer == nullptr,
-+ "Registered PrimaryDataOffer already exists. Wayland protocol error?");
-+
- if (!dataOffer) {
- dataOffer = new PrimaryDataOffer(aPrimaryDataOffer);
- g_hash_table_insert(mActiveOffers, aPrimaryDataOffer, dataOffer);
- }
- }
-
- void
- nsRetrievalContextWayland::SetClipboardDataOffer(wl_data_offer *aWaylandDataOffer)
- {
-+ // Delete existing clipboard data offer
-+ mClipboardOffer = nullptr;
-+
- DataOffer* dataOffer =
- static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
- aWaylandDataOffer));
- NS_ASSERTION(dataOffer, "We're missing clipboard data offer!");
- if (dataOffer) {
- g_hash_table_remove(mActiveOffers, aWaylandDataOffer);
- mClipboardOffer = dataOffer;
- }
- }
-
- void
- nsRetrievalContextWayland::SetPrimaryDataOffer(
- gtk_primary_selection_offer *aPrimaryDataOffer)
- {
-- if (aPrimaryDataOffer == nullptr) {
-- // Release any primary offer we have.
-- mPrimaryOffer = nullptr;
-- } else {
-+ // Release any primary offer we have.
-+ mPrimaryOffer = nullptr;
-+
-+ // aPrimaryDataOffer can be null which means we lost
-+ // the mouse selection.
-+ if (aPrimaryDataOffer) {
- DataOffer* dataOffer =
- static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
- aPrimaryDataOffer));
- NS_ASSERTION(dataOffer, "We're missing primary data offer!");
- if (dataOffer) {
- g_hash_table_remove(mActiveOffers, aPrimaryDataOffer);
- mPrimaryOffer = dataOffer;
- }
- }
- }
-
- void
--nsRetrievalContextWayland::ClearDataOffers(void)
-+nsRetrievalContextWayland::AddDragAndDropDataOffer(wl_data_offer *aDropDataOffer)
-+{
-+ // Remove any existing D&D contexts.
-+ mDragContext = nullptr;
-+
-+ WaylandDataOffer* dataOffer =
-+ static_cast<WaylandDataOffer*>(g_hash_table_lookup(mActiveOffers,
-+ aDropDataOffer));
-+ NS_ASSERTION(dataOffer, "We're missing drag and drop data offer!");
-+ if (dataOffer) {
-+ g_hash_table_remove(mActiveOffers, aDropDataOffer);
-+ mDragContext = new nsWaylandDragContext(dataOffer, mDisplay);
-+ }
-+}
-+
-+nsWaylandDragContext*
-+nsRetrievalContextWayland::GetDragContext(void)
-+{
-+ return mDragContext;
-+}
-+
-+void
-+nsRetrievalContextWayland::ClearClipboardDataOffers(void)
- {
- if (mClipboardOffer)
- mClipboardOffer = nullptr;
- if (mPrimaryOffer)
- mPrimaryOffer = nullptr;
- }
-
-+void
-+nsRetrievalContextWayland::ClearDragAndDropDataOffer(void)
-+{
-+ mDragContext = nullptr;
-+}
-+
- // We have a new fresh data content.
- // We should attach listeners to it and save for further use.
- static void
- data_device_data_offer (void *data,
- struct wl_data_device *data_device,
- struct wl_data_offer *offer)
- {
- nsRetrievalContextWayland *context =
- static_cast<nsRetrievalContextWayland*>(data);
-- context->RegisterDataOffer(offer);
-+ context->RegisterNewDataOffer(offer);
- }
-
- // The new fresh data content is clipboard.
- static void
- data_device_selection (void *data,
- struct wl_data_device *wl_data_device,
- struct wl_data_offer *offer)
- {
-@@ -336,41 +541,88 @@ data_device_selection (void
- }
-
- // The new fresh wayland data content is drag and drop.
- static void
- data_device_enter (void *data,
- struct wl_data_device *data_device,
- uint32_t time,
- struct wl_surface *surface,
-- int32_t x,
-- int32_t y,
-+ int32_t x_fixed,
-+ int32_t y_fixed,
- struct wl_data_offer *offer)
- {
-+ nsRetrievalContextWayland *context =
-+ static_cast<nsRetrievalContextWayland*>(data);
-+ context->AddDragAndDropDataOffer(offer);
-+
-+ nsWaylandDragContext* dragContext = context->GetDragContext();
-+
-+ GtkWidget* gtkWidget = get_gtk_widget_for_wl_surface(surface);
-+ if (!gtkWidget) {
-+ NS_WARNING("DragAndDrop: Unable to get GtkWidget for wl_surface!");
-+ return;
-+ }
-+
-+ LOGDRAG(("nsWindow data_device_enter for GtkWidget %p\n",
-+ (void*)gtkWidget));
-+
-+ dragContext->DropDataEnter(gtkWidget, time,
-+ wl_fixed_to_int(x_fixed),
-+ wl_fixed_to_int(y_fixed));
- }
-
- static void
- data_device_leave (void *data,
- struct wl_data_device *data_device)
- {
-+ nsRetrievalContextWayland *context =
-+ static_cast<nsRetrievalContextWayland*>(data);
-+
-+ nsWaylandDragContext* dropContext = context->GetDragContext();
-+ WindowDragLeaveHandler(dropContext->GetWidget());
-+
-+ context->ClearDragAndDropDataOffer();
- }
-
- static void
- data_device_motion (void *data,
- struct wl_data_device *data_device,
- uint32_t time,
-- int32_t x,
-- int32_t y)
-+ int32_t x_fixed,
-+ int32_t y_fixed)
- {
-+ nsRetrievalContextWayland *context =
-+ static_cast<nsRetrievalContextWayland*>(data);
-+
-+ nsWaylandDragContext* dropContext = context->GetDragContext();
-+
-+ nscoord x = wl_fixed_to_int(x_fixed);
-+ nscoord y = wl_fixed_to_int(y_fixed);
-+ dropContext->DropMotion(time, x, y);
-+
-+ WindowDragMotionHandler(dropContext->GetWidget(), nullptr,
-+ dropContext, x, y, time);
- }
-
- static void
- data_device_drop (void *data,
- struct wl_data_device *data_device)
- {
-+ nsRetrievalContextWayland *context =
-+ static_cast<nsRetrievalContextWayland*>(data);
-+
-+ nsWaylandDragContext* dropContext = context->GetDragContext();
-+
-+ uint32_t time;
-+ nscoord x, y;
-+ dropContext->GetLastDropInfo(&time, &x, &y);
-+
-+ WindowDragDropHandler(dropContext->GetWidget(), nullptr, dropContext,
-+ x, y, time);
- }
-
- /* wl_data_device callback description:
- *
- * data_device_data_offer - It's called when there's a new wl_data_offer
- * available. We need to attach wl_data_offer_listener
- * to it to get available MIME types.
- *
-@@ -400,29 +652,41 @@ static const struct wl_data_device_liste
- static void
- primary_selection_data_offer (void *data,
- struct gtk_primary_selection_device *gtk_primary_selection_device,
- struct gtk_primary_selection_offer *gtk_primary_offer)
- {
- // create and add listener
- nsRetrievalContextWayland *context =
- static_cast<nsRetrievalContextWayland*>(data);
-- context->RegisterDataOffer(gtk_primary_offer);
-+ context->RegisterNewDataOffer(gtk_primary_offer);
- }
-
- static void
- primary_selection_selection (void *data,
- struct gtk_primary_selection_device *gtk_primary_selection_device,
- struct gtk_primary_selection_offer *gtk_primary_offer)
- {
- nsRetrievalContextWayland *context =
- static_cast<nsRetrievalContextWayland*>(data);
- context->SetPrimaryDataOffer(gtk_primary_offer);
- }
-
-+/* gtk_primary_selection_device callback description:
-+ *
-+ * primary_selection_data_offer - It's called when there's a new
-+ * gtk_primary_selection_offer available.
-+ * We need to attach gtk_primary_selection_offer_listener
-+ * to it to get available MIME types.
-+ *
-+ * primary_selection_selection - It's called when the new gtk_primary_selection_offer
-+ * is a primary selection content. It can be also called with
-+ * gtk_primary_selection_offer = null which means there's no
-+ * primary selection.
-+ */
- static const struct
- gtk_primary_selection_device_listener primary_selection_device_listener = {
- primary_selection_data_offer,
- primary_selection_selection,
- };
-
- bool
- nsRetrievalContextWayland::HasSelectionSupport(void)
-@@ -446,17 +710,17 @@ keyboard_handle_enter(void *data, struct
- static void
- keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
- uint32_t serial, struct wl_surface *surface)
- {
- // We lost focus so our clipboard data are outdated
- nsRetrievalContextWayland *context =
- static_cast<nsRetrievalContextWayland*>(data);
-
-- context->ClearDataOffers();
-+ context->ClearClipboardDataOffers();
- }
-
- static void
- keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
- uint32_t serial, uint32_t time, uint32_t key,
- uint32_t state)
- {
- }
-@@ -568,16 +832,17 @@ nsRetrievalContextWayland::nsRetrievalCo
- : mInitialized(false)
- , mSeat(nullptr)
- , mDataDeviceManager(nullptr)
- , mPrimarySelectionDataDeviceManager(nullptr)
- , mKeyboard(nullptr)
- , mActiveOffers(g_hash_table_new(NULL, NULL))
- , mClipboardOffer(nullptr)
- , mPrimaryOffer(nullptr)
-+ , mDragContext(nullptr)
- , mClipboardRequestNumber(0)
- , mClipboardData(nullptr)
- , mClipboardDataLength(0)
- {
- // Available as of GTK 3.8+
- static auto sGdkWaylandDisplayGetWlDisplay =
- (wl_display *(*)(GdkDisplay *))
- dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
-@@ -611,18 +876,31 @@ nsRetrievalContextWayland::nsRetrievalCo
- mSeat);
- gtk_primary_selection_device_add_listener(primaryDataDevice,
- &primary_selection_device_listener, this);
- }
-
- mInitialized = true;
- }
-
-+static gboolean
-+offer_hash_remove(gpointer wl_offer, gpointer aDataOffer, gpointer user_data)
-+{
-+#ifdef DEBUG
-+ nsPrintfCString msg("nsRetrievalContextWayland(): leaked nsDataOffer %p\n",
-+ aDataOffer);
-+ NS_WARNING(msg.get());
-+#endif
-+ delete static_cast<DataOffer*>(aDataOffer);
-+ return true;
-+}
-+
- nsRetrievalContextWayland::~nsRetrievalContextWayland(void)
- {
-+ g_hash_table_foreach_remove(mActiveOffers, offer_hash_remove, nullptr);
- g_hash_table_destroy(mActiveOffers);
- }
-
- GdkAtom*
- nsRetrievalContextWayland::GetTargets(int32_t aWhichClipboard,
- int* aTargetNum)
- {
- if (GetSelectionAtom(aWhichClipboard) == GDK_SELECTION_CLIPBOARD) {
-diff --git a/widget/gtk/nsClipboardWayland.h b/widget/gtk/nsClipboardWayland.h
---- a/widget/gtk/nsClipboardWayland.h
-+++ b/widget/gtk/nsClipboardWayland.h
-@@ -27,65 +27,108 @@ public:
-
- char* GetData(wl_display* aDisplay, const char* aMimeType,
- uint32_t* aContentLength);
-
- virtual ~DataOffer() {};
- private:
- virtual bool RequestDataTransfer(const char* aMimeType, int fd) = 0;
-
-+protected:
- nsTArray<GdkAtom> mTargetMIMETypes;
- };
-
- class WaylandDataOffer : public DataOffer
- {
- public:
- WaylandDataOffer(wl_data_offer* aWaylandDataOffer);
-
-+ void DragOfferAccept(const char* aMimeType, uint32_t aTime);
-+ void SetDragStatus(GdkDragAction aAction, uint32_t aTime);
-+
-+ GdkDragAction GetSelectedDragAction();
-+ void SetSelectedDragAction(uint32_t aWaylandAction);
-+
-+ void SetSourceDragActions(uint32_t aWaylandActions);
-+
-+ virtual ~WaylandDataOffer();
- private:
-- virtual ~WaylandDataOffer();
- bool RequestDataTransfer(const char* aMimeType, int fd) override;
-
- wl_data_offer* mWaylandDataOffer;
-+ uint32_t mSelectedDragAction;
- };
-
- class PrimaryDataOffer : public DataOffer
- {
- public:
- PrimaryDataOffer(gtk_primary_selection_offer* aPrimaryDataOffer);
-+ void SetAvailableDragActions(uint32_t aWaylandActions) {};
-
-+ virtual ~PrimaryDataOffer();
- private:
-- virtual ~PrimaryDataOffer();
- bool RequestDataTransfer(const char* aMimeType, int fd) override;
-
- gtk_primary_selection_offer* mPrimaryDataOffer;
- };
-
-+class nsWaylandDragContext : public nsISupports
-+{
-+ NS_DECL_ISUPPORTS
-+
-+public:
-+ nsWaylandDragContext(WaylandDataOffer* aWaylandDataOffer,
-+ wl_display *aDisplay);
-+
-+ void DropDataEnter(GtkWidget* aGtkWidget, uint32_t aTime,
-+ nscoord aX, nscoord aY);
-+ void DropMotion(uint32_t aTime, nscoord aX, nscoord aY);
-+ void GetLastDropInfo(uint32_t *aTime, nscoord *aX, nscoord *aY);
-+
-+ void SetDragStatus(GdkDragAction action);
-+ GdkDragAction GetSelectedDragAction();
-+
-+ GtkWidget* GetWidget() { return mGtkWidget; }
-+ GList* GetTargets();
-+ char* GetData(const char* aMimeType, uint32_t* aContentLength);
-+private:
-+ virtual ~nsWaylandDragContext() {};
-+
-+ nsAutoPtr<WaylandDataOffer> mDataOffer;
-+ wl_display* mDisplay;
-+ uint32_t mTime;
-+ GtkWidget* mGtkWidget;
-+ nscoord mX, mY;
-+};
-+
- class nsRetrievalContextWayland : public nsRetrievalContext
- {
- public:
- nsRetrievalContextWayland();
-
- virtual const char* GetClipboardData(const char* aMimeType,
- int32_t aWhichClipboard,
- uint32_t* aContentLength) override;
- virtual const char* GetClipboardText(int32_t aWhichClipboard) override;
- virtual void ReleaseClipboardData(const char* aClipboardData) override;
-
- virtual GdkAtom* GetTargets(int32_t aWhichClipboard,
- int* aTargetNum) override;
- virtual bool HasSelectionSupport(void) override;
-
-- void RegisterDataOffer(wl_data_offer *aWaylandDataOffer);
-- void RegisterDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
-+ void RegisterNewDataOffer(wl_data_offer *aWaylandDataOffer);
-+ void RegisterNewDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
-
- void SetClipboardDataOffer(wl_data_offer *aWaylandDataOffer);
- void SetPrimaryDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
-+ void AddDragAndDropDataOffer(wl_data_offer *aWaylandDataOffer);
-+ nsWaylandDragContext* GetDragContext();
-
-- void ClearDataOffers();
-+ void ClearClipboardDataOffers();
-+ void ClearDragAndDropDataOffer();
-
- void ConfigureKeyboard(wl_seat_capability caps);
- void TransferFastTrackClipboard(int aClipboardRequestNumber,
- GtkSelectionData *aSelectionData);
-
- void InitDataDeviceManager(wl_registry *registry, uint32_t id, uint32_t version);
- void InitPrimarySelectionDataDeviceManager(wl_registry *registry, uint32_t id);
- void InitSeat(wl_registry *registry, uint32_t id, uint32_t version, void *data);
-@@ -98,16 +141,17 @@ private:
- wl_data_device_manager *mDataDeviceManager;
- gtk_primary_selection_device_manager *mPrimarySelectionDataDeviceManager;
- wl_keyboard *mKeyboard;
-
- // Data offers provided by Wayland data device
- GHashTable* mActiveOffers;
- nsAutoPtr<DataOffer> mClipboardOffer;
- nsAutoPtr<DataOffer> mPrimaryOffer;
-+ RefPtr<nsWaylandDragContext> mDragContext;
-
- int mClipboardRequestNumber;
- char* mClipboardData;
- uint32_t mClipboardDataLength;
-
- // Mime types used for text data at Gtk+, see request_text_received_func()
- // at gtkclipboard.c.
- #define TEXT_MIME_TYPES_NUM 3
-diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp
---- a/widget/gtk/nsDragService.cpp
-+++ b/widget/gtk/nsDragService.cpp
-@@ -37,16 +37,19 @@
- #include "nsViewManager.h"
- #include "nsIFrame.h"
- #include "nsGtkUtils.h"
- #include "nsGtkKeyUtils.h"
- #include "mozilla/gfx/2D.h"
- #include "gfxPlatform.h"
- #include "ScreenHelperGTK.h"
- #include "nsArrayUtils.h"
-+#ifdef MOZ_WAYLAND
-+#include "nsClipboardWayland.h"
-+#endif
-
- using namespace mozilla;
- using namespace mozilla::gfx;
-
- // This sets how opaque the drag image is
- #define DRAG_IMAGE_ALPHA_LEVEL 0.5
-
- // These values are copied from GtkDragResult (rather than using GtkDragResult
-@@ -93,16 +96,20 @@ invisibleSourceDragDataGet(GtkWidget
- GtkSelectionData *aSelectionData,
- guint aInfo,
- guint32 aTime,
- gpointer aData);
-
- nsDragService::nsDragService()
- : mScheduledTask(eDragTaskNone)
- , mTaskSource(0)
-+#ifdef MOZ_WAYLAND
-+ , mPendingWaylandDragContext(nullptr)
-+ , mTargetWaylandDragContext(nullptr)
-+#endif
- {
- // We have to destroy the hidden widget before the event loop stops
- // running.
- nsCOMPtr<nsIObserverService> obsServ =
- mozilla::services::GetObserverService();
- obsServ->AddObserver(this, "quit-application", false);
-
- // our hidden source widget
-@@ -509,16 +516,19 @@ nsDragService::EndDragSession(bool aDone
- }
- }
-
- // unset our drag action
- SetDragAction(DRAGDROP_ACTION_NONE);
-
- // We're done with the drag context.
- mTargetDragContextForRemote = nullptr;
-+#ifdef MOZ_WAYLAND
-+ mTargetWaylandDragContextForRemote = nullptr;
-+#endif
-
- return nsBaseDragService::EndDragSession(aDoneDrag, aKeyModifiers);
- }
-
- // nsIDragSession
- NS_IMETHODIMP
- nsDragService::SetCanDrop(bool aCanDrop)
- {
-@@ -629,16 +639,24 @@ nsDragService::GetNumDropItems(uint32_t
- if (!mTargetWidget) {
- MOZ_LOG(sDragLm, LogLevel::Debug,
- ("*** warning: GetNumDropItems \
- called without a valid target widget!\n"));
- *aNumItems = 0;
- return NS_OK;
- }
-
-+#ifdef MOZ_WAYLAND
-+ // TODO: Wayland implementation of text/uri-list.
-+ if (!mTargetDragContext) {
-+ *aNumItems = 1;
-+ return NS_OK;
-+ }
-+#endif
-+
- bool isList = IsTargetContextList();
- if (isList)
- mSourceDataItems->GetLength(aNumItems);
- else {
- GdkAtom gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE);
- GetTargetDragData(gdkFlavor);
- if (mTargetDragData) {
- const char *data = reinterpret_cast<char*>(mTargetDragData);
-@@ -1020,19 +1038,28 @@ nsDragService::IsDataFlavorSupported(con
- }
- }
- }
- }
- return NS_OK;
- }
-
- // check the target context vs. this flavor, one at a time
-- GList *tmp;
-- for (tmp = gdk_drag_context_list_targets(mTargetDragContext);
-- tmp; tmp = tmp->next) {
-+ GList *tmp = nullptr;
-+ if (mTargetDragContext) {
-+ tmp = gdk_drag_context_list_targets(mTargetDragContext);
-+ }
-+#ifdef MOZ_WAYLAND
-+ else {
-+ tmp = mTargetWaylandDragContext->GetTargets();
-+ }
-+#endif
-+ GList *tmp_head = tmp;
-+
-+ for (; tmp; tmp = tmp->next) {
- /* Bug 331198 */
- GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
- gchar *name = nullptr;
- name = gdk_atom_name(atom);
- MOZ_LOG(sDragLm, LogLevel::Debug,
- ("checking %s against %s\n", name, aDataFlavor));
- if (name && (strcmp(name, aDataFlavor) == 0)) {
- MOZ_LOG(sDragLm, LogLevel::Debug, ("good!\n"));
-@@ -1067,16 +1094,23 @@ nsDragService::IsDataFlavorSupported(con
- (strcmp(aDataFlavor, kFileMime) == 0))) {
- MOZ_LOG(sDragLm, LogLevel::Debug,
- ("good! ( it's text plain and we're checking \
- against text/unicode or application/x-moz-file)\n"));
- *_retval = true;
- }
- g_free(name);
- }
-+
-+ // mTargetWaylandDragContext->GetTargets allocates the list
-+ // so we need to free it here.
-+ if (!mTargetDragContext) {
-+ g_list_free(tmp_head);
-+ }
-+
- return NS_OK;
- }
-
- void
- nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext)
- {
- MOZ_LOG(sDragLm, LogLevel::Debug,
- ("nsDragService::ReplyToDragMotion %d", mCanDrop));
-@@ -1098,16 +1132,46 @@ nsDragService::ReplyToDragMotion(GdkDrag
- action = GDK_ACTION_MOVE;
- break;
- }
- }
-
- gdk_drag_status(aDragContext, action, mTargetTime);
- }
-
-+#ifdef MOZ_WAYLAND
-+void
-+nsDragService::ReplyToDragMotion(nsWaylandDragContext* aDragContext)
-+{
-+ MOZ_LOG(sDragLm, LogLevel::Debug,
-+ ("nsDragService::ReplyToDragMotion %d", mCanDrop));
-+
-+ GdkDragAction action = (GdkDragAction)0;
-+ if (mCanDrop) {
-+ // notify the dragger if we can drop
-+ switch (mDragAction) {
-+ case DRAGDROP_ACTION_COPY:
-+ action = GDK_ACTION_COPY;
-+ break;
-+ case DRAGDROP_ACTION_LINK:
-+ action = GDK_ACTION_LINK;
-+ break;
-+ case DRAGDROP_ACTION_NONE:
-+ action = (GdkDragAction)0;
-+ break;
-+ default:
-+ action = GDK_ACTION_MOVE;
-+ break;
-+ }
-+ }
-+
-+ aDragContext->SetDragStatus(action);
-+}
-+#endif
-+
- void
- nsDragService::TargetDataReceived(GtkWidget *aWidget,
- GdkDragContext *aContext,
- gint aX,
- gint aY,
- GtkSelectionData *aSelectionData,
- guint aInfo,
- guint32 aTime)
-@@ -1129,16 +1193,22 @@ nsDragService::TargetDataReceived(GtkWid
- }
- }
-
- bool
- nsDragService::IsTargetContextList(void)
- {
- bool retval = false;
-
-+#ifdef MOZ_WAYLAND
-+ // TODO: We need a wayland implementation here.
-+ if (!mTargetDragContext)
-+ return retval;
-+#endif
-+
- // gMimeListType drags only work for drags within a single process. The
- // gtk_drag_get_source_widget() function will return nullptr if the source
- // of the drag is another app, so we use it to check if a gMimeListType
- // drop will work or not.
- if (gtk_drag_get_source_widget(mTargetDragContext) == nullptr)
- return retval;
-
- GList *tmp;
-@@ -1167,27 +1237,38 @@ void
- nsDragService::GetTargetDragData(GdkAtom aFlavor)
- {
- MOZ_LOG(sDragLm, LogLevel::Debug, ("getting data flavor %p\n", aFlavor));
- MOZ_LOG(sDragLm, LogLevel::Debug, ("mLastWidget is %p and mLastContext is %p\n",
- mTargetWidget.get(),
- mTargetDragContext.get()));
- // reset our target data areas
- TargetResetData();
-- gtk_drag_get_data(mTargetWidget, mTargetDragContext, aFlavor, mTargetTime);
-+
-+ if (mTargetDragContext) {
-+ gtk_drag_get_data(mTargetWidget, mTargetDragContext, aFlavor, mTargetTime);
-
-- MOZ_LOG(sDragLm, LogLevel::Debug, ("about to start inner iteration."));
-- PRTime entryTime = PR_Now();
-- while (!mTargetDragDataReceived && mDoingDrag) {
-- // check the number of iterations
-- MOZ_LOG(sDragLm, LogLevel::Debug, ("doing iteration...\n"));
-- PR_Sleep(20*PR_TicksPerSecond()/1000); /* sleep for 20 ms/iteration */
-- if (PR_Now()-entryTime > NS_DND_TIMEOUT) break;
-- gtk_main_iteration();
-+ MOZ_LOG(sDragLm, LogLevel::Debug, ("about to start inner iteration."));
-+ PRTime entryTime = PR_Now();
-+ while (!mTargetDragDataReceived && mDoingDrag) {
-+ // check the number of iterations
-+ MOZ_LOG(sDragLm, LogLevel::Debug, ("doing iteration...\n"));
-+ PR_Sleep(20*PR_TicksPerSecond()/1000); /* sleep for 20 ms/iteration */
-+ if (PR_Now()-entryTime > NS_DND_TIMEOUT) break;
-+ gtk_main_iteration();
-+ }
- }
-+#ifdef MOZ_WAYLAND
-+ else {
-+ mTargetDragData =
-+ mTargetWaylandDragContext->GetData(gdk_atom_name(aFlavor),
-+ &mTargetDragDataLen);
-+ mTargetDragDataReceived = true;
-+ }
-+#endif
- MOZ_LOG(sDragLm, LogLevel::Debug, ("finished inner iteration\n"));
- }
-
- void
- nsDragService::TargetResetData(void)
- {
- mTargetDragDataReceived = false;
- // make sure to free old data if we have to
-@@ -1428,17 +1509,17 @@ nsDragService::SourceEndDragSession(GdkD
- }
- }
-
- if (mDataTransfer) {
- mDataTransfer->SetDropEffectInt(dropEffect);
- }
-
- // Schedule the appropriate drag end dom events.
-- Schedule(eDragTaskSourceEnd, nullptr, nullptr, LayoutDeviceIntPoint(), 0);
-+ Schedule(eDragTaskSourceEnd, nullptr, nullptr, nullptr, LayoutDeviceIntPoint(), 0);
- }
-
- static void
- CreateUriList(nsIArray *items, gchar **text, gint *length)
- {
- uint32_t i, count;
- GString *uriList = g_string_new(nullptr);
-
-@@ -1778,64 +1859,68 @@ invisibleSourceDragEnd(GtkWidget
- //
- // No Gecko drag events are dispatched (during nested event loops) while other
- // Gecko drag events are in flight. This helps event handlers that may not
- // expect nested events, while accessing an event's dataTransfer for example.
-
- gboolean
- nsDragService::ScheduleMotionEvent(nsWindow *aWindow,
- GdkDragContext *aDragContext,
-+ nsWaylandDragContext *aWaylandDragContext,
- LayoutDeviceIntPoint aWindowPoint, guint aTime)
- {
-- if (mScheduledTask == eDragTaskMotion) {
-+ if (aDragContext && mScheduledTask == eDragTaskMotion) {
- // The drag source has sent another motion message before we've
- // replied to the previous. That shouldn't happen with Xdnd. The
- // spec for Motif drags is less clear, but we'll just update the
- // scheduled task with the new position reply only to the most
- // recent message.
- NS_WARNING("Drag Motion message received before previous reply was sent");
- }
-
- // Returning TRUE means we'll reply with a status message, unless we first
- // get a leave.
-- return Schedule(eDragTaskMotion, aWindow, aDragContext,
-+ return Schedule(eDragTaskMotion, aWindow, aDragContext, aWaylandDragContext,
- aWindowPoint, aTime);
- }
-
- void
- nsDragService::ScheduleLeaveEvent()
- {
- // We don't know at this stage whether a drop signal will immediately
- // follow. If the drop signal gets sent it will happen before we return
- // to the main loop and the scheduled leave task will be replaced.
-- if (!Schedule(eDragTaskLeave, nullptr, nullptr, LayoutDeviceIntPoint(), 0)) {
-+ if (!Schedule(eDragTaskLeave, nullptr, nullptr, nullptr,
-+ LayoutDeviceIntPoint(), 0)) {
- NS_WARNING("Drag leave after drop");
- }
- }
-
- gboolean
- nsDragService::ScheduleDropEvent(nsWindow *aWindow,
- GdkDragContext *aDragContext,
-+ nsWaylandDragContext *aWaylandDragContext,
- LayoutDeviceIntPoint aWindowPoint, guint aTime)
- {
- if (!Schedule(eDragTaskDrop, aWindow,
-- aDragContext, aWindowPoint, aTime)) {
-+ aDragContext, aWaylandDragContext, aWindowPoint, aTime)) {
- NS_WARNING("Additional drag drop ignored");
- return FALSE;
- }
-
- SetDragEndPoint(aWindowPoint + aWindow->WidgetToScreenOffset());
-
- // We'll reply with gtk_drag_finish().
- return TRUE;
- }
-
- gboolean
- nsDragService::Schedule(DragTask aTask, nsWindow *aWindow,
- GdkDragContext *aDragContext,
-+ nsWaylandDragContext *aWaylandDragContext,
- LayoutDeviceIntPoint aWindowPoint, guint aTime)
- {
- // If there is an existing leave or motion task scheduled, then that
- // will be replaced. When the new task is run, it will dispatch
- // any necessary leave or motion events.
-
- // If aTask is eDragTaskSourceEnd, then it will replace even a scheduled
- // drop event (which could happen if the drop event has not been processed
-@@ -1844,16 +1929,19 @@ nsDragService::Schedule(DragTask aTask,
- // drop.
- if (mScheduledTask == eDragTaskSourceEnd ||
- (mScheduledTask == eDragTaskDrop && aTask != eDragTaskSourceEnd))
- return FALSE;
-
- mScheduledTask = aTask;
- mPendingWindow = aWindow;
- mPendingDragContext = aDragContext;
-+#ifdef MOZ_WAYLAND
-+ mPendingWaylandDragContext = aWaylandDragContext;
-+#endif
- mPendingWindowPoint = aWindowPoint;
- mPendingTime = aTime;
-
- if (!mTaskSource) {
- // High priority is used here because the native events involved have
- // already waited at default priority. Perhaps a lower than default
- // priority could be used for motion tasks because there is a chance
- // that a leave or drop is waiting, but managing different priorities
-@@ -1919,17 +2007,24 @@ nsDragService::RunScheduledTask()
- // This may be the start of a destination drag session.
- StartDragSession();
-
- // mTargetWidget may be nullptr if the window has been destroyed.
- // (The leave event is not scheduled if a drop task is still scheduled.)
- // We still reply appropriately to indicate that the drop will or didn't
- // succeeed.
- mTargetWidget = mTargetWindow->GetMozContainerWidget();
-- mTargetDragContext.steal(mPendingDragContext);
-+ if (mTargetDragContext) {
-+ mTargetDragContext.steal(mPendingDragContext);
-+ }
-+#ifdef MOZ_WAYLAND
-+ else {
-+ mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
-+ }
-+#endif
- mTargetTime = mPendingTime;
-
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model
- // (as at 27 December 2010) indicates that a "drop" event should only be
- // fired (at the current target element) if the current drag operation is
- // not none. The current drag operation will only be set to a non-none
- // value during a "dragover" event.
- //
-@@ -1951,44 +2046,59 @@ nsDragService::RunScheduledTask()
- // protocol is used.
- if (task == eDragTaskMotion || positionHasChanged) {
- UpdateDragAction();
- TakeDragEventDispatchedToChildProcess(); // Clear the old value.
- DispatchMotionEvents();
- if (task == eDragTaskMotion) {
- if (TakeDragEventDispatchedToChildProcess()) {
- mTargetDragContextForRemote = mTargetDragContext;
-+#ifdef MOZ_WAYLAND
-+ mTargetWaylandDragContextForRemote = mTargetWaylandDragContext;
-+#endif
- } else {
- // Reply to tell the source whether we can drop and what
- // action would be taken.
-- ReplyToDragMotion(mTargetDragContext);
-+ if (mTargetDragContext) {
-+ ReplyToDragMotion(mTargetDragContext);
-+ }
-+#ifdef MOZ_WAYLAND
-+ else {
-+ ReplyToDragMotion(mTargetWaylandDragContext);
-+ }
-+#endif
- }
- }
- }
-
- if (task == eDragTaskDrop) {
- gboolean success = DispatchDropEvent();
-
- // Perhaps we should set the del parameter to TRUE when the drag
- // action is move, but we don't know whether the data was successfully
- // transferred.
-- gtk_drag_finish(mTargetDragContext, success,
-- /* del = */ FALSE, mTargetTime);
-+ if (mTargetDragContext) {
-+ gtk_drag_finish(mTargetDragContext, success,
-+ /* del = */ FALSE, mTargetTime);
-+ }
-
- // This drag is over, so clear out our reference to the previous
- // window.
- mTargetWindow = nullptr;
- // Make sure to end the drag session. If this drag started in a
- // different app, we won't get a drag_end signal to end it from.
- EndDragSession(true, GetCurrentModifiers());
- }
-
- // We're done with the drag context.
- mTargetWidget = nullptr;
- mTargetDragContext = nullptr;
-+#ifdef MOZ_WAYLAND
-+ mTargetWaylandDragContext = nullptr;
-+#endif
-
- // If we got another drag signal while running the sheduled task, that
- // must have happened while running a nested event loop. Leave the task
- // source on the event loop.
- if (mScheduledTask != eDragTaskNone)
- return TRUE;
-
- // We have no task scheduled.
-@@ -2008,17 +2118,26 @@ nsDragService::UpdateDragAction()
- // nsContentUtils::SetDataTransferInEvent() to set the initial
- // dataTransfer.dropEffect, so GdkDragContext::suggested_action would be
- // more appropriate. GdkDragContext::actions should be used to set
- // dataTransfer.effectAllowed, which doesn't currently happen with
- // external sources.
-
- // default is to do nothing
- int action = nsIDragService::DRAGDROP_ACTION_NONE;
-- GdkDragAction gdkAction = gdk_drag_context_get_actions(mTargetDragContext);
-+ GdkDragAction gdkAction = GDK_ACTION_DEFAULT;
-+ if (mTargetDragContext) {
-+ gdkAction = gdk_drag_context_get_actions(mTargetDragContext);
-+ }
-+#ifdef MOZ_WAYLAND
-+ else {
-+ // We got the selected D&D action from compositor on Wayland.
-+ gdkAction = mTargetWaylandDragContext->GetSelectedDragAction();
-+ }
-+#endif
-
- // set the default just in case nothing matches below
- if (gdkAction & GDK_ACTION_DEFAULT)
- action = nsIDragService::DRAGDROP_ACTION_MOVE;
-
- // first check to see if move is set
- if (gdkAction & GDK_ACTION_MOVE)
- action = nsIDragService::DRAGDROP_ACTION_MOVE;
-@@ -2037,16 +2156,22 @@ nsDragService::UpdateDragAction()
-
- NS_IMETHODIMP
- nsDragService::UpdateDragEffect()
- {
- if (mTargetDragContextForRemote) {
- ReplyToDragMotion(mTargetDragContextForRemote);
- mTargetDragContextForRemote = nullptr;
- }
-+#ifdef MOZ_WAYLAND
-+ else if (mTargetWaylandDragContextForRemote) {
-+ ReplyToDragMotion(mTargetWaylandDragContextForRemote);
-+ mTargetWaylandDragContextForRemote = nullptr;
-+ }
-+#endif
- return NS_OK;
- }
-
- void
- nsDragService::DispatchMotionEvents()
- {
- mCanDrop = false;
-
-diff --git a/widget/gtk/nsDragService.h b/widget/gtk/nsDragService.h
---- a/widget/gtk/nsDragService.h
-+++ b/widget/gtk/nsDragService.h
-@@ -9,16 +9,17 @@
-
- #include "mozilla/RefPtr.h"
- #include "nsBaseDragService.h"
- #include "nsIObserver.h"
- #include "nsAutoRef.h"
- #include <gtk/gtk.h>
-
- class nsWindow;
-+class nsWaylandDragContext;
-
- namespace mozilla {
- namespace gfx {
- class SourceSurface;
- }
- }
-
- #ifndef HAVE_NSGOBJECTREFTRAITS
-@@ -93,21 +94,23 @@ public:
- gint aX,
- gint aY,
- GtkSelectionData *aSelection_data,
- guint aInfo,
- guint32 aTime);
-
- gboolean ScheduleMotionEvent(nsWindow *aWindow,
- GdkDragContext *aDragContext,
-+ nsWaylandDragContext* aPendingWaylandDragContext,
- mozilla::LayoutDeviceIntPoint aWindowPoint,
- guint aTime);
- void ScheduleLeaveEvent();
- gboolean ScheduleDropEvent(nsWindow *aWindow,
- GdkDragContext *aDragContext,
-+ nsWaylandDragContext* aPendingWaylandDragContext,
- mozilla::LayoutDeviceIntPoint aWindowPoint,
- guint aTime);
-
- nsWindow* GetMostRecentDestWindow()
- {
- return mScheduledTask == eDragTaskNone ? mTargetWindow
- : mPendingWindow;
- }
-@@ -153,30 +156,39 @@ private:
-
- // mPendingWindow, mPendingWindowPoint, mPendingDragContext, and
- // mPendingTime, carry information from the GTK signal that will be used
- // when the scheduled task is run. mPendingWindow and mPendingDragContext
- // will be nullptr if the scheduled task is eDragTaskLeave.
- RefPtr<nsWindow> mPendingWindow;
- mozilla::LayoutDeviceIntPoint mPendingWindowPoint;
- nsCountedRef<GdkDragContext> mPendingDragContext;
-+#ifdef MOZ_WAYLAND
-+ RefPtr<nsWaylandDragContext> mPendingWaylandDragContext;
-+#endif
- guint mPendingTime;
-
- // mTargetWindow and mTargetWindowPoint record the position of the last
- // eDragTaskMotion or eDragTaskDrop task that was run or is still running.
- // mTargetWindow is cleared once the drag has completed or left.
- RefPtr<nsWindow> mTargetWindow;
- mozilla::LayoutDeviceIntPoint mTargetWindowPoint;
- // mTargetWidget and mTargetDragContext are set only while dispatching
- // motion or drop events. mTime records the corresponding timestamp.
- nsCountedRef<GtkWidget> mTargetWidget;
- nsCountedRef<GdkDragContext> mTargetDragContext;
-+#ifdef MOZ_WAYLAND
-+ RefPtr<nsWaylandDragContext> mTargetWaylandDragContext;
-+#endif
- // mTargetDragContextForRemote is set while waiting for a reply from
- // a child process.
- nsCountedRef<GdkDragContext> mTargetDragContextForRemote;
-+#ifdef MOZ_WAYLAND
-+ RefPtr<nsWaylandDragContext> mTargetWaylandDragContextForRemote;
-+#endif
- guint mTargetTime;
-
- // is it OK to drop on us?
- bool mCanDrop;
-
- // have we received our drag data?
- bool mTargetDragDataReceived;
- // last data received and its length
-@@ -207,22 +219,25 @@ private:
- bool SetAlphaPixmap(SourceSurface *aPixbuf,
- GdkDragContext *aContext,
- int32_t aXOffset,
- int32_t aYOffset,
- const mozilla::LayoutDeviceIntRect &dragRect);
-
- gboolean Schedule(DragTask aTask, nsWindow *aWindow,
- GdkDragContext *aDragContext,
-+ nsWaylandDragContext* aPendingWaylandDragContext,
- mozilla::LayoutDeviceIntPoint aWindowPoint, guint aTime);
-
- // Callback for g_idle_add_full() to run mScheduledTask.
- static gboolean TaskDispatchCallback(gpointer data);
- gboolean RunScheduledTask();
- void UpdateDragAction();
- void DispatchMotionEvents();
- void ReplyToDragMotion(GdkDragContext* aDragContext);
-+#ifdef MOZ_WAYLAND
-+ void ReplyToDragMotion(nsWaylandDragContext* aDragContext);
-+#endif
- gboolean DispatchDropEvent();
- static uint32_t GetCurrentModifiers();
- };
-
- #endif // nsDragService_h__
--
-diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
---- a/widget/gtk/nsWindow.cpp
-+++ b/widget/gtk/nsWindow.cpp
-@@ -6081,23 +6081,23 @@ touch_event_cb(GtkWidget* aWidget, GdkEv
- void
- nsWindow::InitDragEvent(WidgetDragEvent &aEvent)
- {
- // set the keyboard modifiers
- guint modifierState = KeymapWrapper::GetCurrentModifierState();
- KeymapWrapper::InitInputEvent(aEvent, modifierState);
- }
-
--static gboolean
--drag_motion_event_cb(GtkWidget *aWidget,
-- GdkDragContext *aDragContext,
-- gint aX,
-- gint aY,
-- guint aTime,
-- gpointer aData)
-+gboolean
-+WindowDragMotionHandler(GtkWidget *aWidget,
-+ GdkDragContext *aDragContext,
-+ nsWaylandDragContext *aWaylandDragContext,
-+ gint aX,
-+ gint aY,
-+ guint aTime)
- {
- RefPtr<nsWindow> window = get_window_for_gtk_widget(aWidget);
- if (!window)
- return FALSE;
-
- // figure out which internal widget this drag motion actually happened on
- nscoord retx = 0;
- nscoord rety = 0;
-@@ -6112,25 +6112,34 @@ drag_motion_event_cb(GtkWidget *aWidget,
- }
-
- LOGDRAG(("nsWindow drag-motion signal for %p\n", (void*)innerMostWindow));
-
- LayoutDeviceIntPoint point = window->GdkPointToDevicePixels({ retx, rety });
-
- RefPtr<nsDragService> dragService = nsDragService::GetInstance();
- return dragService->
-- ScheduleMotionEvent(innerMostWindow, aDragContext,
-+ ScheduleMotionEvent(innerMostWindow, aDragContext, aWaylandDragContext,
- point, aTime);
- }
-
--static void
--drag_leave_event_cb(GtkWidget *aWidget,
-- GdkDragContext *aDragContext,
-- guint aTime,
-- gpointer aData)
-+static gboolean
-+drag_motion_event_cb(GtkWidget *aWidget,
-+ GdkDragContext *aDragContext,
-+ gint aX,
-+ gint aY,
-+ guint aTime,
-+ gpointer aData)
-+{
-+ return WindowDragMotionHandler(aWidget, aDragContext, nullptr,
-+ aX, aY, aTime);
-+}
-+
-+void
-+WindowDragLeaveHandler(GtkWidget *aWidget)
- {
- RefPtr<nsWindow> window = get_window_for_gtk_widget(aWidget);
- if (!window)
- return;
-
- RefPtr<nsDragService> dragService = nsDragService::GetInstance();
-
- nsWindow *mostRecentDragWindow = dragService->GetMostRecentDestWindow();
-@@ -6153,24 +6162,32 @@ drag_leave_event_cb(GtkWidget *aWidget,
- }
-
- LOGDRAG(("nsWindow drag-leave signal for %p\n",
- (void*)mostRecentDragWindow));
-
- dragService->ScheduleLeaveEvent();
- }
-
--
--static gboolean
--drag_drop_event_cb(GtkWidget *aWidget,
-- GdkDragContext *aDragContext,
-- gint aX,
-- gint aY,
-- guint aTime,
-- gpointer aData)
-+static void
-+drag_leave_event_cb(GtkWidget *aWidget,
-+ GdkDragContext *aDragContext,
-+ guint aTime,
-+ gpointer aData)
-+{
-+ WindowDragLeaveHandler(aWidget);
-+}
-+
-+gboolean
-+WindowDragDropHandler(GtkWidget *aWidget,
-+ GdkDragContext *aDragContext,
-+ nsWaylandDragContext *aWaylandDragContext,
-+ gint aX,
-+ gint aY,
-+ guint aTime)
- {
- RefPtr<nsWindow> window = get_window_for_gtk_widget(aWidget);
- if (!window)
- return FALSE;
-
- // figure out which internal widget this drag motion actually happened on
- nscoord retx = 0;
- nscoord rety = 0;
-@@ -6185,20 +6202,31 @@ drag_drop_event_cb(GtkWidget *aWidget,
- }
-
- LOGDRAG(("nsWindow drag-drop signal for %p\n", (void*)innerMostWindow));
-
- LayoutDeviceIntPoint point = window->GdkPointToDevicePixels({ retx, rety });
-
- RefPtr<nsDragService> dragService = nsDragService::GetInstance();
- return dragService->
-- ScheduleDropEvent(innerMostWindow, aDragContext,
-+ ScheduleDropEvent(innerMostWindow, aDragContext, aWaylandDragContext,
- point, aTime);
- }
-
-+static gboolean
-+drag_drop_event_cb(GtkWidget *aWidget,
-+ GdkDragContext *aDragContext,
-+ gint aX,
-+ gint aY,
-+ guint aTime,
-+ gpointer aData)
-+{
-+ return WindowDragDropHandler(aWidget, aDragContext, nullptr, aX, aY, aTime);
-+}
-+
- static void
- drag_data_received_event_cb(GtkWidget *aWidget,
- GdkDragContext *aDragContext,
- gint aX,
- gint aY,
- GtkSelectionData *aSelectionData,
- guint aInfo,
- guint aTime,
-diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
---- a/widget/gtk/nsWindow.h
-+++ b/widget/gtk/nsWindow.h
-@@ -61,16 +61,31 @@ extern mozilla::LazyLogModule gWidgetDra
-
- #define LOG(args)
- #define LOGFOCUS(args)
- #define LOGDRAG(args)
- #define LOGDRAW(args)
-
- #endif /* MOZ_LOGGING */
-
-+#ifdef MOZ_WAYLAND
-+class nsWaylandDragContext;
-+
-+gboolean
-+WindowDragMotionHandler(GtkWidget *aWidget, GdkDragContext *aDragContext,
-+ nsWaylandDragContext *aWaylandDragContext,
-+ gint aX, gint aY, guint aTime);
-+gboolean
-+WindowDragDropHandler(GtkWidget *aWidget, GdkDragContext *aDragContext,
-+ nsWaylandDragContext *aWaylandDragContext, gint aX, gint aY,
-+ guint aTime);
-+void
-+WindowDragLeaveHandler(GtkWidget *aWidget);
-+#endif
-+
- class gfxPattern;
-
- namespace mozilla {
- class TimeStamp;
- class CurrentX11TimeGetter;
- }
-
- class nsWindow final : public nsBaseWidget
-
diff --git a/mozilla-1438136.patch b/mozilla-1438136.patch
deleted file mode 100644
index 6462a41..0000000
--- a/mozilla-1438136.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-
-# HG changeset patch
-# User Evan Klitzke <evan@eklitzke.org>
-# Date 1526337180 -10800
-# Node ID 5c1d015760f220f5438ffa23a585140db7a9801d
-# Parent 505667081ae29ee0a66ef5ba19c3870570b08564
-Bug 1438136 - [Wayland/Clipboard] Null terminate text string returned by GetClipboardText(), r=stransky
-
-diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
---- a/widget/gtk/nsClipboardWayland.cpp
-+++ b/widget/gtk/nsClipboardWayland.cpp
-@@ -666,19 +666,20 @@ void
- nsRetrievalContextWayland::TransferFastTrackClipboard(
- int aClipboardRequestNumber, GtkSelectionData *aSelectionData)
- {
- if (mClipboardRequestNumber == aClipboardRequestNumber) {
- int dataLength = gtk_selection_data_get_length(aSelectionData);
- if (dataLength > 0) {
- mClipboardDataLength = dataLength;
- mClipboardData = reinterpret_cast<char*>(
-- g_malloc(sizeof(char)*mClipboardDataLength));
-+ g_malloc(sizeof(char)*(mClipboardDataLength+1)));
- memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),
- sizeof(char)*mClipboardDataLength);
-+ mClipboardData[mClipboardDataLength] = '\0';
- }
- } else {
- NS_WARNING("Received obsoleted clipboard data!");
- }
- }
-
- const char*
- nsRetrievalContextWayland::GetClipboardData(const char* aMimeType,
-
diff --git a/mozilla-1441743.patch b/mozilla-1441743.patch
deleted file mode 100644
index 59018c7..0000000
--- a/mozilla-1441743.patch
+++ /dev/null
@@ -1,336 +0,0 @@
-diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h
---- a/widget/gtk/WindowSurfaceWayland.h
-+++ b/widget/gtk/WindowSurfaceWayland.h
-@@ -3,16 +3,17 @@
- * 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/. */
-
- #ifndef _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_WAYLAND_H
- #define _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_WAYLAND_H
-
- #include <prthread.h>
-+#include "mozilla/gfx/Types.h"
-
- namespace mozilla {
- namespace widget {
-
- // Our general connection to Wayland display server,
- // holds our display connection and runs event loop.
- class nsWaylandDisplay : public nsISupports {
- NS_DECL_THREADSAFE_ISUPPORTS
-@@ -61,17 +62,17 @@ private:
- };
-
- // Holds actual graphics data for wl_surface
- class WindowBackBuffer {
- public:
- WindowBackBuffer(nsWaylandDisplay* aDisplay, int aWidth, int aHeight);
- ~WindowBackBuffer();
-
-- already_AddRefed<gfx::DrawTarget> Lock(const LayoutDeviceIntRegion& aRegion);
-+ already_AddRefed<gfx::DrawTarget> Lock();
-
- void Attach(wl_surface* aSurface);
- void Detach();
- bool IsAttached() { return mAttached; }
-
- bool Resize(int aWidth, int aHeight);
- bool SetImageDataFromBackBuffer(class WindowBackBuffer* aSourceBuffer);
-
-@@ -107,27 +108,33 @@ public:
- WindowSurfaceWayland(nsWindow *aWindow);
- ~WindowSurfaceWayland();
-
- already_AddRefed<gfx::DrawTarget> Lock(const LayoutDeviceIntRegion& aRegion) override;
- void Commit(const LayoutDeviceIntRegion& aInvalidRegion) final;
- void FrameCallbackHandler();
-
- private:
-- WindowBackBuffer* GetBufferToDraw(int aWidth, int aHeight);
-+ WindowBackBuffer* GetFrontBufferToDraw(int aWidth, int aHeight);
- void UpdateScaleFactor();
-
-+ already_AddRefed<gfx::DrawTarget> LockFrontBuffer(int aWidth, int aHeight);
-+ already_AddRefed<gfx::DrawTarget> LockImageSurface(const gfx::IntSize& aLockSize);
-+ bool CommitImageSurface(const LayoutDeviceIntRegion& aRegion);
-+
- // TODO: Do we need to hold a reference to nsWindow object?
- nsWindow* mWindow;
- nsWaylandDisplay* mWaylandDisplay;
- WindowBackBuffer* mFrontBuffer;
- WindowBackBuffer* mBackBuffer;
-+ RefPtr<gfxImageSurface> mImageSurface;
- wl_callback* mFrameCallback;
- wl_surface* mFrameCallbackSurface;
- MessageLoop* mDisplayThreadMessageLoop;
-+ bool mDirectWlBufferDraw;
- bool mDelayedCommit;
- bool mFullScreenDamage;
- bool mIsMainThread;
- };
-
- } // namespace widget
- } // namespace mozilla
-
-
-diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp
---- a/widget/gtk/WindowSurfaceWayland.cpp
-+++ b/widget/gtk/WindowSurfaceWayland.cpp
-@@ -299,16 +299,17 @@ nsWaylandDisplay::Matches(wl_display *aD
- }
-
- NS_IMPL_ISUPPORTS(nsWaylandDisplay, nsISupports);
-
- nsWaylandDisplay::nsWaylandDisplay(wl_display *aDisplay)
- : mThreadId(PR_GetCurrentThread())
- // gfx::SurfaceFormat::B8G8R8A8 is a basic Wayland format
- // and is always present.
-+ // TODO: Provide also format without alpha (Bug 1470126).
- , mFormat(gfx::SurfaceFormat::B8G8R8A8)
- , mShm(nullptr)
- , mDisplay(aDisplay)
- {
- if (NS_IsMainThread()) {
- // Use default event queue in main thread operated by Gtk+.
- mEventQueue = nullptr;
- } else {
-@@ -530,21 +531,19 @@ WindowBackBuffer::SetImageDataFromBackBu
- }
-
- mShmPool.SetImageDataFromPool(&aSourceBuffer->mShmPool,
- aSourceBuffer->mWidth * aSourceBuffer->mHeight * BUFFER_BPP);
- return true;
- }
-
- already_AddRefed<gfx::DrawTarget>
--WindowBackBuffer::Lock(const LayoutDeviceIntRegion& aRegion)
-+WindowBackBuffer::Lock()
- {
-- gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect();
-- gfx::IntSize lockSize(bounds.XMost(), bounds.YMost());
--
-+ gfx::IntSize lockSize(mWidth, mHeight);
- return gfxPlatform::CreateDrawTargetForData(static_cast<unsigned char*>(mShmPool.GetImageData()),
- lockSize,
- BUFFER_BPP * mWidth,
- mWaylandDisplay->GetSurfaceFormat());
- }
-
- static void
- frame_callback_handler(void *data, struct wl_callback *callback, uint32_t time)
-@@ -560,16 +559,17 @@ static const struct wl_callback_listener
- WindowSurfaceWayland::WindowSurfaceWayland(nsWindow *aWindow)
- : mWindow(aWindow)
- , mWaylandDisplay(WaylandDisplayGet(aWindow->GetWaylandDisplay()))
- , mFrontBuffer(nullptr)
- , mBackBuffer(nullptr)
- , mFrameCallback(nullptr)
- , mFrameCallbackSurface(nullptr)
- , mDisplayThreadMessageLoop(MessageLoop::current())
-+ , mDirectWlBufferDraw(true)
- , mDelayedCommit(false)
- , mFullScreenDamage(false)
- , mIsMainThread(NS_IsMainThread())
- {
- }
-
- WindowSurfaceWayland::~WindowSurfaceWayland()
- {
-@@ -598,17 +598,17 @@ WindowSurfaceWayland::UpdateScaleFactor(
- {
- wl_surface* waylandSurface = mWindow->GetWaylandSurface();
- if (waylandSurface) {
- wl_surface_set_buffer_scale(waylandSurface, mWindow->GdkScaleFactor());
- }
- }
-
- WindowBackBuffer*
--WindowSurfaceWayland::GetBufferToDraw(int aWidth, int aHeight)
-+WindowSurfaceWayland::GetFrontBufferToDraw(int aWidth, int aHeight)
- {
- if (!mFrontBuffer) {
- mFrontBuffer = new WindowBackBuffer(mWaylandDisplay, aWidth, aHeight);
- mBackBuffer = new WindowBackBuffer(mWaylandDisplay, aWidth, aHeight);
- return mFrontBuffer;
- }
-
- if (!mFrontBuffer->IsAttached()) {
-@@ -647,46 +647,149 @@ WindowSurfaceWayland::GetBufferToDraw(in
- // the new buffer and leave gecko to render new whole content.
- mFrontBuffer->Resize(aWidth, aHeight);
- }
-
- return mFrontBuffer;
- }
-
- already_AddRefed<gfx::DrawTarget>
-+WindowSurfaceWayland::LockFrontBuffer(int aWidth, int aHeight)
-+{
-+ WindowBackBuffer* buffer = GetFrontBufferToDraw(aWidth, aHeight);
-+ if (buffer) {
-+ return buffer->Lock();
-+ }
-+
-+ NS_WARNING("WindowSurfaceWayland::LockFrontBuffer(): No buffer available");
-+ return nullptr;
-+}
-+
-+already_AddRefed<gfx::DrawTarget>
-+WindowSurfaceWayland::LockImageSurface(const gfx::IntSize& aLockSize)
-+{
-+ if (!mImageSurface || mImageSurface->CairoStatus() ||
-+ !(aLockSize <= mImageSurface->GetSize())) {
-+ mImageSurface = new gfxImageSurface(aLockSize,
-+ SurfaceFormatToImageFormat(mWaylandDisplay->GetSurfaceFormat()));
-+ if (mImageSurface->CairoStatus()) {
-+ return nullptr;
-+ }
-+ }
-+
-+ return gfxPlatform::CreateDrawTargetForData(mImageSurface->Data(),
-+ mImageSurface->GetSize(),
-+ mImageSurface->Stride(),
-+ mWaylandDisplay->GetSurfaceFormat());
-+}
-+
-+/*
-+ There are some situations which can happen here:
-+
-+ A) Lock() is called to whole surface. In that case we don't need
-+ to clip/buffer the drawing and we can return wl_buffer directly
-+ for drawing.
-+ - mFrontBuffer is available - that's an ideal situation.
-+ - mFrontBuffer is locked by compositor - flip buffers and draw.
-+ - if we can't flip buffers - go B)
-+
-+ B) Lock() is requested for part(s) of screen. We need to provide temporary
-+ surface to draw into and copy result (clipped) to target wl_surface.
-+ */
-+already_AddRefed<gfx::DrawTarget>
- WindowSurfaceWayland::Lock(const LayoutDeviceIntRegion& aRegion)
- {
- MOZ_ASSERT(mIsMainThread == NS_IsMainThread());
-
-- // We allocate back buffer to widget size but return only
-- // portion requested by aRegion.
-- LayoutDeviceIntRect rect = mWindow->GetBounds();
-- WindowBackBuffer* buffer = GetBufferToDraw(rect.width,
-- rect.height);
-- if (!buffer) {
-- NS_WARNING("No drawing buffer available");
-- return nullptr;
-+ LayoutDeviceIntRect screenRect = mWindow->GetBounds();
-+ gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect();
-+ gfx::IntSize lockSize(bounds.XMost(), bounds.YMost());
-+
-+ // Are we asked for entire nsWindow to draw?
-+ mDirectWlBufferDraw = (aRegion.GetNumRects() == 1 &&
-+ bounds.x == 0 && bounds.y == 0 &&
-+ lockSize.width == screenRect.width &&
-+ lockSize.height == screenRect.height);
-+
-+ if (mDirectWlBufferDraw) {
-+ RefPtr<gfx::DrawTarget> dt = LockFrontBuffer(screenRect.width,
-+ screenRect.height);
-+ if (dt) {
-+ return dt.forget();
-+ }
-+
-+ // We don't have any front buffer available. Try indirect drawing
-+ // to mImageSurface which is mirrored to front buffer at commit.
-+ mDirectWlBufferDraw = false;
- }
-
-- return buffer->Lock(aRegion);
-+ return LockImageSurface(lockSize);
-+}
-+
-+bool
-+WindowSurfaceWayland::CommitImageSurface(const LayoutDeviceIntRegion& aRegion)
-+{
-+ MOZ_ASSERT(!mDirectWlBufferDraw);
-+
-+ LayoutDeviceIntRect screenRect = mWindow->GetBounds();
-+ gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect();
-+
-+ gfx::Rect rect(bounds);
-+ if (rect.IsEmpty()) {
-+ return false;
-+ }
-+
-+ RefPtr<gfx::DrawTarget> dt = LockFrontBuffer(screenRect.width,
-+ screenRect.height);
-+ RefPtr<gfx::SourceSurface> surf =
-+ gfx::Factory::CreateSourceSurfaceForCairoSurface(mImageSurface->CairoSurface(),
-+ mImageSurface->GetSize(),
-+ mImageSurface->Format());
-+ if (!dt || !surf) {
-+ return false;
-+ }
-+
-+ uint32_t numRects = aRegion.GetNumRects();
-+ if (numRects != 1) {
-+ AutoTArray<IntRect, 32> rects;
-+ rects.SetCapacity(numRects);
-+ for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
-+ rects.AppendElement(iter.Get().ToUnknownRect());
-+ }
-+ dt->PushDeviceSpaceClipRects(rects.Elements(), rects.Length());
-+ }
-+
-+ dt->DrawSurface(surf, rect, rect);
-+
-+ if (numRects != 1) {
-+ dt->PopClip();
-+ }
-+
-+ return true;
- }
-
- void
- WindowSurfaceWayland::Commit(const LayoutDeviceIntRegion& aInvalidRegion)
- {
- MOZ_ASSERT(mIsMainThread == NS_IsMainThread());
-
- wl_surface* waylandSurface = mWindow->GetWaylandSurface();
- if (!waylandSurface) {
- // Target window is already destroyed - don't bother to render there.
-+ NS_WARNING("WindowSurfaceWayland::Commit(): parent wl_surface is already hidden/deleted.");
- return;
- }
- wl_proxy_set_queue((struct wl_proxy *)waylandSurface,
- mWaylandDisplay->GetEventQueue());
-
-+ if (!mDirectWlBufferDraw) {
-+ // We have new content at mImageSurface - copy data to mFrontBuffer first.
-+ CommitImageSurface(aInvalidRegion);
-+ }
-+
- if (mFullScreenDamage) {
- LayoutDeviceIntRect rect = mWindow->GetBounds();
- wl_surface_damage(waylandSurface, 0, 0, rect.width, rect.height);
- mFullScreenDamage = false;
- } else {
- for (auto iter = aInvalidRegion.RectIter(); !iter.Done(); iter.Next()) {
- const mozilla::LayoutDeviceIntRect &r = iter.Get();
- wl_surface_damage(waylandSurface, r.x, r.y, r.width, r.height);
-@@ -730,17 +833,17 @@ WindowSurfaceWayland::FrameCallbackHandl
- mFrameCallback = nullptr;
- mFrameCallbackSurface = nullptr;
- }
-
- if (mDelayedCommit) {
- wl_surface* waylandSurface = mWindow->GetWaylandSurface();
- if (!waylandSurface) {
- // Target window is already destroyed - don't bother to render there.
-- NS_WARNING("No drawing buffer available");
-+ NS_WARNING("WindowSurfaceWayland::FrameCallbackHandler(): parent wl_surface is already hidden/deleted.");
- return;
- }
- wl_proxy_set_queue((struct wl_proxy *)waylandSurface,
- mWaylandDisplay->GetEventQueue());
-
- // Send pending surface to compositor and register frame callback
- // for possible subsequent drawing.
- mFrameCallback = wl_surface_frame(waylandSurface);
diff --git a/mozilla-1460603.patch b/mozilla-1460603.patch
deleted file mode 100644
index 62d13a5..0000000
--- a/mozilla-1460603.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff -up firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp.mozilla-1460603 firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp
---- firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp.mozilla-1460603 2018-05-16 07:38:30.000000000 +0200
-+++ firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp 2018-05-25 10:58:45.170047851 +0200
-@@ -31,6 +31,13 @@
- #include "GLContextProvider.h"
- #include "gfxPrefs.h"
- #include "ScopedGLHelpers.h"
-+#ifdef MOZ_WIDGET_GTK
-+#include <gdk/gdk.h>
-+#ifdef MOZ_WAYLAND
-+#include <gdk/gdkwayland.h>
-+#include <dlfcn.h>
-+#endif // MOZ_WIDGET_GTK
-+#endif // MOZ_WAYLAND
-
- namespace mozilla {
- namespace gl {
-@@ -566,7 +573,22 @@ GLLibraryEGL::EnsureInitialized(bool for
- mIsWARP = true;
- }
- } else {
-- chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);
-+ void *nativeDisplay = EGL_DEFAULT_DISPLAY;
-+#ifdef MOZ_WAYLAND
-+ // Some drivers doesn't support EGL_DEFAULT_DISPLAY
-+ GdkDisplay *gdkDisplay = gdk_display_get_default();
-+ if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) {
-+ static auto sGdkWaylandDisplayGetWlDisplay =
-+ (wl_display *(*)(GdkDisplay *))
-+ dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
-+ nativeDisplay = sGdkWaylandDisplayGetWlDisplay(gdkDisplay);
-+ if (!nativeDisplay) {
-+ NS_WARNING("Failed to get wl_display.");
-+ return nullptr;
-+ }
-+ }
-+#endif
-+ chosenDisplay = GetAndInitDisplay(*this, nativeDisplay);
- }
-
- if (!chosenDisplay) {
-@@ -872,4 +894,3 @@ AfterEGLCall(const char* glFunction)
-
- } /* namespace gl */
- } /* namespace mozilla */
--
diff --git a/mozilla-1460605-1.patch b/mozilla-1460605-1.patch
deleted file mode 100644
index 70806bf..0000000
--- a/mozilla-1460605-1.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-
-# HG changeset patch
-# User Martin Stransky <stransky@redhat.com>
-# Date 1525961643 -7200
-# Node ID c085f9360dfa4d0fc3d04d6db40d37e1369616b3
-# Parent acaaa40ebdf142fda38d5661f7631f029a2406c6
-Bug 1460605 - Use NS_NATIVE_EGL_WINDOW instead of NS_NATIVE_WINDOW on GTK r=lsalzman
-
-Original patch author is Takuro Ashie <ashie@clear-code.com>
-
-NS_NATIVE_EGL_WINDOW is exported by Gtk toolkit code and provides both X11 window
-handle for X11 Gtk backend and EGL window handle for Wayland backend.
-
-MozReview-Commit-ID: DEmlaLL7zGY
-
-diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
---- a/gfx/gl/GLContextProviderEGL.cpp
-+++ b/gfx/gl/GLContextProviderEGL.cpp
-@@ -1,18 +1,16 @@
- /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /* 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/. */
-
- #if defined(MOZ_WIDGET_GTK)
-- #include <gdk/gdkx.h>
-- // we're using default display for now
-- #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) ((EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->GetNativeData(NS_NATIVE_WINDOW)))
-- #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) ((EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->RealWidget()->GetNativeData(NS_NATIVE_WINDOW)))
-+ #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_EGL_WINDOW))
-+ #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) ((EGLNativeWindowType)aWidget->RealWidget()->GetNativeData(NS_NATIVE_EGL_WINDOW))
- #elif defined(MOZ_WIDGET_ANDROID)
- #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_JAVA_SURFACE))
- #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) (aWidget->AsAndroid()->GetEGLNativeWindow())
- #elif defined(XP_WIN)
- #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
- #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) ((EGLNativeWindowType)aWidget->AsWindows()->GetHwnd())
- #else
- #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
-
diff --git a/mozilla-1460605-2.patch b/mozilla-1460605-2.patch
deleted file mode 100644
index 157e2fd..0000000
--- a/mozilla-1460605-2.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-
-# HG changeset patch
-# User Martin Stransky <stransky@redhat.com>
-# Date 1525961060 -7200
-# Node ID acaaa40ebdf142fda38d5661f7631f029a2406c6
-# Parent 5543294befe9494593370f33c40ba50c8239e0c6
-Bug 1460605 - Provide NS_NATIVE_EGL_WINDOW to get a native EGL window on Wayland, r=jhorak
-
-Original patch author is Takuro Ashie <ashie@clear-code.com>
-
-Provide ability to create native EGL window and provide it under NS_NATIVE_EGL_WINDOW
-to GL code. The native EGL window is owned/managed by mozcontainer.
-
-MozReview-Commit-ID: 4d0Kk6DRSaD
-
-diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
---- a/config/system-headers.mozbuild
-+++ b/config/system-headers.mozbuild
-@@ -1334,8 +1334,14 @@ if CONFIG['MOZ_SYSTEM_ICU']:
- 'unicode/unistr.h',
- 'unicode/unorm.h',
- 'unicode/unum.h',
- 'unicode/upluralrules.h',
- 'unicode/ureldatefmt.h',
- 'unicode/ustring.h',
- 'unicode/utypes.h',
- ]
-+
-+if CONFIG['MOZ_WAYLAND']:
-+ system_headers += [
-+ 'wayland-client.h',
-+ 'wayland-egl.h',
-+ ]
-diff --git a/widget/gtk/mozcontainer.cpp b/widget/gtk/mozcontainer.cpp
---- a/widget/gtk/mozcontainer.cpp
-+++ b/widget/gtk/mozcontainer.cpp
-@@ -5,16 +5,17 @@
- * 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 "mozcontainer.h"
- #include <gtk/gtk.h>
- #ifdef MOZ_WAYLAND
- #include <gdk/gdkx.h>
- #include <gdk/gdkwayland.h>
-+#include <wayland-egl.h>
- #endif
- #include <stdio.h>
- #include <dlfcn.h>
-
- #ifdef ACCESSIBILITY
- #include <atk/atk.h>
- #include "maiRedundantObjectFactory.h"
- #endif
-@@ -202,16 +203,21 @@ void
- moz_container_init (MozContainer *container)
- {
- gtk_widget_set_can_focus(GTK_WIDGET(container), TRUE);
- gtk_container_set_resize_mode(GTK_CONTAINER(container), GTK_RESIZE_IMMEDIATE);
- gtk_widget_set_redraw_on_allocate(GTK_WIDGET(container), FALSE);
-
- #if defined(MOZ_WAYLAND)
- {
-+ container->subcompositor = nullptr;
-+ container->surface = nullptr;
-+ container->subsurface = nullptr;
-+ container->eglwindow = nullptr;
-+
- GdkDisplay *gdk_display = gtk_widget_get_display(GTK_WIDGET(container));
- if (GDK_IS_WAYLAND_DISPLAY (gdk_display)) {
- // Available as of GTK 3.8+
- static auto sGdkWaylandDisplayGetWlDisplay =
- (wl_display *(*)(GdkDisplay *))
- dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
-
- wl_display* display = sGdkWaylandDisplayGetWlDisplay(gdk_display);
-@@ -284,16 +290,17 @@ moz_container_map_surface(MozContainer *
- wl_region_destroy(region);
- }
- return true;
- }
-
- static void
- moz_container_unmap_surface(MozContainer *container)
- {
-+ g_clear_pointer(&container->eglwindow, wl_egl_window_destroy);
- g_clear_pointer(&container->subsurface, wl_subsurface_destroy);
- g_clear_pointer(&container->surface, wl_surface_destroy);
- }
-
- #endif
-
- void
- moz_container_map (GtkWidget *widget)
-@@ -429,16 +436,21 @@ moz_container_size_allocate (GtkWidget
- // We need to position our subsurface according to GdkWindow
- // when offset changes (GdkWindow is maximized for instance).
- // see gtk-clutter-embed.c for reference.
- if (container->subsurface) {
- gint x, y;
- gdk_window_get_position(gtk_widget_get_window(widget), &x, &y);
- wl_subsurface_set_position(container->subsurface, x, y);
- }
-+ if (container->eglwindow) {
-+ wl_egl_window_resize(container->eglwindow,
-+ allocation->width, allocation->height,
-+ 0, 0);
-+ }
- #endif
- }
-
- void
- moz_container_remove (GtkContainer *container, GtkWidget *child_widget)
- {
- MozContainerChild *child;
- MozContainer *moz_container;
-@@ -554,9 +566,32 @@ moz_container_get_wl_surface(MozContaine
- if (!gdk_window_is_visible(window))
- return nullptr;
-
- moz_container_map_surface(container);
- }
-
- return container->surface;
- }
-+
-+struct wl_egl_window *
-+moz_container_get_wl_egl_window(MozContainer *container)
-+{
-+ if (!container->eglwindow) {
-+ struct wl_surface *wlsurf = moz_container_get_wl_surface(container);
-+ if (!wlsurf)
-+ return nullptr;
-+
-+ GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(container));
-+ container->eglwindow
-+ = wl_egl_window_create(wlsurf,
-+ gdk_window_get_width(window),
-+ gdk_window_get_height(window));
-+ }
-+ return container->eglwindow;
-+}
-+
-+gboolean
-+moz_container_has_wl_egl_window(MozContainer *container)
-+{
-+ return container->eglwindow ? true : false;
-+}
- #endif
-diff --git a/widget/gtk/mozcontainer.h b/widget/gtk/mozcontainer.h
---- a/widget/gtk/mozcontainer.h
-+++ b/widget/gtk/mozcontainer.h
-@@ -67,16 +67,17 @@ struct _MozContainer
- {
- GtkContainer container;
- GList *children;
-
- #ifdef MOZ_WAYLAND
- struct wl_subcompositor *subcompositor;
- struct wl_surface *surface;
- struct wl_subsurface *subsurface;
-+ struct wl_egl_window *eglwindow;
- #endif
- };
-
- struct _MozContainerClass
- {
- GtkContainerClass parent_class;
- };
-
-@@ -90,11 +91,13 @@ void moz_container_move (
- GtkWidget *child_widget,
- gint x,
- gint y,
- gint width,
- gint height);
-
- #ifdef MOZ_WAYLAND
- struct wl_surface* moz_container_get_wl_surface(MozContainer *container);
-+struct wl_egl_window* moz_container_get_wl_egl_window(MozContainer *container);
-+gboolean moz_container_has_wl_egl_window(MozContainer *container);
- #endif
-
- #endif /* __MOZ_CONTAINER_H__ */
-diff --git a/widget/gtk/mozwayland/mozwayland.c b/widget/gtk/mozwayland/mozwayland.c
---- a/widget/gtk/mozwayland/mozwayland.c
-+++ b/widget/gtk/mozwayland/mozwayland.c
-@@ -266,8 +266,26 @@ wl_display_read_events(struct wl_display
- return -1;
- }
-
- MOZ_EXPORT void
- wl_log_set_handler_client(wl_log_func_t handler)
- {
- }
-
-+MOZ_EXPORT struct wl_egl_window *
-+wl_egl_window_create(struct wl_surface *surface,
-+ int width, int height)
-+{
-+ return NULL;
-+}
-+
-+MOZ_EXPORT void
-+wl_egl_window_destroy(struct wl_egl_window *egl_window)
-+{
-+}
-+
-+MOZ_EXPORT void
-+wl_egl_window_resize(struct wl_egl_window *egl_window,
-+ int width, int height,
-+ int dx, int dy)
-+{
-+}
-diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
---- a/widget/gtk/nsWindow.cpp
-+++ b/widget/gtk/nsWindow.cpp
-@@ -1734,16 +1734,25 @@ nsWindow::GetNativeData(uint32_t aDataTy
- return mIMContext.get();
- }
- case NS_NATIVE_OPENGL_CONTEXT:
- return nullptr;
- #ifdef MOZ_X11
- case NS_NATIVE_COMPOSITOR_DISPLAY:
- return gfxPlatformGtk::GetPlatform()->GetCompositorDisplay();
- #endif // MOZ_X11
-+ case NS_NATIVE_EGL_WINDOW: {
-+ if (mIsX11Display)
-+ return mGdkWindow ? (void*)GDK_WINDOW_XID(mGdkWindow) : nullptr;
-+#ifdef MOZ_WAYLAND
-+ if (mContainer)
-+ return moz_container_get_wl_egl_window(mContainer);
-+#endif
-+ return nullptr;
-+ }
- default:
- NS_WARNING("nsWindow::GetNativeData called with bad value");
- return nullptr;
- }
- }
-
- nsresult
- nsWindow::SetTitle(const nsAString& aTitle)
-@@ -4303,16 +4312,26 @@ nsWindow::NativeShow(bool aAction)
- else if (mContainer) {
- gtk_widget_show(GTK_WIDGET(mContainer));
- }
- else if (mGdkWindow) {
- gdk_window_show_unraised(mGdkWindow);
- }
- }
- else {
-+#ifdef MOZ_WAYLAND
-+ if (mContainer && moz_container_has_wl_egl_window(mContainer)) {
-+ // Because wl_egl_window is destroyed on moz_container_unmap(),
-+ // the current compositor cannot use it anymore. To avoid crash,
-+ // destroy the compositor & recreate a new compositor on next
-+ // expose event.
-+ DestroyLayerManager();
-+ }
-+#endif
-+
- if (mIsTopLevel) {
- // Workaround window freezes on GTK versions before 3.21.2 by
- // ensuring that configure events get dispatched to windows before
- // they are unmapped. See bug 1225044.
- if (gtk_check_version(3, 21, 2) != nullptr && mPendingConfigures > 0) {
- GtkAllocation allocation;
- gtk_widget_get_allocation(GTK_WIDGET(mShell), &allocation);
-
-diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h
---- a/widget/nsIWidget.h
-+++ b/widget/nsIWidget.h
-@@ -138,16 +138,17 @@ typedef void* nsNativeWidget;
- #define NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW 105
- #endif
- #if defined(MOZ_WIDGET_GTK)
- // set/get nsPluginNativeWindowGtk, e10s specific
- #define NS_NATIVE_PLUGIN_OBJECT_PTR 104
- #ifdef MOZ_X11
- #define NS_NATIVE_COMPOSITOR_DISPLAY 105
- #endif // MOZ_X11
-+#define NS_NATIVE_EGL_WINDOW 106
- #endif
- #ifdef MOZ_WIDGET_ANDROID
- #define NS_JAVA_SURFACE 100
- #define NS_PRESENTATION_WINDOW 101
- #define NS_PRESENTATION_SURFACE 102
- #endif
-
- // Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
-
diff --git a/mozilla-1460810.patch b/mozilla-1460810.patch
deleted file mode 100644
index 016f75f..0000000
--- a/mozilla-1460810.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-# HG changeset patch
-# User Evan Klitzke <evan@eklitzke.org>
-# Parent c5e0ee17388381f96d0acf4bdd9d163827719096
-Bug 1460810 - [Gtk/Wayland] Handle error value (-1) returned by gtk_section_data_get_length(), r=stransky
-
-diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
---- a/widget/gtk/nsClipboardWayland.cpp
-+++ b/widget/gtk/nsClipboardWayland.cpp
-@@ -662,18 +662,19 @@ wayland_clipboard_contents_received(GtkC
- delete fastTrack;
- }
-
- void
- nsRetrievalContextWayland::TransferFastTrackClipboard(
- int aClipboardRequestNumber, GtkSelectionData *aSelectionData)
- {
- if (mClipboardRequestNumber == aClipboardRequestNumber) {
-- mClipboardDataLength = gtk_selection_data_get_length(aSelectionData);
-- if (mClipboardDataLength > 0) {
-+ int dataLength = gtk_selection_data_get_length(aSelectionData);
-+ if (dataLength > 0) {
-+ mClipboardDataLength = dataLength;
- mClipboardData = reinterpret_cast<char*>(
- g_malloc(sizeof(char)*mClipboardDataLength));
- memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),
- sizeof(char)*mClipboardDataLength);
- }
- } else {
- NS_WARNING("Received obsoleted clipboard data!");
- }
diff --git a/mozilla-1461306.patch b/mozilla-1461306.patch
deleted file mode 100644
index 84ee6c6..0000000
--- a/mozilla-1461306.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-
-# HG changeset patch
-# User Martin Stransky <stransky@redhat.com>
-# Date 1526299286 -7200
-# Node ID 6495ae9d01e06109539413c538fd25ed942f6eb8
-# Parent 67553a1262de53d0ec85fdfcf1a2b55631eaca44
-Bug 1461306 - [Wayland] Don't use sizeof() to get mime type array size, r=jhorak
-
-MozReview-Commit-ID: GE5helkqoUt
-
-diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
---- a/widget/gtk/nsClipboardWayland.cpp
-+++ b/widget/gtk/nsClipboardWayland.cpp
-@@ -723,17 +723,17 @@ const char*
- nsRetrievalContextWayland::GetClipboardText(int32_t aWhichClipboard)
- {
- GdkAtom selection = GetSelectionAtom(aWhichClipboard);
- DataOffer* dataOffer = (selection == GDK_SELECTION_PRIMARY) ?
- mPrimaryOffer : mClipboardOffer;
- if (!dataOffer)
- return nullptr;
-
-- for (unsigned int i = 0; i < sizeof(sTextMimeTypes); i++) {
-+ for (unsigned int i = 0; i < TEXT_MIME_TYPES_NUM; i++) {
- if (dataOffer->HasTarget(sTextMimeTypes[i])) {
- uint32_t unused;
- return GetClipboardData(sTextMimeTypes[i], aWhichClipboard,
- &unused);
- }
- }
- return nullptr;
- }
-
diff --git a/mozilla-1462622.patch b/mozilla-1462622.patch
deleted file mode 100644
index a1903dc..0000000
--- a/mozilla-1462622.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-
-# HG changeset patch
-# User Martin Stransky <stransky@redhat.com>
-# Date 1526647470 -7200
-# Node ID d41fee41e38400fab5da0689c1f49e30f80e2d1b
-# Parent d2b91476bebc48f9e89f9d3e6c7b33decb2ae941
-Bug 1462622 - [Gtk/Linux] Don't use GLXVsyncSource() on non-X11 displays, r=lsalzman
-
-MozReview-Commit-ID: BBtnNLWqSiq
-
-diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
---- a/gfx/thebes/gfxPlatformGtk.cpp
-+++ b/gfx/thebes/gfxPlatformGtk.cpp
-@@ -736,18 +736,20 @@ private:
- };
-
- already_AddRefed<gfx::VsyncSource>
- gfxPlatformGtk::CreateHardwareVsyncSource()
- {
- // Only use GLX vsync when the OpenGL compositor is being used.
- // The extra cost of initializing a GLX context while blocking the main
- // thread is not worth it when using basic composition.
-+ // Also don't use it on non-X11 displays.
- if (gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) {
-- if (gl::sGLXLibrary.SupportsVideoSync()) {
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
-+ gl::sGLXLibrary.SupportsVideoSync()) {
- RefPtr<VsyncSource> vsyncSource = new GLXVsyncSource();
- VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
- if (!static_cast<GLXVsyncSource::GLXDisplay&>(display).Setup()) {
- NS_WARNING("Failed to setup GLContext, falling back to software vsync.");
- return gfxPlatform::CreateHardwareVsyncSource();
- }
- return vsyncSource.forget();
- }
-
diff --git a/mozilla-1462642.patch b/mozilla-1462642.patch
deleted file mode 100644
index 9bd6ab8..0000000
--- a/mozilla-1462642.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-diff -up firefox-60.0.1/gfx/gl/GLContextEGL.h.mozilla-1462642 firefox-60.0.1/gfx/gl/GLContextEGL.h
---- firefox-60.0.1/gfx/gl/GLContextEGL.h.mozilla-1462642 2018-05-16 07:38:29.000000000 +0200
-+++ firefox-60.0.1/gfx/gl/GLContextEGL.h 2018-05-25 10:54:09.271902218 +0200
-@@ -133,6 +133,10 @@ protected:
- static EGLSurface CreatePBufferSurfaceTryingPowerOfTwo(EGLConfig config,
- EGLenum bindToTextureFormat,
- gfx::IntSize& pbsize);
-+#if defined(MOZ_WAYLAND)
-+ static EGLSurface CreateWaylandBufferSurface(EGLConfig config,
-+ gfx::IntSize& pbsize);
-+#endif
- #if defined(MOZ_WIDGET_ANDROID)
- public:
- EGLSurface CreateCompatibleSurface(void* aWindow);
-diff -up firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp.mozilla-1462642 firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp
---- firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp.mozilla-1462642 2018-05-25 10:54:09.258902265 +0200
-+++ firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp 2018-05-25 10:55:57.634553279 +0200
-@@ -63,6 +63,17 @@
- #include "ScopedGLHelpers.h"
- #include "TextureImageEGL.h"
-
-+#if defined(MOZ_WAYLAND)
-+#include "nsAutoPtr.h"
-+#include "nsDataHashtable.h"
-+
-+#include <gtk/gtk.h>
-+#include <gdk/gdkx.h>
-+#include <gdk/gdkwayland.h>
-+#include <wayland-egl.h>
-+#include <dlfcn.h>
-+#endif
-+
- using namespace mozilla::gfx;
-
- namespace mozilla {
-@@ -70,6 +81,35 @@ namespace gl {
-
- using namespace mozilla::widget;
-
-+#if defined(MOZ_WAYLAND)
-+class WaylandGLSurface {
-+public:
-+ WaylandGLSurface(struct wl_surface *aWaylandSurface,
-+ struct wl_egl_window *aEGLWindow);
-+ ~WaylandGLSurface();
-+private:
-+ struct wl_surface *mWaylandSurface;
-+ struct wl_egl_window *mEGLWindow;
-+};
-+
-+static nsDataHashtable<nsPtrHashKey<void>, WaylandGLSurface*>
-+ sWaylandGLSurface;
-+
-+void
-+DeleteWaylandGLSurface(EGLSurface surface)
-+{
-+ // We're running on Wayland which means our EGLSurface may
-+ // have attached Wayland backend data which must be released.
-+ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
-+ auto entry = sWaylandGLSurface.Lookup(surface);
-+ if (entry) {
-+ delete entry.Data();
-+ entry.Remove();
-+ }
-+ }
-+}
-+#endif
-+
- #define ADD_ATTR_2(_array, _k, _v) do { \
- (_array).AppendElement(_k); \
- (_array).AppendElement(_v); \
-@@ -125,6 +165,9 @@ DestroySurface(EGLSurface oldSurface) {
- EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
- sEGLLibrary.fDestroySurface(EGL_DISPLAY(), oldSurface);
-+#if defined(MOZ_WAYLAND)
-+ DeleteWaylandGLSurface(oldSurface);
-+#endif
- }
- }
-
-@@ -588,6 +631,52 @@ TRY_AGAIN_POWER_OF_TWO:
- return surface;
- }
-
-+#if defined(MOZ_WAYLAND)
-+WaylandGLSurface::WaylandGLSurface(struct wl_surface *aWaylandSurface,
-+ struct wl_egl_window *aEGLWindow)
-+ : mWaylandSurface(aWaylandSurface)
-+ , mEGLWindow(aEGLWindow)
-+{
-+}
-+
-+WaylandGLSurface::~WaylandGLSurface()
-+{
-+ wl_egl_window_destroy(mEGLWindow);
-+ wl_surface_destroy(mWaylandSurface);
-+}
-+
-+EGLSurface
-+GLContextEGL::CreateWaylandBufferSurface(EGLConfig config,
-+ mozilla::gfx::IntSize& pbsize)
-+{
-+ // Available as of GTK 3.8+
-+ static auto sGdkWaylandDisplayGetWlCompositor =
-+ (wl_compositor *(*)(GdkDisplay *))
-+ dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_compositor");
-+
-+ if (!sGdkWaylandDisplayGetWlCompositor)
-+ return nullptr;
-+
-+ struct wl_compositor *compositor =
-+ sGdkWaylandDisplayGetWlCompositor(gdk_display_get_default());
-+ struct wl_surface *wlsurface = wl_compositor_create_surface(compositor);
-+ struct wl_egl_window *eglwindow =
-+ wl_egl_window_create(wlsurface, pbsize.width, pbsize.height);
-+
-+ EGLSurface surface =
-+ sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, eglwindow, 0);
-+
-+ if (surface) {
-+ WaylandGLSurface* waylandData =
-+ new WaylandGLSurface(wlsurface, eglwindow);
-+ auto entry = sWaylandGLSurface.LookupForAdd(surface);
-+ entry.OrInsert([&waylandData](){ return waylandData; });
-+ }
-+
-+ return surface;
-+}
-+#endif
-+
- static const EGLint kEGLConfigAttribsOffscreenPBuffer[] = {
- LOCAL_EGL_SURFACE_TYPE, LOCAL_EGL_PBUFFER_BIT,
- LOCAL_EGL_RENDERABLE_TYPE, LOCAL_EGL_OPENGL_ES2_BIT,
-@@ -807,7 +896,17 @@ FillContextAttribs(bool alpha, bool dept
- bool es3, nsTArray<EGLint>* out)
- {
- out->AppendElement(LOCAL_EGL_SURFACE_TYPE);
-+#if defined(MOZ_WAYLAND)
-+ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
-+ // Wayland on desktop does not support PBuffer or FBO.
-+ // We create a dummy wl_egl_window instead.
-+ out->AppendElement(LOCAL_EGL_WINDOW_BIT);
-+ } else {
-+ out->AppendElement(LOCAL_EGL_PBUFFER_BIT);
-+ }
-+#else
- out->AppendElement(LOCAL_EGL_PBUFFER_BIT);
-+#endif
-
- out->AppendElement(LOCAL_EGL_RENDERABLE_TYPE);
- if (es3) {
-@@ -926,9 +1025,17 @@ GLContextEGL::CreateEGLPBufferOffscreenC
- }
-
- mozilla::gfx::IntSize pbSize(size);
-- EGLSurface surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(config,
-- LOCAL_EGL_NONE,
-- pbSize);
-+ EGLSurface surface = nullptr;
-+#if defined(MOZ_WAYLAND)
-+ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
-+ surface = GLContextEGL::CreateWaylandBufferSurface(config, pbSize);
-+ } else
-+#endif
-+ {
-+ surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(config,
-+ LOCAL_EGL_NONE,
-+ pbSize);
-+ }
- if (!surface) {
- *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_POT");
- NS_WARNING("Failed to create PBuffer for context!");
-@@ -941,6 +1048,9 @@ GLContextEGL::CreateEGLPBufferOffscreenC
- if (!gl) {
- NS_WARNING("Failed to create GLContext from PBuffer");
- sEGLLibrary.fDestroySurface(sEGLLibrary.Display(), surface);
-+#if defined(MOZ_WAYLAND)
-+ DeleteWaylandGLSurface(surface);
-+#endif
- return nullptr;
- }
-
diff --git a/mozilla-1463753.patch b/mozilla-1463753.patch
deleted file mode 100644
index 4e83fd4..0000000
--- a/mozilla-1463753.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-
-# HG changeset patch
-# User Martin Stransky <stransky@redhat.com>
-# Date 1527155477 -7200
-# Node ID 172827af80fa02953e0c7723c0dee915c411c286
-# Parent a5c04fe7278db916b3efd5f06a5f2a9da0d64ad2
-Bug 1463753 - [DragAndDrop] Update mTarget(Wayland)DragContext unconditionally and check its validity after that, r=jhorak
-
-MozReview-Commit-ID: KiNaPDDVvLu
-
-diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp
---- a/widget/gtk/nsDragService.cpp
-+++ b/widget/gtk/nsDragService.cpp
-@@ -1043,21 +1043,21 @@ nsDragService::IsDataFlavorSupported(con
- }
-
- // check the target context vs. this flavor, one at a time
- GList *tmp = nullptr;
- if (mTargetDragContext) {
- tmp = gdk_drag_context_list_targets(mTargetDragContext);
- }
- #ifdef MOZ_WAYLAND
-- else {
-+ else if (mTargetWaylandDragContext) {
- tmp = mTargetWaylandDragContext->GetTargets();
- }
-+ GList *tmp_head = tmp;
- #endif
-- GList *tmp_head = tmp;
-
- for (; tmp; tmp = tmp->next) {
- /* Bug 331198 */
- GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
- gchar *name = nullptr;
- name = gdk_atom_name(atom);
- MOZ_LOG(sDragLm, LogLevel::Debug,
- ("checking %s against %s\n", name, aDataFlavor));
-@@ -1095,21 +1095,23 @@ nsDragService::IsDataFlavorSupported(con
- MOZ_LOG(sDragLm, LogLevel::Debug,
- ("good! ( it's text plain and we're checking \
- against text/unicode or application/x-moz-file)\n"));
- *_retval = true;
- }
- g_free(name);
- }
-
-+#ifdef MOZ_WAYLAND
- // mTargetWaylandDragContext->GetTargets allocates the list
- // so we need to free it here.
-- if (!mTargetDragContext) {
-+ if (!mTargetDragContext && tmp_head) {
- g_list_free(tmp_head);
- }
-+#endif
-
- return NS_OK;
- }
-
- void
- nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext)
- {
- MOZ_LOG(sDragLm, LogLevel::Debug,
-@@ -2007,23 +2009,19 @@ nsDragService::RunScheduledTask()
- // This may be the start of a destination drag session.
- StartDragSession();
-
- // mTargetWidget may be nullptr if the window has been destroyed.
- // (The leave event is not scheduled if a drop task is still scheduled.)
- // We still reply appropriately to indicate that the drop will or didn't
- // succeeed.
- mTargetWidget = mTargetWindow->GetMozContainerWidget();
-- if (mTargetDragContext) {
-- mTargetDragContext.steal(mPendingDragContext);
-- }
-+ mTargetDragContext.steal(mPendingDragContext);
- #ifdef MOZ_WAYLAND
-- else {
-- mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
-- }
-+ mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
- #endif
- mTargetTime = mPendingTime;
-
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model
- // (as at 27 December 2010) indicates that a "drop" event should only be
- // fired (at the current target element) if the current drag operation is
- // not none. The current drag operation will only be set to a non-none
- // value during a "dragover" event.
-@@ -2056,17 +2054,17 @@ nsDragService::RunScheduledTask()
- #endif
- } else {
- // Reply to tell the source whether we can drop and what
- // action would be taken.
- if (mTargetDragContext) {
- ReplyToDragMotion(mTargetDragContext);
- }
- #ifdef MOZ_WAYLAND
-- else {
-+ else if (mTargetWaylandDragContext) {
- ReplyToDragMotion(mTargetWaylandDragContext);
- }
- #endif
- }
- }
- }
-
- if (task == eDragTaskDrop) {
-@@ -2123,17 +2121,17 @@ nsDragService::UpdateDragAction()
-
- // default is to do nothing
- int action = nsIDragService::DRAGDROP_ACTION_NONE;
- GdkDragAction gdkAction = GDK_ACTION_DEFAULT;
- if (mTargetDragContext) {
- gdkAction = gdk_drag_context_get_actions(mTargetDragContext);
- }
- #ifdef MOZ_WAYLAND
-- else {
-+ else if (mTargetWaylandDragContext) {
- // We got the selected D&D action from compositor on Wayland.
- gdkAction = mTargetWaylandDragContext->GetSelectedDragAction();
- }
- #endif
-
- // set the default just in case nothing matches below
- if (gdkAction & GDK_ACTION_DEFAULT)
- action = nsIDragService::DRAGDROP_ACTION_MOVE;
-
diff --git a/mozilla-1464808.patch b/mozilla-1464808.patch
deleted file mode 100644
index 6cb6bde..0000000
--- a/mozilla-1464808.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
---- a/widget/gtk/nsClipboardWayland.cpp
-+++ b/widget/gtk/nsClipboardWayland.cpp
-@@ -201,21 +201,25 @@ WaylandDataOffer::DragOfferAccept(const
- }
-
- /* We follow logic of gdk_wayland_drag_context_commit_status()/gdkdnd-wayland.c
- * here.
- */
- void
- WaylandDataOffer::SetDragStatus(GdkDragAction aAction, uint32_t aTime)
- {
-- uint32_t dnd_actions = gdk_to_wl_actions(aAction);
- uint32_t all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY |
- WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
-
-- wl_data_offer_set_actions(mWaylandDataOffer, all_actions, dnd_actions);
-+ /* Default Firefox D&D action is move so set it here as a preferred one.
-+ Actual D&D action will be select by Wayland compositor and reported
-+ at data_offer_action() callback.
-+ */
-+ wl_data_offer_set_actions(mWaylandDataOffer, all_actions,
-+ WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
-
- /* Workaround Wayland D&D architecture here. To get the data_device_drop()
- signal (which routes to nsDragService::GetData() call) we need to
- accept at least one mime type before data_device_leave().
-
- Real wl_data_offer_accept() for actualy requested data mime type is
- called from nsDragService::GetData().
- */
diff --git a/mozilla-1464823.patch b/mozilla-1464823.patch
deleted file mode 100644
index 9870d98..0000000
--- a/mozilla-1464823.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Bug 1464823 - Don't sync rendering on Mesa as the Mesa Wayland implementation is buggy.
-
-diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
---- a/gfx/gl/GLContextProviderEGL.cpp
-+++ b/gfx/gl/GLContextProviderEGL.cpp
-@@ -273,20 +273,17 @@ GLContextEGLFactory::Create(EGLNativeWin
- if (!gl) {
- gfxCriticalNote << "Failed to create EGLContext!";
- mozilla::gl::DestroySurface(surface);
- return nullptr;
- }
-
- gl->MakeCurrent();
- gl->SetIsDoubleBuffered(doubleBuffered);
-- if (aWebRender && sEGLLibrary.IsANGLE()) {
-- MOZ_ASSERT(doubleBuffered);
-- sEGLLibrary.fSwapInterval(EGL_DISPLAY(), 0);
-- }
-+ sEGLLibrary.fSwapInterval(EGL_DISPLAY(), 0);
- return gl.forget();
- }
-
- GLContextEGL::GLContextEGL(CreateContextFlags flags, const SurfaceCaps& caps,
- bool isOffscreen, EGLConfig config, EGLSurface surface,
- EGLContext context)
- : GLContext(flags, caps, nullptr, isOffscreen, false)
- , mConfig(config)
diff --git a/mozilla-1465371.patch b/mozilla-1465371.patch
deleted file mode 100644
index 8e4e8e1..0000000
--- a/mozilla-1465371.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
---- a/toolkit/xre/nsAppRunner.cpp
-+++ b/toolkit/xre/nsAppRunner.cpp
-@@ -1700,31 +1700,25 @@ ParseRemoteCommandLine(nsCString& progra
-
- return REMOTE_FOUND;
- }
-
- static RemoteResult
- StartRemoteClient(const char* aDesktopStartupID,
- nsCString& program,
- const char* profile,
-- const char* username,
-- bool aIsX11Display)
-+ const char* username)
- {
- nsAutoPtr<nsRemoteClient> client;
-
-- if (aIsX11Display) {
-- client = new XRemoteClient();
-- } else {
- #if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND)
-- client = new DBusRemoteClient();
-+ client = new DBusRemoteClient();
- #else
-- MOZ_ASSERT(false, "Missing remote implementation!");
-- return REMOTE_NOT_FOUND;
-+ client = new XRemoteClient();
- #endif
-- }
-
- nsresult rv = client->Init();
- if (NS_FAILED(rv))
- return REMOTE_NOT_FOUND;
-
- nsCString response;
- bool success = false;
- rv = client->SendCommandLine(program.get(), username, profile,
-@@ -4070,18 +4064,17 @@ XREMain::XRE_mainStartup(bool* aExitFlag
- NS_WARNING("Cannot lock XRemote start mutex");
- }
- }
-
- // Try to remote the entire command line. If this fails, start up normally.
- const char* desktopStartupIDPtr =
- mDesktopStartupID.IsEmpty() ? nullptr : mDesktopStartupID.get();
-
-- rr = StartRemoteClient(desktopStartupIDPtr, program, profile, username,
-- GDK_IS_X11_DISPLAY(mGdkDisplay));
-+ rr = StartRemoteClient(desktopStartupIDPtr, program, profile, username);
- if (rr == REMOTE_FOUND) {
- *aExitFlag = true;
- return 0;
- }
- if (rr == REMOTE_ARG_BAD) {
- return 1;
- }
- }
-
diff --git a/mozilla-1466473.patch b/mozilla-1466473.patch
deleted file mode 100644
index 5ee521d..0000000
--- a/mozilla-1466473.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
---- a/toolkit/xre/moz.build
-+++ b/toolkit/xre/moz.build
-@@ -116,17 +116,17 @@ UNIFIED_SOURCES += [
- # they pull in OS X system headers.
- # nsEmbedFunctions.cpp cannot be built in unified mode because it pulls in X11 headers.
- SOURCES += [
- 'nsAppRunner.cpp',
- 'nsEmbedFunctions.cpp',
- 'ProfileReset.cpp',
- ]
-
--if CONFIG['MOZ_GL_DEFAULT_PROVIDER'] == 'GLX':
-+if CONFIG['MOZ_X11']:
- UNIFIED_SOURCES += [
- 'glxtest.cpp',
- ]
-
- if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
- UNIFIED_SOURCES += [
- 'EventTracer.cpp',
- ]
-@@ -142,17 +142,17 @@ if CONFIG['MOZ_PDF_PRINTING']:
- LOCAL_INCLUDES += [
- '../components/printingui',
- ]
-
- include('/ipc/chromium/chromium-config.mozbuild')
-
- FINAL_LIBRARY = 'xul'
-
--if CONFIG['MOZ_GL_DEFAULT_PROVIDER'] == 'GLX':
-+if CONFIG['MOZ_X11']:
- DEFINES['USE_GLX_TEST'] = True
-
- for var in ('MOZ_APP_NAME', 'MOZ_APP_BASENAME', 'MOZ_APP_DISPLAYNAME',
- 'MOZ_APP_VERSION', 'OS_TARGET', 'MOZ_WIDGET_TOOLKIT'):
- DEFINES[var] = '"%s"' % CONFIG[var]
-
- if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
- DEFINES['MOZ_UPDATER'] = True
-
diff --git a/mozilla-1468670.patch b/mozilla-1468670.patch
deleted file mode 100644
index 42a05e2..0000000
--- a/mozilla-1468670.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h
---- a/widget/gtk/nsGtkKeyUtils.h
-+++ b/widget/gtk/nsGtkKeyUtils.h
-@@ -169,17 +169,20 @@ protected:
-
- bool mInitialized;
-
- /**
- * Initializing methods.
- */
- void Init();
- void InitXKBExtension();
-- void InitBySystemSettings();
-+ void InitBySystemSettingsX11();
-+#ifdef MOZ_WAYLAND
-+ void InitBySystemSettingsWayland();
-+#endif
-
- /**
- * mModifierKeys stores each hardware key information.
- */
- struct ModifierKey {
- guint mHardwareKeycode;
- guint mMask;
-
-
-diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp
---- a/widget/gtk/nsGtkKeyUtils.cpp
-+++ b/widget/gtk/nsGtkKeyUtils.cpp
-@@ -190,17 +190,21 @@ KeymapWrapper::Init()
- MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
- ("%p Init, mGdkKeymap=%p",
- this, mGdkKeymap));
-
- mModifierKeys.Clear();
- memset(mModifierMasks, 0, sizeof(mModifierMasks));
-
- if (GDK_IS_X11_DISPLAY(gdk_display_get_default()))
-- InitBySystemSettings();
-+ InitBySystemSettingsX11();
-+#ifdef MOZ_WAYLAND
-+ else
-+ InitBySystemSettingsWayland();
-+#endif
-
- gdk_window_add_filter(nullptr, FilterEvents, this);
-
- MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
- ("%p Init, CapsLock=0x%X, NumLock=0x%X, "
- "ScrollLock=0x%X, Level3=0x%X, Level5=0x%X, "
- "Shift=0x%X, Ctrl=0x%X, Alt=0x%X, Meta=0x%X, Super=0x%X, Hyper=0x%X",
- this,
-@@ -270,20 +274,20 @@ KeymapWrapper::InitXKBExtension()
- return;
- }
-
- MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
- ("%p InitXKBExtension, Succeeded", this));
- }
-
- void
--KeymapWrapper::InitBySystemSettings()
-+KeymapWrapper::InitBySystemSettingsX11()
- {
- MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
-- ("%p InitBySystemSettings, mGdkKeymap=%p",
-+ ("%p InitBySystemSettingsX11, mGdkKeymap=%p",
- this, mGdkKeymap));
-
- Display* display =
- gdk_x11_display_get_xdisplay(gdk_display_get_default());
-
- int min_keycode = 0;
- int max_keycode = 0;
- XDisplayKeycodes(display, &min_keycode, &max_keycode);
-@@ -434,16 +438,26 @@ KeymapWrapper::InitBySystemSettings()
- }
- }
- }
-
- XFreeModifiermap(xmodmap);
- XFree(xkeymap);
- }
-
-+#ifdef MOZ_WAYLAND
-+void
-+KeymapWrapper::InitBySystemSettingsWayland()
-+{
-+ // Not implemented yet, but at least Alt modifier should be handled to save
-+ // popular usage.
-+ mModifierMasks[INDEX_ALT] = 1 << 3;
-+}
-+#endif
-+
- KeymapWrapper::~KeymapWrapper()
- {
- gdk_window_remove_filter(nullptr, FilterEvents, this);
- g_signal_handlers_disconnect_by_func(mGdkKeymap,
- FuncToGpointer(OnKeysChanged), this);
- g_signal_handlers_disconnect_by_func(mGdkKeymap,
- FuncToGpointer(OnDirectionChanged), this);
- g_object_unref(mGdkKeymap);
diff --git a/rb244010.patch b/rb244010.patch
deleted file mode 100644
index 0df8c3b..0000000
--- a/rb244010.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-diff --git a/gfx/gl/GLContextProviderWayland.cpp b/gfx/gl/GLContextProviderWayland.cpp
-new file mode 100644
---- /dev/null
-+++ b/gfx/gl/GLContextProviderWayland.cpp
-@@ -0,0 +1,99 @@
-+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-+/* 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/. */
-+
-+#ifdef MOZ_WIDGET_GTK
-+#include <gdk/gdk.h>
-+#include <gdk/gdkx.h>
-+#endif
-+
-+#include "GLContextProvider.h"
-+
-+namespace mozilla {
-+namespace gl {
-+
-+using namespace mozilla::gfx;
-+using namespace mozilla::widget;
-+
-+static class GLContextProviderGLX sGLContextProviderGLX;
-+static class GLContextProviderEGL sGLContextProviderEGL;
-+
-+already_AddRefed<GLContext>
-+GLContextProviderWayland::CreateWrappingExisting(void* aContext, void* aSurface)
-+{
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-+ return sGLContextProviderGLX.CreateWrappingExisting(aContext, aSurface);
-+ } else {
-+ return sGLContextProviderEGL.CreateWrappingExisting(aContext, aSurface);
-+ }
-+}
-+
-+already_AddRefed<GLContext>
-+GLContextProviderWayland::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
-+{
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-+ return sGLContextProviderGLX.CreateForCompositorWidget(aCompositorWidget, aForceAccelerated);
-+ } else {
-+ return sGLContextProviderEGL.CreateForCompositorWidget(aCompositorWidget, aForceAccelerated);
-+ }
-+}
-+
-+already_AddRefed<GLContext>
-+GLContextProviderWayland::CreateForWindow(nsIWidget* aWidget,
-+ bool aWebRender,
-+ bool aForceAccelerated)
-+{
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-+ return sGLContextProviderGLX.CreateForWindow(aWidget, aWebRender, aForceAccelerated);
-+ } else {
-+ return sGLContextProviderEGL.CreateForWindow(aWidget, aWebRender, aForceAccelerated);
-+ }
-+}
-+
-+/*static*/ already_AddRefed<GLContext>
-+GLContextProviderWayland::CreateHeadless(CreateContextFlags flags,
-+ nsACString* const out_failureId)
-+{
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-+ return sGLContextProviderGLX.CreateHeadless(flags, out_failureId);
-+ } else {
-+ return sGLContextProviderEGL.CreateHeadless(flags, out_failureId);
-+ }
-+}
-+
-+/*static*/ already_AddRefed<GLContext>
-+GLContextProviderWayland::CreateOffscreen(const IntSize& size,
-+ const SurfaceCaps& minCaps,
-+ CreateContextFlags flags,
-+ nsACString* const out_failureId)
-+{
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-+ return sGLContextProviderGLX.CreateOffscreen(size, minCaps, flags, out_failureId);
-+ } else {
-+ return sGLContextProviderEGL.CreateOffscreen(size, minCaps, flags, out_failureId);
-+ }
-+}
-+
-+/*static*/ GLContext*
-+GLContextProviderWayland::GetGlobalContext()
-+{
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-+ return sGLContextProviderGLX.GetGlobalContext();
-+ } else {
-+ return sGLContextProviderEGL.GetGlobalContext();
-+ }
-+}
-+
-+/*static*/ void
-+GLContextProviderWayland::Shutdown()
-+{
-+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-+ sGLContextProviderGLX.Shutdown();
-+ } else {
-+ sGLContextProviderEGL.Shutdown();
-+ }
-+}
-+
-+} /* namespace gl */
-+} /* namespace mozilla */
-diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
---- a/gfx/gl/moz.build
-+++ b/gfx/gl/moz.build
-@@ -8,17 +8,17 @@ gl_provider = 'Null'
-
- if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
- gl_provider = 'WGL'
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- gl_provider = 'CGL'
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
- gl_provider = 'EAGL'
- elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
-- if CONFIG['MOZ_EGL_XRENDER_COMPOSITE'] or CONFIG['MOZ_WAYLAND']:
-+ if CONFIG['MOZ_EGL_XRENDER_COMPOSITE']:
- gl_provider = 'EGL'
- else:
- gl_provider = 'GLX'
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
- gl_provider = 'EGL'
-
- if CONFIG['MOZ_GL_PROVIDER']:
- gl_provider = CONFIG['MOZ_GL_PROVIDER']
-@@ -114,16 +114,21 @@ elif gl_provider == 'GLX':
- SOURCES += [
- 'GLContextProviderGLX.cpp',
- 'SharedSurfaceGLX.cpp'
- ]
- EXPORTS += [
- 'SharedSurfaceGLX.h'
- ]
-
-+if CONFIG['MOZ_WAYLAND']:
-+ SOURCES += [
-+ 'GLContextProviderWayland.cpp',
-+ ]
-+
- UNIFIED_SOURCES += [
- 'AndroidSurfaceTexture.cpp',
- 'DecomposeIntoNoRepeatTriangles.cpp',
- 'EGLUtils.cpp',
- 'GfxTexturesReporter.cpp',
- 'GLBlitHelper.cpp',
- 'GLContext.cpp',
- 'GLContextFeatures.cpp',
-
diff --git a/rb244012.patch b/rb244012.patch
deleted file mode 100644
index a096b0e..0000000
--- a/rb244012.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h
---- a/gfx/gl/GLContextProvider.h
-+++ b/gfx/gl/GLContextProvider.h
-@@ -36,30 +36,38 @@ namespace gl {
-
- #ifdef XP_MACOSX
- #define GL_CONTEXT_PROVIDER_NAME GLContextProviderCGL
- #include "GLContextProviderImpl.h"
- #undef GL_CONTEXT_PROVIDER_NAME
- #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderCGL
- #endif
-
--#if defined(MOZ_X11) && !defined(MOZ_WAYLAND)
-+#if defined(MOZ_X11)
- #define GL_CONTEXT_PROVIDER_NAME GLContextProviderGLX
- #include "GLContextProviderImpl.h"
- #undef GL_CONTEXT_PROVIDER_NAME
- #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderGLX
- #endif
-
- #define GL_CONTEXT_PROVIDER_NAME GLContextProviderEGL
- #include "GLContextProviderImpl.h"
- #undef GL_CONTEXT_PROVIDER_NAME
- #ifndef GL_CONTEXT_PROVIDER_DEFAULT
- #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL
- #endif
-
-+#if defined(MOZ_WAYLAND)
-+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland
-+ #include "GLContextProviderImpl.h"
-+ #undef GL_CONTEXT_PROVIDER_NAME
-+ #undef GL_CONTEXT_PROVIDER_DEFAULT
-+ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland
-+#endif
-+
- #if defined(MOZ_WIDGET_UIKIT)
- #define GL_CONTEXT_PROVIDER_NAME GLContextProviderEAGL
- #include "GLContextProviderImpl.h"
- #undef GL_CONTEXT_PROVIDER_NAME
- #ifndef GL_CONTEXT_PROVIDER_DEFAULT
- #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEAGL
- #endif
- #endif
-
diff --git a/rb245262.patch b/rb245262.patch
deleted file mode 100644
index 25550b5..0000000
--- a/rb245262.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
---- a/security/sandbox/linux/SandboxFilter.cpp
-+++ b/security/sandbox/linux/SandboxFilter.cpp
-@@ -1048,16 +1048,24 @@ public:
-
- case __NR_mprotect:
- case __NR_brk:
- case __NR_madvise:
- // libc's realloc uses mremap (Bug 1286119); wasm does too (bug 1342385).
- case __NR_mremap:
- return Allow();
-
-+ // Bug 1462640: Mesa libEGL uses mincore to test whether values
-+ // are pointers, for reasons.
-+ case __NR_mincore: {
-+ Arg<size_t> length(1);
-+ return If(length == getpagesize(), Allow())
-+ .Else(SandboxPolicyCommon::EvaluateSyscall(sysno));
-+ }
-+
- case __NR_sigaltstack:
- return Allow();
-
- #ifdef __NR_set_thread_area
- case __NR_set_thread_area:
- return Allow();
- #endif
-
-
diff --git a/rb246410.patch b/rb246410.patch
deleted file mode 100644
index ad71643..0000000
--- a/rb246410.patch
+++ /dev/null
@@ -1,314 +0,0 @@
-diff -up firefox-61.0/gfx/gl/GLScreenBuffer.cpp.rb246410 firefox-61.0/gfx/gl/GLScreenBuffer.cpp
---- firefox-61.0/gfx/gl/GLScreenBuffer.cpp.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/gl/GLScreenBuffer.cpp 2018-06-19 12:25:27.612265592 +0200
-@@ -29,7 +29,7 @@
- #include "SharedSurfaceIO.h"
- #endif
-
--#ifdef GL_PROVIDER_GLX
-+#ifdef MOZ_X11
- #include "GLXLibrary.h"
- #include "SharedSurfaceGLX.h"
- #endif
-@@ -83,7 +83,7 @@ GLScreenBuffer::CreateFactory(GLContext*
- if (useGl) {
- #if defined(XP_MACOSX)
- factory = SurfaceFactory_IOSurface::Create(gl, caps, ipcChannel, flags);
--#elif defined(GL_PROVIDER_GLX)
-+#elif defined(MOZ_X11)
- if (sGLXLibrary.UseTextureFromPixmap())
- factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
- #elif defined(MOZ_WIDGET_UIKIT)
-@@ -119,7 +119,7 @@ GLScreenBuffer::CreateFactory(GLContext*
- #endif
- }
-
--#ifdef GL_PROVIDER_GLX
-+#ifdef MOZ_X11
- if (!factory && sGLXLibrary.UseTextureFromPixmap()) {
- factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
- }
-diff -up firefox-61.0/gfx/layers/client/TextureClient.cpp.rb246410 firefox-61.0/gfx/layers/client/TextureClient.cpp
---- firefox-61.0/gfx/layers/client/TextureClient.cpp.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/layers/client/TextureClient.cpp 2018-06-19 12:25:27.612265592 +0200
-@@ -45,10 +45,8 @@
- #endif
- #ifdef MOZ_X11
- #include "mozilla/layers/TextureClientX11.h"
--#ifdef GL_PROVIDER_GLX
- #include "GLXLibrary.h"
- #endif
--#endif
-
- #ifdef XP_MACOSX
- #include "mozilla/layers/MacIOSurfaceTextureClientOGL.h"
-@@ -1127,7 +1125,6 @@ TextureClient::CreateForDrawing(TextureF
- {
- data = X11TextureData::Create(aSize, aFormat, aTextureFlags, aAllocator);
- }
--#ifdef GL_PROVIDER_GLX
- if (!data && aLayersBackend == LayersBackend::LAYERS_OPENGL &&
- type == gfxSurfaceType::Xlib &&
- aFormat != SurfaceFormat::A8 &&
-@@ -1136,7 +1133,6 @@ TextureClient::CreateForDrawing(TextureF
- data = X11TextureData::Create(aSize, aFormat, aTextureFlags, aAllocator);
- }
- #endif
--#endif
-
- #ifdef XP_MACOSX
- if (!data && gfxPrefs::UseIOSurfaceTextures()) {
-diff -up firefox-61.0/gfx/layers/composite/X11TextureHost.cpp.rb246410 firefox-61.0/gfx/layers/composite/X11TextureHost.cpp
---- firefox-61.0/gfx/layers/composite/X11TextureHost.cpp.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/layers/composite/X11TextureHost.cpp 2018-06-19 12:25:27.612265592 +0200
-@@ -7,10 +7,8 @@
- #include "X11TextureHost.h"
- #include "mozilla/layers/BasicCompositor.h"
- #include "mozilla/layers/X11TextureSourceBasic.h"
--#ifdef GL_PROVIDER_GLX
- #include "mozilla/layers/CompositorOGL.h"
- #include "mozilla/layers/X11TextureSourceOGL.h"
--#endif
- #include "gfxXlibSurface.h"
- #include "gfx2DGlue.h"
-
-@@ -43,12 +41,10 @@ X11TextureHost::Lock()
- mTextureSource =
- new X11TextureSourceBasic(mCompositor->AsBasicCompositor(), mSurface);
- break;
--#ifdef GL_PROVIDER_GLX
- case LayersBackend::LAYERS_OPENGL:
- mTextureSource =
- new X11TextureSourceOGL(mCompositor->AsCompositorOGL(), mSurface);
- break;
--#endif
- default:
- return false;
- }
-@@ -78,11 +74,9 @@ X11TextureHost::GetFormat() const
- return SurfaceFormat::UNKNOWN;
- }
- gfxContentType type = mSurface->GetContentType();
--#ifdef GL_PROVIDER_GLX
- if (mCompositor->GetBackendType() == LayersBackend::LAYERS_OPENGL) {
- return X11TextureSourceOGL::ContentTypeToSurfaceFormat(type);
- }
--#endif
- return X11TextureSourceBasic::ContentTypeToSurfaceFormat(type);
- }
-
-diff -up firefox-61.0/gfx/layers/ipc/ShadowLayerUtilsX11.cpp.rb246410 firefox-61.0/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
---- firefox-61.0/gfx/layers/ipc/ShadowLayerUtilsX11.cpp.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/layers/ipc/ShadowLayerUtilsX11.cpp 2018-06-19 12:25:27.612265592 +0200
-@@ -74,11 +74,9 @@ SurfaceDescriptorX11::SurfaceDescriptorX
- mFormat = cairo_xlib_surface_get_visual(aSurf->CairoSurface())->visualid;
- }
-
--#ifdef GL_PROVIDER_GLX
- if (aForwardGLX) {
- mGLXPixmap = aSurf->GetGLXPixmap();
- }
--#endif
- }
-
- SurfaceDescriptorX11::SurfaceDescriptorX11(Drawable aDrawable, XID aFormatID,
-@@ -109,10 +107,8 @@ SurfaceDescriptorX11::OpenForeign() cons
- surf = new gfxXlibSurface(display, mId, visual, mSize);
- }
-
--#ifdef GL_PROVIDER_GLX
- if (mGLXPixmap)
- surf->BindGLXPixmap(mGLXPixmap);
--#endif
-
- return surf->CairoStatus() ? nullptr : surf.forget();
- }
-diff -up firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.cpp.rb246410 firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.cpp
---- firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.cpp.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.cpp 2018-06-19 12:25:27.613265589 +0200
-@@ -4,7 +4,7 @@
- * 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/. */
-
--#ifdef GL_PROVIDER_GLX
-+#ifdef MOZ_X11
-
- #include "X11TextureSourceOGL.h"
- #include "gfxXlibSurface.h"
-diff -up firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.h.rb246410 firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.h
---- firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.h.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/layers/opengl/X11TextureSourceOGL.h 2018-06-19 12:25:27.613265589 +0200
-@@ -7,7 +7,7 @@
- #ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H
- #define MOZILLA_GFX_X11TEXTURESOURCEOGL__H
-
--#ifdef GL_PROVIDER_GLX
-+#ifdef MOZ_X11
-
- #include "mozilla/layers/CompositorOGL.h"
- #include "mozilla/layers/TextureHostOGL.h"
-diff -up firefox-61.0/gfx/thebes/gfxPlatformGtk.cpp.rb246410 firefox-61.0/gfx/thebes/gfxPlatformGtk.cpp
---- firefox-61.0/gfx/thebes/gfxPlatformGtk.cpp.rb246410 2018-06-19 12:25:27.598265633 +0200
-+++ firefox-61.0/gfx/thebes/gfxPlatformGtk.cpp 2018-06-19 12:26:35.751066530 +0200
-@@ -42,11 +42,9 @@
- #include "mozilla/Preferences.h"
- #include "mozilla/X11Util.h"
-
--#ifdef GL_PROVIDER_GLX
- #include "GLContextProvider.h"
- #include "GLContextGLX.h"
- #include "GLXLibrary.h"
--#endif
-
- /* Undefine the Status from Xlib since it will conflict with system headers on OSX */
- #if defined(__APPLE__) && defined(Status)
-@@ -508,7 +506,7 @@ gfxPlatformGtk::CheckVariationFontSuppor
- return major * 1000000 + minor * 1000 + patch >= 2007001;
- }
-
--#ifdef GL_PROVIDER_GLX
-+#ifdef MOZ_X11
-
- class GLXVsyncSource final : public VsyncSource
- {
-diff -up firefox-61.0/gfx/thebes/gfxPlatformGtk.h.rb246410 firefox-61.0/gfx/thebes/gfxPlatformGtk.h
---- firefox-61.0/gfx/thebes/gfxPlatformGtk.h.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/thebes/gfxPlatformGtk.h 2018-06-19 12:25:27.613265589 +0200
-@@ -97,7 +97,7 @@ public:
-
- bool AccelerateLayersByDefault() override;
-
--#ifdef GL_PROVIDER_GLX
-+#ifdef MOZ_X11
- already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
- #endif
-
-diff -up firefox-61.0/gfx/thebes/gfxXlibSurface.cpp.rb246410 firefox-61.0/gfx/thebes/gfxXlibSurface.cpp
---- firefox-61.0/gfx/thebes/gfxXlibSurface.cpp.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/thebes/gfxXlibSurface.cpp 2018-06-19 12:25:27.613265589 +0200
-@@ -25,9 +25,7 @@ using namespace mozilla::gfx;
-
- gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual)
- : mPixmapTaken(false), mDisplay(dpy), mDrawable(drawable)
--#if defined(GL_PROVIDER_GLX)
- , mGLXPixmap(X11None)
--#endif
- {
- const gfx::IntSize size = DoSizeQuery();
- cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, size.width, size.height);
-@@ -36,9 +34,7 @@ gfxXlibSurface::gfxXlibSurface(Display *
-
- gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const gfx::IntSize& size)
- : mPixmapTaken(false), mDisplay(dpy), mDrawable(drawable)
--#if defined(GL_PROVIDER_GLX)
- , mGLXPixmap(X11None)
--#endif
- {
- NS_ASSERTION(Factory::CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
- "Bad size");
-@@ -51,9 +47,7 @@ gfxXlibSurface::gfxXlibSurface(Screen *s
- const gfx::IntSize& size)
- : mPixmapTaken(false), mDisplay(DisplayOfScreen(screen)),
- mDrawable(drawable)
--#if defined(GL_PROVIDER_GLX)
-- , mGLXPixmap(X11None)
--#endif
-+ , mGLXPixmap(X11None)
- {
- NS_ASSERTION(Factory::CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
- "Bad Size");
-@@ -67,9 +61,7 @@ gfxXlibSurface::gfxXlibSurface(Screen *s
-
- gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf)
- : mPixmapTaken(false)
--#if defined(GL_PROVIDER_GLX)
-- , mGLXPixmap(X11None)
--#endif
-+ , mGLXPixmap(X11None)
- {
- NS_PRECONDITION(cairo_surface_status(csurf) == 0,
- "Not expecting an error surface");
-@@ -84,11 +76,9 @@ gfxXlibSurface::~gfxXlibSurface()
- {
- // gfxASurface's destructor calls RecordMemoryFreed().
- if (mPixmapTaken) {
--#if defined(GL_PROVIDER_GLX)
- if (mGLXPixmap) {
- gl::sGLXLibrary.DestroyPixmap(mDisplay, mGLXPixmap);
- }
--#endif
- XFreePixmap (mDisplay, mDrawable);
- }
- }
-@@ -120,7 +110,7 @@ gfxXlibSurface::TakePixmap()
- // The bit depth returned from Cairo is technically int, but this is
- // the last place we'd be worried about that scenario.
- unsigned int bitDepth = cairo_xlib_surface_get_depth(CairoSurface());
-- MOZ_ASSERT((bitDepth % 8) == 0, "Memory used not recorded correctly");
-+ MOZ_ASSERT((bitDepth % 8) == 0, "Memory used not recorded correctly");
-
- // Divide by 8 because surface_get_depth gives us the number of *bits* per
- // pixel.
-@@ -272,7 +262,7 @@ gfxXlibSurface::CreateSimilarSurface(gfx
- void
- gfxXlibSurface::Finish()
- {
--#if defined(GL_PROVIDER_GLX)
-+#if defined(MOZ_X11)
- if (mPixmapTaken && mGLXPixmap) {
- gl::sGLXLibrary.DestroyPixmap(mDisplay, mGLXPixmap);
- mGLXPixmap = X11None;
-@@ -498,7 +488,7 @@ gfxXlibSurface::DepthOfVisual(const Scre
- NS_ERROR("Visual not on Screen.");
- return 0;
- }
--
-+
- /* static */
- Visual*
- gfxXlibSurface::FindVisual(Screen *screen, gfxImageFormat format)
-@@ -587,7 +577,7 @@ gfxXlibSurface::XRenderFormat()
- return cairo_xlib_surface_get_xrender_format(CairoSurface());
- }
-
--#if defined(GL_PROVIDER_GLX)
-+#if defined(MOZ_X11)
- GLXPixmap
- gfxXlibSurface::GetGLXPixmap()
- {
-diff -up firefox-61.0/gfx/thebes/gfxXlibSurface.h.rb246410 firefox-61.0/gfx/thebes/gfxXlibSurface.h
---- firefox-61.0/gfx/thebes/gfxXlibSurface.h.rb246410 2018-06-19 01:03:35.000000000 +0200
-+++ firefox-61.0/gfx/thebes/gfxXlibSurface.h 2018-06-19 12:25:27.613265589 +0200
-@@ -12,9 +12,7 @@
- #include <X11/Xlib.h>
- #include "X11UndefineNone.h"
-
--#if defined(GL_PROVIDER_GLX)
- #include "GLXLibrary.h"
--#endif
-
- #include "nsSize.h"
-
-@@ -86,12 +84,10 @@ public:
- // Find a visual and colormap pair suitable for rendering to this surface.
- bool GetColormapAndVisual(Colormap* colormap, Visual **visual);
-
--#if defined(GL_PROVIDER_GLX)
- GLXPixmap GetGLXPixmap();
- // Binds a GLXPixmap backed by this context's surface.
- // Primarily for use in sharing surfaces.
- void BindGLXPixmap(GLXPixmap aPixmap);
--#endif
-
- // Return true if cairo will take its slow path when this surface is used
- // in a pattern with EXTEND_PAD. As a workaround for XRender's RepeatPad
-@@ -114,9 +110,7 @@ protected:
-
- const mozilla::gfx::IntSize DoSizeQuery();
-
--#if defined(GL_PROVIDER_GLX)
- GLXPixmap mGLXPixmap;
--#endif
- };
-
- #endif /* GFX_XLIBSURFACE_H */
diff --git a/rb255772.patch b/rb255772.patch
deleted file mode 100644
index c67952b..0000000
--- a/rb255772.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --git a/widget/xremoteclient/DBusRemoteClient.cpp b/widget/xremoteclient/DBusRemoteClient.cpp
---- a/widget/xremoteclient/DBusRemoteClient.cpp
-+++ b/widget/xremoteclient/DBusRemoteClient.cpp
-@@ -137,17 +137,17 @@ DBusRemoteClient::GetRemoteDestinationNa
- profileName.get());
- if (aDestinationName.Length() > DBUS_MAXIMUM_NAME_LENGTH)
- aDestinationName.Truncate(DBUS_MAXIMUM_NAME_LENGTH);
-
- static auto sDBusValidateBusName =
- (bool (*)(const char *, DBusError *))
- dlsym(RTLD_DEFAULT, "dbus_validate_bus_name");
- if (!sDBusValidateBusName) {
-- return false
-+ return false;
- }
-
- if (!sDBusValidateBusName(aDestinationName.get(), nullptr)) {
- // We don't have a valid busName yet - try to create a default one.
- aDestinationName = nsPrintfCString("org.mozilla.%s.%s", aProgram,
- "default");
- if (!sDBusValidateBusName(aDestinationName.get(), nullptr)) {
- // We failed completelly to get a valid bus name - just quit
-
diff --git a/sources b/sources
index 4820453..77bcade 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (firefox-langpacks-61.0.2-20180809.tar.xz) = 1123bea1967e8795f8a2a5999244bf99c7fb947fca30d0469c27e9e9b4b182d5fa913150bd16f243898eaf4c14c7645721b0d4c78dfc769a622015410567b93e
-SHA512 (firefox-61.0.2.source.tar.xz) = a20b127726cf0a082604efcbc9b91ea3c653ac639edb4b26e1fadef51410ccdae9b5d3a534563528945d2425382346858af307e79e8da1e4972aacbe1277f6ff
+SHA512 (firefox-langpacks-62.0-20180828.tar.xz) = a3995432c54e7b8bf05d0b114977eda5a52f5072bd45ab685c56ab7218e891ebdf724d0aebf9c5e5aafa7b9dcdec2dcbf1a5aae2f23cf5984469c5830e631a00
+SHA512 (firefox-62.0.source.tar.xz) = 23603b5bead5b030ad5caab84c2f26c323d99e1a12f99a70c511cd6b26b33e332c1c1954d4a6accbec496447a279fac30b4fcba9ea8bd200364f911b82c4b947
bgstack15