mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 910978 part.6 Implement nsTextEvent::AssignTextEventData() and make nsTextEvent not a derived class of nsInputEvent because nobody uses the stored data r=smaug
This commit is contained in:
parent
99828257aa
commit
55d40230f3
@ -576,7 +576,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
{
|
||||
nsTextEvent* oldTextEvent = static_cast<nsTextEvent*>(mEvent);
|
||||
nsTextEvent* textEvent = new nsTextEvent(false, msg, nullptr);
|
||||
textEvent->AssignGUIEventData(*oldTextEvent, true);
|
||||
textEvent->AssignTextEventData(*oldTextEvent, true);
|
||||
newEvent = textEvent;
|
||||
break;
|
||||
}
|
||||
|
@ -460,6 +460,9 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
||||
bool
|
||||
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
|
||||
{
|
||||
if (!NS_IS_INPUT_EVENT(mEvent)) {
|
||||
MOZ_CRASH("mEvent must be nsInputEvent or derived class");
|
||||
}
|
||||
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);
|
||||
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SHIFT)) {
|
||||
return inputEvent->IsShift();
|
||||
|
@ -1331,7 +1331,7 @@ struct nsTextRange
|
||||
|
||||
typedef nsTextRange* nsTextRangeArray;
|
||||
|
||||
class nsTextEvent : public nsInputEvent
|
||||
class nsTextEvent : public nsGUIEvent
|
||||
{
|
||||
private:
|
||||
friend class mozilla::dom::PBrowserParent;
|
||||
@ -1347,7 +1347,7 @@ public:
|
||||
|
||||
public:
|
||||
nsTextEvent(bool isTrusted, uint32_t msg, nsIWidget *w)
|
||||
: nsInputEvent(isTrusted, msg, w, NS_TEXT_EVENT),
|
||||
: nsGUIEvent(isTrusted, msg, w, NS_TEXT_EVENT),
|
||||
rangeCount(0), rangeArray(nullptr), isChar(false)
|
||||
{
|
||||
}
|
||||
@ -1359,6 +1359,16 @@ public:
|
||||
// array.
|
||||
nsTextRangeArray rangeArray;
|
||||
bool isChar;
|
||||
|
||||
void AssignTextEventData(const nsTextEvent& aEvent, bool aCopyTargets)
|
||||
{
|
||||
AssignGUIEventData(aEvent, aCopyTargets);
|
||||
|
||||
isChar = aEvent.isChar;
|
||||
|
||||
// Currently, we don't need to copy the other members because they are
|
||||
// for internal use only (not available from JS).
|
||||
}
|
||||
};
|
||||
|
||||
class nsCompositionEvent : public nsGUIEvent
|
||||
@ -1924,10 +1934,10 @@ enum nsDragDropEventStatus {
|
||||
(((evnt)->eventStructType == NS_INPUT_EVENT) || \
|
||||
((evnt)->eventStructType == NS_MOUSE_EVENT) || \
|
||||
((evnt)->eventStructType == NS_KEY_EVENT) || \
|
||||
((evnt)->eventStructType == NS_TEXT_EVENT) || \
|
||||
((evnt)->eventStructType == NS_TOUCH_EVENT) || \
|
||||
((evnt)->eventStructType == NS_DRAG_EVENT) || \
|
||||
((evnt)->eventStructType == NS_MOUSE_SCROLL_EVENT) || \
|
||||
((evnt)->eventStructType == NS_WHEEL_EVENT) || \
|
||||
((evnt)->eventStructType == NS_SIMPLE_GESTURE_EVENT))
|
||||
|
||||
#define NS_IS_MOUSE_EVENT(evnt) \
|
||||
|
@ -338,7 +338,7 @@ struct ParamTraits<nsTextEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsInputEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<nsGUIEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.seqno);
|
||||
WriteParam(aMsg, aParam.theText);
|
||||
WriteParam(aMsg, aParam.isChar);
|
||||
@ -349,7 +349,7 @@ struct ParamTraits<nsTextEvent>
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, static_cast<nsInputEvent*>(aResult)) ||
|
||||
if (!ReadParam(aMsg, aIter, static_cast<nsGUIEvent*>(aResult)) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->seqno) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->theText) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->isChar) ||
|
||||
|
@ -218,6 +218,29 @@ const kTests = [
|
||||
},
|
||||
todoMismatch: [],
|
||||
},
|
||||
{ description: "nsTextEvent (text)",
|
||||
targetID: "input-text", eventType: "text",
|
||||
dispatchEvent: function () {
|
||||
document.getElementById(this.targetID).value = "";
|
||||
document.getElementById(this.targetID).focus();
|
||||
synthesizeComposition({ type: "compositionstart" });
|
||||
synthesizeComposition({ type: "compositionupdate", data: "\u306D" });
|
||||
synthesizeText({ "composition":
|
||||
{ "string": "\u306D",
|
||||
"clauses":
|
||||
[
|
||||
{ "length": 0, "attr": 0 }
|
||||
]
|
||||
},
|
||||
"caret": { "start": 1, "length": 0 }
|
||||
});
|
||||
synthesizeComposition({ type: "compositionend", data: "\u732B" });
|
||||
},
|
||||
canRun: function () {
|
||||
return true;
|
||||
},
|
||||
todoMismatch: [ ],
|
||||
},
|
||||
];
|
||||
|
||||
function doTest(aTest)
|
||||
|
@ -1593,8 +1593,6 @@ nsIMM32Handler::DispatchTextEvent(nsWindow* aWindow,
|
||||
event.rangeArray = textRanges.Elements();
|
||||
|
||||
event.theText = mCompositionString.get();
|
||||
mozilla::widget::ModifierKeyState modKeyState;
|
||||
modKeyState.InitInputEvent(event);
|
||||
|
||||
aWindow->DispatchWindowEvent(&event);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user