Bug 910978 part.9 Implement widget::WheelEvent::AssignWheelEventData() r=smaug

This commit is contained in:
Masayuki Nakano 2013-09-03 20:45:29 +09:00
parent 2ce0c3d82d
commit aeee25cf0b
3 changed files with 56 additions and 18 deletions

View File

@ -606,24 +606,7 @@ nsDOMEvent::DuplicatePrivateData()
static_cast<widget::WheelEvent*>(mEvent);
widget::WheelEvent* wheelEvent =
new widget::WheelEvent(false, msg, nullptr);
wheelEvent->AssignInputEventData(*oldWheelEvent, true);
wheelEvent->deltaX = oldWheelEvent->deltaX;
wheelEvent->deltaY = oldWheelEvent->deltaY;
wheelEvent->deltaZ = oldWheelEvent->deltaZ;
wheelEvent->deltaMode = oldWheelEvent->deltaMode;
wheelEvent->relatedTarget = oldWheelEvent->relatedTarget;
wheelEvent->button = oldWheelEvent->button;
wheelEvent->buttons = oldWheelEvent->buttons;
wheelEvent->modifiers = oldWheelEvent->modifiers;
wheelEvent->inputSource = oldWheelEvent->inputSource;
wheelEvent->customizedByUserPrefs = oldWheelEvent->customizedByUserPrefs;
wheelEvent->isMomentum = oldWheelEvent->isMomentum;
wheelEvent->isPixelOnlyDevice = oldWheelEvent->isPixelOnlyDevice;
wheelEvent->lineOrPageDeltaX = oldWheelEvent->lineOrPageDeltaX;
wheelEvent->lineOrPageDeltaY = oldWheelEvent->lineOrPageDeltaY;
wheelEvent->scrollType = oldWheelEvent->scrollType;
wheelEvent->overflowDeltaX = oldWheelEvent->overflowDeltaX;
wheelEvent->overflowDeltaY = oldWheelEvent->overflowDeltaY;
wheelEvent->AssignWheelEventData(*oldWheelEvent, true);
newEvent = wheelEvent;
break;
}

View File

@ -1541,6 +1541,24 @@ public:
// it would need to check the deltaX and deltaY.
double overflowDeltaX;
double overflowDeltaY;
void AssignWheelEventData(const WheelEvent& aEvent, bool aCopyTargets)
{
AssignMouseEventBaseData(aEvent, aCopyTargets);
deltaX = aEvent.deltaX;
deltaY = aEvent.deltaY;
deltaZ = aEvent.deltaZ;
deltaMode = aEvent.deltaMode;
customizedByUserPrefs = aEvent.customizedByUserPrefs;
isMomentum = aEvent.isMomentum;
isPixelOnlyDevice = aEvent.isPixelOnlyDevice;
lineOrPageDeltaX = aEvent.lineOrPageDeltaX;
lineOrPageDeltaY = aEvent.lineOrPageDeltaY;
scrollType = aEvent.scrollType;
overflowDeltaX = aEvent.overflowDeltaX;
overflowDeltaY = aEvent.overflowDeltaY;
}
};
} // namespace widget

View File

@ -312,6 +312,43 @@ const kTests = [
},
todoMismatch: [ ],
},
{ description: "widget::WheelEvent (wheel, vertical)",
targetID: "input-text", eventType: "wheel",
dispatchEvent: function () {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 3, 4,
{ deltaY: 20, lineOrPageDeltaY: 1, altKey: true });
},
canRun: function () {
return true;
},
todoMismatch: [ ],
},
{ description: "widget::WheelEvent (wheel, horizontal)",
targetID: "input-text", eventType: "wheel",
dispatchEvent: function () {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 4, 5,
{ deltaX: 20, lineOrPageDeltaX: 1, ctrlKey: true });
},
canRun: function () {
return true;
},
todoMismatch: [ ],
},
{ description: "widget::WheelEvent (wheel, both)",
targetID: "input-text", eventType: "wheel",
dispatchEvent: function () {
document.getElementById(this.targetID).value = "";
synthesizeWheel(document.getElementById(this.targetID), 4, 5,
{ deltaX: 20, deltaY: 10,
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 });
},
canRun: function () {
return true;
},
todoMismatch: [ ],
},
];
function doTest(aTest)