icecat: add release icecat-140.10.1-1gnu1 for ecne

This commit is contained in:
Ark74 2026-05-04 16:58:41 -06:00
parent a5f93cb214
commit ff85d7c623
1256 changed files with 63469 additions and 24141 deletions

View file

@ -89,7 +89,11 @@ IPCResult ClipboardWriteRequestParent::RecvSetData(
return IPC_OK();
}
mAsyncSetClipboardData->SetData(trans, nullptr);
rv = mAsyncSetClipboardData->SetData(trans, nullptr);
if (rv == NS_ERROR_IN_PROGRESS) {
return IPC_FAIL(this, "reentrant SetData");
}
// Non-fatal errors are notified via the callback inside SetData.
return IPC_OK();
}

View file

@ -7,6 +7,8 @@
#define mozilla_widget_IMEData_h_
#include "mozilla/CheckedInt.h"
#include "mozilla/EnumSet.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/EventForwards.h"
#include "mozilla/NativeKeyBindingsType.h"
#include "mozilla/ToString.h"
@ -208,74 +210,46 @@ namespace widget {
/**
* Preference for receiving IME updates
*
* If mWantUpdates is not NOTIFY_NOTHING, nsTextStateManager will observe text
* If mWantUpdates is not empty, IMEContentObserver will observe text
* change and/or selection change and call nsIWidget::NotifyIME() with
* NOTIFY_IME_OF_SELECTION_CHANGE and/or NOTIFY_IME_OF_TEXT_CHANGE.
* Please note that the text change observing cost is very expensive especially
* on an HTML editor has focus.
* If the IME implementation on a particular platform doesn't care about
* NOTIFY_IME_OF_SELECTION_CHANGE and/or NOTIFY_IME_OF_TEXT_CHANGE,
* they should set mWantUpdates to NOTIFY_NOTHING to avoid the cost.
* they should set mWantUpdates to empty to avoid the cost.
* If the IME implementation needs notifications even while our process is
* deactive, it should also set NOTIFY_DURING_DEACTIVE.
* inactive, it should also set NotifyDuringInactive.
*/
struct IMENotificationRequests final {
typedef uint8_t Notifications;
enum : Notifications {
NOTIFY_NOTHING = 0,
NOTIFY_TEXT_CHANGE = 1 << 1,
NOTIFY_POSITION_CHANGE = 1 << 2,
// NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR is used when mouse button is pressed
// or released on a character in the focused editor. The notification is
// notified to IME as a mouse event. If it's consumed by IME, NotifyIME()
// returns NS_SUCCESS_EVENT_CONSUMED. Otherwise, it returns NS_OK if it's
// handled without any error.
NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR = 1 << 3,
// NOTE: NOTIFY_DURING_DEACTIVE isn't supported in environments where two
// or more compositions are possible. E.g., Mac and Linux (GTK).
NOTIFY_DURING_DEACTIVE = 1 << 7,
NOTIFY_ALL = NOTIFY_TEXT_CHANGE | NOTIFY_POSITION_CHANGE |
NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR,
};
IMENotificationRequests() : mWantUpdates(NOTIFY_NOTHING) {}
explicit IMENotificationRequests(Notifications aWantUpdates)
: mWantUpdates(aWantUpdates) {}
IMENotificationRequests operator|(
const IMENotificationRequests& aOther) const {
return IMENotificationRequests(aOther.mWantUpdates | mWantUpdates);
}
IMENotificationRequests& operator|=(const IMENotificationRequests& aOther) {
mWantUpdates |= aOther.mWantUpdates;
return *this;
}
bool operator==(const IMENotificationRequests& aOther) const {
return mWantUpdates == aOther.mWantUpdates;
}
bool WantTextChange() const { return !!(mWantUpdates & NOTIFY_TEXT_CHANGE); }
bool WantPositionChanged() const {
return !!(mWantUpdates & NOTIFY_POSITION_CHANGE);
}
bool WantChanges() const { return WantTextChange(); }
bool WantMouseButtonEventOnChar() const {
return !!(mWantUpdates & NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR);
}
bool WantDuringDeactive() const {
return !!(mWantUpdates & NOTIFY_DURING_DEACTIVE);
}
Notifications mWantUpdates;
enum class IMENotificationRequest : uint8_t {
TextChange,
PositionChange,
// NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR is used when mouse button is pressed
// or released on a character in the focused editor. The notification is
// notified to IME as a mouse event. If it's consumed by IME, NotifyIME()
// returns NS_SUCCESS_EVENT_CONSUMED. Otherwise, it returns NS_OK if it's
// handled without any error.
MouseEventOnChar,
// NOTE: NotifyDuringInactive isn't supported in environments where two
// or more compositions are possible. E.g., Mac and Linux (GTK).
NotifyDuringInactive,
};
} // namespace widget
template <>
struct MaxEnumValue<widget::IMENotificationRequest> {
static constexpr uint8_t value = static_cast<uint8_t>(
widget::IMENotificationRequest::NotifyDuringInactive);
};
namespace widget {
using IMENotificationRequests = EnumSet<IMENotificationRequest>;
inline constexpr const IMENotificationRequests AllIMENotificationRequests = {
IMENotificationRequest::TextChange, IMENotificationRequest::PositionChange,
IMENotificationRequest::MouseEventOnChar};
/**
* IME enabled states.
*
@ -641,7 +615,7 @@ struct InputContextAction final {
// IMEMessage is shared by IMEStateManager and TextComposition.
// Update values in GeckoEditable.java if you make changes here.
// XXX Negative values are used in Android...
typedef int8_t IMEMessageType;
using IMEMessageType = int8_t;
enum IMEMessage : IMEMessageType {
// This is used by IMENotification internally. This means that the instance
// hasn't been initialized yet.

View file

@ -725,7 +725,7 @@ nsresult PuppetWidget::NotifyIMEOfFocusChange(
}
mIMENotificationRequestsOfParent =
IMENotificationRequests(IMENotificationRequests::NOTIFY_ALL);
IMENotificationRequests(AllIMENotificationRequests);
RefPtr<PuppetWidget> self = this;
mBrowserChild->SendNotifyIMEFocus(mContentCache, aIMENotification)
->Then(
@ -780,8 +780,9 @@ nsresult PuppetWidget::NotifyIMEOfTextChange(
}
// BrowserParent doesn't this this to cache. we don't send the notification
// if parent process doesn't request NOTIFY_TEXT_CHANGE.
if (mIMENotificationRequestsOfParent.WantTextChange()) {
// if parent process doesn't request text changes.
if (mIMENotificationRequestsOfParent.contains(
IMENotificationRequest::TextChange)) {
mBrowserChild->SendNotifyIMETextChange(mContentCache, aIMENotification);
} else {
mBrowserChild->SendUpdateContentCache(mContentCache);
@ -843,7 +844,8 @@ nsresult PuppetWidget::NotifyIMEOfPositionChange(
!mContentCache.CacheCaretAndTextRects(this, &aIMENotification))) {
return NS_ERROR_FAILURE;
}
if (mIMENotificationRequestsOfParent.WantPositionChanged()) {
if (mIMENotificationRequestsOfParent.contains(
IMENotificationRequest::PositionChange)) {
mBrowserChild->SendNotifyIMEPositionChange(mContentCache, aIMENotification);
} else {
mBrowserChild->SendUpdateContentCache(mContentCache);
@ -1089,10 +1091,9 @@ PuppetWidget::NotifyIME(TextEventDispatcher* aTextEventDispatcher,
NS_IMETHODIMP_(IMENotificationRequests)
PuppetWidget::GetIMENotificationRequests() {
return IMENotificationRequests(
mIMENotificationRequestsOfParent.mWantUpdates |
IMENotificationRequests::NOTIFY_TEXT_CHANGE |
IMENotificationRequests::NOTIFY_POSITION_CHANGE);
return mIMENotificationRequestsOfParent +
IMENotificationRequests{IMENotificationRequest::TextChange,
IMENotificationRequest::PositionChange};
}
NS_IMETHODIMP_(void)

View file

@ -40,15 +40,18 @@ SwipeTracker::SwipeTracker(nsIWidget& aWidget,
const PanGestureInput& aSwipeStartEvent,
uint32_t aAllowedDirections,
uint32_t aSwipeDirection)
: mWidget(aWidget),
mRefreshDriver(GetRefreshDriver(mWidget)),
: mWidget(do_GetWeakReference(&aWidget)),
mRefreshDriver(GetRefreshDriver(aWidget)),
mAxis(0.0, 0.0, 0.0, kSpringForce, 1.0),
mEventPosition(RoundedToInt(ViewAs<LayoutDevicePixel>(
aSwipeStartEvent.mPanStartPoint,
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent))),
mLastEventTimeStamp(aSwipeStartEvent.mTimeStamp),
mAllowedDirections(aAllowedDirections),
mSwipeDirection(aSwipeDirection) {
mSwipeDirection(aSwipeDirection) {}
void SwipeTracker::StartTracking(
const PanGestureInput& aSwipeStartEvent) {
SendSwipeEvent(eSwipeGestureStart, 0, 0.0, aSwipeStartEvent.mTimeStamp);
ProcessEvent(aSwipeStartEvent, /* aProcessingFirstEvent = */ true);
}
@ -96,6 +99,8 @@ bool SwipeTracker::ComputeSwipeSuccess() const {
nsEventStatus SwipeTracker::ProcessEvent(
const PanGestureInput& aEvent, bool aProcessingFirstEvent /* = false */) {
RefPtr<SwipeTracker> selfPin(this);
// If the fingers have already been lifted or the swipe direction is where
// navigation is impossible, don't process this event for swiping.
if (!mEventsAreControllingSwipe || !SwipingInAllowedDirection()) {
@ -109,12 +114,16 @@ nsEventStatus SwipeTracker::ProcessEvent(
: nsEventStatus_eConsumeNoDefault;
}
nsCOMPtr<nsIWidget> widget = do_QueryReferent(mWidget);
if (!widget) {
return nsEventStatus_eIgnore;
}
mDeltaTypeIsPage = aEvent.mDeltaType == PanGestureInput::PANDELTA_PAGE;
double delta = [&]() -> double {
if (mDeltaTypeIsPage) {
return -aEvent.mPanDisplacement.x / StaticPrefs::widget_swipe_page_size();
}
return -aEvent.mPanDisplacement.x / mWidget.GetDefaultScaleInternal() /
return -aEvent.mPanDisplacement.x / widget->GetDefaultScaleInternal() /
StaticPrefs::widget_swipe_pixel_size();
}();
@ -185,6 +194,8 @@ void SwipeTracker::StartAnimating(double aStartValue, double aTargetValue) {
}
void SwipeTracker::WillRefresh(TimeStamp aTime) {
RefPtr<SwipeTracker> selfPin(this);
// FIXME(emilio): shouldn't we be using `aTime`?
TimeStamp now = TimeStamp::Now();
mAxis.Simulate(now - mLastAnimationFrameTime);
@ -214,7 +225,11 @@ void SwipeTracker::CancelSwipe(const TimeStamp& aTimeStamp) {
void SwipeTracker::SwipeFinished(const TimeStamp& aTimeStamp) {
SendSwipeEvent(eSwipeGestureEnd, 0, 0.0, aTimeStamp);
mWidget.SwipeFinished();
nsCOMPtr<nsIWidget> widget = do_QueryReferent(mWidget);
if (!widget) {
return;
}
widget->SwipeFinished();
}
void SwipeTracker::UnregisterFromRefreshDriver() {
@ -238,14 +253,18 @@ void SwipeTracker::UnregisterFromRefreshDriver() {
return geckoEvent;
}
bool SwipeTracker::SendSwipeEvent(EventMessage aMsg, uint32_t aDirection,
void SwipeTracker::SendSwipeEvent(EventMessage aMsg, uint32_t aDirection,
double aDelta, const TimeStamp& aTimeStamp) {
nsCOMPtr<nsIWidget> widget = do_QueryReferent(mWidget);
if (!widget) {
return;
}
WidgetSimpleGestureEvent geckoEvent =
CreateSwipeGestureEvent(aMsg, &mWidget, mEventPosition, aTimeStamp);
CreateSwipeGestureEvent(aMsg, widget, mEventPosition, aTimeStamp);
geckoEvent.mDirection = aDirection;
geckoEvent.mDelta = aDelta;
geckoEvent.mAllowedDirections = mAllowedDirections;
return mWidget.DispatchWindowEvent(geckoEvent);
widget->DispatchWindowEvent(geckoEvent);
}
// static

View file

@ -11,6 +11,7 @@
#include "mozilla/layers/AxisPhysicsMSDModel.h"
#include "mozilla/RefPtr.h"
#include "mozilla/TimeStamp.h"
#include "nsIWeakReferenceUtils.h"
#include "nsRefreshObservers.h"
#include "Units.h"
@ -54,6 +55,8 @@ class SwipeTracker final : public nsARefreshObserver {
void Destroy();
void StartTracking(const PanGestureInput& aSwipeStartEvent);
nsEventStatus ProcessEvent(const PanGestureInput& aEvent,
bool aProcessingFirstEvent = false);
void CancelSwipe(const TimeStamp& aTimeStamp);
@ -79,10 +82,10 @@ class SwipeTracker final : public nsARefreshObserver {
void StartAnimating(double aStartValue, double aTargetValue);
void SwipeFinished(const TimeStamp& aTimeStamp);
void UnregisterFromRefreshDriver();
bool SendSwipeEvent(EventMessage aMsg, uint32_t aDirection, double aDelta,
void SendSwipeEvent(EventMessage aMsg, uint32_t aDirection, double aDelta,
const TimeStamp& aTimeStamp);
nsIWidget& mWidget;
nsWeakPtr mWidget;
RefPtr<nsRefreshDriver> mRefreshDriver;
layers::AxisPhysicsMSDModel mAxis;
const LayoutDeviceIntPoint mEventPosition;

View file

@ -527,7 +527,7 @@ void TextEventDispatcher::UpdateNotificationRequests() {
nsCOMPtr<TextEventDispatcherListener> nativeListener =
mWidget->GetNativeTextEventDispatcherListener();
if (nativeListener) {
mIMENotificationRequests |= nativeListener->GetIMENotificationRequests();
mIMENotificationRequests += nativeListener->GetIMENotificationRequests();
}
}
}

View file

@ -5,14 +5,16 @@
#ifndef mozilla_textinputdispatcherlistener_h_
#define mozilla_textinputdispatcherlistener_h_
#include "mozilla/EnumSet.h"
#include "nsWeakReference.h"
namespace mozilla {
namespace widget {
enum class IMENotificationRequest : uint8_t;
class TextEventDispatcher;
struct IMENotification;
struct IMENotificationRequests;
using IMENotificationRequests = EnumSet<IMENotificationRequest>;
#define NS_TEXT_INPUT_PROXY_LISTENER_IID \
{0xf2226f55, \

View file

@ -1461,7 +1461,7 @@ void GeckoEditableSupport::WillDispatchKeyboardEvent(
NS_IMETHODIMP_(IMENotificationRequests)
GeckoEditableSupport::GetIMENotificationRequests() {
return IMENotificationRequests(IMENotificationRequests::NOTIFY_TEXT_CHANGE);
return {IMENotificationRequest::TextChange};
}
static bool ShouldKeyboardDismiss(const nsAString& aInputType,

View file

@ -3436,7 +3436,7 @@ IMEInputHandler::GetIMENotificationRequests() {
// XXX Shouldn't we move floating window which shows composition string
// when plugin has focus and its parent is scrolled or the window is
// moved?
return IMENotificationRequests(IMENotificationRequests::NOTIFY_TEXT_CHANGE);
return {IMENotificationRequest::TextChange};
}
NS_IMETHODIMP_(void)

View file

@ -919,13 +919,21 @@ bool DMABufSurfaceRGBA::ImportSurfaceDescriptor(
const SurfaceDescriptor& aDesc) {
const SurfaceDescriptorDMABuf& desc = aDesc.get_SurfaceDescriptorDMABuf();
mBufferPlaneCount = desc.fds().Length();
MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
if (mBufferPlaneCount <= 0 || desc.width().Length() == 0 ||
desc.height().Length() == 0 || desc.modifier().Length() == 0 ||
desc.strides().Length() < (uint32_t)mBufferPlaneCount ||
desc.offsets().Length() < (uint32_t)mBufferPlaneCount) {
return false;
}
mFOURCCFormat = desc.fourccFormat();
mWidth = desc.width()[0];
mHeight = desc.height()[0];
mBufferPlaneCount = desc.fds().Length();
mGbmBufferFlags = desc.flags();
mBufferModifier = desc.modifier()[0];
MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
mUID = desc.uid();
mPID = desc.pid();
@ -1482,6 +1490,9 @@ bool DMABufSurfaceYUV::ImportPRIMESurfaceDescriptor(
unsigned int subsample = i == 0 ? 0 : 1;
unsigned int object = aDesc.layers[i].object_index[0];
if (object >= aDesc.num_objects) {
return false;
}
mBufferModifiers[i] = aDesc.objects[object].drm_format_modifier;
mDrmFormats[i] = aDesc.layers[i].drm_format;
mOffsets[i] = aDesc.layers[i].offset[0];
@ -1515,6 +1526,9 @@ void DMABufSurfaceYUV::ReleaseVADRMPRIMESurfaceDescriptor(
VADRMPRIMESurfaceDescriptor& aDesc) {
for (unsigned int i = 0; i < aDesc.num_layers; i++) {
unsigned int object = aDesc.layers[i].object_index[0];
if (object >= aDesc.num_objects) {
continue;
}
if (aDesc.objects[object].fd != -1) {
close(aDesc.objects[object].fd);
aDesc.objects[object].fd = -1;
@ -1792,6 +1806,19 @@ bool DMABufSurfaceYUV::Create(const SurfaceDescriptor& aDesc) {
bool DMABufSurfaceYUV::ImportSurfaceDescriptor(
const SurfaceDescriptorDMABuf& aDesc) {
mBufferPlaneCount = aDesc.fds().Length();
MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
if (mBufferPlaneCount <= 0 ||
aDesc.width().Length() < (uint32_t)mBufferPlaneCount ||
aDesc.height().Length() < (uint32_t)mBufferPlaneCount ||
aDesc.widthAligned().Length() < (uint32_t)mBufferPlaneCount ||
aDesc.heightAligned().Length() < (uint32_t)mBufferPlaneCount ||
aDesc.format().Length() < (uint32_t)mBufferPlaneCount ||
aDesc.modifier().Length() < (uint32_t)mBufferPlaneCount ||
aDesc.strides().Length() < (uint32_t)mBufferPlaneCount ||
aDesc.offsets().Length() < (uint32_t)mBufferPlaneCount) {
return false;
}
mSurfaceType = SURFACE_YUV;
mFOURCCFormat = aDesc.fourccFormat();
mColorSpace = aDesc.yUVColorSpace();
@ -1804,7 +1831,6 @@ bool DMABufSurfaceYUV::ImportSurfaceDescriptor(
LOGDMABUF("DMABufSurfaceYUV::ImportSurfaceDescriptor() UID %d", mUID);
MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
for (int i = 0; i < mBufferPlaneCount; i++) {
mDmabufFds[i] = aDesc.fds()[i];
mWidth[i] = aDesc.width()[i];

View file

@ -603,13 +603,10 @@ TextEventDispatcher* IMContextWrapper::GetTextEventDispatcher() {
NS_IMETHODIMP_(IMENotificationRequests)
IMContextWrapper::GetIMENotificationRequests() {
IMENotificationRequests::Notifications notifications =
IMENotificationRequests::NOTIFY_NOTHING;
// If it's not enabled, we don't need position change notification.
if (IsEnabled()) {
notifications |= IMENotificationRequests::NOTIFY_POSITION_CHANGE;
}
return IMENotificationRequests(notifications);
return IsEnabled()
? IMENotificationRequests{IMENotificationRequest::PositionChange}
: IMENotificationRequests{};
}
void IMContextWrapper::OnDestroyWindow(nsWindow* aWindow) {

View file

@ -30,6 +30,7 @@
#include "WidgetUtilsGtk.h"
#include "gfxPlatform.h"
#include "GRefPtr.h"
#include "nsFilePicker.h"
#undef LOG
@ -615,10 +616,10 @@ bool nsFilePicker::WarnForNonReadableFile(void* file_chooser) {
}
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
auto* cancel_dialog = gtk_message_dialog_new(
RefPtr<GtkWidget> cancel_dialog = gtk_message_dialog_new(
GTK_WINDOW(file_chooser), flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
"%s", NS_ConvertUTF16toUTF8(errorMessage).get());
gtk_dialog_run(GTK_DIALOG(cancel_dialog));
gtk_dialog_run(GTK_DIALOG(cancel_dialog.get()));
gtk_widget_destroy(cancel_dialog);
return true;

View file

@ -10,6 +10,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Services.h"
#include "GRefPtr.h"
#include "MozContainer.h"
#include "nsIPrintSettings.h"
#include "nsIWidget.h"
@ -69,12 +70,12 @@ static void ShowCustomDialog(GtkComboBox* changed_box, gpointer user_data) {
nsAutoString intlString;
printBundle->GetStringFromName("headerFooterCustom", intlString);
GtkWidget* prompt_dialog = gtk_dialog_new_with_buttons(
RefPtr<GtkWidget> prompt_dialog = gtk_dialog_new_with_buttons(
NS_ConvertUTF16toUTF8(intlString).get(), printDialog,
(GtkDialogFlags)(GTK_DIALOG_MODAL), g_dgettext("gtk30", "_Cancel"),
GTK_RESPONSE_REJECT, g_dgettext("gtk30", "_OK"), GTK_RESPONSE_ACCEPT,
nullptr);
gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog),
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
g_dgettext("gtk30", "_Cancel"), GTK_RESPONSE_REJECT,
g_dgettext("gtk30", "_OK"), GTK_RESPONSE_ACCEPT, nullptr);
gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog.get()),
GTK_RESPONSE_ACCEPT);
printBundle->GetStringFromName("customHeaderFooterPrompt", intlString);
@ -107,9 +108,9 @@ static void ShowCustomDialog(GtkComboBox* changed_box, gpointer user_data) {
gtk_widget_show_all(custom_hbox);
gtk_box_pack_start(
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(prompt_dialog))),
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(prompt_dialog.get()))),
custom_hbox, FALSE, FALSE, 0);
gint diag_response = gtk_dialog_run(GTK_DIALOG(prompt_dialog));
gint diag_response = gtk_dialog_run(GTK_DIALOG(prompt_dialog.get()));
if (diag_response == GTK_RESPONSE_ACCEPT) {
const gchar* response_text = gtk_entry_get_text(GTK_ENTRY(custom_entry));
@ -139,7 +140,7 @@ class nsPrintDialogWidgetGTK {
nsresult ExportSettings(nsIPrintSettings* aNSSettings);
private:
GtkWidget* dialog;
RefPtr<GtkWidget> dialog;
GtkWidget* shrink_to_fit_toggle;
GtkWidget* print_bg_colors_toggle;
GtkWidget* print_bg_images_toggle;
@ -177,9 +178,12 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsPIDOMWindowOuter* aParent,
dialog = gtk_print_unix_dialog_new(GetUTF8FromBundle("printTitleGTK").get(),
gtkParent);
if (gtkParent) {
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog.get()), TRUE);
}
gtk_print_unix_dialog_set_manual_capabilities(
GTK_PRINT_UNIX_DIALOG(dialog),
GTK_PRINT_UNIX_DIALOG(dialog.get()),
GtkPrintCapabilities(
GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_COLLATE |
GTK_PRINT_CAPABILITY_REVERSE | GTK_PRINT_CAPABILITY_SCALE |
@ -315,7 +319,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsPIDOMWindowOuter* aParent,
gtk_box_pack_start(GTK_BOX(custom_options_tab),
header_footer_vertical_squasher, FALSE, FALSE, 0);
gtk_print_unix_dialog_add_custom_tab(GTK_PRINT_UNIX_DIALOG(dialog),
gtk_print_unix_dialog_add_custom_tab(GTK_PRINT_UNIX_DIALOG(dialog.get()),
custom_options_tab, tab_label);
gtk_widget_show_all(custom_options_tab);
}
@ -340,7 +344,7 @@ const char* nsPrintDialogWidgetGTK::OptionWidgetToString(GtkWidget* dropdown) {
}
gint nsPrintDialogWidgetGTK::Run() {
const gint response = gtk_dialog_run(GTK_DIALOG(dialog));
const gint response = gtk_dialog_run(GTK_DIALOG(dialog.get()));
gtk_widget_hide(dialog);
return response;
}
@ -394,8 +398,10 @@ nsresult nsPrintDialogWidgetGTK::ImportSettings(nsIPrintSettings* aNSSettings) {
aNSSettings->GetNumPagesPerSheet(&pagesPerSide);
gtk_print_settings_set_number_up(settings, pagesPerSide);
gtk_print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(dialog), settings);
gtk_print_unix_dialog_set_page_setup(GTK_PRINT_UNIX_DIALOG(dialog), setup);
gtk_print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(dialog.get()),
settings);
gtk_print_unix_dialog_set_page_setup(GTK_PRINT_UNIX_DIALOG(dialog.get()),
setup);
return NS_OK;
}
@ -405,11 +411,11 @@ nsresult nsPrintDialogWidgetGTK::ExportSettings(nsIPrintSettings* aNSSettings) {
NS_ENSURE_TRUE(aNSSettings, NS_ERROR_FAILURE);
GtkPrintSettings* settings =
gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog));
gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog.get()));
GtkPageSetup* setup =
gtk_print_unix_dialog_get_page_setup(GTK_PRINT_UNIX_DIALOG(dialog));
GtkPrinter* printer =
gtk_print_unix_dialog_get_selected_printer(GTK_PRINT_UNIX_DIALOG(dialog));
gtk_print_unix_dialog_get_page_setup(GTK_PRINT_UNIX_DIALOG(dialog.get()));
GtkPrinter* printer = gtk_print_unix_dialog_get_selected_printer(
GTK_PRINT_UNIX_DIALOG(dialog.get()));
if (settings && setup && printer) {
ExportHeaderFooter(aNSSettings);

View file

@ -244,11 +244,13 @@ nsBaseClipboard::AsyncSetClipboardData::SetData(nsITransferable* aTransferable,
MOZ_ASSERT(mClipboard);
MOZ_ASSERT(
mClipboard->nsIClipboard::IsClipboardTypeSupported(mClipboardType));
MOZ_DIAGNOSTIC_ASSERT(mClipboard->mPendingWriteRequests[mClipboardType] ==
this);
RefPtr<AsyncSetClipboardData> selfPin(this);
if (mClipboard->mPendingWriteRequests[mClipboardType] != this) {
return NS_ERROR_IN_PROGRESS;
}
mClipboard->mPendingWriteRequests[mClipboardType] = nullptr;
RefPtr<AsyncSetClipboardData> request =
std::move(mClipboard->mPendingWriteRequests[mClipboardType]);
nsresult rv = mClipboard->SetData(aTransferable, aOwner, mClipboardType,
mWindowContext);
MaybeNotifyCallback(rv);
@ -275,13 +277,13 @@ void nsBaseClipboard::AsyncSetClipboardData::MaybeNotifyCallback(
// take a reference to mClipboard.
MOZ_ASSERT(IsValid());
// Once the callback is notified, setData should not be allowed, so invalidate
// this request.
mClipboard = nullptr;
if (nsCOMPtr<nsIAsyncClipboardRequestCallback> callback =
mCallback.forget()) {
callback->OnComplete(aResult);
}
// Once the callback is notified, setData should not be allowed, so invalidate
// this request.
mClipboard = nullptr;
}
void nsBaseClipboard::RejectPendingAsyncSetDataRequestIfAny(

View file

@ -1947,7 +1947,8 @@ void nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY,
mWidgetListener->WindowMoved(this, aX, aY, aByMoveToRect);
}
if (mIMEHasFocus && IMENotificationRequestsRef().WantPositionChanged()) {
if (mIMEHasFocus && IMENotificationRequestsRef().contains(
IMENotificationRequest::PositionChange)) {
NotifyIME(IMENotification(IMEMessage::NOTIFY_IME_OF_POSITION_CHANGE));
}
}
@ -2371,6 +2372,7 @@ void nsBaseWidget::TrackScrollEventAsSwipe(
mSwipeTracker =
new SwipeTracker(*this, aSwipeStartEvent, aAllowedDirections, direction);
mSwipeTracker->StartTracking(aSwipeStartEvent);
if (!mAPZC) {
mCurrentPanGestureBelongsToSwipe = true;

View file

@ -40,24 +40,22 @@ nsColorPickerProxy::Open(
mozilla::ipc::IPCResult nsColorPickerProxy::RecvUpdate(
const nsAString& aColor) {
if (mCallback) {
mCallback->Update(aColor);
if (nsCOMPtr<nsIColorPickerShownCallback> callback = mCallback) {
callback->Update(aColor);
}
return IPC_OK();
}
mozilla::ipc::IPCResult nsColorPickerProxy::Recv__delete__(
const nsAString& aColor) {
if (mCallback) {
mCallback->Done(aColor);
mCallback = nullptr;
if (nsCOMPtr<nsIColorPickerShownCallback> callback = std::move(mCallback)) {
callback->Done(aColor);
}
return IPC_OK();
}
void nsColorPickerProxy::ActorDestroy(ActorDestroyReason aWhy) {
if (mCallback) {
mCallback->Done(u""_ns);
mCallback = nullptr;
if (nsCOMPtr<nsIColorPickerShownCallback> callback = std::move(mCallback)) {
callback->Done(u""_ns);
}
}

View file

@ -507,14 +507,20 @@ struct ParamTraits<mozilla::WidgetKeyboardEvent> {
}
};
template <>
struct ParamTraits<mozilla::TextRangeStyle::LineStyle>
: ContiguousEnumSerializerInclusive<
mozilla::TextRangeStyle::LineStyle,
mozilla::TextRangeStyle::LineStyle::None,
mozilla::TextRangeStyle::LineStyle::Wavy> {};
template <>
struct ParamTraits<mozilla::TextRangeStyle> {
using paramType = mozilla::TextRangeStyle;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.mDefinedStyles);
WriteParam(aWriter, static_cast<mozilla::TextRangeStyle::LineStyleType>(
aParam.mLineStyle));
WriteParam(aWriter, aParam.mLineStyle);
WriteParam(aWriter, aParam.mIsBoldLine);
WriteParam(aWriter, aParam.mForegroundColor);
WriteParam(aWriter, aParam.mBackgroundColor);
@ -522,20 +528,21 @@ struct ParamTraits<mozilla::TextRangeStyle> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
mozilla::TextRangeStyle::LineStyleType lineStyle;
if (!ReadParam(aReader, &aResult->mDefinedStyles) ||
!ReadParam(aReader, &lineStyle) ||
!ReadParam(aReader, &aResult->mIsBoldLine) ||
!ReadParam(aReader, &aResult->mForegroundColor) ||
!ReadParam(aReader, &aResult->mBackgroundColor) ||
!ReadParam(aReader, &aResult->mUnderlineColor)) {
return false;
}
aResult->mLineStyle = mozilla::TextRangeStyle::ToLineStyle(lineStyle);
return true;
return ReadParam(aReader, &aResult->mDefinedStyles) &&
ReadParam(aReader, &aResult->mLineStyle) &&
ReadParam(aReader, &aResult->mIsBoldLine) &&
ReadParam(aReader, &aResult->mForegroundColor) &&
ReadParam(aReader, &aResult->mBackgroundColor) &&
ReadParam(aReader, &aResult->mUnderlineColor);
}
};
template <>
struct ParamTraits<mozilla::TextRangeType>
: ContiguousEnumSerializerInclusive<
mozilla::TextRangeType, mozilla::TextRangeType::eUninitialized,
mozilla::TextRangeType::eSelectedClause> {};
template <>
struct ParamTraits<mozilla::TextRange> {
using paramType = mozilla::TextRange;
@ -543,20 +550,15 @@ struct ParamTraits<mozilla::TextRange> {
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.mStartOffset);
WriteParam(aWriter, aParam.mEndOffset);
WriteParam(aWriter, mozilla::ToRawTextRangeType(aParam.mRangeType));
WriteParam(aWriter, aParam.mRangeType);
WriteParam(aWriter, aParam.mRangeStyle);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
mozilla::RawTextRangeType rawTextRangeType;
if (ReadParam(aReader, &aResult->mStartOffset) &&
ReadParam(aReader, &aResult->mEndOffset) &&
ReadParam(aReader, &rawTextRangeType) &&
ReadParam(aReader, &aResult->mRangeStyle)) {
aResult->mRangeType = mozilla::ToTextRangeType(rawTextRangeType);
return true;
}
return false;
return ReadParam(aReader, &aResult->mStartOffset) &&
ReadParam(aReader, &aResult->mEndOffset) &&
ReadParam(aReader, &aResult->mRangeType) &&
ReadParam(aReader, &aResult->mRangeStyle);
}
};
@ -668,19 +670,6 @@ struct ParamTraits<mozilla::WidgetSelectionEvent> {
}
};
template <>
struct ParamTraits<mozilla::widget::IMENotificationRequests> {
using paramType = mozilla::widget::IMENotificationRequests;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.mWantUpdates);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, &aResult->mWantUpdates);
}
};
template <>
struct ParamTraits<mozilla::widget::NativeIMEContext> {
using paramType = mozilla::widget::NativeIMEContext;
@ -775,13 +764,22 @@ struct ParamTraits<mozilla::widget::IMENotification::MouseButtonEventData> {
}
};
template <>
struct ParamTraits<mozilla::widget::IMEMessage>
: ContiguousEnumSerializerInclusive<
mozilla::widget::IMEMessage,
// FYI: mozilla::widget::NOTIFY_IME_OF_NOTHING is the actual lowest
// value, but it shouldn't be set at crossing the process boundary
// since it's odd to notify the process of "nothing happened".
mozilla::widget::NOTIFY_IME_OF_FOCUS,
mozilla::widget::REQUEST_TO_CANCEL_COMPOSITION> {};
template <>
struct ParamTraits<mozilla::widget::IMENotification> {
using paramType = mozilla::widget::IMENotification;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter,
static_cast<mozilla::widget::IMEMessageType>(aParam.mMessage));
WriteParam(aWriter, aParam.mMessage);
switch (aParam.mMessage) {
case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE:
WriteParam(aWriter, aParam.mSelectionChangeData);
@ -798,21 +796,29 @@ struct ParamTraits<mozilla::widget::IMENotification> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
mozilla::widget::IMEMessageType IMEMessage = 0;
if (!ReadParam(aReader, &IMEMessage)) {
if (!ReadParam(aReader, &aResult->mMessage)) {
return false;
}
aResult->mMessage = static_cast<mozilla::widget::IMEMessage>(IMEMessage);
switch (aResult->mMessage) {
case mozilla::widget::NOTIFY_IME_OF_NOTHING:
MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE(
"NOTIFY_IME_OF_NOTHING shouldn't cross the process boundary");
return false;
case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE:
return ReadParam(aReader, &aResult->mSelectionChangeData);
case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE:
return ReadParam(aReader, &aResult->mTextChangeData);
case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
return ReadParam(aReader, &aResult->mMouseButtonEventData);
default:
case mozilla::widget::NOTIFY_IME_OF_FOCUS:
case mozilla::widget::NOTIFY_IME_OF_BLUR:
case mozilla::widget::NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
case mozilla::widget::NOTIFY_IME_OF_POSITION_CHANGE:
case mozilla::widget::REQUEST_TO_COMMIT_COMPOSITION:
case mozilla::widget::REQUEST_TO_CANCEL_COMPOSITION:
return true;
}
return false;
}
};
@ -1032,6 +1038,16 @@ struct ParamTraits<mozilla::InputData> {
WriteParam(aWriter, aParam.mLayersId);
}
template <typename T>
static bool Read(MessageReader* aReader, mozilla::InputType aInputType,
T* aResult) {
if (!Read(aReader, static_cast<mozilla::InputData*>(aResult))) {
return false;
}
return aResult->mInputType == aInputType;
}
private:
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, &aResult->mInputType) &&
ReadParam(aReader, &aResult->mTimeStamp) &&
@ -1118,7 +1134,8 @@ struct ParamTraits<mozilla::MultiTouchInput> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, static_cast<mozilla::InputData*>(aResult)) &&
return ParamTraits<mozilla::InputData>::Read(
aReader, mozilla::MULTITOUCH_INPUT, aResult) &&
ReadParam(aReader, &aResult->mType) &&
ReadParam(aReader, &aResult->mTouches) &&
ReadParam(aReader, &aResult->mHandledByAPZ) &&
@ -1160,7 +1177,8 @@ struct ParamTraits<mozilla::MouseInput> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, static_cast<mozilla::InputData*>(aResult)) &&
return ParamTraits<mozilla::InputData>::Read(aReader, mozilla::MOUSE_INPUT,
aResult) &&
ReadParam(aReader, &aResult->mButtonType) &&
ReadParam(aReader, &aResult->mType) &&
ReadParam(aReader, &aResult->mInputSource) &&
@ -1211,7 +1229,8 @@ struct ParamTraits<mozilla::PanGestureInput>
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, static_cast<mozilla::InputData*>(aResult)) &&
return ParamTraits<mozilla::InputData>::Read(
aReader, mozilla::PANGESTURE_INPUT, aResult) &&
ReadParam(aReader, &aResult->mType) &&
ReadParam(aReader, &aResult->mPanStartPoint) &&
ReadParam(aReader, &aResult->mPanDisplacement) &&
@ -1267,7 +1286,8 @@ struct ParamTraits<mozilla::PinchGestureInput> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, static_cast<mozilla::InputData*>(aResult)) &&
return ParamTraits<mozilla::InputData>::Read(
aReader, mozilla::PINCHGESTURE_INPUT, aResult) &&
ReadParam(aReader, &aResult->mType) &&
ReadParam(aReader, &aResult->mSource) &&
ReadParam(aReader, &aResult->mScreenOffset) &&
@ -1299,7 +1319,8 @@ struct ParamTraits<mozilla::TapGestureInput> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, static_cast<mozilla::InputData*>(aResult)) &&
return ParamTraits<mozilla::InputData>::Read(
aReader, mozilla::TAPGESTURE_INPUT, aResult) &&
ReadParam(aReader, &aResult->mType) &&
ReadParam(aReader, &aResult->mPoint) &&
ReadParam(aReader, &aResult->mLocalPoint);
@ -1362,7 +1383,8 @@ struct ParamTraits<mozilla::ScrollWheelInput> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, static_cast<mozilla::InputData*>(aResult)) &&
return ParamTraits<mozilla::InputData>::Read(
aReader, mozilla::SCROLLWHEEL_INPUT, aResult) &&
ReadParam(aReader, &aResult->mDeltaType) &&
ReadParam(aReader, &aResult->mScrollMode) &&
ReadParam(aReader, &aResult->mOrigin) &&
@ -1406,7 +1428,8 @@ struct ParamTraits<mozilla::KeyboardInput> {
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, static_cast<mozilla::InputData*>(aResult)) &&
return ParamTraits<mozilla::InputData>::Read(
aReader, mozilla::KEYBOARD_INPUT, aResult) &&
ReadParam(aReader, &aResult->mType) &&
ReadParam(aReader, &aResult->mKeyCode) &&
ReadParam(aReader, &aResult->mCharCode) &&

View file

@ -343,6 +343,7 @@ class nsIWidget : public nsISupports {
typedef mozilla::widget::IMEEnabled IMEEnabled;
typedef mozilla::widget::IMEMessage IMEMessage;
typedef mozilla::widget::IMENotification IMENotification;
typedef mozilla::widget::IMENotificationRequest IMENotificationRequest;
typedef mozilla::widget::IMENotificationRequests IMENotificationRequests;
typedef mozilla::widget::IMEState IMEState;
typedef mozilla::widget::InputContext InputContext;

View file

@ -114,6 +114,7 @@ void DataStruct::GetData(nsISupports** aData) {
void DataStruct::ClearData() {
if (mCacheFD) {
PR_Close(mCacheFD);
mCacheFD = nullptr;
}
mData = nullptr;
}

View file

@ -36,7 +36,7 @@ nsresult TextInputHandler::NotifyIME(TextEventDispatcher* aTextEventDispatcher,
}
IMENotificationRequests TextInputHandler::GetIMENotificationRequests() {
return IMENotificationRequests();
return IMENotificationRequests{};
}
void TextInputHandler::OnRemovedFrom(

View file

@ -347,9 +347,8 @@ UINT IMMHandler::GetKeyboardCodePage() { return sCodePage; }
// static
IMENotificationRequests IMMHandler::GetIMENotificationRequests() {
return IMENotificationRequests(
IMENotificationRequests::NOTIFY_POSITION_CHANGE |
IMENotificationRequests::NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR);
return {IMENotificationRequest::PositionChange,
IMENotificationRequest::MouseEventOnChar};
}
// used for checking the lParam of WM_IME_COMPOSITION

View file

@ -497,7 +497,7 @@ nsresult TSFEmptyTextStore::SetFocusAndUpdateDocumentURLAndBrowsingMode(
}
IMENotificationRequests TSFEmptyTextStore::GetIMENotificationRequests() const {
return IMENotificationRequests();
return {};
}
} // namespace mozilla::widget

View file

@ -3189,7 +3189,7 @@ IMENotificationRequests TSFTextStore::GetIMENotificationRequests() const {
if (NS_WARN_IF(!mDocumentMgr)) {
// If there is no active text store, we don't need any notifications
// since there is no sink which needs notifications.
return IMENotificationRequests();
return {};
}
// Otherwise, requests all notifications since even if some of them may not
@ -3207,11 +3207,10 @@ IMENotificationRequests TSFTextStore::GetIMENotificationRequests() const {
// focused element isn't changed. Therefore, if sEnabledTextStore isn't
// nullptr, we need to keep notifying the sink even when it is not focused
// text store for the thread manager.
return IMENotificationRequests(
IMENotificationRequests::NOTIFY_TEXT_CHANGE |
IMENotificationRequests::NOTIFY_POSITION_CHANGE |
IMENotificationRequests::NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR |
IMENotificationRequests::NOTIFY_DURING_DEACTIVE);
return {IMENotificationRequest::TextChange,
IMENotificationRequest::PositionChange,
IMENotificationRequest::MouseEventOnChar,
IMENotificationRequest::NotifyDuringInactive};
}
nsresult TSFTextStore::OnTextChangeInternal(

View file

@ -622,7 +622,7 @@ void TSFUtils::ClearStoringTextStoresIf(
IMENotificationRequests TSFUtils::GetIMENotificationRequests() {
return sCurrentTextStore ? sCurrentTextStore->GetIMENotificationRequests()
: IMENotificationRequests();
: IMENotificationRequests{};
}
inline std::ostream& operator<<(

View file

@ -41,9 +41,6 @@ namespace mozilla::widget {
class TSFEmptyTextStore;
class TSFTextStore;
class TSFTextStoreBase;
struct IMENotificationRequests;
struct InputContext;
struct InputContextAction;
class TSFUtils final {
public:

View file

@ -361,7 +361,7 @@ IMENotificationRequests IMEHandler::GetIMENotificationRequests() {
// an editor has focus isn't supported by IMEContentObserver nor
// ContentCacheInParent. Therefore, we need to request whole notifications
// which are necessary either IMMHandler or TSFTextStore.
return IMMHandler::GetIMENotificationRequests() |
return IMMHandler::GetIMENotificationRequests() +
TSFUtils::GetIMENotificationRequests();
}