}
return (Container) result;
}
protected EventExecutionUnit createEventObject(InputEvent e, String type) {
EventExecutionUnit task = null;
if (canvas != null) {
Scriptable event = cx.newObject(global);
event.put("type", event, type);
event.put("altKey", event, Boolean.valueOf(e.isAltDown()));
event.put("ctrlKey", event, Boolean.valueOf(e.isControlDown()));
event.put("shiftKey", event, Boolean.valueOf(e.isShiftDown()));
event.put("button", event,
Integer.valueOf(e.getModifiersEx() >> 10 & 0x7));
if ((e instanceof MouseEvent)) {
MouseEvent me = (MouseEvent) e;
event.put("clientX", event, Integer.valueOf(me.getX()));
event.put("clientY", event, Integer.valueOf(me.getY()));
event.put("layerX", event, Integer.valueOf(me.getX()));
event.put("layerY", event, Integer.valueOf(me.getY()));
event.put("offsetX", event, Integer.valueOf(me.getX()));
event.put("offsetY", event, Integer.valueOf(me.getY()));
event.put("pageX", event, Integer.valueOf(me.getX()));
event.put("pageY", event, Integer.valueOf(me.getY()));
event.put("screenX", event, Integer.valueOf(me.getXOnScreen()));
event.put("screenY", event, Integer.valueOf(me.getYOnScreen()));
event.put("x", event, Integer.valueOf(me.getX()));
event.put("y", event, Integer.valueOf(me.getY()));
switch (me.getButton()) {
case 2:
event.put("which", event, Integer.valueOf(3));
break;
case 3:
event.put("which", event, Integer.valueOf(2));
break;
default:
event.put("which", event, Integer.valueOf(me.getButton()));
}
task = new EventExecutionUnit(canvas, "on" + type,
new Object[] { event });
} else if ((e instanceof KeyEvent)) {
KeyEvent ke = (KeyEvent) e;
event.put("keyCode", event, Integer.valueOf(ke.getKeyCode()));
event.put("which", event, Integer.valueOf(ke.getKeyChar()));
task = new EventExecutionUnit(domWindow.getDocument(), "on"
+ type, new Object[] { event });
}
addTask(task);
e.consume();
}