summaryrefslogtreecommitdiffstats
path: root/widget/TextEvents.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /widget/TextEvents.h
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/TextEvents.h')
-rw-r--r--widget/TextEvents.h60
1 files changed, 47 insertions, 13 deletions
diff --git a/widget/TextEvents.h b/widget/TextEvents.h
index 71d2e656e2..3f42561c75 100644
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -1442,13 +1442,8 @@ class WidgetSelectionEvent : public WidgetGUIEvent {
******************************************************************************/
class InternalEditorInputEvent : public InternalUIEvent {
- private:
- InternalEditorInputEvent()
- : mData(VoidString()),
- mInputType(EditorInputType::eUnknown),
- mIsComposing(false) {}
-
public:
+ InternalEditorInputEvent() = delete;
virtual InternalEditorInputEvent* AsEditorInputEvent() override {
return this;
}
@@ -1457,9 +1452,7 @@ class InternalEditorInputEvent : public InternalUIEvent {
nsIWidget* aWidget = nullptr,
const WidgetEventTime* aTime = nullptr)
: InternalUIEvent(aIsTrusted, aMessage, aWidget, eEditorInputEventClass,
- aTime),
- mData(VoidString()),
- mInputType(EditorInputType::eUnknown) {}
+ aTime) {}
virtual WidgetEvent* Duplicate() const override {
MOZ_ASSERT(mClass == eEditorInputEventClass,
@@ -1472,13 +1465,13 @@ class InternalEditorInputEvent : public InternalUIEvent {
return result;
}
- nsString mData;
+ nsString mData = VoidString();
RefPtr<dom::DataTransfer> mDataTransfer;
OwningNonNullStaticRangeArray mTargetRanges;
- EditorInputType mInputType;
+ EditorInputType mInputType = EditorInputType::eUnknown;
- bool mIsComposing;
+ bool mIsComposing = false;
void AssignEditorInputEventData(const InternalEditorInputEvent& aEvent,
bool aCopyTargets) {
@@ -1502,10 +1495,51 @@ class InternalEditorInputEvent : public InternalUIEvent {
private:
static const char16_t* const kInputTypeNames[];
- typedef nsTHashMap<nsStringHashKey, EditorInputType> InputTypeHashtable;
+ using InputTypeHashtable = nsTHashMap<nsStringHashKey, EditorInputType>;
static InputTypeHashtable* sInputTypeHashtable;
};
+/******************************************************************************
+ * mozilla::InternalLegacyTextEvent
+ ******************************************************************************/
+
+class InternalLegacyTextEvent : public InternalUIEvent {
+ public:
+ InternalLegacyTextEvent() = delete;
+
+ virtual InternalLegacyTextEvent* AsLegacyTextEvent() override { return this; }
+
+ InternalLegacyTextEvent(bool aIsTrusted, EventMessage aMessage,
+ nsIWidget* aWidget = nullptr,
+ const WidgetEventTime* aTime = nullptr)
+ : InternalUIEvent(aIsTrusted, aMessage, aWidget, eLegacyTextEventClass,
+ aTime) {}
+
+ virtual WidgetEvent* Duplicate() const override {
+ MOZ_ASSERT(mClass == eLegacyTextEventClass,
+ "Duplicate() must be overridden by sub class");
+ // Not copying widget, it is a weak reference.
+ InternalLegacyTextEvent* result =
+ new InternalLegacyTextEvent(false, mMessage, nullptr, this);
+ result->AssignLegacyTextEventData(*this, true);
+ result->mFlags = mFlags;
+ return result;
+ }
+
+ nsString mData;
+ RefPtr<dom::DataTransfer> mDataTransfer;
+ EditorInputType mInputType = EditorInputType::eUnknown;
+
+ void AssignLegacyTextEventData(const InternalLegacyTextEvent& aEvent,
+ bool aCopyTargets) {
+ AssignUIEventData(aEvent, aCopyTargets);
+
+ mData = aEvent.mData;
+ mDataTransfer = aEvent.mDataTransfer;
+ mInputType = aEvent.mInputType;
+ }
+};
+
} // namespace mozilla
#endif // mozilla_TextEvents_h__