diff --git a/mozilla/java/dom/classes/org/mozilla/dom/events/EventImpl.java b/mozilla/java/dom/classes/org/mozilla/dom/events/EventImpl.java
index b7b6f986c0d..36e69a39371 100644
--- a/mozilla/java/dom/classes/org/mozilla/dom/events/EventImpl.java
+++ b/mozilla/java/dom/classes/org/mozilla/dom/events/EventImpl.java
@@ -54,44 +54,40 @@ public class EventImpl implements Event {
* The type property represents the event name as a string
* property.
*/
- public native String getType();
+ public native String getType();
/**
* The target property indicates the EventTarget
* to which the event was originally dispatched.
*/
- public native EventTarget getTarget();
+ public native EventTarget getTarget();
/**
* The currentNode property indicates the Node
* whose EventListeners are currently being processed. This
* is particularly useful during capturing and bubbling.
*/
- public native Node getCurrentNode();
+ public native Node getCurrentNode();
/**
* The eventPhase property indicates which phase of event flow
* is currently being evaluated.
*/
- public native short getEventPhase();
+ public native short getEventPhase();
/**
* The bubbles property indicates whether or not an event is a
* bubbling event. If the event can bubble the value is true, else the
* value is false.
*/
- public boolean getBubbles() {
- throw new UnsupportedOperationException();
- }
+ public native boolean getBubbles();
/**
* The cancelable property indicates whether or not an event
* can have its default action prevented. If the default action can be
* prevented the value is true, else the value is false.
*/
- public boolean getCancelable() {
- throw new UnsupportedOperationException();
- }
+ public native boolean getCancelable();
/**
* The preventBubble method is used to end the bubbling phase
@@ -101,7 +97,7 @@ public class EventImpl implements Event {
* at that level and the event will not be propagated upward within the
* tree.
*/
- public native void preventBubble();
+ public native void preventBubble();
/**
* The preventCapture method is used to end the capturing phase
@@ -111,7 +107,7 @@ public class EventImpl implements Event {
* cease at that level and the event will not be propagated any further
* down.
*/
- public native void preventCapture();
+ public native void preventCapture();
/**
* If an event is cancelable, the preventCapture method is used
@@ -124,7 +120,7 @@ public class EventImpl implements Event {
* preventDefault has been called it will remain in effect
* throughout the remainder of the event's propagation.
*/
- public native void preventDefault();
+ public native void preventDefault();
/**
* The stopPropagation method is used prevent further
@@ -134,7 +130,7 @@ public class EventImpl implements Event {
* on the current EventTarget before event flow stops. This
* method may be used during any stage of event flow.
*/
- public void stopPropagation() {
+ public void stopPropagation() {
throw new UnsupportedOperationException();
}
@@ -149,14 +145,11 @@ public class EventImpl implements Event {
* @param cancelableArg Specifies whether or not the event's default action
* can be prevented.
*/
- public void initEvent(String eventTypeArg,
- boolean canBubbleArg,
- boolean cancelableArg) {
- throw new UnsupportedOperationException();
- }
+ public native void initEvent(String eventTypeArg,
+ boolean canBubbleArg,
+ boolean cancelableArg);
public long getTimeStamp() {
throw new UnsupportedOperationException();
}
}
-
diff --git a/mozilla/java/dom/classes/org/mozilla/dom/events/MouseEventImpl.java b/mozilla/java/dom/classes/org/mozilla/dom/events/MouseEventImpl.java
index 636e1601829..fcf41cf713e 100644
--- a/mozilla/java/dom/classes/org/mozilla/dom/events/MouseEventImpl.java
+++ b/mozilla/java/dom/classes/org/mozilla/dom/events/MouseEventImpl.java
@@ -57,66 +57,64 @@ public class MouseEventImpl extends UIEventImpl implements MouseEvent {
* screenX indicates the horizontal coordinate at which the
* event occurred in relative to the origin of the screen coordinate system.
*/
- public native int getScreenX();
+ public native int getScreenX();
/**
* screenY indicates the vertical coordinate at which the event
* occurred relative to the origin of the screen coordinate system.
*/
- public native int getScreenY();
+ public native int getScreenY();
/**
* clientX indicates the horizontal coordinate at which the
* event occurred relative to the DOM implementation's client area.
*/
- public native int getClientX();
+ public native int getClientX();
/**
* clientY indicates the vertical coordinate at which the event
* occurred relative to the DOM implementation's client area.
*/
- public native int getClientY();
+ public native int getClientY();
/**
* ctrlKey indicates whether the 'ctrl' key was depressed
* during the firing of the event.
*/
- public native boolean getCtrlKey();
+ public native boolean getCtrlKey();
/**
* shiftKey indicates whether the 'shift' key was depressed
* during the firing of the event.
*/
- public native boolean getShiftKey();
+ public native boolean getShiftKey();
/**
* altKey indicates whether the 'alt' key was depressed during
* the firing of the event. On some platforms this key may map to an
* alternative key name.
*/
- public native boolean getAltKey();
+ public native boolean getAltKey();
/**
* metaKey indicates whether the 'meta' key was depressed
* during the firing of the event. On some platforms this key may map to
* an alternative key name.
*/
- public native boolean getMetaKey();
+ public native boolean getMetaKey();
/**
* During mouse events caused by the depression or release of a mouse
* button, button is used to indicate which mouse button
* changed state.
*/
- public native short getButton();
+ public native short getButton();
/**
* relatedNode is used to identify a secondary node related to
* a UI event.
*/
- public Node getRelatedNode() {
- throw new UnsupportedOperationException();
- }
+ public native Node getRelatedNode();
/**
*
@@ -142,22 +140,20 @@ public class MouseEventImpl extends UIEventImpl implements MouseEvent {
* @param buttonArg Specifies the Event's mouse button.
* @param relatedNodeArg Specifies the Event's related Node.
*/
- public void initMouseEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- AbstractView viewArg,
- int detailArg,
- int screenXArg,
- int screenYArg,
- int clientXArg,
- int clientYArg,
- boolean ctrlKeyArg,
- boolean altKeyArg,
- boolean shiftKeyArg,
- boolean metaKeyArg,
- short buttonArg,
- Node relatedNodeArg) {
- throw new UnsupportedOperationException();
- }
+ public native void initMouseEvent(String typeArg,
+ boolean canBubbleArg,
+ boolean cancelableArg,
+ AbstractView viewArg,
+ int detailArg,
+ int screenXArg,
+ int screenYArg,
+ int clientXArg,
+ int clientYArg,
+ boolean ctrlKeyArg,
+ boolean altKeyArg,
+ boolean shiftKeyArg,
+ boolean metaKeyArg,
+ short buttonArg,
+ Node relatedNodeArg);
}
diff --git a/mozilla/java/dom/classes/org/mozilla/dom/events/UIEventImpl.java b/mozilla/java/dom/classes/org/mozilla/dom/events/UIEventImpl.java
index f7fc6b1c438..ab6ea77e4a3 100644
--- a/mozilla/java/dom/classes/org/mozilla/dom/events/UIEventImpl.java
+++ b/mozilla/java/dom/classes/org/mozilla/dom/events/UIEventImpl.java
@@ -47,17 +47,13 @@ public class UIEventImpl extends EventImpl implements UIEvent {
* The view attribute identifies the AbstractView
* from which the event was generated.
*/
- public AbstractView getView() {
- throw new UnsupportedOperationException();
- }
+ public native AbstractView getView();
/**
* Specifies some detail information about the Event, depending
* on the type of event.
*/
- public int getDetail() {
- throw new UnsupportedOperationException();
- }
+ public native int getDetail();
/**
*
@@ -69,12 +65,10 @@ public class UIEventImpl extends EventImpl implements UIEvent {
* AbstractView.
* @param detailArg Specifies the Event's detail.
*/
- public void initUIEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- AbstractView viewArg,
- int detailArg) {
- throw new UnsupportedOperationException();
- }
+ public native void initUIEvent(String typeArg,
+ boolean canBubbleArg,
+ boolean cancelableArg,
+ AbstractView viewArg,
+ int detailArg);
}
diff --git a/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.cpp b/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.cpp
index bf877743cc1..3db3752eb84 100644
--- a/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.cpp
+++ b/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.cpp
@@ -44,7 +44,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_EventImpl_getCurrentNode
nsresult rv = event->GetCurrentNode(&ret);
if (NS_FAILED(rv) || !ret) {
JavaDOMGlobals::ThrowException(env,
- "Event.getCurrentNode: failed");
+ "Event.getCurrentNode: failed", rv);
return NULL;
}
@@ -71,7 +71,7 @@ JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_EventImpl_getEventPhase
nsresult rv = event->GetEventPhase(&eventPhase);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "Event.getEventPhase: failed");
+ "Event.getEventPhase: failed", rv);
return 0;
}
@@ -105,6 +105,60 @@ JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_EventImpl_getEventPhase
return ret;
}
+/*
+ * Class: org_mozilla_dom_events_EventImpl
+ * Method: getBubbles
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_EventImpl_getBubbles
+ (JNIEnv *env, jobject jthis)
+{
+ nsIDOMEvent* event = (nsIDOMEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event) {
+ JavaDOMGlobals::ThrowException(env,
+ "Event.getBubbles: NULL pointer");
+ return JNI_FALSE;
+ }
+
+ PRBool canBubble = PR_FALSE;
+ nsresult rv = event->GetBubbles(&canBubble);
+ if (NS_FAILED(rv)) {
+ JavaDOMGlobals::ThrowException(env,
+ "Event.getBubbles: failed", rv);
+ return JNI_FALSE;
+ }
+
+ return (canBubble == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
+}
+
+/*
+ * Class: org_mozilla_dom_events_EventImpl
+ * Method: getCancelable
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_EventImpl_getCancelable
+ (JNIEnv *env, jobject jthis)
+{
+ nsIDOMEvent* event = (nsIDOMEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event) {
+ JavaDOMGlobals::ThrowException(env,
+ "Event.getCancelable: NULL pointer");
+ return JNI_FALSE;
+ }
+
+ PRBool cancelable = PR_FALSE;
+ nsresult rv = event->GetCancelable(&cancelable);
+ if (NS_FAILED(rv)) {
+ JavaDOMGlobals::ThrowException(env,
+ "Event.getCancelable: failed", rv);
+ return JNI_FALSE;
+ }
+
+ return (cancelable == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
+}
+
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getTarget
@@ -125,7 +179,7 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_EventImpl_getTarget
nsresult rv = event->GetTarget(&ret);
if (NS_FAILED(rv) || !ret) {
JavaDOMGlobals::ThrowException(env,
- "Event.getTarget: failed");
+ "Event.getTarget: failed", rv);
return NULL;
}
@@ -152,7 +206,7 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_dom_events_EventImpl_getType
nsresult rv = event->GetType(ret);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "Event.getType: failed");
+ "Event.getType: failed", rv);
return NULL;
}
@@ -182,11 +236,10 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventBubble
return;
}
- nsIDOMNode* ret = nsnull;
nsresult rv = event->PreventBubble();
- if (NS_FAILED(rv) || !ret) {
+ if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "Event.preventBubble: failed");
+ "Event.preventBubble: failed", rv);
}
}
@@ -206,11 +259,10 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventCapture
return;
}
- nsIDOMNode* ret = nsnull;
nsresult rv = event->PreventCapture();
- if (NS_FAILED(rv) || !ret) {
+ if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "Event.preventCapture: failed");
+ "Event.preventCapture: failed", rv);
}
}
@@ -230,11 +282,45 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventDefault
return;
}
- nsIDOMNode* ret = nsnull;
nsresult rv = event->PreventDefault();
- if (NS_FAILED(rv) || !ret) {
+ if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "Event.preventDefault: failed");
+ "Event.preventDefault: failed", rv);
}
}
+/*
+ * Class: org_mozilla_dom_events_EventImpl
+ * Method: initEvent
+ * Signature: (Ljava/lang/String;ZZ)V
+ */
+JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_initEvent
+ (JNIEnv *env, jobject jthis, jstring jeventTypeArg, jboolean jcanBubbleArg, jboolean jcancelableArg)
+{
+ nsIDOMEvent* event = (nsIDOMEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event || !jeventTypeArg) {
+ JavaDOMGlobals::ThrowException(env,
+ "Event.initEvent: NULL pointer");
+ return;
+ }
+
+ jboolean iscopy = JNI_FALSE;
+ const char* cvalue = env->GetStringUTFChars(jeventTypeArg, &iscopy);
+ if (!cvalue) {
+ PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
+ ("Event.initEvent: GetStringUTFChars failed\n"));
+ return;
+ }
+
+ PRBool canBubble = jcanBubbleArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+ PRBool cancelable = jcancelableArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+
+ nsresult rv = event->InitEvent(cvalue, canBubble, cancelable);
+ if (iscopy == JNI_TRUE)
+ env->ReleaseStringUTFChars(jeventTypeArg, cvalue);
+ if (NS_FAILED(rv)) {
+ PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
+ ("Event.initEvent: failed (%x)\n", rv));
+ }
+}
diff --git a/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.h b/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.h
index 41c7f9fd70a..e5d56503241 100644
--- a/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.h
+++ b/mozilla/java/dom/jni/org_mozilla_dom_events_EventImpl.h
@@ -7,6 +7,22 @@
#ifdef __cplusplus
extern "C" {
#endif
+/*
+ * Class: org_mozilla_dom_events_EventImpl
+ * Method: getType
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_mozilla_dom_events_EventImpl_getType
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_mozilla_dom_events_EventImpl
+ * Method: getTarget
+ * Signature: ()Lorg/w3c/dom/events/EventTarget;
+ */
+JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_EventImpl_getTarget
+ (JNIEnv *, jobject);
+
/*
* Class: org_mozilla_dom_events_EventImpl
* Method: getCurrentNode
@@ -25,18 +41,18 @@ JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_EventImpl_getEventPhase
/*
* Class: org_mozilla_dom_events_EventImpl
- * Method: getTarget
- * Signature: ()Lorg/w3c/dom/events/EventTarget;
+ * Method: getBubbles
+ * Signature: ()Z
*/
-JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_EventImpl_getTarget
+JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_EventImpl_getBubbles
(JNIEnv *, jobject);
/*
* Class: org_mozilla_dom_events_EventImpl
- * Method: getType
- * Signature: ()Ljava/lang/String;
+ * Method: getCancelable
+ * Signature: ()Z
*/
-JNIEXPORT jstring JNICALL Java_org_mozilla_dom_events_EventImpl_getType
+JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_EventImpl_getCancelable
(JNIEnv *, jobject);
/*
@@ -63,6 +79,14 @@ JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventCapture
JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_preventDefault
(JNIEnv *, jobject);
+/*
+ * Class: org_mozilla_dom_events_EventImpl
+ * Method: initEvent
+ * Signature: (Ljava/lang/String;ZZ)V
+ */
+JNIEXPORT void JNICALL Java_org_mozilla_dom_events_EventImpl_initEvent
+ (JNIEnv *, jobject, jstring, jboolean, jboolean);
+
#ifdef __cplusplus
}
#endif
diff --git a/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.cpp b/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.cpp
index 162fae9ff4c..55fbada6f8c 100644
--- a/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.cpp
+++ b/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.cpp
@@ -20,6 +20,7 @@
*/
#include "prlog.h"
+#include "nsIDOMNode.h"
#include "nsIDOMMouseEvent.h"
#include "javaDOMEventsGlobals.h"
#include "org_mozilla_dom_events_MouseEventImpl.h"
@@ -44,7 +45,7 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getAltKey
nsresult rv = event->GetAltKey(&altKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getAltKey: failed");
+ "MouseEvent.getAltKey: failed", rv);
return JNI_FALSE;
}
@@ -73,7 +74,7 @@ JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getButton
nsresult rv = event->GetButton(&code);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getButton: failed");
+ "MouseEvent.getButton: failed", rv);
return 0;
}
@@ -100,7 +101,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getClientX
nsresult rv = event->GetClientX(&clientX);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getClientX: failed");
+ "MouseEvent.getClientX: failed", rv);
return 0;
}
@@ -127,7 +128,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getClientY
nsresult rv = event->GetClientY(&clientY);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getClientY: failed");
+ "MouseEvent.getClientY: failed", rv);
return 0;
}
@@ -155,7 +156,7 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getCtrlKey
nsresult rv = event->GetCtrlKey(&ctrlKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getCtrlKey: failed");
+ "MouseEvent.getCtrlKey: failed", rv);
return JNI_FALSE;
}
@@ -183,7 +184,7 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getMetaKey
nsresult rv = event->GetMetaKey(&metaKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getMetaKey: failed");
+ "MouseEvent.getMetaKey: failed", rv);
return JNI_FALSE;
}
@@ -211,7 +212,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenX
nsresult rv = event->GetScreenX(&screenX);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getScreenX: failed");
+ "MouseEvent.getScreenX: failed", rv);
return 0;
}
@@ -238,7 +239,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenY
nsresult rv = event->GetScreenY(&screenY);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getScreenY: failed");
+ "MouseEvent.getScreenY: failed", rv);
return 0;
}
@@ -266,11 +267,107 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getShiftKe
nsresult rv = event->GetShiftKey(&shiftKey);
if (NS_FAILED(rv)) {
JavaDOMGlobals::ThrowException(env,
- "MouseEvent.getShiftKey: failed");
+ "MouseEvent.getShiftKey: failed", rv);
return JNI_FALSE;
}
return (shiftKey == PR_TRUE) ? JNI_TRUE : JNI_FALSE;
}
+/*
+ * Class: org_mozilla_dom_events_MouseEventImpl
+ * Method: getRelatedNode
+ * Signature: ()Lorg/w3c/dom/Node;
+ */
+JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getRelatedNode
+ (JNIEnv *env, jobject jthis)
+{
+ nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event) {
+ JavaDOMGlobals::ThrowException(env,
+ "MouseEvent.getRelatedNode: NULL pointer");
+ return NULL;
+ }
+
+ nsIDOMNode* node = nsnull;
+ nsresult rv = event->GetRelatedNode(&node);
+ if (NS_FAILED(rv)) {
+ JavaDOMGlobals::ThrowException(env,
+ "MouseEvent.getRelatedNode: failed", rv);
+ return NULL;
+ }
+ if (!node)
+ return NULL;
+
+ return JavaDOMGlobals::CreateNodeSubtype(env, node);
+}
+
+/*
+ * Class: org_mozilla_dom_events_MouseEventImpl
+ * Method: initMouseEvent
+ * Signature: (Ljava/lang/String;ZZLorg/w3c/dom/views/AbstractView;IIIIIZZZZSLorg/w3c/dom/Node;)V
+ */
+JNIEXPORT void JNICALL Java_org_mozilla_dom_events_MouseEventImpl_initMouseEvent
+ (JNIEnv *env, jobject jthis,
+ jstring jtypeArg,
+ jboolean jcanBubbleArg,
+ jboolean jcancelableArg,
+ jobject jviewArg,
+ jint jdetailArg,
+ jint jscreenXArg,
+ jint jscreenYArg,
+ jint jclientXArg,
+ jint jclientYArg,
+ jboolean jctrlKeyArg,
+ jboolean jaltKeyArg,
+ jboolean jshiftKeyArg,
+ jboolean jmetaKeyArg,
+ jshort jbuttonArg,
+ jobject jrelatedNodeArg)
+{
+ nsIDOMMouseEvent* event = (nsIDOMMouseEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event) {
+ JavaDOMGlobals::ThrowException(env,
+ "MouseEvent.initMouseEvent: NULL pointer");
+ return;
+ }
+
+ jboolean iscopy = JNI_FALSE;
+ const char* cvalue = env->GetStringUTFChars(jtypeArg, &iscopy);
+ if (!cvalue) {
+ PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
+ ("UIEvent.initUIEvent: GetStringUTFChars failed"));
+ return;
+ }
+
+ PRBool canBubble = jcanBubbleArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+ PRBool cancelable = jcancelableArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+ PRBool ctrlKeyArg = jctrlKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+ PRBool altKeyArg = jaltKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+ PRBool shiftKeyArg = jshiftKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+ PRBool metaKeyArg = jmetaKeyArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+
+ nsresult rv = event->InitMouseEvent(cvalue,
+ ctrlKeyArg,
+ altKeyArg,
+ shiftKeyArg,
+ metaKeyArg,
+ (PRInt32)jscreenXArg,
+ (PRInt32)jscreenYArg,
+ (PRInt32)jclientXArg,
+ (PRInt32)jclientYArg,
+ (PRUint16)jbuttonArg,
+ (PRUint16)jdetailArg);
+
+ if (iscopy == JNI_TRUE)
+ env->ReleaseStringUTFChars(jtypeArg, cvalue);
+ if (NS_FAILED(rv)) {
+ JavaDOMGlobals::ThrowException(env,
+ "UIEvent.initUIEvent: failed", rv);
+ }
+
+}
+
diff --git a/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.h b/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.h
index fcadc05770d..cb8fa78c169 100644
--- a/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.h
+++ b/mozilla/java/dom/jni/org_mozilla_dom_events_MouseEventImpl.h
@@ -9,18 +9,18 @@ extern "C" {
#endif
/*
* Class: org_mozilla_dom_events_MouseEventImpl
- * Method: getAltKey
- * Signature: ()Z
+ * Method: getScreenX
+ * Signature: ()I
*/
-JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getAltKey
+JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenX
(JNIEnv *, jobject);
/*
* Class: org_mozilla_dom_events_MouseEventImpl
- * Method: getButton
- * Signature: ()S
+ * Method: getScreenY
+ * Signature: ()I
*/
-JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getButton
+JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenY
(JNIEnv *, jobject);
/*
@@ -47,6 +47,22 @@ JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getClientY
JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getCtrlKey
(JNIEnv *, jobject);
+/*
+ * Class: org_mozilla_dom_events_MouseEventImpl
+ * Method: getShiftKey
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getShiftKey
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_mozilla_dom_events_MouseEventImpl
+ * Method: getAltKey
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getAltKey
+ (JNIEnv *, jobject);
+
/*
* Class: org_mozilla_dom_events_MouseEventImpl
* Method: getMetaKey
@@ -57,27 +73,27 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getMetaKey
/*
* Class: org_mozilla_dom_events_MouseEventImpl
- * Method: getScreenX
- * Signature: ()I
+ * Method: getButton
+ * Signature: ()S
*/
-JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenX
+JNIEXPORT jshort JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getButton
(JNIEnv *, jobject);
/*
* Class: org_mozilla_dom_events_MouseEventImpl
- * Method: getScreenY
- * Signature: ()I
+ * Method: getRelatedNode
+ * Signature: ()Lorg/w3c/dom/Node;
*/
-JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getScreenY
+JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getRelatedNode
(JNIEnv *, jobject);
/*
* Class: org_mozilla_dom_events_MouseEventImpl
- * Method: getShiftKey
- * Signature: ()Z
+ * Method: initMouseEvent
+ * Signature: (Ljava/lang/String;ZZLorg/w3c/dom/views/AbstractView;IIIIIZZZZSLorg/w3c/dom/Node;)V
*/
-JNIEXPORT jboolean JNICALL Java_org_mozilla_dom_events_MouseEventImpl_getShiftKey
- (JNIEnv *, jobject);
+JNIEXPORT void JNICALL Java_org_mozilla_dom_events_MouseEventImpl_initMouseEvent
+ (JNIEnv *, jobject, jstring, jboolean, jboolean, jobject, jint, jint, jint, jint, jint, jboolean, jboolean, jboolean, jboolean, jshort, jobject);
#ifdef __cplusplus
}
diff --git a/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.cpp b/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.cpp
index 7ddfb8b3532..1b16afe3589 100644
--- a/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.cpp
+++ b/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.cpp
@@ -20,6 +20,108 @@
*/
#include "prlog.h"
+#include"javaDOMEventsGlobals.h"
#include "org_mozilla_dom_events_UIEventImpl.h"
+#include "nsIDOMUIEvent.h"
+#include "nsIDOMAbstractView.h"
+
+/*
+ * Class: org_mozilla_dom_events_UIEventImpl
+ * Method: getView
+ * Signature: ()Lorg/w3c/dom/views/AbstractView;
+ */
+JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_UIEventImpl_getView
+ (JNIEnv *env, jobject jthis)
+{
+ nsIDOMUIEvent* event = (nsIDOMUIEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event) {
+ JavaDOMGlobals::ThrowException(env,
+ "Event.getCurrentNode: NULL pointer");
+ return NULL;
+ }
+
+ nsIDOMAbstractView* aView = nsnull;
+ nsresult rv = event->GetView(&aView);
+ if (NS_FAILED(rv) || !aView) {
+ JavaDOMGlobals::ThrowException(env,
+ "UIEvent.getView: failed", rv);
+ return NULL;
+ }
+
+ // REMIND: Abstract View
+ return NULL; //JavaDOMEventGlobals::CreateEventSubtype(env, ret);
+}
+
+/*
+ * Class: org_mozilla_dom_events_UIEventImpl
+ * Method: getDetail
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_UIEventImpl_getDetail
+ (JNIEnv *env, jobject jthis)
+{
+ nsIDOMUIEvent* event = (nsIDOMUIEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event) {
+ JavaDOMGlobals::ThrowException(env,
+ "UIEvent.getDetail: NULL pointer");
+ return 0;
+ }
+
+ PRInt32 aDetail = 0;
+ nsresult rv = event->GetDetail(&aDetail);
+ if (NS_FAILED(rv)) {
+ JavaDOMGlobals::ThrowException(env,
+ "UIEvent.getDetail: failed", rv);
+ return 0;
+ }
+
+ return (jint)aDetail;
+}
+
+/*
+ * Class: org_mozilla_dom_events_UIEventImpl
+ * Method: initUIEvent
+ * Signature: (Ljava/lang/String;ZZLorg/w3c/dom/views/AbstractView;I)V
+ */
+JNIEXPORT void JNICALL Java_org_mozilla_dom_events_UIEventImpl_initUIEvent
+ (JNIEnv *env, jobject jthis,
+ jstring jtypeArg,
+ jboolean jcanBubbleArg,
+ jboolean jcancelableArg,
+ jobject jviewArg,
+ jint jdetailArg)
+{
+ nsIDOMUIEvent* event = (nsIDOMUIEvent*)
+ env->GetLongField(jthis, JavaDOMEventsGlobals::eventPtrFID);
+ if (!event || !jtypeArg || !jviewArg) {
+ JavaDOMGlobals::ThrowException(env,
+ "Event.initUIEvent: NULL pointer\n");
+ return;
+ }
+
+ jboolean iscopy = JNI_FALSE;
+ const char* cvalue = env->GetStringUTFChars(jtypeArg, &iscopy);
+ if (!cvalue) {
+ PR_LOG(JavaDOMGlobals::log, PR_LOG_ERROR,
+ ("UIEvent.initUIEvent: GetStringUTFChars failed\n"));
+ return;
+ }
+
+ PRBool canBubble = jcanBubbleArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+ PRBool cancelable = jcancelableArg == JNI_TRUE ? PR_TRUE : PR_FALSE;
+
+
+ // REMIND: need to deal with AbstractView
+ // NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)=0;
+ nsresult rv = event->InitUIEvent(cvalue, canBubble, cancelable, NULL, (PRUint32)jdetailArg);
+
+ if (iscopy == JNI_TRUE)
+ env->ReleaseStringUTFChars(jtypeArg, cvalue);
+ if (NS_FAILED(rv)) {
+ JavaDOMGlobals::ThrowException(env,
+ "UIEvent.initUIEvent: failed", rv);
+ }
+}
-/* Can't be implemented at the moment */
diff --git a/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.h b/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.h
index fe2effbffb3..594da8ac54b 100644
--- a/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.h
+++ b/mozilla/java/dom/jni/org_mozilla_dom_events_UIEventImpl.h
@@ -7,6 +7,30 @@
#ifdef __cplusplus
extern "C" {
#endif
+/*
+ * Class: org_mozilla_dom_events_UIEventImpl
+ * Method: getView
+ * Signature: ()Lorg/w3c/dom/views/AbstractView;
+ */
+JNIEXPORT jobject JNICALL Java_org_mozilla_dom_events_UIEventImpl_getView
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_mozilla_dom_events_UIEventImpl
+ * Method: getDetail
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_mozilla_dom_events_UIEventImpl_getDetail
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_mozilla_dom_events_UIEventImpl
+ * Method: initUIEvent
+ * Signature: (Ljava/lang/String;ZZLorg/w3c/dom/views/AbstractView;I)V
+ */
+JNIEXPORT void JNICALL Java_org_mozilla_dom_events_UIEventImpl_initUIEvent
+ (JNIEnv *, jobject, jstring, jboolean, jboolean, jobject, jint);
+
#ifdef __cplusplus
}
#endif