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
Родитель 2ce0c3d82d
Коммит aeee25cf0b
3 изменённых файлов: 56 добавлений и 18 удалений

Просмотреть файл

@ -606,24 +606,7 @@ nsDOMEvent::DuplicatePrivateData()
static_cast<widget::WheelEvent*>(mEvent); static_cast<widget::WheelEvent*>(mEvent);
widget::WheelEvent* wheelEvent = widget::WheelEvent* wheelEvent =
new widget::WheelEvent(false, msg, nullptr); new widget::WheelEvent(false, msg, nullptr);
wheelEvent->AssignInputEventData(*oldWheelEvent, true); wheelEvent->AssignWheelEventData(*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;
newEvent = wheelEvent; newEvent = wheelEvent;
break; break;
} }

Просмотреть файл

@ -1541,6 +1541,24 @@ public:
// it would need to check the deltaX and deltaY. // it would need to check the deltaX and deltaY.
double overflowDeltaX; double overflowDeltaX;
double overflowDeltaY; 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 } // namespace widget

Просмотреть файл

@ -312,6 +312,43 @@ const kTests = [
}, },
todoMismatch: [ ], 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) function doTest(aTest)