mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1166323 - Remove IME sequence number. r=masayuki,nchen
This commit is contained in:
parent
b53b02cfb1
commit
6392ef0331
@ -155,26 +155,6 @@ parent:
|
||||
CpowEntry[] aCpows, Principal aPrincipal)
|
||||
returns (OwningSerializedStructuredCloneBuffer[] retval);
|
||||
|
||||
/**
|
||||
* The IME sequence number (seqno) parameter is used to make sure
|
||||
* that a notification is discarded if it arrives at the chrome process
|
||||
* too late. If the notification is late and we accept it, we will have
|
||||
* an out-of-date view of the content process, which means events that we
|
||||
* dispatch based on this out-of-date view will be wrong also.
|
||||
* (see Bug 599550 and Bug 591047 comments 44, 50, and 54)
|
||||
*
|
||||
* Chrome increments seqno and includes it in each IME event sent to
|
||||
* content, and content sends its current seqno back to chrome with each
|
||||
* notification. A notification is up-to-date only if the content
|
||||
* seqno is the same as the current chrome seqno, meaning no additional
|
||||
* event was sent to content before the notification was received
|
||||
*
|
||||
* On blur, chrome returns the current seqno to content, and content
|
||||
* uses it to discard subsequent events until the content seqno and
|
||||
* chrome seqno-on-blur match again. These events, meant for the blurred
|
||||
* textfield, are discarded to prevent events going to the wrong target
|
||||
*/
|
||||
|
||||
/**
|
||||
* Notifies chrome that there is a focus change involving an editable
|
||||
* object (input, textarea, document, contentEditable. etc.)
|
||||
@ -182,10 +162,9 @@ parent:
|
||||
* focus PR_TRUE if editable object is receiving focus
|
||||
* PR_FALSE if losing focus
|
||||
* preference Native widget preference for IME updates
|
||||
* seqno Current seqno value on the chrome side
|
||||
*/
|
||||
prio(urgent) sync NotifyIMEFocus(bool focus)
|
||||
returns (nsIMEUpdatePreference preference, uint32_t seqno);
|
||||
returns (nsIMEUpdatePreference preference);
|
||||
|
||||
/**
|
||||
* Notifies chrome that there has been a change in text content
|
||||
@ -221,13 +200,12 @@ parent:
|
||||
* Notifies chrome that there has been a change in selection
|
||||
* Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
|
||||
*
|
||||
* seqno Current seqno value on the content side
|
||||
* anchor Offset where the selection started
|
||||
* focus Offset where the caret is
|
||||
* writingMode CSS writing-mode in effect at the focus
|
||||
* causedByComposition true if the change is caused by composition
|
||||
*/
|
||||
prio(urgent) async NotifyIMESelection(uint32_t seqno, uint32_t anchor,
|
||||
prio(urgent) async NotifyIMESelection(uint32_t anchor,
|
||||
uint32_t focus,
|
||||
WritingMode writingMode,
|
||||
bool causedByComposition);
|
||||
|
@ -264,7 +264,6 @@ TabParent::TabParent(nsIContentParent* aManager,
|
||||
, mIMECompositionEnding(false)
|
||||
, mIMEEventCountAfterEnding(0)
|
||||
, mIMECompositionStart(0)
|
||||
, mIMESeqno(0)
|
||||
, mIMECompositionRectOffset(0)
|
||||
, mRect(0, 0, 0, 0)
|
||||
, mDimensions(0, 0)
|
||||
@ -1847,11 +1846,8 @@ TabParent::RecvHideTooltip()
|
||||
|
||||
bool
|
||||
TabParent::RecvNotifyIMEFocus(const bool& aFocus,
|
||||
nsIMEUpdatePreference* aPreference,
|
||||
uint32_t* aSeqno)
|
||||
nsIMEUpdatePreference* aPreference)
|
||||
{
|
||||
*aSeqno = mIMESeqno;
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget) {
|
||||
*aPreference = nsIMEUpdatePreference();
|
||||
@ -1922,8 +1918,7 @@ TabParent::RecvNotifyIMESelectedCompositionRect(
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvNotifyIMESelection(const uint32_t& aSeqno,
|
||||
const uint32_t& aAnchor,
|
||||
TabParent::RecvNotifyIMESelection(const uint32_t& aAnchor,
|
||||
const uint32_t& aFocus,
|
||||
const mozilla::WritingMode& aWritingMode,
|
||||
const bool& aCausedByComposition)
|
||||
@ -1932,29 +1927,27 @@ TabParent::RecvNotifyIMESelection(const uint32_t& aSeqno,
|
||||
if (!widget)
|
||||
return true;
|
||||
|
||||
if (aSeqno == mIMESeqno) {
|
||||
mIMESelectionAnchor = aAnchor;
|
||||
mIMESelectionFocus = aFocus;
|
||||
mWritingMode = aWritingMode;
|
||||
const nsIMEUpdatePreference updatePreference =
|
||||
widget->GetIMEUpdatePreference();
|
||||
if (updatePreference.WantSelectionChange() &&
|
||||
(updatePreference.WantChangesCausedByComposition() ||
|
||||
!aCausedByComposition)) {
|
||||
IMENotification notification(NOTIFY_IME_OF_SELECTION_CHANGE);
|
||||
notification.mSelectionChangeData.mOffset =
|
||||
std::min(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
notification.mSelectionChangeData.mLength =
|
||||
mIMESelectionAnchor > mIMESelectionFocus ?
|
||||
mIMESelectionAnchor - mIMESelectionFocus :
|
||||
mIMESelectionFocus - mIMESelectionAnchor;
|
||||
notification.mSelectionChangeData.mReversed =
|
||||
mIMESelectionFocus < mIMESelectionAnchor;
|
||||
notification.mSelectionChangeData.SetWritingMode(mWritingMode);
|
||||
notification.mSelectionChangeData.mCausedByComposition =
|
||||
aCausedByComposition;
|
||||
widget->NotifyIME(notification);
|
||||
}
|
||||
mIMESelectionAnchor = aAnchor;
|
||||
mIMESelectionFocus = aFocus;
|
||||
mWritingMode = aWritingMode;
|
||||
const nsIMEUpdatePreference updatePreference =
|
||||
widget->GetIMEUpdatePreference();
|
||||
if (updatePreference.WantSelectionChange() &&
|
||||
(updatePreference.WantChangesCausedByComposition() ||
|
||||
!aCausedByComposition)) {
|
||||
IMENotification notification(NOTIFY_IME_OF_SELECTION_CHANGE);
|
||||
notification.mSelectionChangeData.mOffset =
|
||||
std::min(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
notification.mSelectionChangeData.mLength =
|
||||
mIMESelectionAnchor > mIMESelectionFocus ?
|
||||
mIMESelectionAnchor - mIMESelectionFocus :
|
||||
mIMESelectionFocus - mIMESelectionAnchor;
|
||||
notification.mSelectionChangeData.mReversed =
|
||||
mIMESelectionFocus < mIMESelectionAnchor;
|
||||
notification.mSelectionChangeData.SetWritingMode(mWritingMode);
|
||||
notification.mSelectionChangeData.mCausedByComposition =
|
||||
aCausedByComposition;
|
||||
widget->NotifyIME(notification);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2298,7 +2291,6 @@ TabParent::SendCompositionEvent(WidgetCompositionEvent& event)
|
||||
mIMEEventCountAfterEnding++;
|
||||
return true;
|
||||
}
|
||||
event.mSeqno = ++mIMESeqno;
|
||||
return PBrowserParent::SendCompositionEvent(event);
|
||||
}
|
||||
|
||||
@ -2328,7 +2320,6 @@ TabParent::SendCompositionChangeEvent(WidgetCompositionEvent& event)
|
||||
mIMECompositionStart + event.mData.Length();
|
||||
mIMEComposing = !event.CausesDOMCompositionEndEvent();
|
||||
|
||||
event.mSeqno = ++mIMESeqno;
|
||||
return PBrowserParent::SendCompositionEvent(event);
|
||||
}
|
||||
|
||||
@ -2340,7 +2331,6 @@ TabParent::SendSelectionEvent(WidgetSelectionEvent& event)
|
||||
}
|
||||
mIMESelectionAnchor = event.mOffset + (event.mReversed ? event.mLength : 0);
|
||||
mIMESelectionFocus = event.mOffset + (!event.mReversed ? event.mLength : 0);
|
||||
event.mSeqno = ++mIMESeqno;
|
||||
return PBrowserParent::SendSelectionEvent(event);
|
||||
}
|
||||
|
||||
|
@ -161,8 +161,8 @@ public:
|
||||
InfallibleTArray<CpowEntry>&& aCpows,
|
||||
const IPC::Principal& aPrincipal) override;
|
||||
virtual bool RecvNotifyIMEFocus(const bool& aFocus,
|
||||
nsIMEUpdatePreference* aPreference,
|
||||
uint32_t* aSeqno) override;
|
||||
nsIMEUpdatePreference* aPreference)
|
||||
override;
|
||||
virtual bool RecvNotifyIMETextChange(const uint32_t& aStart,
|
||||
const uint32_t& aEnd,
|
||||
const uint32_t& aNewEnd,
|
||||
@ -172,8 +172,7 @@ public:
|
||||
InfallibleTArray<LayoutDeviceIntRect>&& aRects,
|
||||
const uint32_t& aCaretOffset,
|
||||
const LayoutDeviceIntRect& aCaretRect) override;
|
||||
virtual bool RecvNotifyIMESelection(const uint32_t& aSeqno,
|
||||
const uint32_t& aAnchor,
|
||||
virtual bool RecvNotifyIMESelection(const uint32_t& aAnchor,
|
||||
const uint32_t& aFocus,
|
||||
const mozilla::WritingMode& aWritingMode,
|
||||
const bool& aCausedByComposition) override;
|
||||
@ -482,7 +481,6 @@ protected:
|
||||
// Compositions in almost all cases are small enough for nsAutoString
|
||||
nsAutoString mIMECompositionText;
|
||||
uint32_t mIMECompositionStart;
|
||||
uint32_t mIMESeqno;
|
||||
|
||||
uint32_t mIMECompositionRectOffset;
|
||||
InfallibleTArray<LayoutDeviceIntRect> mIMECompositionRects;
|
||||
|
@ -1243,7 +1243,7 @@ IdentityInfoInit()
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
PR_NOT_REACHED("Could not find EV root in NSS storage");
|
||||
//PR_NOT_REACHED("Could not find EV root in NSS storage");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -137,9 +137,7 @@ PuppetWidget::InitIMEState()
|
||||
{
|
||||
MOZ_ASSERT(mTabChild);
|
||||
if (mNeedIMEStateInit) {
|
||||
uint32_t chromeSeqno;
|
||||
mTabChild->SendNotifyIMEFocus(false, &mIMEPreferenceOfParent, &chromeSeqno);
|
||||
mIMELastBlurSeqno = mIMELastReceivedSeqno = chromeSeqno;
|
||||
mTabChild->SendNotifyIMEFocus(false, &mIMEPreferenceOfParent);
|
||||
mNeedIMEStateInit = false;
|
||||
}
|
||||
}
|
||||
@ -313,24 +311,6 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
|
||||
|
||||
aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
uint32_t seqno = kLatestSeqno;
|
||||
switch (event->mClass) {
|
||||
case eCompositionEventClass:
|
||||
seqno = event->AsCompositionEvent()->mSeqno;
|
||||
break;
|
||||
case eSelectionEventClass:
|
||||
seqno = event->AsSelectionEvent()->mSeqno;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (seqno != kLatestSeqno) {
|
||||
mIMELastReceivedSeqno = seqno;
|
||||
if (mIMELastReceivedSeqno < mIMELastBlurSeqno) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (mAttachedWidgetListener) {
|
||||
aStatus = mAttachedWidgetListener->HandleEvent(event, mUseAttachedEvents);
|
||||
}
|
||||
@ -582,7 +562,6 @@ PuppetWidget::IMEEndComposition(bool aCancel)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
compositionCommitEvent.mSeqno = mIMELastReceivedSeqno;
|
||||
DispatchEvent(&compositionCommitEvent, status);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -699,10 +678,8 @@ PuppetWidget::NotifyIMEOfFocusChange(bool aFocus)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t chromeSeqno;
|
||||
mIMEPreferenceOfParent = nsIMEUpdatePreference();
|
||||
if (!mTabChild->SendNotifyIMEFocus(aFocus, &mIMEPreferenceOfParent,
|
||||
&chromeSeqno)) {
|
||||
if (!mTabChild->SendNotifyIMEFocus(aFocus, &mIMEPreferenceOfParent)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -711,8 +688,6 @@ PuppetWidget::NotifyIMEOfFocusChange(bool aFocus)
|
||||
notification.mSelectionChangeData.mCausedByComposition = false;
|
||||
NotifyIMEOfSelectionChange(notification); // Update selection
|
||||
NotifyIMEOfEditorRect();
|
||||
} else {
|
||||
mIMELastBlurSeqno = chromeSeqno;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -897,7 +872,6 @@ PuppetWidget::NotifyIMEOfSelectionChange(
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mTabChild->SendNotifyIMESelection(
|
||||
mIMELastReceivedSeqno,
|
||||
aIMENotification.mSelectionChangeData.StartOffset(),
|
||||
aIMENotification.mSelectionChangeData.EndOffset(),
|
||||
aIMENotification.mSelectionChangeData.GetWritingMode(),
|
||||
|
@ -309,13 +309,6 @@ private:
|
||||
mozilla::RefPtr<DrawTarget> mDrawTarget;
|
||||
// IME
|
||||
nsIMEUpdatePreference mIMEPreferenceOfParent;
|
||||
// Latest seqno received through events
|
||||
uint32_t mIMELastReceivedSeqno;
|
||||
// Chrome's seqno value when last blur occurred
|
||||
// arriving events with seqno up to this should be discarded
|
||||
// Note that if seqno overflows (~50 days at 1 ms increment rate),
|
||||
// events will be discarded until new focus/blur occurs
|
||||
uint32_t mIMELastBlurSeqno;
|
||||
bool mNeedIMEStateInit;
|
||||
|
||||
// The DPI of the screen corresponding to this widget
|
||||
|
@ -37,8 +37,6 @@ enum
|
||||
|
||||
#undef NS_DEFINE_VK
|
||||
|
||||
#define kLatestSeqno UINT32_MAX
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
@ -352,13 +350,9 @@ private:
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
WidgetCompositionEvent()
|
||||
: mSeqno(kLatestSeqno)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
uint32_t mSeqno;
|
||||
|
||||
public:
|
||||
virtual WidgetCompositionEvent* AsCompositionEvent() override
|
||||
{
|
||||
@ -368,7 +362,6 @@ public:
|
||||
WidgetCompositionEvent(bool aIsTrusted, uint32_t aMessage,
|
||||
nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eCompositionEventClass)
|
||||
, mSeqno(kLatestSeqno)
|
||||
{
|
||||
// XXX compositionstart is cancelable in draft of DOM3 Events.
|
||||
// However, it doesn't make sense for us, we cannot cancel composition
|
||||
@ -619,8 +612,7 @@ private:
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
WidgetSelectionEvent()
|
||||
: mSeqno(kLatestSeqno)
|
||||
, mOffset(0)
|
||||
: mOffset(0)
|
||||
, mLength(0)
|
||||
, mReversed(false)
|
||||
, mExpandToClusterBoundary(true)
|
||||
@ -628,9 +620,6 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
uint32_t mSeqno;
|
||||
|
||||
public:
|
||||
virtual WidgetSelectionEvent* AsSelectionEvent() override
|
||||
{
|
||||
@ -639,7 +628,6 @@ public:
|
||||
|
||||
WidgetSelectionEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget)
|
||||
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eSelectionEventClass)
|
||||
, mSeqno(kLatestSeqno)
|
||||
, mOffset(0)
|
||||
, mLength(0)
|
||||
, mReversed(false)
|
||||
|
@ -521,7 +521,6 @@ struct ParamTraits<mozilla::WidgetCompositionEvent>
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.mSeqno);
|
||||
WriteParam(aMsg, aParam.mData);
|
||||
bool hasRanges = !!aParam.mRanges;
|
||||
WriteParam(aMsg, hasRanges);
|
||||
@ -535,7 +534,6 @@ struct ParamTraits<mozilla::WidgetCompositionEvent>
|
||||
bool hasRanges;
|
||||
if (!ReadParam(aMsg, aIter,
|
||||
static_cast<mozilla::WidgetGUIEvent*>(aResult)) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mSeqno) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mData) ||
|
||||
!ReadParam(aMsg, aIter, &hasRanges)) {
|
||||
return false;
|
||||
@ -625,7 +623,6 @@ struct ParamTraits<mozilla::WidgetSelectionEvent>
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.mSeqno);
|
||||
WriteParam(aMsg, aParam.mOffset);
|
||||
WriteParam(aMsg, aParam.mLength);
|
||||
WriteParam(aMsg, aParam.mReversed);
|
||||
@ -638,7 +635,6 @@ struct ParamTraits<mozilla::WidgetSelectionEvent>
|
||||
{
|
||||
return ReadParam(aMsg, aIter,
|
||||
static_cast<mozilla::WidgetGUIEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSeqno) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mLength) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReversed) &&
|
||||
|
Loading…
Reference in New Issue
Block a user