mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 960871 part.5 Copy mRanges and related methods from WidgetTextEvent to WidgetCompositionEvent r=smaug
This commit is contained in:
parent
20ded1179a
commit
40622dd546
@ -320,12 +320,32 @@ public:
|
||||
// TextComposition automatically.
|
||||
nsString mData;
|
||||
|
||||
nsRefPtr<TextRangeArray> mRanges;
|
||||
|
||||
void AssignCompositionEventData(const WidgetCompositionEvent& aEvent,
|
||||
bool aCopyTargets)
|
||||
{
|
||||
AssignGUIEventData(aEvent, aCopyTargets);
|
||||
|
||||
mData = aEvent.mData;
|
||||
|
||||
// Currently, we don't need to copy the other members because they are
|
||||
// for internal use only (not available from JS).
|
||||
}
|
||||
|
||||
bool IsComposing() const
|
||||
{
|
||||
return mRanges && mRanges->IsComposing();
|
||||
}
|
||||
|
||||
uint32_t TargetClauseOffset() const
|
||||
{
|
||||
return mRanges ? mRanges->TargetClauseOffset() : 0;
|
||||
}
|
||||
|
||||
uint32_t RangeCount() const
|
||||
{
|
||||
return mRanges ? mRanges->Length() : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -494,14 +494,33 @@ struct ParamTraits<mozilla::WidgetCompositionEvent>
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.mSeqno);
|
||||
WriteParam(aMsg, aParam.mData);
|
||||
bool hasRanges = !!aParam.mRanges;
|
||||
WriteParam(aMsg, hasRanges);
|
||||
if (hasRanges) {
|
||||
WriteParam(aMsg, *aParam.mRanges.get());
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter,
|
||||
static_cast<mozilla::WidgetGUIEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSeqno) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mData);
|
||||
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;
|
||||
}
|
||||
|
||||
if (!hasRanges) {
|
||||
aResult->mRanges = nullptr;
|
||||
} else {
|
||||
aResult->mRanges = new mozilla::TextRangeArray();
|
||||
if (!ReadParam(aMsg, aIter, aResult->mRanges.get())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user