2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-08-08 18:47:19 +03:00
|
|
|
/* 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_IMEData_h_
|
|
|
|
#define mozilla_widget_IMEData_h_
|
|
|
|
|
2020-11-26 13:34:13 +03:00
|
|
|
#include "mozilla/CheckedInt.h"
|
2020-05-01 06:02:13 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2020-12-02 08:32:19 +03:00
|
|
|
#include "mozilla/ToString.h"
|
2020-05-01 06:02:13 +03:00
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsRect.h"
|
2017-12-07 03:52:51 +03:00
|
|
|
#include "nsString.h"
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
#include "Units.h"
|
2015-08-08 18:47:19 +03:00
|
|
|
|
2015-12-11 09:15:57 +03:00
|
|
|
class nsIWidget;
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class WritingMode;
|
|
|
|
|
2020-11-26 13:34:13 +03:00
|
|
|
// Helper class to logging string which may contain various Unicode characters
|
|
|
|
// and/or may be too long string for logging.
|
|
|
|
class MOZ_STACK_CLASS PrintStringDetail : public nsAutoCString {
|
|
|
|
public:
|
|
|
|
static constexpr uint32_t kMaxLengthForCompositionString = 8;
|
2020-11-27 17:48:03 +03:00
|
|
|
static constexpr uint32_t kMaxLengthForSelectedString = 12;
|
2020-11-26 15:37:30 +03:00
|
|
|
static constexpr uint32_t kMaxLengthForEditor = 20;
|
2020-11-26 13:34:13 +03:00
|
|
|
|
|
|
|
PrintStringDetail() = delete;
|
|
|
|
explicit PrintStringDetail(const nsAString& aString,
|
|
|
|
uint32_t aMaxLength = UINT32_MAX);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static nsCString PrintCharData(char32_t aChar);
|
|
|
|
};
|
|
|
|
|
2020-11-26 15:37:42 +03:00
|
|
|
// StartAndEndOffsets represents a range in flat-text.
|
|
|
|
template <typename IntType>
|
|
|
|
class StartAndEndOffsets {
|
|
|
|
protected:
|
|
|
|
static IntType MaxOffset() { return std::numeric_limits<IntType>::max(); }
|
|
|
|
|
|
|
|
public:
|
|
|
|
StartAndEndOffsets() = delete;
|
|
|
|
explicit StartAndEndOffsets(IntType aStartOffset, IntType aEndOffset)
|
|
|
|
: mStartOffset(aStartOffset),
|
|
|
|
mEndOffset(aStartOffset <= aEndOffset ? aEndOffset : aStartOffset) {
|
|
|
|
MOZ_ASSERT(aStartOffset <= mEndOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
IntType StartOffset() const { return mStartOffset; }
|
|
|
|
IntType Length() const { return mEndOffset - mStartOffset; }
|
|
|
|
IntType EndOffset() const { return mEndOffset; }
|
|
|
|
|
|
|
|
bool IsOffsetInRange(IntType aOffset) const {
|
|
|
|
return aOffset >= mStartOffset && aOffset < mEndOffset;
|
|
|
|
}
|
|
|
|
bool IsOffsetInRangeOrEndOffset(IntType aOffset) const {
|
|
|
|
return aOffset >= mStartOffset && aOffset <= mEndOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MoveTo(IntType aNewStartOffset) {
|
|
|
|
auto delta = static_cast<int64_t>(mStartOffset) - aNewStartOffset;
|
|
|
|
mStartOffset += delta;
|
|
|
|
mEndOffset += delta;
|
|
|
|
}
|
|
|
|
void SetOffsetAndLength(IntType aNewOffset, IntType aNewLength) {
|
|
|
|
mStartOffset = aNewOffset;
|
|
|
|
CheckedInt<IntType> endOffset(aNewOffset + aNewLength);
|
|
|
|
mEndOffset = endOffset.isValid() ? endOffset.value() : MaxOffset();
|
|
|
|
}
|
|
|
|
void SetEndOffset(IntType aEndOffset) {
|
|
|
|
MOZ_ASSERT(mStartOffset <= aEndOffset);
|
|
|
|
mEndOffset = std::max(aEndOffset, mStartOffset);
|
|
|
|
}
|
|
|
|
void SetStartAndEndOffsets(IntType aStartOffset, IntType aEndOffset) {
|
|
|
|
MOZ_ASSERT(aStartOffset <= aEndOffset);
|
|
|
|
mStartOffset = aStartOffset;
|
|
|
|
mEndOffset = aStartOffset <= aEndOffset ? aEndOffset : aStartOffset;
|
|
|
|
}
|
|
|
|
void SetLength(IntType aNewLength) {
|
|
|
|
CheckedInt<IntType> endOffset(mStartOffset + aNewLength);
|
|
|
|
mEndOffset = endOffset.isValid() ? endOffset.value() : MaxOffset();
|
|
|
|
}
|
|
|
|
|
|
|
|
friend std::ostream& operator<<(
|
|
|
|
std::ostream& aStream,
|
|
|
|
const StartAndEndOffsets<IntType>& aStartAndEndOffsets) {
|
|
|
|
aStream << "{ mStartOffset=" << aStartAndEndOffsets.mStartOffset
|
|
|
|
<< ", mEndOffset=" << aStartAndEndOffsets.mEndOffset
|
|
|
|
<< ", Length()=" << aStartAndEndOffsets.Length() << " }";
|
|
|
|
return aStream;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
IntType mStartOffset;
|
|
|
|
IntType mEndOffset;
|
|
|
|
};
|
|
|
|
|
2020-11-26 13:34:13 +03:00
|
|
|
// OffsetAndData class is designed for storing composition string and its
|
|
|
|
// start offset. Length() and EndOffset() return only valid length or
|
|
|
|
// offset. I.e., if the string is too long for inserting at the offset,
|
|
|
|
// the length is shrunken. However, the string itself is not shrunken.
|
|
|
|
// Therefore, moving it to where all of the string can be contained,
|
|
|
|
// they will return longer/bigger value.
|
2020-12-02 08:32:19 +03:00
|
|
|
enum class OffsetAndDataFor {
|
|
|
|
CompositionString,
|
|
|
|
SelectedString,
|
|
|
|
EditorString,
|
|
|
|
};
|
2020-11-26 13:34:13 +03:00
|
|
|
template <typename IntType>
|
|
|
|
class OffsetAndData {
|
|
|
|
protected:
|
|
|
|
static IntType MaxOffset() { return std::numeric_limits<IntType>::max(); }
|
|
|
|
|
|
|
|
public:
|
|
|
|
OffsetAndData() = delete;
|
2020-12-02 08:32:19 +03:00
|
|
|
explicit OffsetAndData(
|
|
|
|
IntType aStartOffset, const nsAString& aData,
|
|
|
|
OffsetAndDataFor aFor = OffsetAndDataFor::CompositionString)
|
|
|
|
: mData(aData), mOffset(aStartOffset), mFor(aFor) {}
|
2020-11-26 13:34:13 +03:00
|
|
|
|
|
|
|
IntType StartOffset() const { return mOffset; }
|
|
|
|
IntType Length() const {
|
|
|
|
CheckedInt<IntType> endOffset(mOffset + mData.Length());
|
|
|
|
return endOffset.isValid() ? mData.Length() : MaxOffset() - mOffset;
|
|
|
|
}
|
|
|
|
IntType EndOffset() const { return mOffset + Length(); }
|
2020-11-26 15:37:42 +03:00
|
|
|
StartAndEndOffsets<IntType> CreateStartAndEndOffsets() const {
|
|
|
|
return StartAndEndOffsets<IntType>(StartOffset(), EndOffset());
|
|
|
|
}
|
2020-11-26 13:34:13 +03:00
|
|
|
const nsString& DataRef() const {
|
|
|
|
// In strictly speaking, we should return substring which may be shrunken
|
|
|
|
// for rounding to the max offset. However, it's unrealistic edge case,
|
|
|
|
// and creating new string is not so cheap job in a hot path. Therefore,
|
|
|
|
// this just returns the data as-is.
|
|
|
|
return mData;
|
|
|
|
}
|
2020-12-02 08:32:19 +03:00
|
|
|
bool IsDataEmpty() const { return mData.IsEmpty(); }
|
2020-11-26 13:34:13 +03:00
|
|
|
|
|
|
|
bool IsOffsetInRange(IntType aOffset) const {
|
|
|
|
return aOffset >= mOffset && aOffset < EndOffset();
|
|
|
|
}
|
|
|
|
bool IsOffsetInRangeOrEndOffset(IntType aOffset) const {
|
|
|
|
return aOffset >= mOffset && aOffset <= EndOffset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MoveTo(IntType aNewOffset) { mOffset = aNewOffset; }
|
|
|
|
void SetOffsetAndData(IntType aStartOffset, const nsAString& aData) {
|
|
|
|
mOffset = aStartOffset;
|
|
|
|
mData = aData;
|
|
|
|
}
|
|
|
|
void SetData(const nsAString& aData) { mData = aData; }
|
2020-12-02 08:32:19 +03:00
|
|
|
void TruncateData(uint32_t aLength = 0) { mData.Truncate(aLength); }
|
2020-11-26 13:34:13 +03:00
|
|
|
void ReplaceData(nsAString::size_type aCutStart,
|
|
|
|
nsAString::size_type aCutLength,
|
|
|
|
const nsAString& aNewString) {
|
|
|
|
mData.Replace(aCutStart, aCutLength, aNewString);
|
|
|
|
}
|
|
|
|
|
|
|
|
friend std::ostream& operator<<(
|
|
|
|
std::ostream& aStream, const OffsetAndData<IntType>& aOffsetAndData) {
|
2020-12-02 08:32:19 +03:00
|
|
|
const auto maxDataLength =
|
|
|
|
aOffsetAndData.mFor == OffsetAndDataFor::CompositionString
|
|
|
|
? PrintStringDetail::kMaxLengthForCompositionString
|
|
|
|
: (aOffsetAndData.mFor == OffsetAndDataFor::SelectedString
|
|
|
|
? PrintStringDetail::kMaxLengthForSelectedString
|
|
|
|
: PrintStringDetail::kMaxLengthForEditor);
|
2020-11-26 13:34:13 +03:00
|
|
|
aStream << "{ mOffset=" << aOffsetAndData.mOffset << ", mData="
|
2020-12-02 08:32:19 +03:00
|
|
|
<< PrintStringDetail(aOffsetAndData.mData, maxDataLength).get()
|
2020-11-26 13:34:13 +03:00
|
|
|
<< ", Length()=" << aOffsetAndData.Length()
|
|
|
|
<< ", EndOffset()=" << aOffsetAndData.EndOffset() << " }";
|
|
|
|
return aStream;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsString mData;
|
|
|
|
IntType mOffset;
|
2020-12-02 08:32:19 +03:00
|
|
|
OffsetAndDataFor mFor;
|
2020-11-26 13:34:13 +03:00
|
|
|
};
|
|
|
|
|
2017-04-11 15:24:55 +03:00
|
|
|
namespace widget {
|
2015-08-08 18:47:19 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Preference for receiving IME updates
|
|
|
|
*
|
|
|
|
* If mWantUpdates is not NOTIFY_NOTHING, nsTextStateManager 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.
|
|
|
|
* If the IME implementation needs notifications even while our process is
|
|
|
|
* deactive, it should also set NOTIFY_DURING_DEACTIVE.
|
|
|
|
*/
|
2017-04-11 15:24:55 +03:00
|
|
|
struct IMENotificationRequests final {
|
2015-08-08 18:47:19 +03:00
|
|
|
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).
|
2017-05-08 14:07:56 +03:00
|
|
|
NOTIFY_DURING_DEACTIVE = 1 << 7,
|
|
|
|
|
|
|
|
NOTIFY_ALL = NOTIFY_TEXT_CHANGE | NOTIFY_POSITION_CHANGE |
|
|
|
|
NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR,
|
2015-08-08 18:47:19 +03:00
|
|
|
};
|
|
|
|
|
2016-06-28 10:51:59 +03:00
|
|
|
IMENotificationRequests() : mWantUpdates(NOTIFY_NOTHING) {}
|
2015-08-08 18:47:19 +03:00
|
|
|
|
2017-04-11 15:24:55 +03:00
|
|
|
explicit IMENotificationRequests(Notifications aWantUpdates)
|
2016-06-28 10:51:59 +03:00
|
|
|
: mWantUpdates(aWantUpdates) {}
|
2015-08-08 18:47:19 +03:00
|
|
|
|
2017-04-11 15:24:55 +03:00
|
|
|
IMENotificationRequests operator|(
|
|
|
|
const IMENotificationRequests& aOther) const {
|
|
|
|
return IMENotificationRequests(aOther.mWantUpdates | mWantUpdates);
|
2015-12-22 08:58:48 +03:00
|
|
|
}
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
IMENotificationRequests& operator|=(const IMENotificationRequests& aOther) {
|
|
|
|
mWantUpdates |= aOther.mWantUpdates;
|
|
|
|
return *this;
|
|
|
|
}
|
2017-04-13 08:32:12 +03:00
|
|
|
bool operator==(const IMENotificationRequests& aOther) const {
|
|
|
|
return mWantUpdates == aOther.mWantUpdates;
|
|
|
|
}
|
2015-12-22 08:58:48 +03:00
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
bool WantTextChange() const { return !!(mWantUpdates & NOTIFY_TEXT_CHANGE); }
|
|
|
|
|
|
|
|
bool WantPositionChanged() const {
|
|
|
|
return !!(mWantUpdates & NOTIFY_POSITION_CHANGE);
|
|
|
|
}
|
|
|
|
|
2016-06-28 09:23:12 +03:00
|
|
|
bool WantChanges() const { return WantTextChange(); }
|
2015-08-08 18:47:19 +03:00
|
|
|
|
|
|
|
bool WantMouseButtonEventOnChar() const {
|
|
|
|
return !!(mWantUpdates & NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WantDuringDeactive() const {
|
|
|
|
return !!(mWantUpdates & NOTIFY_DURING_DEACTIVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
Notifications mWantUpdates;
|
|
|
|
};
|
|
|
|
|
2020-12-21 08:52:03 +03:00
|
|
|
/**
|
|
|
|
* IME enabled states.
|
|
|
|
*
|
|
|
|
* WARNING: If you change these values, you also need to edit:
|
|
|
|
* nsIDOMWindowUtils.idl
|
|
|
|
*/
|
|
|
|
enum class IMEEnabled {
|
|
|
|
/**
|
|
|
|
* 'Disabled' means the user cannot use IME. So, the IME open state should
|
|
|
|
* be 'closed' during 'disabled'.
|
|
|
|
*/
|
|
|
|
Disabled,
|
|
|
|
/**
|
|
|
|
* 'Enabled' means the user can use IME.
|
|
|
|
*/
|
|
|
|
Enabled,
|
|
|
|
/**
|
|
|
|
* 'Password' state is a special case for the password editors.
|
|
|
|
* E.g., on mac, the password editors should disable the non-Roman
|
|
|
|
* keyboard layouts at getting focus. Thus, the password editor may have
|
|
|
|
* special rules on some platforms.
|
|
|
|
*/
|
|
|
|
Password,
|
|
|
|
/**
|
|
|
|
* 'Unknown' is useful when you cache this enum. So, this shouldn't be
|
|
|
|
* used with nsIWidget::SetInputContext().
|
|
|
|
*/
|
|
|
|
Unknown,
|
|
|
|
};
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
/**
|
2017-05-08 14:07:56 +03:00
|
|
|
* Contains IMEStatus plus information about the current
|
2015-08-08 18:47:19 +03:00
|
|
|
* input context that the IME can use as hints if desired.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct IMEState final {
|
2020-12-21 08:52:03 +03:00
|
|
|
IMEEnabled mEnabled;
|
2015-08-08 18:47:19 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* IME open states the mOpen value of SetInputContext() should be one value of
|
|
|
|
* OPEN, CLOSE or DONT_CHANGE_OPEN_STATE. GetInputContext() should return
|
|
|
|
* OPEN, CLOSE or OPEN_STATE_NOT_SUPPORTED.
|
|
|
|
*/
|
|
|
|
enum Open {
|
|
|
|
/**
|
|
|
|
* 'Unsupported' means the platform cannot return actual IME open state.
|
|
|
|
* This value is used only by GetInputContext().
|
|
|
|
*/
|
|
|
|
OPEN_STATE_NOT_SUPPORTED,
|
|
|
|
/**
|
|
|
|
* 'Don't change' means the widget shouldn't change IME open state when
|
|
|
|
* SetInputContext() is called.
|
|
|
|
*/
|
|
|
|
DONT_CHANGE_OPEN_STATE = OPEN_STATE_NOT_SUPPORTED,
|
|
|
|
/**
|
|
|
|
* 'Open' means that IME should compose in its primary language (or latest
|
|
|
|
* input mode except direct ASCII character input mode). Even if IME is
|
|
|
|
* opened by this value, users should be able to close IME by theirselves.
|
|
|
|
* Web contents can specify this value by |ime-mode: active;|.
|
|
|
|
*/
|
|
|
|
OPEN,
|
|
|
|
/**
|
|
|
|
* 'Closed' means that IME shouldn't handle key events (or should handle
|
|
|
|
* as ASCII character inputs on mobile device). Even if IME is closed by
|
|
|
|
* this value, users should be able to open IME by theirselves.
|
|
|
|
* Web contents can specify this value by |ime-mode: inactive;|.
|
|
|
|
*/
|
|
|
|
CLOSED
|
|
|
|
};
|
|
|
|
Open mOpen;
|
|
|
|
|
2020-12-21 08:52:03 +03:00
|
|
|
IMEState() : mEnabled(IMEEnabled::Enabled), mOpen(DONT_CHANGE_OPEN_STATE) {}
|
2015-08-08 18:47:19 +03:00
|
|
|
|
2020-12-21 08:52:03 +03:00
|
|
|
explicit IMEState(IMEEnabled aEnabled, Open aOpen = DONT_CHANGE_OPEN_STATE)
|
2015-08-08 18:47:19 +03:00
|
|
|
: mEnabled(aEnabled), mOpen(aOpen) {}
|
|
|
|
|
|
|
|
// Returns true if the user can input characters.
|
|
|
|
// This means that a plain text editor, an HTML editor, a password editor or
|
|
|
|
// a plain text editor whose ime-mode is "disabled".
|
|
|
|
bool IsEditable() const {
|
2020-12-21 08:52:03 +03:00
|
|
|
return mEnabled == IMEEnabled::Enabled || mEnabled == IMEEnabled::Password;
|
2015-08-08 18:47:19 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-12-11 09:15:57 +03:00
|
|
|
// NS_ONLY_ONE_NATIVE_IME_CONTEXT is a special value of native IME context.
|
|
|
|
// If there can be only one IME composition in a process, this can be used.
|
|
|
|
#define NS_ONLY_ONE_NATIVE_IME_CONTEXT \
|
|
|
|
(reinterpret_cast<void*>(static_cast<intptr_t>(-1)))
|
|
|
|
|
2015-12-11 09:15:57 +03:00
|
|
|
struct NativeIMEContext final {
|
|
|
|
// Pointer to native IME context. Typically this is the result of
|
|
|
|
// nsIWidget::GetNativeData(NS_RAW_NATIVE_IME_CONTEXT) in the parent process.
|
|
|
|
// See also NS_ONLY_ONE_NATIVE_IME_CONTEXT.
|
|
|
|
uintptr_t mRawNativeIMEContext;
|
|
|
|
// Process ID of the origin of mNativeIMEContext.
|
|
|
|
uint64_t mOriginProcessID;
|
|
|
|
|
2018-06-15 17:48:51 +03:00
|
|
|
NativeIMEContext() : mRawNativeIMEContext(0), mOriginProcessID(0) {
|
2015-12-11 09:15:57 +03:00
|
|
|
Init(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit NativeIMEContext(nsIWidget* aWidget)
|
2018-06-15 17:48:51 +03:00
|
|
|
: mRawNativeIMEContext(0), mOriginProcessID(0) {
|
2015-12-11 09:15:57 +03:00
|
|
|
Init(aWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsValid() const {
|
|
|
|
return mRawNativeIMEContext &&
|
|
|
|
mOriginProcessID != static_cast<uintptr_t>(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init(nsIWidget* aWidget);
|
|
|
|
void InitWithRawNativeIMEContext(const void* aRawNativeIMEContext) {
|
|
|
|
InitWithRawNativeIMEContext(const_cast<void*>(aRawNativeIMEContext));
|
|
|
|
}
|
|
|
|
void InitWithRawNativeIMEContext(void* aRawNativeIMEContext);
|
|
|
|
|
|
|
|
bool operator==(const NativeIMEContext& aOther) const {
|
|
|
|
return mRawNativeIMEContext == aOther.mRawNativeIMEContext &&
|
|
|
|
mOriginProcessID == aOther.mOriginProcessID;
|
|
|
|
}
|
|
|
|
bool operator!=(const NativeIMEContext& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
struct InputContext final {
|
|
|
|
InputContext()
|
2015-12-11 09:15:57 +03:00
|
|
|
: mOrigin(XRE_IsParentProcess() ? ORIGIN_MAIN : ORIGIN_CONTENT),
|
2015-08-08 18:47:19 +03:00
|
|
|
mMayBeIMEUnaware(false),
|
2018-01-05 16:28:00 +03:00
|
|
|
mHasHandledUserInput(false),
|
2017-07-30 20:45:03 +03:00
|
|
|
mInPrivateBrowsing(false) {}
|
2015-08-08 18:47:19 +03:00
|
|
|
|
2017-09-28 11:31:29 +03:00
|
|
|
// If InputContext instance is a static variable, any heap allocated stuff
|
|
|
|
// of its members need to be deleted at XPCOM shutdown. Otherwise, it's
|
|
|
|
// detected as memory leak.
|
|
|
|
void ShutDown() {
|
2018-09-17 12:45:02 +03:00
|
|
|
mHTMLInputType.Truncate();
|
|
|
|
mHTMLInputInputmode.Truncate();
|
|
|
|
mActionHint.Truncate();
|
2020-09-15 17:27:00 +03:00
|
|
|
mAutocapitalize.Truncate();
|
2017-09-28 11:31:29 +03:00
|
|
|
}
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
bool IsPasswordEditor() const {
|
|
|
|
return mHTMLInputType.LowerCaseEqualsLiteral("password");
|
|
|
|
}
|
|
|
|
|
2020-09-15 17:27:00 +03:00
|
|
|
// https://html.spec.whatwg.org/dev/interaction.html#autocapitalization
|
|
|
|
bool IsAutocapitalizeSupported() const {
|
|
|
|
return !mHTMLInputType.EqualsLiteral("password") &&
|
|
|
|
!mHTMLInputType.EqualsLiteral("url") &&
|
|
|
|
!mHTMLInputType.EqualsLiteral("email");
|
|
|
|
}
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
IMEState mIMEState;
|
|
|
|
|
|
|
|
/* The type of the input if the input is a html input field */
|
|
|
|
nsString mHTMLInputType;
|
|
|
|
|
|
|
|
/* The type of the inputmode */
|
|
|
|
nsString mHTMLInputInputmode;
|
|
|
|
|
|
|
|
/* A hint for the action that is performed when the input is submitted */
|
|
|
|
nsString mActionHint;
|
|
|
|
|
2020-09-15 17:27:00 +03:00
|
|
|
/* A hint for autocapitalize */
|
|
|
|
nsString mAutocapitalize;
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
/**
|
|
|
|
* mOrigin indicates whether this focus event refers to main or remote
|
|
|
|
* content.
|
|
|
|
*/
|
|
|
|
enum Origin {
|
|
|
|
// Adjusting focus of content on the main process
|
|
|
|
ORIGIN_MAIN,
|
|
|
|
// Adjusting focus of content in a remote process
|
|
|
|
ORIGIN_CONTENT
|
|
|
|
};
|
|
|
|
Origin mOrigin;
|
|
|
|
|
|
|
|
/* True if the webapp may be unaware of IME events such as input event or
|
|
|
|
* composiion events. This enables a key-events-only mode on Android for
|
|
|
|
* compatibility with webapps relying on key listeners. */
|
|
|
|
bool mMayBeIMEUnaware;
|
|
|
|
|
2017-11-22 01:28:36 +03:00
|
|
|
/**
|
|
|
|
* True if the document has ever received user input
|
|
|
|
*/
|
|
|
|
bool mHasHandledUserInput;
|
|
|
|
|
2017-07-30 20:45:03 +03:00
|
|
|
/* Whether the owning document of the input element has been loaded
|
|
|
|
* in private browsing mode. */
|
|
|
|
bool mInPrivateBrowsing;
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
bool IsOriginMainProcess() const { return mOrigin == ORIGIN_MAIN; }
|
|
|
|
|
|
|
|
bool IsOriginContentProcess() const { return mOrigin == ORIGIN_CONTENT; }
|
|
|
|
|
|
|
|
bool IsOriginCurrentProcess() const {
|
|
|
|
if (XRE_IsParentProcess()) {
|
|
|
|
return IsOriginMainProcess();
|
|
|
|
}
|
|
|
|
return IsOriginContentProcess();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-03 06:28:10 +03:00
|
|
|
// FYI: Implemented in nsBaseWidget.cpp
|
|
|
|
const char* ToChar(InputContext::Origin aOrigin);
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
struct InputContextAction final {
|
|
|
|
/**
|
|
|
|
* mCause indicates what action causes calling nsIWidget::SetInputContext().
|
|
|
|
* It must be one of following values.
|
|
|
|
*/
|
|
|
|
enum Cause {
|
|
|
|
// The cause is unknown but originated from content. Focus might have been
|
|
|
|
// changed by content script.
|
|
|
|
CAUSE_UNKNOWN,
|
|
|
|
// The cause is unknown but originated from chrome. Focus might have been
|
|
|
|
// changed by chrome script.
|
|
|
|
CAUSE_UNKNOWN_CHROME,
|
|
|
|
// The cause is user's keyboard operation.
|
|
|
|
CAUSE_KEY,
|
|
|
|
// The cause is user's mouse operation.
|
2015-11-12 19:36:19 +03:00
|
|
|
CAUSE_MOUSE,
|
|
|
|
// The cause is user's touch operation (implies mouse)
|
Bug 1406446 - part 1: InputContextAction should treat focus change during handling a user input as caused by user input even if it's caused by JS r=smaug
Currently, widget doesn't show VKB when input context change is caused by JS.
However, if it's caused by an event handler of a user input, user may expect
to open VKB. For example, if a touch event in fake editor causes moving
focus to actual editable node, user expect to show VKB.
Therefore, InputContextAction should declare two causes. One is unknown but
occurred during handling non-keyboard event. The other is unknown but occurred
during handling keyboard event.
However, EventStateManager doesn't have an API to check if it's being handling
a keyboard event. Therefore, this patch adds it first.
AutoHandlingUserInputStatePusher sends event type to StartHandlingUserInput()
and StopHandlingUserInput() of EventStateManager and sUserKeyboardEventDepth
manages the number of nested keyboard event handling. Therefore,
EventStateManager::IsHandlingKeyboardInput() can return if it's handling a
keyboard event.
IMEStateManager uses this new API to adjust the cause of changes of input
context.
Finally, InputContextAction::IsUserInput() is renamed to IsHandlingUserInput()
for consistency with EventStateManager and starts to return true when the
input context change is caused by script while it's handling a user input.
MozReview-Commit-ID: 5JsLqdqeGah
--HG--
extra : rebase_source : 9fcf7687d1bf90eeebbf6eac62d4488ff64b083c
2017-10-23 20:46:15 +03:00
|
|
|
CAUSE_TOUCH,
|
2019-06-28 03:39:45 +03:00
|
|
|
// The cause is users' long press operation.
|
|
|
|
CAUSE_LONGPRESS,
|
Bug 1406446 - part 1: InputContextAction should treat focus change during handling a user input as caused by user input even if it's caused by JS r=smaug
Currently, widget doesn't show VKB when input context change is caused by JS.
However, if it's caused by an event handler of a user input, user may expect
to open VKB. For example, if a touch event in fake editor causes moving
focus to actual editable node, user expect to show VKB.
Therefore, InputContextAction should declare two causes. One is unknown but
occurred during handling non-keyboard event. The other is unknown but occurred
during handling keyboard event.
However, EventStateManager doesn't have an API to check if it's being handling
a keyboard event. Therefore, this patch adds it first.
AutoHandlingUserInputStatePusher sends event type to StartHandlingUserInput()
and StopHandlingUserInput() of EventStateManager and sUserKeyboardEventDepth
manages the number of nested keyboard event handling. Therefore,
EventStateManager::IsHandlingKeyboardInput() can return if it's handling a
keyboard event.
IMEStateManager uses this new API to adjust the cause of changes of input
context.
Finally, InputContextAction::IsUserInput() is renamed to IsHandlingUserInput()
for consistency with EventStateManager and starts to return true when the
input context change is caused by script while it's handling a user input.
MozReview-Commit-ID: 5JsLqdqeGah
--HG--
extra : rebase_source : 9fcf7687d1bf90eeebbf6eac62d4488ff64b083c
2017-10-23 20:46:15 +03:00
|
|
|
// The cause is unknown but it occurs during user input except keyboard
|
|
|
|
// input. E.g., an event handler of a user input event moves focus.
|
|
|
|
CAUSE_UNKNOWN_DURING_NON_KEYBOARD_INPUT,
|
|
|
|
// The cause is unknown but it occurs during keyboard input.
|
|
|
|
CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT,
|
2015-08-08 18:47:19 +03:00
|
|
|
};
|
|
|
|
Cause mCause;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mFocusChange indicates what happened for focus.
|
|
|
|
*/
|
|
|
|
enum FocusChange {
|
|
|
|
FOCUS_NOT_CHANGED,
|
|
|
|
// A content got focus.
|
|
|
|
GOT_FOCUS,
|
|
|
|
// Focused content lost focus.
|
|
|
|
LOST_FOCUS,
|
|
|
|
// Menu got pseudo focus that means focused content isn't changed but
|
|
|
|
// keyboard events will be handled by menu.
|
|
|
|
MENU_GOT_PSEUDO_FOCUS,
|
|
|
|
// Menu lost pseudo focus that means focused content will handle keyboard
|
|
|
|
// events.
|
2017-05-19 09:52:59 +03:00
|
|
|
MENU_LOST_PSEUDO_FOCUS,
|
|
|
|
// The widget is created. When a widget is crated, it may need to notify
|
|
|
|
// IME module to initialize its native IME context. In such case, this is
|
|
|
|
// used. I.e., this isn't used by IMEStateManager.
|
|
|
|
WIDGET_CREATED
|
2015-08-08 18:47:19 +03:00
|
|
|
};
|
|
|
|
FocusChange mFocusChange;
|
|
|
|
|
|
|
|
bool ContentGotFocusByTrustedCause() const {
|
|
|
|
return (mFocusChange == GOT_FOCUS && mCause != CAUSE_UNKNOWN);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UserMightRequestOpenVKB() const {
|
Bug 1406446 - part 1: InputContextAction should treat focus change during handling a user input as caused by user input even if it's caused by JS r=smaug
Currently, widget doesn't show VKB when input context change is caused by JS.
However, if it's caused by an event handler of a user input, user may expect
to open VKB. For example, if a touch event in fake editor causes moving
focus to actual editable node, user expect to show VKB.
Therefore, InputContextAction should declare two causes. One is unknown but
occurred during handling non-keyboard event. The other is unknown but occurred
during handling keyboard event.
However, EventStateManager doesn't have an API to check if it's being handling
a keyboard event. Therefore, this patch adds it first.
AutoHandlingUserInputStatePusher sends event type to StartHandlingUserInput()
and StopHandlingUserInput() of EventStateManager and sUserKeyboardEventDepth
manages the number of nested keyboard event handling. Therefore,
EventStateManager::IsHandlingKeyboardInput() can return if it's handling a
keyboard event.
IMEStateManager uses this new API to adjust the cause of changes of input
context.
Finally, InputContextAction::IsUserInput() is renamed to IsHandlingUserInput()
for consistency with EventStateManager and starts to return true when the
input context change is caused by script while it's handling a user input.
MozReview-Commit-ID: 5JsLqdqeGah
--HG--
extra : rebase_source : 9fcf7687d1bf90eeebbf6eac62d4488ff64b083c
2017-10-23 20:46:15 +03:00
|
|
|
// If focus is changed, user must not request to open VKB.
|
|
|
|
if (mFocusChange != FOCUS_NOT_CHANGED) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (mCause) {
|
|
|
|
// If user clicks or touches focused editor, user must request to open
|
|
|
|
// VKB.
|
|
|
|
case CAUSE_MOUSE:
|
|
|
|
case CAUSE_TOUCH:
|
|
|
|
// If script does something during a user input and that causes changing
|
|
|
|
// input context, user might request to open VKB. E.g., user clicks
|
|
|
|
// dummy editor and JS moves focus to an actual editable node. However,
|
|
|
|
// this should return false if the user input is a keyboard event since
|
|
|
|
// physical keyboard operation shouldn't cause opening VKB.
|
|
|
|
case CAUSE_UNKNOWN_DURING_NON_KEYBOARD_INPUT:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
2015-08-08 18:47:19 +03:00
|
|
|
}
|
|
|
|
|
Bug 1406446 - part 1: InputContextAction should treat focus change during handling a user input as caused by user input even if it's caused by JS r=smaug
Currently, widget doesn't show VKB when input context change is caused by JS.
However, if it's caused by an event handler of a user input, user may expect
to open VKB. For example, if a touch event in fake editor causes moving
focus to actual editable node, user expect to show VKB.
Therefore, InputContextAction should declare two causes. One is unknown but
occurred during handling non-keyboard event. The other is unknown but occurred
during handling keyboard event.
However, EventStateManager doesn't have an API to check if it's being handling
a keyboard event. Therefore, this patch adds it first.
AutoHandlingUserInputStatePusher sends event type to StartHandlingUserInput()
and StopHandlingUserInput() of EventStateManager and sUserKeyboardEventDepth
manages the number of nested keyboard event handling. Therefore,
EventStateManager::IsHandlingKeyboardInput() can return if it's handling a
keyboard event.
IMEStateManager uses this new API to adjust the cause of changes of input
context.
Finally, InputContextAction::IsUserInput() is renamed to IsHandlingUserInput()
for consistency with EventStateManager and starts to return true when the
input context change is caused by script while it's handling a user input.
MozReview-Commit-ID: 5JsLqdqeGah
--HG--
extra : rebase_source : 9fcf7687d1bf90eeebbf6eac62d4488ff64b083c
2017-10-23 20:46:15 +03:00
|
|
|
/**
|
|
|
|
* IsHandlingUserInput() returns true if it's caused by a user action directly
|
|
|
|
* or it's caused by script or something but it occurred while we're handling
|
|
|
|
* a user action. E.g., when it's caused by Element.focus() in an event
|
|
|
|
* handler of a user input, this returns true.
|
|
|
|
*/
|
|
|
|
static bool IsHandlingUserInput(Cause aCause) {
|
2016-02-09 22:39:55 +03:00
|
|
|
switch (aCause) {
|
|
|
|
case CAUSE_KEY:
|
|
|
|
case CAUSE_MOUSE:
|
|
|
|
case CAUSE_TOUCH:
|
2019-06-28 03:39:45 +03:00
|
|
|
case CAUSE_LONGPRESS:
|
Bug 1406446 - part 1: InputContextAction should treat focus change during handling a user input as caused by user input even if it's caused by JS r=smaug
Currently, widget doesn't show VKB when input context change is caused by JS.
However, if it's caused by an event handler of a user input, user may expect
to open VKB. For example, if a touch event in fake editor causes moving
focus to actual editable node, user expect to show VKB.
Therefore, InputContextAction should declare two causes. One is unknown but
occurred during handling non-keyboard event. The other is unknown but occurred
during handling keyboard event.
However, EventStateManager doesn't have an API to check if it's being handling
a keyboard event. Therefore, this patch adds it first.
AutoHandlingUserInputStatePusher sends event type to StartHandlingUserInput()
and StopHandlingUserInput() of EventStateManager and sUserKeyboardEventDepth
manages the number of nested keyboard event handling. Therefore,
EventStateManager::IsHandlingKeyboardInput() can return if it's handling a
keyboard event.
IMEStateManager uses this new API to adjust the cause of changes of input
context.
Finally, InputContextAction::IsUserInput() is renamed to IsHandlingUserInput()
for consistency with EventStateManager and starts to return true when the
input context change is caused by script while it's handling a user input.
MozReview-Commit-ID: 5JsLqdqeGah
--HG--
extra : rebase_source : 9fcf7687d1bf90eeebbf6eac62d4488ff64b083c
2017-10-23 20:46:15 +03:00
|
|
|
case CAUSE_UNKNOWN_DURING_NON_KEYBOARD_INPUT:
|
|
|
|
case CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT:
|
2016-02-09 22:39:55 +03:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Bug 1406446 - part 1: InputContextAction should treat focus change during handling a user input as caused by user input even if it's caused by JS r=smaug
Currently, widget doesn't show VKB when input context change is caused by JS.
However, if it's caused by an event handler of a user input, user may expect
to open VKB. For example, if a touch event in fake editor causes moving
focus to actual editable node, user expect to show VKB.
Therefore, InputContextAction should declare two causes. One is unknown but
occurred during handling non-keyboard event. The other is unknown but occurred
during handling keyboard event.
However, EventStateManager doesn't have an API to check if it's being handling
a keyboard event. Therefore, this patch adds it first.
AutoHandlingUserInputStatePusher sends event type to StartHandlingUserInput()
and StopHandlingUserInput() of EventStateManager and sUserKeyboardEventDepth
manages the number of nested keyboard event handling. Therefore,
EventStateManager::IsHandlingKeyboardInput() can return if it's handling a
keyboard event.
IMEStateManager uses this new API to adjust the cause of changes of input
context.
Finally, InputContextAction::IsUserInput() is renamed to IsHandlingUserInput()
for consistency with EventStateManager and starts to return true when the
input context change is caused by script while it's handling a user input.
MozReview-Commit-ID: 5JsLqdqeGah
--HG--
extra : rebase_source : 9fcf7687d1bf90eeebbf6eac62d4488ff64b083c
2017-10-23 20:46:15 +03:00
|
|
|
bool IsHandlingUserInput() const { return IsHandlingUserInput(mCause); }
|
2017-09-18 17:33:58 +03:00
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
InputContextAction()
|
|
|
|
: mCause(CAUSE_UNKNOWN), mFocusChange(FOCUS_NOT_CHANGED) {}
|
|
|
|
|
|
|
|
explicit InputContextAction(Cause aCause,
|
|
|
|
FocusChange aFocusChange = FOCUS_NOT_CHANGED)
|
|
|
|
: mCause(aCause), mFocusChange(aFocusChange) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
enum IMEMessage : IMEMessageType {
|
|
|
|
// This is used by IMENotification internally. This means that the instance
|
|
|
|
// hasn't been initialized yet.
|
|
|
|
NOTIFY_IME_OF_NOTHING,
|
|
|
|
// An editable content is getting focus
|
|
|
|
NOTIFY_IME_OF_FOCUS,
|
|
|
|
// An editable content is losing focus
|
|
|
|
NOTIFY_IME_OF_BLUR,
|
|
|
|
// Selection in the focused editable content is changed
|
|
|
|
NOTIFY_IME_OF_SELECTION_CHANGE,
|
|
|
|
// Text in the focused editable content is changed
|
|
|
|
NOTIFY_IME_OF_TEXT_CHANGE,
|
2016-05-31 05:39:15 +03:00
|
|
|
// Notified when a dispatched composition event is handled by the
|
|
|
|
// contents. This must be notified after the other notifications.
|
|
|
|
// Note that if a remote process has focus, this is notified only once when
|
|
|
|
// all dispatched events are handled completely. So, the receiver shouldn't
|
|
|
|
// count number of received this notification for comparing with the number
|
|
|
|
// of dispatched events.
|
Bug 1275906 part.2 TextComposition should use IMEContentObserver for sending NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED if the editor which has the composition is in the active IMEContentObserver r=smaug
For sending NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED after the other change notifications which was caused by the user input, we need to use IMEContentObserver::IMENotificationSender because it sends the notifications when it's safe to do it.
This patch makes TextComposition use IMEContentObserver to send the notification. However, if there is no active IMEContentObserver, e.g., composition events are fired on unfocused window, TextComposition sends it by itself (same as current implementation).
If IMEContentObserver stops observing when it has pending NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED, it cannot send the notification (i.e., it is discarded completely in such case). However, in such case, IMEContentObserver sends NOTIFY_IME_OF_BLUR. So, anyway, native IME handler should treat the blur notification as it including NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.
On the other hand, we're buggy if composition events are fired in non-active window. Even in such case, IMEContentObserver should be created for active editor in each document and it notifies IME of the changes. But this is out of the scope of this bug.
MozReview-Commit-ID: 7Q0ZsJTh4hX
--HG--
extra : rebase_source : 6417f991fa8c0fbe3f25b27bacf4257e5485aecc
2016-06-01 16:14:41 +03:00
|
|
|
// NOTE: If a composition event causes moving focus from the focused editor,
|
|
|
|
// this notification may not be notified as usual. Even in such case,
|
|
|
|
// NOTIFY_IME_OF_BLUR is always sent. So, notification listeners
|
|
|
|
// should tread the blur notification as including this if there is
|
|
|
|
// pending composition events.
|
2016-05-31 05:39:15 +03:00
|
|
|
NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED,
|
2015-08-08 18:47:19 +03:00
|
|
|
// Position or size of focused element may be changed.
|
|
|
|
NOTIFY_IME_OF_POSITION_CHANGE,
|
|
|
|
// Mouse button event is fired on a character in focused editor
|
|
|
|
NOTIFY_IME_OF_MOUSE_BUTTON_EVENT,
|
|
|
|
// Request to commit current composition to IME
|
|
|
|
// (some platforms may not support)
|
|
|
|
REQUEST_TO_COMMIT_COMPOSITION,
|
|
|
|
// Request to cancel current composition to IME
|
|
|
|
// (some platforms may not support)
|
|
|
|
REQUEST_TO_CANCEL_COMPOSITION
|
|
|
|
};
|
|
|
|
|
2016-05-31 05:39:15 +03:00
|
|
|
// FYI: Implemented in nsBaseWidget.cpp
|
|
|
|
const char* ToChar(IMEMessage aIMEMessage);
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
struct IMENotification final {
|
|
|
|
IMENotification() : mMessage(NOTIFY_IME_OF_NOTHING), mSelectionChangeData() {}
|
|
|
|
|
|
|
|
IMENotification(const IMENotification& aOther)
|
2015-08-26 14:01:05 +03:00
|
|
|
: mMessage(NOTIFY_IME_OF_NOTHING) {
|
2015-08-08 18:47:19 +03:00
|
|
|
Assign(aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
~IMENotification() { Clear(); }
|
|
|
|
|
|
|
|
MOZ_IMPLICIT IMENotification(IMEMessage aMessage)
|
2018-06-15 17:48:51 +03:00
|
|
|
: mMessage(aMessage), mSelectionChangeData() {
|
2015-08-08 18:47:19 +03:00
|
|
|
switch (aMessage) {
|
|
|
|
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
|
|
|
mSelectionChangeData.mString = new nsString();
|
2015-08-21 19:43:41 +03:00
|
|
|
mSelectionChangeData.Clear();
|
2015-08-08 18:47:19 +03:00
|
|
|
break;
|
|
|
|
case NOTIFY_IME_OF_TEXT_CHANGE:
|
|
|
|
mTextChangeData.Clear();
|
|
|
|
break;
|
|
|
|
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
2015-08-29 02:58:26 +03:00
|
|
|
mMouseButtonEventData.mEventMessage = eVoidEvent;
|
2015-08-08 18:47:19 +03:00
|
|
|
mMouseButtonEventData.mOffset = UINT32_MAX;
|
|
|
|
mMouseButtonEventData.mCursorPos.Set(nsIntPoint(0, 0));
|
|
|
|
mMouseButtonEventData.mCharRect.Set(nsIntRect(0, 0, 0, 0));
|
|
|
|
mMouseButtonEventData.mButton = -1;
|
|
|
|
mMouseButtonEventData.mButtons = 0;
|
|
|
|
mMouseButtonEventData.mModifiers = 0;
|
2015-10-27 06:46:27 +03:00
|
|
|
break;
|
2015-08-08 18:47:19 +03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Assign(const IMENotification& aOther) {
|
2015-08-21 19:43:41 +03:00
|
|
|
bool changingMessage = mMessage != aOther.mMessage;
|
|
|
|
if (changingMessage) {
|
|
|
|
Clear();
|
|
|
|
mMessage = aOther.mMessage;
|
|
|
|
}
|
2015-08-08 18:47:19 +03:00
|
|
|
switch (mMessage) {
|
|
|
|
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
2015-08-21 19:43:41 +03:00
|
|
|
if (changingMessage) {
|
|
|
|
mSelectionChangeData.mString = new nsString();
|
|
|
|
}
|
|
|
|
mSelectionChangeData.Assign(aOther.mSelectionChangeData);
|
2015-08-08 18:47:19 +03:00
|
|
|
break;
|
|
|
|
case NOTIFY_IME_OF_TEXT_CHANGE:
|
|
|
|
mTextChangeData = aOther.mTextChangeData;
|
|
|
|
break;
|
|
|
|
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
|
|
|
mMouseButtonEventData = aOther.mMouseButtonEventData;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IMENotification& operator=(const IMENotification& aOther) {
|
|
|
|
Assign(aOther);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Clear() {
|
|
|
|
if (mMessage == NOTIFY_IME_OF_SELECTION_CHANGE) {
|
|
|
|
MOZ_ASSERT(mSelectionChangeData.mString);
|
|
|
|
delete mSelectionChangeData.mString;
|
|
|
|
mSelectionChangeData.mString = nullptr;
|
|
|
|
}
|
|
|
|
mMessage = NOTIFY_IME_OF_NOTHING;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasNotification() const { return mMessage != NOTIFY_IME_OF_NOTHING; }
|
|
|
|
|
|
|
|
void MergeWith(const IMENotification& aNotification) {
|
|
|
|
switch (mMessage) {
|
|
|
|
case NOTIFY_IME_OF_NOTHING:
|
|
|
|
MOZ_ASSERT(aNotification.mMessage != NOTIFY_IME_OF_NOTHING);
|
|
|
|
Assign(aNotification);
|
|
|
|
break;
|
|
|
|
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
|
|
|
MOZ_ASSERT(aNotification.mMessage == NOTIFY_IME_OF_SELECTION_CHANGE);
|
2015-08-21 19:43:41 +03:00
|
|
|
mSelectionChangeData.Assign(aNotification.mSelectionChangeData);
|
2015-08-08 18:47:19 +03:00
|
|
|
break;
|
|
|
|
case NOTIFY_IME_OF_TEXT_CHANGE:
|
|
|
|
MOZ_ASSERT(aNotification.mMessage == NOTIFY_IME_OF_TEXT_CHANGE);
|
|
|
|
mTextChangeData += aNotification.mTextChangeData;
|
|
|
|
break;
|
|
|
|
case NOTIFY_IME_OF_POSITION_CHANGE:
|
2016-05-31 05:39:15 +03:00
|
|
|
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
2015-08-08 18:47:19 +03:00
|
|
|
MOZ_ASSERT(aNotification.mMessage == mMessage);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MOZ_CRASH("Merging notification isn't supported");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IMEMessage mMessage;
|
|
|
|
|
|
|
|
struct Point {
|
|
|
|
int32_t mX;
|
|
|
|
int32_t mY;
|
|
|
|
|
|
|
|
void Set(const nsIntPoint& aPoint) {
|
|
|
|
mX = aPoint.x;
|
|
|
|
mY = aPoint.y;
|
|
|
|
}
|
|
|
|
nsIntPoint AsIntPoint() const { return nsIntPoint(mX, mY); }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Rect {
|
|
|
|
int32_t mX;
|
|
|
|
int32_t mY;
|
|
|
|
int32_t mWidth;
|
|
|
|
int32_t mHeight;
|
|
|
|
|
|
|
|
void Set(const nsIntRect& aRect) {
|
2018-01-10 19:14:16 +03:00
|
|
|
aRect.GetRect(&mX, &mY, &mWidth, &mHeight);
|
2015-08-08 18:47:19 +03:00
|
|
|
}
|
|
|
|
nsIntRect AsIntRect() const { return nsIntRect(mX, mY, mWidth, mHeight); }
|
|
|
|
};
|
|
|
|
|
|
|
|
// NOTIFY_IME_OF_SELECTION_CHANGE specific data
|
2015-08-21 19:43:41 +03:00
|
|
|
struct SelectionChangeDataBase {
|
2015-08-08 18:47:19 +03:00
|
|
|
// Selection range.
|
|
|
|
uint32_t mOffset;
|
|
|
|
|
|
|
|
// Selected string
|
|
|
|
nsString* mString;
|
|
|
|
|
|
|
|
// Writing mode at the selection.
|
|
|
|
uint8_t mWritingMode;
|
|
|
|
|
|
|
|
bool mReversed;
|
|
|
|
bool mCausedByComposition;
|
|
|
|
bool mCausedBySelectionEvent;
|
2015-10-27 01:21:37 +03:00
|
|
|
bool mOccurredDuringComposition;
|
2015-08-08 18:47:19 +03:00
|
|
|
|
|
|
|
void SetWritingMode(const WritingMode& aWritingMode);
|
|
|
|
WritingMode GetWritingMode() const;
|
|
|
|
|
|
|
|
uint32_t StartOffset() const {
|
|
|
|
return mOffset + (mReversed ? Length() : 0);
|
|
|
|
}
|
|
|
|
uint32_t EndOffset() const { return mOffset + (mReversed ? 0 : Length()); }
|
|
|
|
const nsString& String() const { return *mString; }
|
|
|
|
uint32_t Length() const { return mString->Length(); }
|
|
|
|
bool IsInInt32Range() const { return mOffset + Length() <= INT32_MAX; }
|
2015-09-08 06:54:14 +03:00
|
|
|
bool IsCollapsed() const { return mString->IsEmpty(); }
|
2015-09-14 17:28:43 +03:00
|
|
|
void ClearSelectionData() {
|
2015-08-21 19:43:41 +03:00
|
|
|
mOffset = UINT32_MAX;
|
|
|
|
mString->Truncate();
|
|
|
|
mWritingMode = 0;
|
|
|
|
mReversed = false;
|
2015-09-14 17:28:43 +03:00
|
|
|
}
|
|
|
|
void Clear() {
|
|
|
|
ClearSelectionData();
|
2015-08-21 19:43:41 +03:00
|
|
|
mCausedByComposition = false;
|
|
|
|
mCausedBySelectionEvent = false;
|
2015-10-27 01:21:37 +03:00
|
|
|
mOccurredDuringComposition = false;
|
2015-08-21 19:43:41 +03:00
|
|
|
}
|
|
|
|
bool IsValid() const { return mOffset != UINT32_MAX; }
|
2015-08-21 19:43:41 +03:00
|
|
|
void Assign(const SelectionChangeDataBase& aOther) {
|
2015-08-21 19:43:41 +03:00
|
|
|
mOffset = aOther.mOffset;
|
|
|
|
*mString = aOther.String();
|
|
|
|
mWritingMode = aOther.mWritingMode;
|
|
|
|
mReversed = aOther.mReversed;
|
2015-09-14 17:28:43 +03:00
|
|
|
AssignReason(aOther.mCausedByComposition, aOther.mCausedBySelectionEvent,
|
2015-10-27 01:21:37 +03:00
|
|
|
aOther.mOccurredDuringComposition);
|
2015-09-14 17:28:43 +03:00
|
|
|
}
|
|
|
|
void AssignReason(bool aCausedByComposition, bool aCausedBySelectionEvent,
|
2015-10-27 01:21:37 +03:00
|
|
|
bool aOccurredDuringComposition) {
|
2015-09-14 17:28:43 +03:00
|
|
|
mCausedByComposition = aCausedByComposition;
|
|
|
|
mCausedBySelectionEvent = aCausedBySelectionEvent;
|
2015-10-27 01:21:37 +03:00
|
|
|
mOccurredDuringComposition = aOccurredDuringComposition;
|
2015-08-21 19:43:41 +03:00
|
|
|
}
|
2015-08-08 18:47:19 +03:00
|
|
|
};
|
|
|
|
|
2015-08-21 19:43:41 +03:00
|
|
|
// SelectionChangeDataBase cannot have constructors because it's used in
|
|
|
|
// the union. Therefore, SelectionChangeData should only implement
|
|
|
|
// constructors. In other words, add other members to
|
|
|
|
// SelectionChangeDataBase.
|
|
|
|
struct SelectionChangeData final : public SelectionChangeDataBase {
|
|
|
|
SelectionChangeData() {
|
|
|
|
mString = &mStringInstance;
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
explicit SelectionChangeData(const SelectionChangeDataBase& aOther) {
|
|
|
|
mString = &mStringInstance;
|
|
|
|
Assign(aOther);
|
|
|
|
}
|
|
|
|
SelectionChangeData(const SelectionChangeData& aOther) {
|
|
|
|
mString = &mStringInstance;
|
|
|
|
Assign(aOther);
|
|
|
|
}
|
|
|
|
SelectionChangeData& operator=(const SelectionChangeDataBase& aOther) {
|
|
|
|
mString = &mStringInstance;
|
|
|
|
Assign(aOther);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
SelectionChangeData& operator=(const SelectionChangeData& aOther) {
|
|
|
|
mString = &mStringInstance;
|
|
|
|
Assign(aOther);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
// When SelectionChangeData is used outside of union, it shouldn't create
|
|
|
|
// nsString instance in the heap as far as possible.
|
|
|
|
nsString mStringInstance;
|
|
|
|
};
|
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
struct TextChangeDataBase {
|
|
|
|
// mStartOffset is the start offset of modified or removed text in
|
|
|
|
// original content and inserted text in new content.
|
|
|
|
uint32_t mStartOffset;
|
|
|
|
// mRemovalEndOffset is the end offset of modified or removed text in
|
|
|
|
// original content. If the value is same as mStartOffset, no text hasn't
|
|
|
|
// been removed yet.
|
|
|
|
uint32_t mRemovedEndOffset;
|
|
|
|
// mAddedEndOffset is the end offset of inserted text or same as
|
|
|
|
// mStartOffset if just removed. The vlaue is offset in the new content.
|
|
|
|
uint32_t mAddedEndOffset;
|
|
|
|
|
2016-01-28 07:28:53 +03:00
|
|
|
// Note that TextChangeDataBase may be the result of merging two or more
|
|
|
|
// changes especially in e10s mode.
|
|
|
|
|
|
|
|
// mCausedOnlyByComposition is true only when *all* merged changes are
|
|
|
|
// caused by composition.
|
|
|
|
bool mCausedOnlyByComposition;
|
2016-01-28 07:28:53 +03:00
|
|
|
// mIncludingChangesDuringComposition is true if at least one change which
|
|
|
|
// is not caused by composition occurred during the last composition.
|
|
|
|
// Note that if after the last composition is finished and there are some
|
|
|
|
// changes not caused by composition, this is set to false.
|
|
|
|
bool mIncludingChangesDuringComposition;
|
2016-01-28 07:28:54 +03:00
|
|
|
// mIncludingChangesWithoutComposition is true if there is at least one
|
|
|
|
// change which did occur when there wasn't a composition ongoing.
|
|
|
|
bool mIncludingChangesWithoutComposition;
|
2015-08-08 18:47:19 +03:00
|
|
|
|
|
|
|
uint32_t OldLength() const {
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
return mRemovedEndOffset - mStartOffset;
|
|
|
|
}
|
|
|
|
uint32_t NewLength() const {
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
return mAddedEndOffset - mStartOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Positive if text is added. Negative if text is removed.
|
|
|
|
int64_t Difference() const { return mAddedEndOffset - mRemovedEndOffset; }
|
|
|
|
|
|
|
|
bool IsInInt32Range() const {
|
|
|
|
MOZ_ASSERT(IsValid());
|
|
|
|
return mStartOffset <= INT32_MAX && mRemovedEndOffset <= INT32_MAX &&
|
|
|
|
mAddedEndOffset <= INT32_MAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsValid() const {
|
|
|
|
return !(mStartOffset == UINT32_MAX && !mRemovedEndOffset &&
|
|
|
|
!mAddedEndOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Clear() {
|
|
|
|
mStartOffset = UINT32_MAX;
|
|
|
|
mRemovedEndOffset = mAddedEndOffset = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MergeWith(const TextChangeDataBase& aOther);
|
|
|
|
TextChangeDataBase& operator+=(const TextChangeDataBase& aOther) {
|
|
|
|
MergeWith(aOther);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void Test();
|
|
|
|
#endif // #ifdef DEBUG
|
|
|
|
};
|
|
|
|
|
|
|
|
// TextChangeDataBase cannot have constructors because they are used in union.
|
|
|
|
// Therefore, TextChangeData should only implement constructor. In other
|
|
|
|
// words, add other members to TextChangeDataBase.
|
|
|
|
struct TextChangeData : public TextChangeDataBase {
|
|
|
|
TextChangeData() { Clear(); }
|
|
|
|
|
|
|
|
TextChangeData(uint32_t aStartOffset, uint32_t aRemovedEndOffset,
|
2015-10-27 01:21:37 +03:00
|
|
|
uint32_t aAddedEndOffset, bool aCausedByComposition,
|
|
|
|
bool aOccurredDuringComposition) {
|
2015-08-08 18:47:19 +03:00
|
|
|
MOZ_ASSERT(aRemovedEndOffset >= aStartOffset,
|
|
|
|
"removed end offset must not be smaller than start offset");
|
|
|
|
MOZ_ASSERT(aAddedEndOffset >= aStartOffset,
|
|
|
|
"added end offset must not be smaller than start offset");
|
|
|
|
mStartOffset = aStartOffset;
|
|
|
|
mRemovedEndOffset = aRemovedEndOffset;
|
|
|
|
mAddedEndOffset = aAddedEndOffset;
|
2016-01-28 07:28:53 +03:00
|
|
|
mCausedOnlyByComposition = aCausedByComposition;
|
2016-01-28 07:28:53 +03:00
|
|
|
mIncludingChangesDuringComposition =
|
|
|
|
!aCausedByComposition && aOccurredDuringComposition;
|
2016-01-28 07:28:54 +03:00
|
|
|
mIncludingChangesWithoutComposition =
|
|
|
|
!aCausedByComposition && !aOccurredDuringComposition;
|
2015-08-08 18:47:19 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MouseButtonEventData {
|
2015-08-26 15:56:59 +03:00
|
|
|
// The value of WidgetEvent::mMessage
|
|
|
|
EventMessage mEventMessage;
|
2015-08-08 18:47:19 +03:00
|
|
|
// Character offset from the start of the focused editor under the cursor
|
|
|
|
uint32_t mOffset;
|
|
|
|
// Cursor position in pixels relative to the widget
|
|
|
|
Point mCursorPos;
|
|
|
|
// Character rect in pixels under the cursor relative to the widget
|
|
|
|
Rect mCharRect;
|
|
|
|
// The value of WidgetMouseEventBase::button and buttons
|
|
|
|
int16_t mButton;
|
|
|
|
int16_t mButtons;
|
|
|
|
// The value of WidgetInputEvent::modifiers
|
|
|
|
Modifiers mModifiers;
|
|
|
|
};
|
|
|
|
|
|
|
|
union {
|
|
|
|
// NOTIFY_IME_OF_SELECTION_CHANGE specific data
|
2015-08-21 19:43:41 +03:00
|
|
|
SelectionChangeDataBase mSelectionChangeData;
|
2015-08-08 18:47:19 +03:00
|
|
|
|
|
|
|
// NOTIFY_IME_OF_TEXT_CHANGE specific data
|
|
|
|
TextChangeDataBase mTextChangeData;
|
|
|
|
|
|
|
|
// NOTIFY_IME_OF_MOUSE_BUTTON_EVENT specific data
|
|
|
|
MouseButtonEventData mMouseButtonEventData;
|
|
|
|
};
|
|
|
|
|
2015-08-21 19:43:41 +03:00
|
|
|
void SetData(const SelectionChangeDataBase& aSelectionChangeData) {
|
|
|
|
MOZ_RELEASE_ASSERT(mMessage == NOTIFY_IME_OF_SELECTION_CHANGE);
|
|
|
|
mSelectionChangeData.Assign(aSelectionChangeData);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetData(const TextChangeDataBase& aTextChangeData) {
|
|
|
|
MOZ_RELEASE_ASSERT(mMessage == NOTIFY_IME_OF_TEXT_CHANGE);
|
|
|
|
mTextChangeData = aTextChangeData;
|
|
|
|
}
|
2015-08-08 18:47:19 +03:00
|
|
|
};
|
|
|
|
|
2016-02-02 11:05:56 +03:00
|
|
|
struct CandidateWindowPosition {
|
|
|
|
// Upper left corner of the candidate window if mExcludeRect is false.
|
|
|
|
// Otherwise, the position currently interested. E.g., caret position.
|
|
|
|
LayoutDeviceIntPoint mPoint;
|
|
|
|
// Rect which shouldn't be overlapped with the candidate window.
|
|
|
|
// This is valid only when mExcludeRect is true.
|
|
|
|
LayoutDeviceIntRect mRect;
|
|
|
|
// See explanation of mPoint and mRect.
|
|
|
|
bool mExcludeRect;
|
|
|
|
};
|
|
|
|
|
2020-12-21 08:52:03 +03:00
|
|
|
std::ostream& operator<<(std::ostream& aStream, const IMEEnabled& aEnabled);
|
2019-08-30 08:56:58 +03:00
|
|
|
std::ostream& operator<<(std::ostream& aStream, const IMEState::Open& aOpen);
|
2020-07-21 11:12:04 +03:00
|
|
|
std::ostream& operator<<(std::ostream& aStream, const IMEState& aState);
|
|
|
|
std::ostream& operator<<(std::ostream& aStream,
|
|
|
|
const InputContext::Origin& aOrigin);
|
|
|
|
std::ostream& operator<<(std::ostream& aStream, const InputContext& aContext);
|
2019-08-30 08:56:58 +03:00
|
|
|
std::ostream& operator<<(std::ostream& aStream,
|
|
|
|
const InputContextAction::Cause& aCause);
|
|
|
|
std::ostream& operator<<(std::ostream& aStream,
|
|
|
|
const InputContextAction::FocusChange& aFocusChange);
|
2020-02-28 07:45:05 +03:00
|
|
|
std::ostream& operator<<(std::ostream& aStream,
|
|
|
|
const IMENotification::SelectionChangeDataBase& aData);
|
|
|
|
std::ostream& operator<<(std::ostream& aStream,
|
|
|
|
const IMENotification::TextChangeDataBase& aData);
|
2019-08-30 08:56:58 +03:00
|
|
|
|
2015-08-08 18:47:19 +03:00
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // #ifndef mozilla_widget_IMEData_h_
|