diff options
author | Grant Gayed <ggayed> | 2010-03-30 15:10:51 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2010-03-30 15:10:51 +0000 |
commit | 552c8bd58eca97b6fa31432ec71e7c05f64afc6d (patch) | |
tree | afb9029e05a48617526ec9a420243bad334f7343 | |
parent | 159d68c5cdc07d0c012524712583b496e401e2e1 (diff) | |
download | eclipse.platform.swt-552c8bd58eca97b6fa31432ec71e7c05f64afc6d.tar.gz eclipse.platform.swt-552c8bd58eca97b6fa31432ec71e7c05f64afc6d.tar.xz eclipse.platform.swt-552c8bd58eca97b6fa31432ec71e7c05f64afc6d.zip |
WebKitGTK initial
27 files changed, 5169 insertions, 32 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties index 27cdd9b856..b4db7a6c33 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties @@ -51,4 +51,5 @@ org.eclipse.swt.internal.wpf.OS,../org.eclipse.swt/Eclipse SWT PI/wpf/library/,\ org.eclipse.swt.internal.win32.Win32,../org.eclipse.swt/Eclipse SWT PI/wpf_win32/library/,\ org.eclipse.swt.internal.cocoa.Cocoa,../org.eclipse.swt/Eclipse SWT PI/carbon/library/,\ org.eclipse.swt.internal.cocoa.OS,../org.eclipse.swt/Eclipse SWT PI/cocoa/library/,\ +org.eclipse.swt.internal.webkit.WebKitGTK,../org.eclipse.swt/Eclipse SWT WebKit/gtk/library/,\ org.eclipse.swt.internal.qt.OS,../org.eclipse.swt/Eclipse SWT PI/qt/library/ diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.webkit.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.webkit.properties new file mode 100755 index 0000000000..d679274ea0 --- /dev/null +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.webkit.properties @@ -0,0 +1,25 @@ +############################################################################### +# Copyright (c) 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +swt_copyright=/*******************************************************************************\n \ +* Copyright (c) 2000, %END_YEAR IBM Corporation and others. All rights reserved.\n \ +* The contents of this file are made available under the terms\n \ +* of the GNU Lesser General Public License (LGPL) Version 2.1 that\n \ +* accompanies this distribution (lgpl-v21.txt). The LGPL is also\n \ +* available at http://www.gnu.org/licenses/lgpl.html. If the version\n \ +* of the LGPL at http://www.gnu.org is different to the version of\n \ +* the LGPL accompanying this distribution and there is any conflict\n \ +* between the two license versions, the terms of the LGPL accompanying\n \ +* this distribution shall govern.\n \ +* \n \ +* Contributors:\n \ +* IBM Corporation - initial API and implementation\n \ +*******************************************************************************/\n + diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk index 2ae41a46d5..a455a2054a 100644 --- a/bundles/org.eclipse.swt/.classpath_gtk +++ b/bundles/org.eclipse.swt/.classpath_gtk @@ -36,6 +36,7 @@ <classpathentry kind="src" path="Eclipse SWT OpenGL/glx"/> <classpathentry kind="src" path="Eclipse SWT OpenGL/common"/> <classpathentry kind="src" path="Eclipse SWT Theme/gtk"/> + <classpathentry kind="src" path="Eclipse SWT WebKit/gtk"/> <classpathentry kind="lib" path="extra_jars/exceptions.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java index 26a38da9da..1ae84e0b23 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java @@ -150,7 +150,7 @@ class Safari extends WebBrowser { NativePendingCookies = null; } -public void create (Composite parent, int style) { +public boolean create (Composite parent, int style) { /* * Note. Loading the webkit bundle on Jaguar causes a crash. * The workaround is to detect any OS prior to 10.30 and fail @@ -401,6 +401,8 @@ public void create (Composite parent, int style) { int preferences = Cocoa.objc_msgSend(Cocoa.C_WebPreferences, Cocoa.S_standardPreferences); Cocoa.objc_msgSend(preferences, Cocoa.S_setJavaEnabled, 0); } + + return true; } static int eventProc3(int nextHandler, int theEvent, int userData) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java index 759778484e..cd9ca6ad5a 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java @@ -44,8 +44,9 @@ public class Browser extends Composite { int userStyle; boolean isClosing; - static final String PACKAGE_PREFIX = "org.eclipse.swt.browser."; //$NON-NLS-1$ static final String NO_INPUT_METHOD = "org.eclipse.swt.internal.gtk.noInputMethod"; //$NON-NLS-1$ + static final String PACKAGE_PREFIX = "org.eclipse.swt.browser."; //$NON-NLS-1$ + static final String PROPERTY_USEWEBKITGTK = "org.eclipse.swt.browser.UseWebKitGTK"; //$NON-NLS-1$ /** * Constructs a new instance of this class given its parent @@ -84,40 +85,45 @@ public Browser (Composite parent, int style) { String platform = SWT.getPlatform (); Display display = parent.getDisplay (); if ("gtk".equals (platform)) display.setData (NO_INPUT_METHOD, null); //$NON-NLS-1$ - String className = null; + String classNames[] = null; if ((style & SWT.MOZILLA) != 0) { - className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$ + classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ } else { if ("win32".equals (platform) || "wpf".equals (platform)) { //$NON-NLS-1$ $NON-NLS-2$ - className = "org.eclipse.swt.browser.IE"; //$NON-NLS-1$ + classNames = new String[] {"org.eclipse.swt.browser.IE"}; //$NON-NLS-1$ } else if ("motif".equals (platform)) { //$NON-NLS-1$ - className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$ + classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ } else if ("gtk".equals (platform)) { //$NON-NLS-1$ - className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$ + if (System.getProperty (PROPERTY_USEWEBKITGTK) != null) { + classNames = new String[] {"org.eclipse.swt.browser.WebKit", "org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ //$NON-NLS-2$ + } else { + classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ + } } else if ("carbon".equals (platform) || "cocoa".equals (platform)) { //$NON-NLS-1$ - className = "org.eclipse.swt.browser.Safari"; //$NON-NLS-1$ + classNames = new String[] {"org.eclipse.swt.browser.Safari"}; //$NON-NLS-1$ } else if ("photon".equals (platform)) { //$NON-NLS-1$ - className = "org.eclipse.swt.browser.Voyager"; //$NON-NLS-1$ + classNames = new String[] {"org.eclipse.swt.browser.Voyager"}; //$NON-NLS-1$ } else { dispose (); SWT.error (SWT.ERROR_NO_HANDLES); } } - try { - Class clazz = Class.forName (className); - webBrowser = (WebBrowser)clazz.newInstance (); - } catch (ClassNotFoundException e) { - } catch (IllegalAccessException e) { - } catch (InstantiationException e) { - } - if (webBrowser == null) { - dispose (); - SWT.error (SWT.ERROR_NO_HANDLES); + for (int i = 0; i < classNames.length; i++) { + try { + Class clazz = Class.forName (classNames[i]); + webBrowser = (WebBrowser)clazz.newInstance (); + if (webBrowser != null) { + webBrowser.setBrowser (this); + if (webBrowser.create (parent, style)) return; + } + } catch (ClassNotFoundException e) { + } catch (IllegalAccessException e) { + } catch (InstantiationException e) { + } } - - webBrowser.setBrowser (this); - webBrowser.create (parent, style); + dispose (); + SWT.error (SWT.ERROR_NO_HANDLES); } static Composite checkParent (Composite parent) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java index 6cb22e7d57..b6f3df75cc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java @@ -171,7 +171,7 @@ abstract class WebBrowser { {19, SWT.PAUSE}, {3, SWT.BREAK}, - /* Safari-specific */ + /* WebKit/Safari-specific */ {186, ';'}, {187, '='}, {189, '-'}, @@ -300,7 +300,7 @@ static void SetPendingCookies (Vector pendingCookies) { } } -public abstract void create (Composite parent, int style); +public abstract boolean create (Composite parent, int style); static String CreateErrorString (String error) { return ERROR_ID + error; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java index 040b404a39..4556ee4bda 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java @@ -28,7 +28,7 @@ class IE extends WebBrowser { }; } -public void create(Composite parent, int style) { +public boolean create(Composite parent, int style) { host = OS.gcnew_WindowsFormsHost(); if (host == 0) SWT.error(SWT.ERROR_NO_HANDLES); webBrowser = OS.gcnew_WebBrowser(); @@ -87,6 +87,8 @@ public void create(Composite parent, int style) { }; browser.addListener(SWT.Resize, listener); browser.addListener(SWT.Dispose, listener); + + return true; } public boolean back() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java index 2798796d5e..32cf5ca16f 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java @@ -32,7 +32,7 @@ class Voyager extends WebBrowser { /* Package Name */ static Callback callback; -public void create(Composite parent, int style) { +public boolean create(Composite parent, int style) { /* use Photon's built-in anchoring for resizing */ int[] args = { OS.Pt_ARG_ANCHOR_FLAGS, @@ -108,6 +108,8 @@ public void create(Composite parent, int style) { browser.addListener(folderEvents[i], listener); } OS.PtRealizeWidget(webHandle); + + return true; } static int webProc(int handle, int data, int info) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java index 0e73cf0131..69658bf328 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java @@ -250,7 +250,7 @@ class IE extends WebBrowser { NativePendingCookies = null; } -public void create(Composite parent, int style) { +public boolean create(Composite parent, int style) { this.style = style; frame = new OleFrame(browser, SWT.NONE); @@ -927,6 +927,8 @@ public void create(Composite parent, int style) { int[] rgdispid = auto.getIDsOfNames(new String[] {"RegisterAsDropTarget"}); //$NON-NLS-1$ if (rgdispid != null) auto.setProperty(rgdispid[0], variant); variant.dispose(); + + return true; } public boolean back() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java index 9ca6733ad0..0defaa7f92 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java @@ -28,7 +28,7 @@ class IE extends WebBrowser { }; } -public void create(Composite parent, int style) { +public boolean create(Composite parent, int style) { frame = OS.gcnew_Frame(); if (frame == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.Frame_NavigationUIVisibility(frame, OS.NavigationUIVisibility_Hidden); @@ -64,6 +64,8 @@ public void create(Composite parent, int style) { }; browser.addListener(SWT.Resize, listener); browser.addListener(SWT.Dispose, listener); + + return true; } public boolean back() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java index 51330987fc..a9cb8de0c6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java @@ -397,7 +397,7 @@ class Mozilla extends WebBrowser { }; } -public void create (Composite parent, int style) { +public boolean create (Composite parent, int style) { delegate = new MozillaDelegate (browser); final Display display = parent.getDisplay (); @@ -799,6 +799,8 @@ public void create (Composite parent, int style) { for (int i = 0; i < folderEvents.length; i++) { browser.addListener (folderEvents[i], listener); } + + return true; } public boolean back () { diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak index 626bc1a9b4..4001af0b6d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak @@ -27,6 +27,7 @@ GNOME_PREFIX = swt-gnome MOZILLA_PREFIX = swt-mozilla$(GCC_VERSION) XULRUNNER_PREFIX = swt-xulrunner XPCOMINIT_PREFIX = swt-xpcominit +WEBKIT_PREFIX = swt-webkit GLX_PREFIX = swt-glx SWT_LIB = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so @@ -39,6 +40,7 @@ GNOME_LIB = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so MOZILLA_LIB = lib$(MOZILLA_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so XULRUNNER_LIB = lib$(XULRUNNER_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so XPCOMINIT_LIB = lib$(XPCOMINIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so +WEBKIT_LIB = lib$(WEBKIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so GLX_LIB = lib$(GLX_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so CAIROCFLAGS = `pkg-config --cflags cairo` @@ -89,6 +91,9 @@ MOZILLAEXCLUDES = -DNO__1XPCOMGlueShutdown \ -DNO_nsDynamicFunctionLoad XULRUNNEREXCLUDES = -DNO__1NS_1InitXPCOM2 +WEBKITCFLAGS = `pkg-config --cflags gtk+-2.0` -I/usr/include/webkit-1.0 -I/usr/include/libsoup-2.4 +WEBKITLIBS = -lwebkit-1.0 + SWT_OBJECTS = swt.o c.o c_stats.o callback.o CDE_OBJECTS = swt.o cde.o cde_structs.o cde_stats.o AWT_OBJECTS = swt_awt.o @@ -99,6 +104,7 @@ GNOME_OBJECTS = swt.o gnome.o gnome_structs.o gnome_stats.o MOZILLA_OBJECTS = swt.o xpcom.o xpcom_custom.o xpcom_structs.o xpcom_stats.o XULRUNNER_OBJECTS = swt.o xpcomxul.o xpcomxul_custom.o xpcomxul_structs.o xpcomxul_stats.o XPCOMINIT_OBJECTS = swt.o xpcominit.o xpcominit_structs.o xpcominit_stats.o +WEBKIT_OBJECTS = swt.o webkit.o webkit_structs.o webkit_stats.o GLX_OBJECTS = swt.o glx.o glx_structs.o glx_stats.o CFLAGS = -O -Wall \ @@ -268,6 +274,23 @@ xpcominit_stats.o: xpcominit_stats.cpp $(CXX) $(MOZILLACFLAGS) ${XULRUNNER_INCLUDES} -c xpcominit_stats.cpp # +# WebKit lib +# +make_webkit: $(WEBKIT_LIB) + +$(WEBKIT_LIB): $(WEBKIT_OBJECTS) + $(CC) $(LFLAGS) -o $(WEBKIT_LIB) $(WEBKIT_OBJECTS) $(WEBKITLIBS) + +webkit.o: webkitgtk.c + $(CC) $(CFLAGS) $(WEBKITCFLAGS) -c webkitgtk.c -o webkit.o + +webkit_structs.o: webkitgtk_structs.c + $(CC) $(CFLAGS) $(WEBKITCFLAGS) -c webkitgtk_structs.c -o webkit_structs.o + +webkit_stats.o: webkitgtk_stats.c webkitgtk_stats.h + $(CC) $(CFLAGS) $(WEBKITCFLAGS) -c webkitgtk_stats.c -o webkit_stats.o + +# # GLX lib # make_glx: $(GLX_LIB) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index 82cee41446..fe2a8ba74a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -1335,6 +1335,30 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1GDK_1TYPE_1PIXBUF) } #endif +#ifndef NO__1GString_1len +JNIEXPORT jint JNICALL OS_NATIVE(_1GString_1len) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1GString_1len_FUNC); + rc = (jint)((GString *)arg0)->len; + OS_NATIVE_EXIT(env, that, _1GString_1len_FUNC); + return rc; +} +#endif + +#ifndef NO__1GString_1str +JNIEXPORT jintLong JNICALL OS_NATIVE(_1GString_1str) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1GString_1str_FUNC); + rc = (jintLong)((GString *)arg0)->str; + OS_NATIVE_EXIT(env, that, _1GString_1str_FUNC); + return rc; +} +#endif + #ifndef NO__1GTK_1IS_1BUTTON JNIEXPORT jboolean JNICALL OS_NATIVE(_1GTK_1IS_1BUTTON) (JNIEnv *env, jclass that, jintLong arg0) @@ -1431,6 +1455,18 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1GTK_1IS_1PLUG) } #endif +#ifndef NO__1GTK_1IS_1SCROLLED_1WINDOW +JNIEXPORT jboolean JNICALL OS_NATIVE(_1GTK_1IS_1SCROLLED_1WINDOW) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1GTK_1IS_1SCROLLED_1WINDOW_FUNC); + rc = (jboolean)GTK_IS_SCROLLED_WINDOW(arg0); + OS_NATIVE_EXIT(env, that, _1GTK_1IS_1SCROLLED_1WINDOW_FUNC); + return rc; +} +#endif + #ifndef NO__1GTK_1IS_1SOCKET JNIEXPORT jboolean JNICALL OS_NATIVE(_1GTK_1IS_1SOCKET) (JNIEnv *env, jclass that, jintLong arg0) @@ -3700,6 +3736,34 @@ fail: } #endif +#if (!defined(NO__1g_1object_1set__I_3B_3BI) && !defined(JNI64)) || (!defined(NO__1g_1object_1set__J_3B_3BJ) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1set__I_3B_3BI)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2, jintLong arg3) +#else +JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1set__J_3B_3BJ)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2, jintLong arg3) +#endif +{ + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; +#ifndef JNI64 + OS_NATIVE_ENTER(env, that, _1g_1object_1set__I_3B_3BI_FUNC); +#else + OS_NATIVE_ENTER(env, that, _1g_1object_1set__J_3B_3BJ_FUNC); +#endif + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + g_object_set((gpointer)arg0, (const gchar *)lparg1, lparg2, (const gchar *)NULL); +fail: + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT); +#ifndef JNI64 + OS_NATIVE_EXIT(env, that, _1g_1object_1set__I_3B_3BI_FUNC); +#else + OS_NATIVE_EXIT(env, that, _1g_1object_1set__J_3B_3BJ_FUNC); +#endif +} +#endif + #ifndef NO__1g_1object_1set_1qdata JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1set_1qdata) (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLong arg2) @@ -3963,6 +4027,18 @@ JNIEXPORT void JNICALL OS_NATIVE(_1g_1signal_1handler_1disconnect) } #endif +#ifndef NO__1g_1signal_1handler_1find +JNIEXPORT jint JNICALL OS_NATIVE(_1g_1signal_1handler_1find) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jintLong arg4, jintLong arg5, jintLong arg6) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1signal_1handler_1find_FUNC); + rc = (jint)g_signal_handler_find((gpointer)arg0, arg1, arg2, (GQuark)arg3, (GClosure *)arg4, (gpointer)arg5, (gpointer)arg6); + OS_NATIVE_EXIT(env, that, _1g_1signal_1handler_1find_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1signal_1handlers_1block_1matched JNIEXPORT jint JNICALL OS_NATIVE(_1g_1signal_1handlers_1block_1matched) (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3, jintLong arg4, jintLong arg5, jintLong arg6) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index 89ce2f17c5..4ea8aa82b7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1355; -int OS_nativeFunctionCallCount[1355]; +int OS_nativeFunctionCount = 1360; +int OS_nativeFunctionCallCount[1360]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -138,6 +138,8 @@ char * OS_nativeFunctionNames[] = { "_1GDK_1ROOT_1PARENT", "_1GDK_1TYPE_1COLOR", "_1GDK_1TYPE_1PIXBUF", + "_1GString_1len", + "_1GString_1str", "_1GTK_1IS_1BUTTON", "_1GTK_1IS_1CELL_1RENDERER_1PIXBUF", "_1GTK_1IS_1CELL_1RENDERER_1TEXT", @@ -146,6 +148,7 @@ char * OS_nativeFunctionNames[] = { "_1GTK_1IS_1IMAGE_1MENU_1ITEM", "_1GTK_1IS_1MENU_1ITEM", "_1GTK_1IS_1PLUG", + "_1GTK_1IS_1SCROLLED_1WINDOW", "_1GTK_1IS_1SOCKET", "_1GTK_1IS_1WINDOW", "_1GTK_1STOCK_1CANCEL", @@ -310,6 +313,11 @@ char * OS_nativeFunctionNames[] = { #else "_1g_1object_1set__J_3BZJ", #endif +#ifndef JNI64 + "_1g_1object_1set__I_3B_3BI", +#else + "_1g_1object_1set__J_3B_3BJ", +#endif "_1g_1object_1set_1qdata", "_1g_1object_1unref", "_1g_1quark_1from_1string", @@ -345,6 +353,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1signal_1emit_1by_1name__J_3B_3B", #endif "_1g_1signal_1handler_1disconnect", + "_1g_1signal_1handler_1find", "_1g_1signal_1handlers_1block_1matched", "_1g_1signal_1handlers_1disconnect_1matched", "_1g_1signal_1handlers_1unblock_1matched", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index 614b30c574..0ab053b774 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -146,6 +146,8 @@ typedef enum { _1GDK_1ROOT_1PARENT_FUNC, _1GDK_1TYPE_1COLOR_FUNC, _1GDK_1TYPE_1PIXBUF_FUNC, + _1GString_1len_FUNC, + _1GString_1str_FUNC, _1GTK_1IS_1BUTTON_FUNC, _1GTK_1IS_1CELL_1RENDERER_1PIXBUF_FUNC, _1GTK_1IS_1CELL_1RENDERER_1TEXT_FUNC, @@ -154,6 +156,7 @@ typedef enum { _1GTK_1IS_1IMAGE_1MENU_1ITEM_FUNC, _1GTK_1IS_1MENU_1ITEM_FUNC, _1GTK_1IS_1PLUG_FUNC, + _1GTK_1IS_1SCROLLED_1WINDOW_FUNC, _1GTK_1IS_1SOCKET_FUNC, _1GTK_1IS_1WINDOW_FUNC, _1GTK_1STOCK_1CANCEL_FUNC, @@ -318,6 +321,11 @@ typedef enum { #else _1g_1object_1set__J_3BZJ_FUNC, #endif +#ifndef JNI64 + _1g_1object_1set__I_3B_3BI_FUNC, +#else + _1g_1object_1set__J_3B_3BJ_FUNC, +#endif _1g_1object_1set_1qdata_FUNC, _1g_1object_1unref_FUNC, _1g_1quark_1from_1string_FUNC, @@ -353,6 +361,7 @@ typedef enum { _1g_1signal_1emit_1by_1name__J_3B_3B_FUNC, #endif _1g_1signal_1handler_1disconnect_FUNC, + _1g_1signal_1handler_1find_FUNC, _1g_1signal_1handlers_1block_1matched_FUNC, _1g_1signal_1handlers_1disconnect_1matched_FUNC, _1g_1signal_1handlers_1unblock_1matched_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index abdb79385d..5ca4f34284 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -42,6 +42,7 @@ public class OS extends C { public static final int ATK_RELATION_LABELLED_BY = 4; public static final int G_FILE_TEST_IS_DIR = 1 << 2; public static final int G_FILE_TEST_IS_EXECUTABLE = 1 << 3; + public static final int G_SIGNAL_MATCH_FUNC = 1 << 3; public static final int G_SIGNAL_MATCH_DATA = 1 << 4; public static final int G_SIGNAL_MATCH_ID = 1 << 0; public static final int GDK_2BUTTON_PRESS = 0x5; @@ -1440,6 +1441,15 @@ public static final boolean GTK_IS_BUTTON(int /*long*/ obj) { lock.unlock(); } } +public static final native boolean _GTK_IS_SCROLLED_WINDOW(int /*long*/ obj); +public static final boolean GTK_IS_SCROLLED_WINDOW(int /*long*/ obj) { + lock.lock(); + try { + return _GTK_IS_SCROLLED_WINDOW(obj); + } finally { + lock.unlock(); + } +} public static final native boolean _GTK_IS_WINDOW(int /*long*/ obj); public static final boolean GTK_IS_WINDOW(int /*long*/ obj) { lock.lock(); @@ -2644,6 +2654,20 @@ public static final void g_object_set(int /*long*/ object, byte[] first_property } /** * @param object cast=(gpointer) + * @param first_property_name cast=(const gchar *),flags=no_out + * @param terminator cast=(const gchar *),flags=sentinel + */ +public static final native void _g_object_set(int /*long*/ object, byte[] first_property_name, byte[] data, int /*long*/ terminator); +public static final void g_object_set(int /*long*/ object, byte[] first_property_name, byte[] data, int /*long*/ terminator) { + lock.lock(); + try { + _g_object_set(object, first_property_name, data, terminator); + } finally { + lock.unlock(); + } +} +/** + * @param object cast=(gpointer) * @param first_property_name cast=(const gchar *) * @param terminator cast=(const gchar *),flags=sentinel */ @@ -2883,6 +2907,22 @@ public static final void g_signal_handler_disconnect(int /*long*/ instance, int } /** * @param instance cast=(gpointer) + * @param detail cast=(GQuark) + * @param closure cast=(GClosure *) + * @param func cast=(gpointer) + * @param data cast=(gpointer) + */ +public static final native int _g_signal_handler_find(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data); +public static final int g_signal_handler_find(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data) { + lock.lock(); + try { + return _g_signal_handler_find(instance, mask, signal_id, detail, closure, func, data); + } finally { + lock.unlock(); + } +} +/** + * @param instance cast=(gpointer) * @param mask cast=(GSignalMatchType) * @param signal_id cast=(guint) * @param detail cast=(GQuark) @@ -3019,6 +3059,32 @@ public static final void g_strfreev(int /*long*/ string_array) { } } /** + * @method flags=getter + * @param string cast=(GString *) + */ +public static final native int _GString_len(int /*long*/ string); +public static final int GString_len(int /*long*/ string) { + lock.lock(); + try { + return _GString_len(string); + } finally { + lock.unlock(); + } +} +/** + * @method flags=getter + * @param string cast=(GString *) + */ +public static final native int /*long*/ _GString_str(int /*long*/ string); +public static final int /*long*/ GString_str(int /*long*/ string) { + lock.lock(); + try { + return _GString_str(string); + } finally { + lock.unlock(); + } +} +/** * @param str cast=(const gchar *) * @param endptr cast=(gchar **) */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c new file mode 100644 index 0000000000..522abce3b9 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c @@ -0,0 +1,1232 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "swt.h" +#include "webkitgtk_structs.h" +#include "webkitgtk_stats.h" + +#define WebKitGTK_NATIVE(func) Java_org_eclipse_swt_internal_webkit_WebKitGTK_##func + +#ifndef NO_JSClassDefinition_1sizeof +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(JSClassDefinition_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, JSClassDefinition_1sizeof_FUNC); + rc = (jint)JSClassDefinition_sizeof(); + WebKitGTK_NATIVE_EXIT(env, that, JSClassDefinition_1sizeof_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSClassCreate +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSClassCreate) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSClassCreate_FUNC); + rc = (jintLong)JSClassCreate((const JSClassDefinition*)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSClassCreate_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSContextGetGlobalObject +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSContextGetGlobalObject) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSContextGetGlobalObject_FUNC); + rc = (jintLong)JSContextGetGlobalObject((JSContextRef)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSContextGetGlobalObject_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSEvaluateScript +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSEvaluateScript) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jint arg4, jintLongArray arg5) +{ + jintLong *lparg5=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSEvaluateScript_FUNC); + if (arg5) if ((lparg5 = (*env)->GetIntLongArrayElements(env, arg5, NULL)) == NULL) goto fail; + rc = (jintLong)JSEvaluateScript((JSContextRef)arg0, (JSStringRef)arg1, (JSObjectRef)arg2, (JSStringRef)arg3, arg4, (JSValueRef *)lparg5); +fail: + if (arg5 && lparg5) (*env)->ReleaseIntLongArrayElements(env, arg5, lparg5, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSEvaluateScript_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSObjectGetPrivate +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSObjectGetPrivate) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSObjectGetPrivate_FUNC); + rc = (jintLong)JSObjectGetPrivate((JSObjectRef)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSObjectGetPrivate_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSObjectGetProperty +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1JSObjectGetProperty) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLongArray arg3) +{ + jintLong *lparg3=NULL; + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSObjectGetProperty_FUNC); + if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail; + rc = (jint)JSObjectGetProperty((JSContextRef)arg0, (JSObjectRef)arg1, (JSStringRef)arg2, (JSValueRef*)lparg3); +fail: + if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSObjectGetProperty_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSObjectGetPropertyAtIndex +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1JSObjectGetPropertyAtIndex) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLongArray arg3) +{ + jintLong *lparg3=NULL; + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSObjectGetPropertyAtIndex_FUNC); + if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail; + rc = (jint)JSObjectGetPropertyAtIndex((JSContextRef)arg0, (JSObjectRef)arg1, (unsigned)arg2, (JSValueRef*)lparg3); +fail: + if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSObjectGetPropertyAtIndex_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSObjectMake +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSObjectMake) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSObjectMake_FUNC); + rc = (jintLong)JSObjectMake((JSContextRef)arg0, (JSClassRef)arg1, (void *)arg2); + WebKitGTK_NATIVE_EXIT(env, that, _1JSObjectMake_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSObjectMakeArray +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSObjectMakeArray) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2, jintLongArray arg3) +{ + jintLong *lparg2=NULL; + jintLong *lparg3=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSObjectMakeArray_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail; + rc = (jintLong)JSObjectMakeArray((JSContextRef)arg0, (size_t)arg1, (const struct OpaqueJSValue * const*)lparg2, (JSValueRef*)lparg3); +fail: + if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0); + if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSObjectMakeArray_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSObjectMakeFunctionWithCallback +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSObjectMakeFunctionWithCallback) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSObjectMakeFunctionWithCallback_FUNC); + rc = (jintLong)JSObjectMakeFunctionWithCallback((JSContextRef)arg0, (JSStringRef)arg1, (JSObjectCallAsFunctionCallback)arg2); + WebKitGTK_NATIVE_EXIT(env, that, _1JSObjectMakeFunctionWithCallback_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSObjectSetProperty +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1JSObjectSetProperty) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jint arg4, jintLongArray arg5) +{ + jintLong *lparg5=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1JSObjectSetProperty_FUNC); + if (arg5) if ((lparg5 = (*env)->GetIntLongArrayElements(env, arg5, NULL)) == NULL) goto fail; + JSObjectSetProperty((JSContextRef)arg0, (JSObjectRef)arg1, (JSStringRef)arg2, (JSValueRef)arg3, (JSPropertyAttributes)arg4, (JSValueRef *)lparg5); +fail: + if (arg5 && lparg5) (*env)->ReleaseIntLongArrayElements(env, arg5, lparg5, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSObjectSetProperty_FUNC); +} +#endif + +#ifndef NO__1JSStringCreateWithUTF8CString +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSStringCreateWithUTF8CString) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSStringCreateWithUTF8CString_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)JSStringCreateWithUTF8CString((const char *)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSStringCreateWithUTF8CString_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSStringGetLength +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSStringGetLength) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSStringGetLength_FUNC); + rc = (jintLong)JSStringGetLength((JSStringRef)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSStringGetLength_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSStringGetMaximumUTF8CStringSize +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSStringGetMaximumUTF8CStringSize) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSStringGetMaximumUTF8CStringSize_FUNC); + rc = (jintLong)JSStringGetMaximumUTF8CStringSize((JSStringRef)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSStringGetMaximumUTF8CStringSize_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSStringGetUTF8CString +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSStringGetUTF8CString) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2) +{ + jbyte *lparg1=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSStringGetUTF8CString_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)JSStringGetUTF8CString((JSStringRef)arg0, (char *)lparg1, (size_t)arg2); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSStringGetUTF8CString_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSStringIsEqualToUTF8CString +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1JSStringIsEqualToUTF8CString) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSStringIsEqualToUTF8CString_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jint)JSStringIsEqualToUTF8CString((JSStringRef)arg0, (const char *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSStringIsEqualToUTF8CString_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSStringRelease +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1JSStringRelease) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1JSStringRelease_FUNC); + JSStringRelease((JSStringRef)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSStringRelease_FUNC); +} +#endif + +#ifndef NO__1JSValueGetType +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1JSValueGetType) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueGetType_FUNC); + rc = (jint)JSValueGetType((JSContextRef)arg0, (JSValueRef)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueGetType_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueIsObjectOfClass +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1JSValueIsObjectOfClass) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueIsObjectOfClass_FUNC); + rc = (jint)JSValueIsObjectOfClass((JSContextRef)arg0, (JSValueRef)arg1, (JSClassRef)arg2); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueIsObjectOfClass_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueMakeBoolean +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSValueMakeBoolean) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueMakeBoolean_FUNC); + rc = (jintLong)JSValueMakeBoolean((JSContextRef)arg0, (bool)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueMakeBoolean_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueMakeNumber +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSValueMakeNumber) + (JNIEnv *env, jclass that, jintLong arg0, jdouble arg1) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueMakeNumber_FUNC); + rc = (jintLong)JSValueMakeNumber((JSContextRef)arg0, (double)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueMakeNumber_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueMakeString +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSValueMakeString) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueMakeString_FUNC); + rc = (jintLong)JSValueMakeString((JSContextRef)arg0, (JSStringRef)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueMakeString_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueMakeUndefined +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSValueMakeUndefined) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueMakeUndefined_FUNC); + rc = (jintLong)JSValueMakeUndefined((JSContextRef)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueMakeUndefined_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueToBoolean +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1JSValueToBoolean) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueToBoolean_FUNC); + rc = (jint)JSValueToBoolean((JSContextRef)arg0, (JSValueRef)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueToBoolean_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueToNumber +JNIEXPORT jdouble JNICALL WebKitGTK_NATIVE(_1JSValueToNumber) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2) +{ + jintLong *lparg2=NULL; + jdouble rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueToNumber_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jdouble)JSValueToNumber((JSContextRef)arg0, (JSValueRef)arg1, (JSValueRef*)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueToNumber_FUNC); + return rc; +} +#endif + +#ifndef NO__1JSValueToStringCopy +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1JSValueToStringCopy) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2) +{ + jintLong *lparg2=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1JSValueToStringCopy_FUNC); + if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jintLong)JSValueToStringCopy((JSContextRef)arg0, (JSValueRef)arg1, (JSValueRef*)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1JSValueToStringCopy_FUNC); + return rc; +} +#endif + +#ifndef NO__1SOUP_1IS_1SESSION +JNIEXPORT jboolean JNICALL WebKitGTK_NATIVE(_1SOUP_1IS_1SESSION) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1SOUP_1IS_1SESSION_FUNC); + rc = (jboolean)SOUP_IS_SESSION(arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1SOUP_1IS_1SESSION_FUNC); + return rc; +} +#endif + +#ifndef NO__1SoupCookie_1expires +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1SoupCookie_1expires) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1SoupCookie_1expires_FUNC); + rc = (jintLong)((SoupCookie *)arg0)->expires; + WebKitGTK_NATIVE_EXIT(env, that, _1SoupCookie_1expires_FUNC); + return rc; +} +#endif + +#ifndef NO__1SoupMessage_1method +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1SoupMessage_1method) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1SoupMessage_1method_FUNC); + ((SoupMessage *)arg0)->method = ((const char *)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1SoupMessage_1method_FUNC); +} +#endif + +#ifndef NO__1SoupMessage_1request_1body +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1SoupMessage_1request_1body) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1SoupMessage_1request_1body_FUNC); + rc = (jintLong)((SoupMessage *)arg0)->request_body; + WebKitGTK_NATIVE_EXIT(env, that, _1SoupMessage_1request_1body_FUNC); + return rc; +} +#endif + +#ifndef NO__1SoupMessage_1request_1headers +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1SoupMessage_1request_1headers) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1SoupMessage_1request_1headers_FUNC); + rc = (jintLong)((SoupMessage *)arg0)->request_headers; + WebKitGTK_NATIVE_EXIT(env, that, _1SoupMessage_1request_1headers_FUNC); + return rc; +} +#endif + +#ifndef NO__1WEBKIT_1IS_1WEB_1FRAME +JNIEXPORT jboolean JNICALL WebKitGTK_NATIVE(_1WEBKIT_1IS_1WEB_1FRAME) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1WEBKIT_1IS_1WEB_1FRAME_FUNC); + rc = (jboolean)WEBKIT_IS_WEB_FRAME(arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1WEBKIT_1IS_1WEB_1FRAME_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1auth_1authenticate +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1auth_1authenticate) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2) +{ + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1auth_1authenticate_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + soup_auth_authenticate((SoupAuth *)arg0, (const char *)lparg1, (const char *)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1auth_1authenticate_FUNC); +} +#endif + +#ifndef NO__1soup_1auth_1get_1host +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1auth_1get_1host) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1auth_1get_1host_FUNC); + rc = (jintLong)soup_auth_get_host((SoupAuth *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1auth_1get_1host_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1auth_1get_1scheme_1name +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1auth_1get_1scheme_1name) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1auth_1get_1scheme_1name_FUNC); + rc = (jintLong)soup_auth_get_scheme_name((SoupAuth *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1auth_1get_1scheme_1name_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1cookie_1jar_1add_1cookie +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1cookie_1jar_1add_1cookie) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1cookie_1jar_1add_1cookie_FUNC); + soup_cookie_jar_add_cookie((SoupCookieJar *)arg0, (SoupCookie *)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1cookie_1jar_1add_1cookie_FUNC); +} +#endif + +#ifndef NO__1soup_1cookie_1jar_1all_1cookies +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1cookie_1jar_1all_1cookies) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1cookie_1jar_1all_1cookies_FUNC); + rc = (jintLong)soup_cookie_jar_all_cookies((SoupCookieJar *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1cookie_1jar_1all_1cookies_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1cookie_1jar_1delete_1cookie +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1cookie_1jar_1delete_1cookie) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1cookie_1jar_1delete_1cookie_FUNC); + soup_cookie_jar_delete_cookie((SoupCookieJar *)arg0, (SoupCookie *)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1cookie_1jar_1delete_1cookie_FUNC); +} +#endif + +#ifndef NO__1soup_1cookie_1jar_1get_1cookies +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1cookie_1jar_1get_1cookies) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1cookie_1jar_1get_1cookies_FUNC); + rc = (jintLong)soup_cookie_jar_get_cookies((SoupCookieJar *)arg0, (SoupURI *)arg1, arg2); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1cookie_1jar_1get_1cookies_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1cookie_1jar_1get_1type +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1soup_1cookie_1jar_1get_1type) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1cookie_1jar_1get_1type_FUNC); + rc = (jint)soup_cookie_jar_get_type(); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1cookie_1jar_1get_1type_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1cookie_1parse +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1cookie_1parse) + (JNIEnv *env, jclass that, jbyteArray arg0, jintLong arg1) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1cookie_1parse_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)soup_cookie_parse((const char *)lparg0, (SoupURI *)arg1); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1cookie_1parse_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1message_1body_1append +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1message_1body_1append) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLong arg2, jintLong arg3) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1message_1body_1append_FUNC); + soup_message_body_append((SoupMessageBody *)arg0, (SoupMemoryUse)arg1, (gconstpointer)arg2, (gsize)arg3); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1message_1body_1append_FUNC); +} +#endif + +#ifndef NO__1soup_1message_1body_1flatten +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1message_1body_1flatten) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1message_1body_1flatten_FUNC); + soup_message_body_flatten((SoupMessageBody *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1message_1body_1flatten_FUNC); +} +#endif + +#ifndef NO__1soup_1message_1get_1uri +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1message_1get_1uri) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1message_1get_1uri_FUNC); + rc = (jintLong)soup_message_get_uri((SoupMessage *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1message_1get_1uri_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1message_1headers_1append +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1message_1headers_1append) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2) +{ + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1message_1headers_1append_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + soup_message_headers_append((SoupMessageHeaders *)arg0, (const char *)lparg1, (const char *)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1message_1headers_1append_FUNC); +} +#endif + +#ifndef NO__1soup_1session_1add_1feature_1by_1type +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1session_1add_1feature_1by_1type) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1session_1add_1feature_1by_1type_FUNC); + soup_session_add_feature_by_type((SoupSession *)arg0, (GType)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1session_1add_1feature_1by_1type_FUNC); +} +#endif + +#ifndef NO__1soup_1session_1feature_1attach +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1session_1feature_1attach) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1session_1feature_1attach_FUNC); + soup_session_feature_attach((SoupSessionFeature *)arg0, (SoupSession *)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1session_1feature_1attach_FUNC); +} +#endif + +#ifndef NO__1soup_1session_1feature_1detach +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1session_1feature_1detach) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1session_1feature_1detach_FUNC); + soup_session_feature_detach((SoupSessionFeature *)arg0, (SoupSession *)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1session_1feature_1detach_FUNC); +} +#endif + +#ifndef NO__1soup_1session_1get_1feature +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1session_1get_1feature) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1session_1get_1feature_FUNC); + rc = (jintLong)soup_session_get_feature((SoupSession *)arg0, (GType)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1session_1get_1feature_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1uri_1free +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1uri_1free) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1uri_1free_FUNC); + soup_uri_free((SoupURI *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1uri_1free_FUNC); +} +#endif + +#ifndef NO__1soup_1uri_1new +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1uri_1new) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1uri_1new_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)soup_uri_new((const char *)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1uri_1new_FUNC); + return rc; +} +#endif + +#ifndef NO__1soup_1uri_1to_1string +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1soup_1uri_1to_1string) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1soup_1uri_1to_1string_FUNC); + rc = (jintLong)soup_uri_to_string((SoupURI *)arg0, arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1soup_1uri_1to_1string_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1download_1cancel +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1download_1cancel) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1download_1cancel_FUNC); + webkit_download_cancel((WebKitDownload *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1download_1cancel_FUNC); +} +#endif + +#ifndef NO__1webkit_1download_1get_1current_1size +JNIEXPORT jlong JNICALL WebKitGTK_NATIVE(_1webkit_1download_1get_1current_1size) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jlong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1download_1get_1current_1size_FUNC); + rc = (jlong)webkit_download_get_current_size((WebKitDownload *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1download_1get_1current_1size_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1download_1get_1status +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1download_1get_1status) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1download_1get_1status_FUNC); + rc = (jint)webkit_download_get_status((WebKitDownload *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1download_1get_1status_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1download_1get_1suggested_1filename +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1download_1get_1suggested_1filename) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1download_1get_1suggested_1filename_FUNC); + rc = (jintLong)webkit_download_get_suggested_filename((WebKitDownload *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1download_1get_1suggested_1filename_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1download_1get_1total_1size +JNIEXPORT jlong JNICALL WebKitGTK_NATIVE(_1webkit_1download_1get_1total_1size) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jlong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1download_1get_1total_1size_FUNC); + rc = (jlong)webkit_download_get_total_size((WebKitDownload *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1download_1get_1total_1size_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1download_1get_1uri +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1download_1get_1uri) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1download_1get_1uri_FUNC); + rc = (jintLong)webkit_download_get_uri((WebKitDownload *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1download_1get_1uri_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1download_1set_1destination_1uri +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1download_1set_1destination_1uri) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1download_1set_1destination_1uri_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + webkit_download_set_destination_uri((WebKitDownload *)arg0, (const gchar *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1download_1set_1destination_1uri_FUNC); +} +#endif + +#ifndef NO__1webkit_1get_1default_1session +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1get_1default_1session) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1get_1default_1session_FUNC); + rc = (jintLong)webkit_get_default_session(); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1get_1default_1session_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1major_1version +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1major_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1major_1version_FUNC); + rc = (jint)webkit_major_version(); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1major_1version_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1micro_1version +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1micro_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1micro_1version_FUNC); + rc = (jint)webkit_micro_version(); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1micro_1version_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1minor_1version +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1minor_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1minor_1version_FUNC); + rc = (jint)webkit_minor_version(); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1minor_1version_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1network_1request_1get_1message +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1network_1request_1get_1message) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1network_1request_1get_1message_FUNC); + rc = (jintLong)webkit_network_request_get_message((WebKitNetworkRequest *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1network_1request_1get_1message_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1network_1request_1get_1uri +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1network_1request_1get_1uri) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1network_1request_1get_1uri_FUNC); + rc = (jintLong)webkit_network_request_get_uri((WebKitNetworkRequest *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1network_1request_1get_1uri_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1network_1request_1new +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1network_1request_1new) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1network_1request_1new_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jintLong)webkit_network_request_new((const gchar *)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1network_1request_1new_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1soup_1auth_1dialog_1get_1type +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1soup_1auth_1dialog_1get_1type) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1soup_1auth_1dialog_1get_1type_FUNC); + rc = (jint)webkit_soup_auth_dialog_get_type(); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1soup_1auth_1dialog_1get_1type_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1data_1source_1get_1data +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1data_1source_1get_1data) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1data_1source_1get_1data_FUNC); + rc = (jintLong)webkit_web_data_source_get_data((WebKitWebDataSource *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1data_1source_1get_1data_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1data_1source_1get_1encoding +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1data_1source_1get_1encoding) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1data_1source_1get_1encoding_FUNC); + rc = (jintLong)webkit_web_data_source_get_encoding((WebKitWebDataSource *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1data_1source_1get_1encoding_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1frame_1get_1data_1source +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1data_1source) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1data_1source_FUNC); + rc = (jintLong)webkit_web_frame_get_data_source((WebKitWebFrame *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1data_1source_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1frame_1get_1global_1context +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1global_1context) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1global_1context_FUNC); + rc = (jintLong)webkit_web_frame_get_global_context((WebKitWebFrame *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1global_1context_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1frame_1get_1load_1status +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1load_1status) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1load_1status_FUNC); + rc = (jint)webkit_web_frame_get_load_status((WebKitWebFrame *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1load_1status_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1frame_1get_1parent +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1parent) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1parent_FUNC); + rc = (jintLong)webkit_web_frame_get_parent((WebKitWebFrame *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1parent_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1frame_1get_1title +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1title) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1title_FUNC); + rc = (jintLong)webkit_web_frame_get_title((WebKitWebFrame *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1title_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1frame_1get_1uri +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1uri) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1uri_FUNC); + rc = (jintLong)webkit_web_frame_get_uri((WebKitWebFrame *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1uri_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1frame_1get_1web_1view +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1frame_1get_1web_1view) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1frame_1get_1web_1view_FUNC); + rc = (jintLong)webkit_web_frame_get_web_view((WebKitWebFrame *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1frame_1get_1web_1view_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1policy_1decision_1download +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1policy_1decision_1download) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1policy_1decision_1download_FUNC); + webkit_web_policy_decision_download((WebKitWebPolicyDecision *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1policy_1decision_1download_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1policy_1decision_1ignore +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1policy_1decision_1ignore) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1policy_1decision_1ignore_FUNC); + webkit_web_policy_decision_ignore((WebKitWebPolicyDecision *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1policy_1decision_1ignore_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1view_1can_1go_1back +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1can_1go_1back) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1can_1go_1back_FUNC); + rc = (jint)webkit_web_view_can_go_back((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1can_1go_1back_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1can_1go_1forward +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1can_1go_1forward) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1can_1go_1forward_FUNC); + rc = (jint)webkit_web_view_can_go_forward((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1can_1go_1forward_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1can_1show_1mime_1type +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1can_1show_1mime_1type) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1can_1show_1mime_1type_FUNC); + rc = (jint)webkit_web_view_can_show_mime_type((WebKitWebView *)arg0, (const gchar *)arg1); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1can_1show_1mime_1type_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1execute_1script +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1execute_1script) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1execute_1script_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + webkit_web_view_execute_script((WebKitWebView *)arg0, (const gchar *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1execute_1script_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1view_1get_1load_1status +JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1load_1status) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1load_1status_FUNC); + rc = (jint)webkit_web_view_get_load_status((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1load_1status_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1get_1main_1frame +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1main_1frame) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1main_1frame_FUNC); + rc = (jintLong)webkit_web_view_get_main_frame((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1main_1frame_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1get_1progress +JNIEXPORT jdouble JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1progress) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jdouble rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1progress_FUNC); + rc = (jdouble)webkit_web_view_get_progress((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1progress_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1get_1settings +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1settings) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1settings_FUNC); + rc = (jintLong)webkit_web_view_get_settings((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1settings_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1get_1title +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1title) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1title_FUNC); + rc = (jintLong)webkit_web_view_get_title((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1title_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1get_1uri +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1uri) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1uri_FUNC); + rc = (jintLong)webkit_web_view_get_uri((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1uri_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1get_1window_1features +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1window_1features) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1window_1features_FUNC); + rc = (jintLong)webkit_web_view_get_window_features((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1window_1features_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1go_1back +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1go_1back) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1go_1back_FUNC); + webkit_web_view_go_back((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1go_1back_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1view_1go_1forward +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1go_1forward) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1go_1forward_FUNC); + webkit_web_view_go_forward((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1go_1forward_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1view_1load_1string +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1load_1string) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jbyteArray arg2, jbyteArray arg3, jbyteArray arg4) +{ + jbyte *lparg1=NULL; + jbyte *lparg2=NULL; + jbyte *lparg3=NULL; + jbyte *lparg4=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1load_1string_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail; + if (arg4) if ((lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL)) == NULL) goto fail; + webkit_web_view_load_string((WebKitWebView *)arg0, (const gchar *)lparg1, (const gchar *)lparg2, (const gchar *)lparg3, (const gchar *)lparg4); +fail: + if (arg4 && lparg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0); + if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); + if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1load_1string_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1view_1load_1uri +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1load_1uri) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1load_1uri_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + webkit_web_view_load_uri((WebKitWebView *)arg0, (const gchar *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1load_1uri_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1view_1new +JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1new) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1new_FUNC); + rc = (jintLong)webkit_web_view_new(); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1new_FUNC); + return rc; +} +#endif + +#ifndef NO__1webkit_1web_1view_1reload +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1reload) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1reload_FUNC); + webkit_web_view_reload((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1reload_FUNC); +} +#endif + +#ifndef NO__1webkit_1web_1view_1stop_1loading +JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1stop_1loading) + (JNIEnv *env, jclass that, jintLong arg0) +{ + WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1stop_1loading_FUNC); + webkit_web_view_stop_loading((WebKitWebView *)arg0); + WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1stop_1loading_FUNC); +} +#endif + +#ifndef NO_memmove +JNIEXPORT void JNICALL WebKitGTK_NATIVE(memmove) + (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) +{ + JSClassDefinition _arg1, *lparg1=NULL; + WebKitGTK_NATIVE_ENTER(env, that, memmove_FUNC); + if (arg1) if ((lparg1 = getJSClassDefinitionFields(env, arg1, &_arg1)) == NULL) goto fail; + memmove((void *)arg0, (const void *)lparg1, (size_t)arg2); +fail: + WebKitGTK_NATIVE_EXIT(env, that, memmove_FUNC); +} +#endif + diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h new file mode 100755 index 0000000000..2b931e79d7 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.h @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#ifndef INC_webkitgtk_H +#define INC_webkitgtk_H + +#include <string.h> +#include <JavaScriptCore/JSContextRef.h> +#include <JavaScriptCore/JSObjectRef.h> +#include <JavaScriptCore/JSStringRef.h> +#include <libsoup/soup-cookie.h> +#include <libsoup/soup-cookie-jar.h> +#include <libsoup/soup-session-feature.h> +#include <libsoup/soup-uri.h> +#include <webkit/webkitdownload.h> +#include <webkit/webkitnetworkrequest.h> +#include <webkit/webkitsoupauthdialog.h> +#include <webkit/webkitversion.h> +#include <webkit/webkitwebpolicydecision.h> +#include <webkit/webkitwebsettings.h> +#include <webkit/webkitwebview.h> +#endif /* INC_webkitgtk_H */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c new file mode 100644 index 0000000000..50ff1bcd6f --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c @@ -0,0 +1,143 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "swt.h" +#include "webkitgtk_stats.h" + +#ifdef NATIVE_STATS + +int WebKitGTK_nativeFunctionCount = 97; +int WebKitGTK_nativeFunctionCallCount[97]; +char * WebKitGTK_nativeFunctionNames[] = { + "JSClassDefinition_1sizeof", + "_1JSClassCreate", + "_1JSContextGetGlobalObject", + "_1JSEvaluateScript", + "_1JSObjectGetPrivate", + "_1JSObjectGetProperty", + "_1JSObjectGetPropertyAtIndex", + "_1JSObjectMake", + "_1JSObjectMakeArray", + "_1JSObjectMakeFunctionWithCallback", + "_1JSObjectSetProperty", + "_1JSStringCreateWithUTF8CString", + "_1JSStringGetLength", + "_1JSStringGetMaximumUTF8CStringSize", + "_1JSStringGetUTF8CString", + "_1JSStringIsEqualToUTF8CString", + "_1JSStringRelease", + "_1JSValueGetType", + "_1JSValueIsObjectOfClass", + "_1JSValueMakeBoolean", + "_1JSValueMakeNumber", + "_1JSValueMakeString", + "_1JSValueMakeUndefined", + "_1JSValueToBoolean", + "_1JSValueToNumber", + "_1JSValueToStringCopy", + "_1SOUP_1IS_1SESSION", + "_1SoupCookie_1expires", + "_1SoupMessage_1method", + "_1SoupMessage_1request_1body", + "_1SoupMessage_1request_1headers", + "_1WEBKIT_1IS_1WEB_1FRAME", + "_1soup_1auth_1authenticate", + "_1soup_1auth_1get_1host", + "_1soup_1auth_1get_1scheme_1name", + "_1soup_1cookie_1jar_1add_1cookie", + "_1soup_1cookie_1jar_1all_1cookies", + "_1soup_1cookie_1jar_1delete_1cookie", + "_1soup_1cookie_1jar_1get_1cookies", + "_1soup_1cookie_1jar_1get_1type", + "_1soup_1cookie_1parse", + "_1soup_1message_1body_1append", + "_1soup_1message_1body_1flatten", + "_1soup_1message_1get_1uri", + "_1soup_1message_1headers_1append", + "_1soup_1session_1add_1feature_1by_1type", + "_1soup_1session_1feature_1attach", + "_1soup_1session_1feature_1detach", + "_1soup_1session_1get_1feature", + "_1soup_1uri_1free", + "_1soup_1uri_1new", + "_1soup_1uri_1to_1string", + "_1webkit_1download_1cancel", + "_1webkit_1download_1get_1current_1size", + "_1webkit_1download_1get_1status", + "_1webkit_1download_1get_1suggested_1filename", + "_1webkit_1download_1get_1total_1size", + "_1webkit_1download_1get_1uri", + "_1webkit_1download_1set_1destination_1uri", + "_1webkit_1get_1default_1session", + "_1webkit_1major_1version", + "_1webkit_1micro_1version", + "_1webkit_1minor_1version", + "_1webkit_1network_1request_1get_1message", + "_1webkit_1network_1request_1get_1uri", + "_1webkit_1network_1request_1new", + "_1webkit_1soup_1auth_1dialog_1get_1type", + "_1webkit_1web_1data_1source_1get_1data", + "_1webkit_1web_1data_1source_1get_1encoding", + "_1webkit_1web_1frame_1get_1data_1source", + "_1webkit_1web_1frame_1get_1global_1context", + "_1webkit_1web_1frame_1get_1load_1status", + "_1webkit_1web_1frame_1get_1parent", + "_1webkit_1web_1frame_1get_1title", + "_1webkit_1web_1frame_1get_1uri", + "_1webkit_1web_1frame_1get_1web_1view", + "_1webkit_1web_1policy_1decision_1download", + "_1webkit_1web_1policy_1decision_1ignore", + "_1webkit_1web_1view_1can_1go_1back", + "_1webkit_1web_1view_1can_1go_1forward", + "_1webkit_1web_1view_1can_1show_1mime_1type", + "_1webkit_1web_1view_1execute_1script", + "_1webkit_1web_1view_1get_1load_1status", + "_1webkit_1web_1view_1get_1main_1frame", + "_1webkit_1web_1view_1get_1progress", + "_1webkit_1web_1view_1get_1settings", + "_1webkit_1web_1view_1get_1title", + "_1webkit_1web_1view_1get_1uri", + "_1webkit_1web_1view_1get_1window_1features", + "_1webkit_1web_1view_1go_1back", + "_1webkit_1web_1view_1go_1forward", + "_1webkit_1web_1view_1load_1string", + "_1webkit_1web_1view_1load_1uri", + "_1webkit_1web_1view_1new", + "_1webkit_1web_1view_1reload", + "_1webkit_1web_1view_1stop_1loading", + "memmove", +}; + +#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func + +JNIEXPORT jint JNICALL STATS_NATIVE(WebKitGTK_1GetFunctionCount) + (JNIEnv *env, jclass that) +{ + return WebKitGTK_nativeFunctionCount; +} + +JNIEXPORT jstring JNICALL STATS_NATIVE(WebKitGTK_1GetFunctionName) + (JNIEnv *env, jclass that, jint index) +{ + return (*env)->NewStringUTF(env, WebKitGTK_nativeFunctionNames[index]); +} + +JNIEXPORT jint JNICALL STATS_NATIVE(WebKitGTK_1GetFunctionCallCount) + (JNIEnv *env, jclass that, jint index) +{ + return WebKitGTK_nativeFunctionCallCount[index]; +} + +#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h new file mode 100644 index 0000000000..1022375a21 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#ifdef NATIVE_STATS +extern int WebKitGTK_nativeFunctionCount; +extern int WebKitGTK_nativeFunctionCallCount[]; +extern char* WebKitGTK_nativeFunctionNames[]; +#define WebKitGTK_NATIVE_ENTER(env, that, func) WebKitGTK_nativeFunctionCallCount[func]++; +#define WebKitGTK_NATIVE_EXIT(env, that, func) +#else +#ifndef WebKitGTK_NATIVE_ENTER +#define WebKitGTK_NATIVE_ENTER(env, that, func) +#endif +#ifndef WebKitGTK_NATIVE_EXIT +#define WebKitGTK_NATIVE_EXIT(env, that, func) +#endif +#endif + +typedef enum { + JSClassDefinition_1sizeof_FUNC, + _1JSClassCreate_FUNC, + _1JSContextGetGlobalObject_FUNC, + _1JSEvaluateScript_FUNC, + _1JSObjectGetPrivate_FUNC, + _1JSObjectGetProperty_FUNC, + _1JSObjectGetPropertyAtIndex_FUNC, + _1JSObjectMake_FUNC, + _1JSObjectMakeArray_FUNC, + _1JSObjectMakeFunctionWithCallback_FUNC, + _1JSObjectSetProperty_FUNC, + _1JSStringCreateWithUTF8CString_FUNC, + _1JSStringGetLength_FUNC, + _1JSStringGetMaximumUTF8CStringSize_FUNC, + _1JSStringGetUTF8CString_FUNC, + _1JSStringIsEqualToUTF8CString_FUNC, + _1JSStringRelease_FUNC, + _1JSValueGetType_FUNC, + _1JSValueIsObjectOfClass_FUNC, + _1JSValueMakeBoolean_FUNC, + _1JSValueMakeNumber_FUNC, + _1JSValueMakeString_FUNC, + _1JSValueMakeUndefined_FUNC, + _1JSValueToBoolean_FUNC, + _1JSValueToNumber_FUNC, + _1JSValueToStringCopy_FUNC, + _1SOUP_1IS_1SESSION_FUNC, + _1SoupCookie_1expires_FUNC, + _1SoupMessage_1method_FUNC, + _1SoupMessage_1request_1body_FUNC, + _1SoupMessage_1request_1headers_FUNC, + _1WEBKIT_1IS_1WEB_1FRAME_FUNC, + _1soup_1auth_1authenticate_FUNC, + _1soup_1auth_1get_1host_FUNC, + _1soup_1auth_1get_1scheme_1name_FUNC, + _1soup_1cookie_1jar_1add_1cookie_FUNC, + _1soup_1cookie_1jar_1all_1cookies_FUNC, + _1soup_1cookie_1jar_1delete_1cookie_FUNC, + _1soup_1cookie_1jar_1get_1cookies_FUNC, + _1soup_1cookie_1jar_1get_1type_FUNC, + _1soup_1cookie_1parse_FUNC, + _1soup_1message_1body_1append_FUNC, + _1soup_1message_1body_1flatten_FUNC, + _1soup_1message_1get_1uri_FUNC, + _1soup_1message_1headers_1append_FUNC, + _1soup_1session_1add_1feature_1by_1type_FUNC, + _1soup_1session_1feature_1attach_FUNC, + _1soup_1session_1feature_1detach_FUNC, + _1soup_1session_1get_1feature_FUNC, + _1soup_1uri_1free_FUNC, + _1soup_1uri_1new_FUNC, + _1soup_1uri_1to_1string_FUNC, + _1webkit_1download_1cancel_FUNC, + _1webkit_1download_1get_1current_1size_FUNC, + _1webkit_1download_1get_1status_FUNC, + _1webkit_1download_1get_1suggested_1filename_FUNC, + _1webkit_1download_1get_1total_1size_FUNC, + _1webkit_1download_1get_1uri_FUNC, + _1webkit_1download_1set_1destination_1uri_FUNC, + _1webkit_1get_1default_1session_FUNC, + _1webkit_1major_1version_FUNC, + _1webkit_1micro_1version_FUNC, + _1webkit_1minor_1version_FUNC, + _1webkit_1network_1request_1get_1message_FUNC, + _1webkit_1network_1request_1get_1uri_FUNC, + _1webkit_1network_1request_1new_FUNC, + _1webkit_1soup_1auth_1dialog_1get_1type_FUNC, + _1webkit_1web_1data_1source_1get_1data_FUNC, + _1webkit_1web_1data_1source_1get_1encoding_FUNC, + _1webkit_1web_1frame_1get_1data_1source_FUNC, + _1webkit_1web_1frame_1get_1global_1context_FUNC, + _1webkit_1web_1frame_1get_1load_1status_FUNC, + _1webkit_1web_1frame_1get_1parent_FUNC, + _1webkit_1web_1frame_1get_1title_FUNC, + _1webkit_1web_1frame_1get_1uri_FUNC, + _1webkit_1web_1frame_1get_1web_1view_FUNC, + _1webkit_1web_1policy_1decision_1download_FUNC, + _1webkit_1web_1policy_1decision_1ignore_FUNC, + _1webkit_1web_1view_1can_1go_1back_FUNC, + _1webkit_1web_1view_1can_1go_1forward_FUNC, + _1webkit_1web_1view_1can_1show_1mime_1type_FUNC, + _1webkit_1web_1view_1execute_1script_FUNC, + _1webkit_1web_1view_1get_1load_1status_FUNC, + _1webkit_1web_1view_1get_1main_1frame_FUNC, + _1webkit_1web_1view_1get_1progress_FUNC, + _1webkit_1web_1view_1get_1settings_FUNC, + _1webkit_1web_1view_1get_1title_FUNC, + _1webkit_1web_1view_1get_1uri_FUNC, + _1webkit_1web_1view_1get_1window_1features_FUNC, + _1webkit_1web_1view_1go_1back_FUNC, + _1webkit_1web_1view_1go_1forward_FUNC, + _1webkit_1web_1view_1load_1string_FUNC, + _1webkit_1web_1view_1load_1uri_FUNC, + _1webkit_1web_1view_1new_FUNC, + _1webkit_1web_1view_1reload_FUNC, + _1webkit_1web_1view_1stop_1loading_FUNC, + memmove_FUNC, +} WebKitGTK_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.c new file mode 100644 index 0000000000..9d799ab20c --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.c @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "swt.h" +#include "webkitgtk_structs.h" + +#ifndef NO_JSClassDefinition +typedef struct JSClassDefinition_FID_CACHE { + int cached; + jclass clazz; + jfieldID version, attributes, className, parentClass, staticValues, staticFunctions, initialize, finalize, hasProperty, getProperty, setProperty, deleteProperty, getPropertyNames, callAsFunction, callAsConstructor, hasInstance, convertToType; +} JSClassDefinition_FID_CACHE; + +JSClassDefinition_FID_CACHE JSClassDefinitionFc; + +void cacheJSClassDefinitionFields(JNIEnv *env, jobject lpObject) +{ + if (JSClassDefinitionFc.cached) return; + JSClassDefinitionFc.clazz = (*env)->GetObjectClass(env, lpObject); + JSClassDefinitionFc.version = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "version", "I"); + JSClassDefinitionFc.attributes = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "attributes", "I"); + JSClassDefinitionFc.className = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "className", I_J); + JSClassDefinitionFc.parentClass = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "parentClass", I_J); + JSClassDefinitionFc.staticValues = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "staticValues", I_J); + JSClassDefinitionFc.staticFunctions = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "staticFunctions", I_J); + JSClassDefinitionFc.initialize = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "initialize", I_J); + JSClassDefinitionFc.finalize = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "finalize", I_J); + JSClassDefinitionFc.hasProperty = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "hasProperty", I_J); + JSClassDefinitionFc.getProperty = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "getProperty", I_J); + JSClassDefinitionFc.setProperty = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "setProperty", I_J); + JSClassDefinitionFc.deleteProperty = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "deleteProperty", I_J); + JSClassDefinitionFc.getPropertyNames = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "getPropertyNames", I_J); + JSClassDefinitionFc.callAsFunction = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "callAsFunction", I_J); + JSClassDefinitionFc.callAsConstructor = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "callAsConstructor", I_J); + JSClassDefinitionFc.hasInstance = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "hasInstance", I_J); + JSClassDefinitionFc.convertToType = (*env)->GetFieldID(env, JSClassDefinitionFc.clazz, "convertToType", I_J); + JSClassDefinitionFc.cached = 1; +} + +JSClassDefinition *getJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct) +{ + if (!JSClassDefinitionFc.cached) cacheJSClassDefinitionFields(env, lpObject); + lpStruct->version = (*env)->GetIntField(env, lpObject, JSClassDefinitionFc.version); + lpStruct->attributes = (JSClassAttributes)(*env)->GetIntField(env, lpObject, JSClassDefinitionFc.attributes); + lpStruct->className = (const char*)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.className); + lpStruct->parentClass = (JSClassRef)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.parentClass); + lpStruct->staticValues = (const JSStaticValue*)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.staticValues); + lpStruct->staticFunctions = (const JSStaticFunction*)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.staticFunctions); + lpStruct->initialize = (JSObjectInitializeCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.initialize); + lpStruct->finalize = (JSObjectFinalizeCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.finalize); + lpStruct->hasProperty = (JSObjectHasPropertyCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.hasProperty); + lpStruct->getProperty = (JSObjectGetPropertyCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.getProperty); + lpStruct->setProperty = (JSObjectSetPropertyCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.setProperty); + lpStruct->deleteProperty = (JSObjectDeletePropertyCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.deleteProperty); + lpStruct->getPropertyNames = (JSObjectGetPropertyNamesCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.getPropertyNames); + lpStruct->callAsFunction = (JSObjectCallAsFunctionCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.callAsFunction); + lpStruct->callAsConstructor = (JSObjectCallAsConstructorCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.callAsConstructor); + lpStruct->hasInstance = (JSObjectHasInstanceCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.hasInstance); + lpStruct->convertToType = (JSObjectConvertToTypeCallback)(*env)->GetIntLongField(env, lpObject, JSClassDefinitionFc.convertToType); + return lpStruct; +} + +void setJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct) +{ + if (!JSClassDefinitionFc.cached) cacheJSClassDefinitionFields(env, lpObject); + (*env)->SetIntField(env, lpObject, JSClassDefinitionFc.version, (jint)lpStruct->version); + (*env)->SetIntField(env, lpObject, JSClassDefinitionFc.attributes, (jint)lpStruct->attributes); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.className, (jintLong)lpStruct->className); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.parentClass, (jintLong)lpStruct->parentClass); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.staticValues, (jintLong)lpStruct->staticValues); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.staticFunctions, (jintLong)lpStruct->staticFunctions); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.initialize, (jintLong)lpStruct->initialize); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.finalize, (jintLong)lpStruct->finalize); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.hasProperty, (jintLong)lpStruct->hasProperty); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.getProperty, (jintLong)lpStruct->getProperty); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.setProperty, (jintLong)lpStruct->setProperty); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.deleteProperty, (jintLong)lpStruct->deleteProperty); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.getPropertyNames, (jintLong)lpStruct->getPropertyNames); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.callAsFunction, (jintLong)lpStruct->callAsFunction); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.callAsConstructor, (jintLong)lpStruct->callAsConstructor); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.hasInstance, (jintLong)lpStruct->hasInstance); + (*env)->SetIntLongField(env, lpObject, JSClassDefinitionFc.convertToType, (jintLong)lpStruct->convertToType); +} +#endif + diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.h new file mode 100644 index 0000000000..4513abbbf2 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_structs.h @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "webkitgtk.h" + +#ifndef NO_JSClassDefinition +void cacheJSClassDefinitionFields(JNIEnv *env, jobject lpObject); +JSClassDefinition *getJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct); +void setJSClassDefinitionFields(JNIEnv *env, jobject lpObject, JSClassDefinition *lpStruct); +#define JSClassDefinition_sizeof() sizeof(JSClassDefinition) +#else +#define cacheJSClassDefinitionFields(a,b) +#define getJSClassDefinitionFields(a,b,c) NULL +#define setJSClassDefinitionFields(a,b,c) +#define JSClassDefinition_sizeof() 0 +#endif + diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java new file mode 100644 index 0000000000..a30a0dee8d --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -0,0 +1,1820 @@ +/******************************************************************************* + * Copyright (c) 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + + +import java.io.UnsupportedEncodingException; +import java.net.*; +import java.util.*; + +import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.gtk.OS; +import org.eclipse.swt.internal.webkit.*; +import org.eclipse.swt.layout.*; +import org.eclipse.swt.widgets.*; + +public class WebKit extends WebBrowser { + int /*long*/ webView, webViewData, scrolledWindow; + int failureCount, lastKeyCode, lastCharCode; + String postData; + String[] headers; + boolean ignoreDispose, loadingText, untrustedText; + byte[] htmlBytes; + BrowserFunction eventFunction; + + static int /*long*/ ExternalClass, PostString; + static boolean LibraryLoaded; + + static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$ + static final String CHARSET_UTF8 = "UTF-8"; //$NON-NLS-1$ + static final String CLASSNAME_EXTERNAL = "External"; //$NON-NLS-1$ + static final String ENCODING_FORM = "Content-Type: application/x-www-form-urlencoded"; //$NON-NLS-1$ + static final String FUNCTIONNAME_CALLJAVA = "callJava"; //$NON-NLS-1$ + static final String OBJECTNAME_EXTERNAL = "external"; //$NON-NLS-1$ + static final String PROPERTY_LENGTH = "length"; //$NON-NLS-1$ + static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$ + static final String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$ + static final String PROTOCOL_HTTP = "http://"; //$NON-NLS-1$ + static final String URI_FILEROOT = "file:///"; //$NON-NLS-1$ + static final String USER_AGENT = "user-agent"; //$NON-NLS-1$ + static final int MAX_PORT = 65535; + static final int MAX_PROGRESS = 100; + static final int[] MIN_VERSION = {1, 1, 90}; + static final char SEPARATOR_FILE = System.getProperty ("file.separator").charAt (0); //$NON-NLS-1$ + static final int STOP_PROPOGATE = 1; + + static final String DOMEVENT_DRAGSTART = "dragstart"; //$NON-NLS-1$ + static final String DOMEVENT_KEYDOWN = "keydown"; //$NON-NLS-1$ + static final String DOMEVENT_KEYPRESS = "keypress"; //$NON-NLS-1$ + static final String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$ + static final String DOMEVENT_MOUSEDOWN = "mousedown"; //$NON-NLS-1$ + static final String DOMEVENT_MOUSEUP = "mouseup"; //$NON-NLS-1$ + static final String DOMEVENT_MOUSEMOVE = "mousemove"; //$NON-NLS-1$ + static final String DOMEVENT_MOUSEOUT = "mouseout"; //$NON-NLS-1$ + static final String DOMEVENT_MOUSEOVER = "mouseover"; //$NON-NLS-1$ + static final String DOMEVENT_MOUSEWHEEL = "mousewheel"; //$NON-NLS-1$ + + /* WebKit signal data */ + static final int HOVERING_OVER_LINK = 1; + static final int NOTIFY_PROGRESS = 2; + static final int NAVIGATION_POLICY_DECISION_REQUESTED = 3; + static final int NOTIFY_TITLE = 4; + static final int POPULATE_POPUP = 5; + static final int STATUS_BAR_TEXT_CHANGED = 6; + static final int CREATE_WEB_VIEW = 7; + static final int WEB_VIEW_READY = 8; + static final int NOTIFY_LOAD_STATUS = 9; + static final int RESOURCE_REQUEST_STARTING = 10; + static final int DOWNLOAD_REQUESTED = 11; + static final int MIME_TYPE_POLICY_DECISION_REQUESTED = 12; + static final int CLOSE_WEB_VIEW = 13; + static final int WINDOW_OBJECT_CLEARED = 14; + static final int CONSOLE_MESSAGE = 15; + + // the following Callbacks are never freed + static Callback Proc2, Proc3, Proc4, Proc5, Proc6; + static Callback JSObjectHasPropertyProc, JSObjectGetPropertyProc, JSObjectCallAsFunctionProc; + + static { + try { + Library.loadLibrary ("swt-webkit"); // $NON-NLS-1$ + LibraryLoaded = true; + } catch (Throwable e) { + } + + Proc2 = new Callback (WebKit.class, "Proc", 2); //$NON-NLS-1$ + if (Proc2.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + Proc3 = new Callback (WebKit.class, "Proc", 3); //$NON-NLS-1$ + if (Proc3.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + Proc4 = new Callback (WebKit.class, "Proc", 4); //$NON-NLS-1$ + if (Proc4.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + Proc5 = new Callback (WebKit.class, "Proc", 5); //$NON-NLS-1$ + if (Proc5.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + Proc6 = new Callback (WebKit.class, "Proc", 6); //$NON-NLS-1$ + if (Proc6.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + JSObjectHasPropertyProc = new Callback (WebKit.class, "JSObjectHasPropertyProc", 3); //$NON-NLS-1$ + if (JSObjectHasPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + JSObjectGetPropertyProc = new Callback (WebKit.class, "JSObjectGetPropertyProc", 4); //$NON-NLS-1$ + if (JSObjectGetPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + JSObjectCallAsFunctionProc = new Callback (WebKit.class, "JSObjectCallAsFunctionProc", 6); //$NON-NLS-1$ + if (JSObjectCallAsFunctionProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + + NativeClearSessions = new Runnable () { + public void run () { + if (!LibraryLoaded) return; + int /*long*/ session = WebKitGTK.webkit_get_default_session (); + int type = WebKitGTK.soup_cookie_jar_get_type (); + int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type); + if (jar == 0) return; + int /*long*/ cookies = WebKitGTK.soup_cookie_jar_all_cookies (jar); + int length = OS.g_slist_length (cookies); + int /*long*/ current = cookies; + for (int i = 0; i < length; i++) { + int /*long*/ cookie = OS.g_slist_data (current); + int /*long*/ expires = WebKitGTK.SoupCookie_expires (cookie); + if (expires == 0) { + /* indicates a session cookie */ + WebKitGTK.soup_cookie_jar_delete_cookie (jar, cookie); + } + OS.g_free (cookie); + current = OS.g_slist_next (current); + } + } + }; + + NativeGetCookie = new Runnable () { + public void run () { + if (!LibraryLoaded) return; + int /*long*/ session = WebKitGTK.webkit_get_default_session (); + int type = WebKitGTK.soup_cookie_jar_get_type (); + int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type); + if (jar == 0) return; + byte[] bytes = Converter.wcsToMbcs (null, CookieUrl, true); + int /*long*/ uri = WebKitGTK.soup_uri_new (bytes); + if (uri == 0) return; + int /*long*/ cookies = WebKitGTK.soup_cookie_jar_get_cookies (jar, uri, 0); + WebKitGTK.soup_uri_free (uri); + if (cookies == 0) return; + int length = OS.strlen (cookies); + bytes = new byte[length]; + C.memmove (bytes, cookies, length); + OS.g_free (cookies); + String allCookies = new String (Converter.mbcsToWcs (null, bytes)); + StringTokenizer tokenizer = new StringTokenizer (allCookies, ";"); //$NON-NLS-1$ + while (tokenizer.hasMoreTokens ()) { + String cookie = tokenizer.nextToken (); + int index = cookie.indexOf ('='); + if (index != -1) { + String name = cookie.substring (0, index).trim (); + if (name.equals (CookieName)) { + CookieValue = cookie.substring (index + 1).trim (); + return; + } + } + } + + } + }; + + NativeSetCookie = new Runnable () { + public void run () { + if (!LibraryLoaded) return; + int /*long*/ session = WebKitGTK.webkit_get_default_session (); + int type = WebKitGTK.soup_cookie_jar_get_type (); + int /*long*/ jar = WebKitGTK.soup_session_get_feature (session, type); + if (jar == 0) { + /* this happens if a navigation has not occurred yet */ + WebKitGTK.soup_session_add_feature_by_type (session, type); + jar = WebKitGTK.soup_session_get_feature (session, type); + } + if (jar == 0) return; + byte[] bytes = Converter.wcsToMbcs (null, CookieUrl, true); + int /*long*/ uri = WebKitGTK.soup_uri_new (bytes); + if (uri == 0) return; + bytes = Converter.wcsToMbcs (null, CookieValue, true); + int /*long*/ cookie = WebKitGTK.soup_cookie_parse (bytes, uri); + if (cookie != 0) { + WebKitGTK.soup_cookie_jar_add_cookie (jar, cookie); + // the following line is intentionally commented + // WebKitGTK.soup_cookie_free (cookie); + CookieResult = true; + } + WebKitGTK.soup_uri_free (uri); + } + }; + + if (NativePendingCookies != null) { + SetPendingCookies (NativePendingCookies); + NativePendingCookies = null; + } + } + +static Browser findBrowser (int /*long*/ webView) { + if (webView == 0) return null; + int /*long*/ parent = OS.gtk_widget_get_parent (webView); + parent = OS.gtk_widget_get_parent (parent); + return (Browser)Display.getCurrent ().findWidget (parent); +} + +static int /*long*/ JSObjectCallAsFunctionProc (int /*long*/ ctx, int /*long*/ function, int /*long*/ thisObject, int /*long*/ argumentCount, int /*long*/ arguments, int /*long*/ exception) { + if (WebKitGTK.JSValueIsObjectOfClass (ctx, thisObject, ExternalClass) == 0) { + return WebKitGTK.JSValueMakeUndefined (ctx); + } + int /*long*/ ptr = WebKitGTK.JSObjectGetPrivate (thisObject); + int /*long*/[] handle = new int /*long*/[1]; + C.memmove (handle, ptr, C.PTR_SIZEOF); + Browser browser = findBrowser (handle[0]); + if (browser == null) return 0; + WebKit webkit = (WebKit)browser.webBrowser; + return webkit.callJava (ctx, function, thisObject, argumentCount, arguments, exception); +} + +static int /*long*/ JSObjectGetPropertyProc (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/ exception) { + byte[] bytes = null; + try { + bytes = (FUNCTIONNAME_CALLJAVA + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, FUNCTIONNAME_CALLJAVA, true); + } + int /*long*/ name = WebKitGTK.JSStringCreateWithUTF8CString (bytes); + int /*long*/ function = WebKitGTK.JSObjectMakeFunctionWithCallback (ctx, name, JSObjectCallAsFunctionProc.getAddress ()); + WebKitGTK.JSStringRelease (name); + return function; +} + +static int /*long*/ JSObjectHasPropertyProc (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName) { + byte[] bytes = null; + try { + bytes = (FUNCTIONNAME_CALLJAVA + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, FUNCTIONNAME_CALLJAVA, true); + } + return WebKitGTK.JSStringIsEqualToUTF8CString (propertyName, bytes); +} + +static int /*long*/ Proc (int /*long*/ handle, int /*long*/ user_data) { + Browser browser = findBrowser (handle); + if (browser == null) return 0; + WebKit webkit = (WebKit)browser.webBrowser; + return webkit.webViewProc (handle, user_data); +} + +static int /*long*/ Proc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { + if (OS.GTK_IS_SCROLLED_WINDOW (handle)) { + /* + * Stop the propagation of events that are not consumed by WebKit, before + * they reach the parent embedder. These events have already been received. + */ + return user_data; + } + + int /*long*/ webView; + if (WebKitGTK.WEBKIT_IS_WEB_FRAME (handle)) { + webView = WebKitGTK.webkit_web_frame_get_web_view (handle); + } else { + webView = handle; + } + Browser browser = findBrowser (webView); + if (browser == null) return 0; + WebKit webkit = (WebKit)browser.webBrowser; + if (webView == handle) { + return webkit.webViewProc (handle, arg0, user_data); + } else { + return webkit.webFrameProc (handle, arg0, user_data); + } +} + +static int /*long*/ Proc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) { + Browser browser = findBrowser (handle); + if (browser == null) return 0; + WebKit webkit = (WebKit)browser.webBrowser; + return webkit.webViewProc (handle, arg0, arg1, user_data); +} + +static int /*long*/ Proc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) { + int /*long*/ webView; + if (WebKitGTK.SOUP_IS_SESSION (handle)) { + webView = user_data; + } else { + webView = handle; + } + Browser browser = findBrowser (webView); + if (browser == null) return 0; + WebKit webkit = (WebKit)browser.webBrowser; + if (webView == handle) { + return webkit.webViewProc (handle, arg0, arg1, arg2, user_data); + } else { + return webkit.sessionProc (handle, arg0, arg1, arg2, user_data); + } +} + +static int /*long*/ Proc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ user_data) { + Browser browser = findBrowser (handle); + if (browser == null) return 0; + WebKit webkit = (WebKit)browser.webBrowser; + return webkit.webViewProc (handle, arg0, arg1, arg2, arg3, user_data); +} + +int /*long*/ sessionProc (int /*long*/ session, int /*long*/ msg, int /*long*/ auth, int /*long*/ retrying, int /*long*/ user_data) { + /* authentication challenges are currently the only notification received from the session */ + if (retrying == 0) { + failureCount = 0; + } else { + if (++failureCount >= 3) return 0; + } + + int /*long*/ uri = WebKitGTK.soup_message_get_uri (msg); + int /*long*/ uriString = WebKitGTK.soup_uri_to_string (uri, 0); + int length = C.strlen (uriString); + byte[] bytes = new byte[length]; + OS.memmove (bytes, uriString, length); + OS.g_free (uriString); + String location = new String (MozillaDelegate.mbcsToWcs (null, bytes)); + + for (int i = 0; i < authenticationListeners.length; i++) { + AuthenticationEvent event = new AuthenticationEvent (browser); + event.location = location; + authenticationListeners[i].authenticate (event); + if (!event.doit) { + OS.g_signal_stop_emission_by_name (session, WebKitGTK.authenticate); + return 0; + } + if (event.user != null && event.password != null) { + byte[] userBytes = Converter.wcsToMbcs (null, event.user, true); + byte[] passwordBytes = Converter.wcsToMbcs (null, event.password, true); + WebKitGTK.soup_auth_authenticate (auth, userBytes, passwordBytes); + OS.g_signal_stop_emission_by_name (session, WebKitGTK.authenticate); + return 0; + } + } + return 0; +} + +int /*long*/ webFrameProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { + switch ((int)/*64*/user_data) { + case NOTIFY_LOAD_STATUS: return webframe_notify_load_status (handle, arg0); + default: return 0; + } +} + +int /*long*/ webViewProc (int /*long*/ handle, int /*long*/ user_data) { + switch ((int)/*64*/user_data) { + case CLOSE_WEB_VIEW: return webkit_close_web_view (handle); + case WEB_VIEW_READY: return webkit_web_view_ready (handle); + default: return 0; + } +} + +int /*long*/ webViewProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { + switch ((int)/*64*/user_data) { + case CREATE_WEB_VIEW: return webkit_create_web_view (handle, arg0); + case DOWNLOAD_REQUESTED: return webkit_download_requested (handle, arg0); + case NOTIFY_LOAD_STATUS: return webkit_notify_load_status (handle, arg0); + case NOTIFY_PROGRESS: return webkit_notify_progress (handle, arg0); + case NOTIFY_TITLE: return webkit_notify_title (handle, arg0); + case POPULATE_POPUP: return webkit_populate_popup (handle, arg0); + case STATUS_BAR_TEXT_CHANGED: return webkit_status_bar_text_changed (handle, arg0); + default: return 0; + } +} + +int /*long*/ webViewProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) { + switch ((int)/*64*/user_data) { + case HOVERING_OVER_LINK: return webkit_hovering_over_link (handle, arg0, arg1); + default: return 0; + } +} + +int /*long*/ webViewProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) { + switch ((int)/*64*/user_data) { + case CONSOLE_MESSAGE: return webkit_console_message (handle, arg0, arg1, arg2); + case WINDOW_OBJECT_CLEARED: return webkit_window_object_cleared (handle, arg0, arg1, arg2); + default: return 0; + } +} + +int /*long*/ webViewProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ user_data) { + switch ((int)/*64*/user_data) { + case MIME_TYPE_POLICY_DECISION_REQUESTED: return webkit_mime_type_policy_decision_requested (handle, arg0, arg1, arg2, arg3); + case NAVIGATION_POLICY_DECISION_REQUESTED: return webkit_navigation_policy_decision_requested (handle, arg0, arg1, arg2, arg3); + case RESOURCE_REQUEST_STARTING: return webkit_resource_request_starting (handle, arg0, arg1, arg2, arg3); + default: return 0; + } +} + +public boolean create (Composite parent, int style) { + if (!LibraryLoaded) return false; + + if (ExternalClass == 0) { + // TODO webkit_check_version() should do the following, but for some reason + // this symbol is missing from the latest build. If it is present in Linux + // distro-provided builds then replace the following with this call. + int major = WebKitGTK.webkit_major_version (); + int minor = WebKitGTK.webkit_minor_version (); + int micro = WebKitGTK.webkit_micro_version (); + boolean success = major > MIN_VERSION[0] || + (major == MIN_VERSION[0] && minor > MIN_VERSION[1]) || + (major == MIN_VERSION[0] && minor == MIN_VERSION[1] && micro >= MIN_VERSION[2]); + if (!success) return false; + + if (Device.DEBUG) { + System.out.println("WebKit version " + major + "." + minor + "." + micro); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + JSClassDefinition jsClassDefinition = new JSClassDefinition (); + byte[] bytes = Converter.wcsToMbcs (null, CLASSNAME_EXTERNAL, true); + jsClassDefinition.className = C.malloc (bytes.length); + OS.memmove (jsClassDefinition.className, bytes, bytes.length); + jsClassDefinition.hasProperty = JSObjectHasPropertyProc.getAddress (); + jsClassDefinition.getProperty = JSObjectGetPropertyProc.getAddress (); + int /*long*/ classDefinitionPtr = C.malloc (JSClassDefinition.sizeof); + WebKitGTK.memmove (classDefinitionPtr, jsClassDefinition, JSClassDefinition.sizeof); + ExternalClass = WebKitGTK.JSClassCreate (classDefinitionPtr); + + bytes = Converter.wcsToMbcs (null, "POST", true); //$NON-NLS-1$ + PostString = C.malloc (bytes.length); + C.memmove (PostString, bytes, bytes.length); + } + + scrolledWindow = OS.gtk_scrolled_window_new (0, 0); + OS.gtk_scrolled_window_set_policy (scrolledWindow, OS.GTK_POLICY_AUTOMATIC, OS.GTK_POLICY_AUTOMATIC); + webView = WebKitGTK.webkit_web_view_new (); + webViewData = C.malloc (C.PTR_SIZEOF); + C.memmove (webViewData, new int /*long*/[] {webView}, C.PTR_SIZEOF); + OS.gtk_container_add (scrolledWindow, webView); + OS.gtk_container_add (browser.handle, scrolledWindow); + OS.gtk_widget_show (scrolledWindow); + OS.gtk_widget_show (webView); + OS.g_signal_connect (webView, WebKitGTK.close_web_view, Proc2.getAddress (), CLOSE_WEB_VIEW); + OS.g_signal_connect (webView, WebKitGTK.console_message, Proc5.getAddress (), CONSOLE_MESSAGE); + OS.g_signal_connect (webView, WebKitGTK.create_web_view, Proc3.getAddress (), CREATE_WEB_VIEW); + OS.g_signal_connect (webView, WebKitGTK.download_requested, Proc3.getAddress (), DOWNLOAD_REQUESTED); + OS.g_signal_connect (webView, WebKitGTK.hovering_over_link, Proc4.getAddress (), HOVERING_OVER_LINK); + OS.g_signal_connect (webView, WebKitGTK.mime_type_policy_decision_requested, Proc6.getAddress (), MIME_TYPE_POLICY_DECISION_REQUESTED); + OS.g_signal_connect (webView, WebKitGTK.navigation_policy_decision_requested, Proc6.getAddress (), NAVIGATION_POLICY_DECISION_REQUESTED); + OS.g_signal_connect (webView, WebKitGTK.notify_load_status, Proc3.getAddress (), NOTIFY_LOAD_STATUS); + OS.g_signal_connect (webView, WebKitGTK.notify_progress, Proc3.getAddress (), NOTIFY_PROGRESS); + OS.g_signal_connect (webView, WebKitGTK.notify_title, Proc3.getAddress (), NOTIFY_TITLE); + OS.g_signal_connect (webView, WebKitGTK.populate_popup, Proc3.getAddress (), POPULATE_POPUP); + OS.g_signal_connect (webView, WebKitGTK.resource_request_starting, Proc6.getAddress (), RESOURCE_REQUEST_STARTING); + OS.g_signal_connect (webView, WebKitGTK.status_bar_text_changed, Proc3.getAddress (), STATUS_BAR_TEXT_CHANGED); + OS.g_signal_connect (webView, WebKitGTK.web_view_ready, Proc2.getAddress (), WEB_VIEW_READY); + OS.g_signal_connect (webView, WebKitGTK.window_object_cleared, Proc5.getAddress (), WINDOW_OBJECT_CLEARED); + + /* Callback to get events before WebKit receives and consumes them */ + OS.g_signal_connect (scrolledWindow, OS.event, Proc3.getAddress (), 0); + /* + * Callbacks to get the events not consumed by WebKit, and to block + * them so that they don't get propagated to the parent handle twice. + * This hook is set after WebKit and is therefore called after WebKit's + * handler because GTK dispatches events in their order of registration. + */ + OS.g_signal_connect (scrolledWindow, OS.button_press_event, Proc3.getAddress (), STOP_PROPOGATE); + OS.g_signal_connect (scrolledWindow, OS.button_release_event, Proc3.getAddress (), STOP_PROPOGATE); + OS.g_signal_connect (scrolledWindow, OS.key_press_event, Proc3.getAddress (), STOP_PROPOGATE); + OS.g_signal_connect (scrolledWindow, OS.key_release_event, Proc3.getAddress (), STOP_PROPOGATE); + OS.g_signal_connect (scrolledWindow, OS.scroll_event, Proc3.getAddress (), STOP_PROPOGATE); + OS.g_signal_connect (scrolledWindow, OS.motion_notify_event, Proc3.getAddress (), STOP_PROPOGATE); + + int /*long*/ settings = WebKitGTK.webkit_web_view_get_settings (webView); + OS.g_object_set (settings, WebKitGTK.javascript_can_open_windows_automatically, 1, 0); + OS.g_object_set (settings, WebKitGTK.enable_universal_access_from_file_uris, 1, 0); + + Listener listener = new Listener () { + public void handleEvent (Event event) { + switch (event.type) { + case SWT.Dispose: { + /* make this handler run after other dispose listeners */ + if (ignoreDispose) { + ignoreDispose = false; + break; + } + ignoreDispose = true; + browser.notifyListeners (event.type, event); + event.type = SWT.NONE; + onDispose (event); + break; + } + case SWT.FocusIn: { + OS.gtk_widget_grab_focus (webView); + break; + } + case SWT.Resize: { + onResize (event); + break; + } + } + } + }; + browser.addListener (SWT.Dispose, listener); + browser.addListener (SWT.FocusIn, listener); + browser.addListener (SWT.KeyDown, listener); + browser.addListener (SWT.Resize, listener); + + /* + * Ensure that our Authenticate listener is at the front of the signal + * queue by removing the default Authenticate listener, adding ours, + * and then re-adding the default listener. + */ + int /*long*/ session = WebKitGTK.webkit_get_default_session (); + int /*long*/ originalAuth = WebKitGTK.soup_session_get_feature (session, WebKitGTK.webkit_soup_auth_dialog_get_type ()); + WebKitGTK.soup_session_feature_detach (originalAuth, session); + OS.g_signal_connect (session, WebKitGTK.authenticate, Proc5.getAddress (), webView); + WebKitGTK.soup_session_feature_attach (originalAuth, session); + + /* + * Check for proxy values set as documented java properties and update the + * session to use these values if needed. + */ + String proxyHost = System.getProperty (PROPERTY_PROXYHOST); + String proxyPortString = System.getProperty (PROPERTY_PROXYPORT); + int port = -1; + if (proxyPortString != null) { + try { + int value = Integer.valueOf (proxyPortString).intValue (); + if (0 <= value && value <= MAX_PORT) port = value; + } catch (NumberFormatException e) { + /* do nothing, java property has non-integer value */ + } + } + if (proxyHost != null || port != -1) { + if (!proxyHost.startsWith (PROTOCOL_HTTP)) { + proxyHost = PROTOCOL_HTTP + proxyHost; + } + proxyHost += ":" + port; //$NON-NLS-1$ + byte[] bytes = Converter.wcsToMbcs (null, proxyHost, true); + int /*long*/ uri = WebKitGTK.soup_uri_new (bytes); + if (uri != 0) { + OS.g_object_set (session, WebKitGTK.SOUP_SESSION_PROXY_URI, uri, 0); + WebKitGTK.soup_uri_free (uri); + } + } + + eventFunction = new BrowserFunction (browser, "HandleWebKitEvent") { //$NON-NLS-1$ + public Object function(Object[] arguments) { + return handleEvent (arguments) ? Boolean.TRUE : Boolean.FALSE; + }; + }; + + return true; +} + +void addEventHandlers (boolean top) { + if (top) { + StringBuffer buffer = new StringBuffer ("window.SWTkeyhandler = function SWTkeyhandler(e) {"); //$NON-NLS-1$ + buffer.append ("try {e.returnValue = HandleWebKitEvent(e.type, e.keyCode, e.charCode, e.altKey, e.ctrlKey, e.shiftKey, e.metaKey);} catch (e) {}};"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('keydown', SWTkeyhandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('keypress', SWTkeyhandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('keyup', SWTkeyhandler, true);"); //$NON-NLS-1$ + execute (buffer.toString ()); + + buffer = new StringBuffer ("window.SWTmousehandler = function SWTmousehandler(e) {"); //$NON-NLS-1$ + buffer.append ("try {e.returnValue = HandleWebKitEvent(e.type, e.screenX, e.screenY, e.detail, e.button, e.altKey, e.ctrlKey, e.shiftKey, e.metaKey, e.relatedTarget != null);} catch (e) {}};"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('mousedown', SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('mouseup', SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('mousemove', SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('mouseover', SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('mouseout', SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('mousewheel', SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("document.addEventListener('dragstart', SWTmousehandler, true);"); //$NON-NLS-1$ + execute (buffer.toString ()); + } else { + StringBuffer buffer = new StringBuffer ("for (var i = 0; i < frames.length; i++) {"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('keydown', window.SWTkeyhandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('keypress', window.SWTkeyhandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('keyup', window.SWTkeyhandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('mousedown', window.SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('mouseup', window.SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('mousemove', window.SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('mouseover', window.SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('mouseout', window.SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('mousewheel', window.SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ("frames[i].document.addEventListener('dragstart', window.SWTmousehandler, true);"); //$NON-NLS-1$ + buffer.append ('}'); + execute (buffer.toString ()); + } +} + +public boolean back () { + if (WebKitGTK.webkit_web_view_can_go_back (webView) == 0) return false; + WebKitGTK.webkit_web_view_go_back (webView); + return true; +} + +public boolean close () { + return close (true); +} + +boolean close (boolean showPrompters) { + if (!jsEnabled) return true; + + String message1 = Compatibility.getMessage("SWT_OnBeforeUnload_Message1"); // $NON-NLS-1$ + String message2 = Compatibility.getMessage("SWT_OnBeforeUnload_Message2"); // $NON-NLS-1$ + String functionName = EXECUTE_ID + "CLOSE"; // $NON-NLS-1$ + StringBuffer buffer = new StringBuffer ("function "); // $NON-NLS-1$ + buffer.append (functionName); + buffer.append ("(win) {\n"); // $NON-NLS-1$ + buffer.append ("var fn = win.onbeforeunload; if (fn != null) {try {var str = fn(); "); // $NON-NLS-1$ + if (showPrompters) { + buffer.append ("if (str != null) { "); // $NON-NLS-1$ + buffer.append ("var result = confirm('"); // $NON-NLS-1$ + buffer.append (message1); + buffer.append ("\\n\\n'+str+'\\n\\n"); // $NON-NLS-1$ + buffer.append (message2); + buffer.append ("');"); // $NON-NLS-1$ + buffer.append ("if (!result) return false;}"); // $NON-NLS-1$ + } + buffer.append ("} catch (e) {}}"); // $NON-NLS-1$ + buffer.append ("try {for (var i = 0; i < win.frames.length; i++) {var result = "); // $NON-NLS-1$ + buffer.append (functionName); + buffer.append ("(win.frames[i]); if (!result) return false;}} catch (e) {} return true;"); // $NON-NLS-1$ + buffer.append ("\n};"); // $NON-NLS-1$ + execute (buffer.toString ()); + + Boolean result = (Boolean)evaluate ("return " + functionName +"(window);"); // $NON-NLS-1$ // $NON-NLS-2$ + if (result == null) return false; + return result.booleanValue (); +} + +public boolean execute (String script) { + int /*long*/ frame = WebKitGTK.webkit_web_view_get_main_frame (webView); + int /*long*/ context = WebKitGTK.webkit_web_frame_get_global_context (frame); + + byte[] bytes = null; + try { + bytes = (script + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, script, true); + } + int /*long*/ scriptString = WebKitGTK.JSStringCreateWithUTF8CString (bytes); + + try { + bytes = (getUrl () + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, getUrl (), true); + } + int /*long*/ urlString = WebKitGTK.JSStringCreateWithUTF8CString (bytes); + + int /*long*/ result = WebKitGTK.JSEvaluateScript (context, scriptString, 0, urlString, 0, null); + WebKitGTK.JSStringRelease (urlString); + WebKitGTK.JSStringRelease (scriptString); + return result != 0; +} + +public boolean forward () { + if (WebKitGTK.webkit_web_view_can_go_forward (webView) == 0) return false; + WebKitGTK.webkit_web_view_go_forward (webView); + return true; +} + +public String getBrowserType () { + return "webkit"; //$NON-NLS-1$ +} + +public String getText () { + int /*long*/ frame = WebKitGTK.webkit_web_view_get_main_frame (webView); + int /*long*/ source = WebKitGTK.webkit_web_frame_get_data_source (frame); + if (source == 0) return ""; //$NON-NLS-1$ + int /*long*/ data = WebKitGTK.webkit_web_data_source_get_data (source); + if (data == 0) return ""; //$NON-NLS-1$ + + int /*long*/ encoding = WebKitGTK.webkit_web_data_source_get_encoding (source); + int length = OS.strlen (encoding); + byte[] bytes = new byte [length]; + OS.memmove (bytes, encoding, length); + String encodingString = new String (Converter.mbcsToWcs (null, bytes)); + + int /*long*/ string = OS.GString_str (data); + length = OS.GString_len (string); + bytes = new byte[length]; + C.memmove (bytes, string, length); + + try { + return new String (bytes, encodingString); + } catch (UnsupportedEncodingException e) { + } + return new String (Converter.mbcsToWcs (null, bytes)); +} + +public String getUrl () { + int /*long*/ uri = WebKitGTK.webkit_web_view_get_uri (webView); + + /* WebKit auto-navigates to about:blank at startup */ + if (uri == 0) return ABOUT_BLANK; + + int length = OS.strlen (uri); + byte[] bytes = new byte[length]; + OS.memmove (bytes, uri, length); + + String url = new String (Converter.mbcsToWcs (null, bytes)); + /* + * If the URI indicates that the page is being rendered from memory + * (via setText()) then set it to about:blank to be consistent with IE. + */ + if (url.equals (URI_FILEROOT)) { + url = ABOUT_BLANK; + } else { + length = URI_FILEROOT.length (); + if (url.startsWith (URI_FILEROOT) && url.charAt (length) == '#') { + url = ABOUT_BLANK + url.substring (length); + } + } + return url; +} + +boolean handleEvent (Object[] arguments) { + + /* + * DOM events are currently received by hooking DOM listeners + * in javascript that invoke this method via a BrowserFunction. + * It should be possible to replace this mechanism with more + * typical callbacks from C once WebKitGTK enhancement request + * https://bugs.webkit.org/show_bug.cgi?id=33590 is completed. + * In the meantime, the argument lists received here are: + * + * For key events: + * argument 0: type (String) + * argument 1: keyCode (Double) + * argument 2: charCode (Double) + * argument 3: altKey (Boolean) + * argument 4: ctrlKey (Boolean) + * argument 5: shiftKey (Boolean) + * argument 6: metaKey (Boolean) + * returns doit + * + * For mouse events + * argument 0: type (String) + * argument 1: screenX (Double) + * argument 2: screenY (Double) + * argument 3: detail (Double) + * argument 4: button (Double) + * argument 5: altKey (Boolean) + * argument 6: ctrlKey (Boolean) + * argument 7: shiftKey (Boolean) + * argument 8: metaKey (Boolean) + * argument 9: hasRelatedTarget (Boolean) + * returns doit + */ + + String type = (String)arguments[0]; + if (type.equals (DOMEVENT_KEYDOWN)) { + int keyCode = translateKey (((Double)arguments[1]).intValue ()); + lastKeyCode = keyCode; + switch (keyCode) { + case SWT.SHIFT: + case SWT.CONTROL: + case SWT.ALT: + case SWT.CAPS_LOCK: + case SWT.NUM_LOCK: + case SWT.SCROLL_LOCK: + case SWT.COMMAND: + case SWT.ESC: + case SWT.TAB: + case SWT.PAUSE: + case SWT.BS: + case SWT.INSERT: + case SWT.DEL: + case SWT.HOME: + case SWT.END: + case SWT.PAGE_UP: + case SWT.PAGE_DOWN: + case SWT.ARROW_DOWN: + case SWT.ARROW_UP: + case SWT.ARROW_LEFT: + case SWT.ARROW_RIGHT: + case SWT.F1: + case SWT.F2: + case SWT.F3: + case SWT.F4: + case SWT.F5: + case SWT.F6: + case SWT.F7: + case SWT.F8: + case SWT.F9: + case SWT.F10: + case SWT.F11: + case SWT.F12: { + /* keypress events will not be received for these keys, so send KeyDowns for them now */ + + Event keyEvent = new Event (); + keyEvent.widget = browser; + keyEvent.type = type.equals (DOMEVENT_KEYDOWN) ? SWT.KeyDown : SWT.KeyUp; + keyEvent.keyCode = keyCode; + switch (keyCode) { + case SWT.BS: keyEvent.character = SWT.BS; break; + case SWT.DEL: keyEvent.character = SWT.DEL; break; + case SWT.ESC: keyEvent.character = SWT.ESC; break; + case SWT.TAB: keyEvent.character = SWT.TAB; break; + } + lastCharCode = keyEvent.character; + keyEvent.stateMask = + (((Boolean)arguments[3]).booleanValue () ? SWT.ALT : 0) | + (((Boolean)arguments[4]).booleanValue () ? SWT.CTRL : 0) | + (((Boolean)arguments[5]).booleanValue () ? SWT.SHIFT : 0) | + (((Boolean)arguments[6]).booleanValue () ? SWT.COMMAND : 0); + keyEvent.stateMask &= ~keyCode; /* remove current keydown if it's a state key */ + final int stateMask = keyEvent.stateMask; + if (!sendKeyEvent (keyEvent) || browser.isDisposed ()) return false; + + if (browser.isFocusControl ()) { + if (keyCode == SWT.TAB && (stateMask & (SWT.CTRL | SWT.ALT)) == 0) { + browser.getDisplay ().asyncExec (new Runnable () { + public void run () { + if (browser.isDisposed ()) return; + if (browser.getDisplay ().getFocusControl () == null) { + int traversal = (stateMask & SWT.SHIFT) != 0 ? SWT.TRAVERSE_TAB_PREVIOUS : SWT.TRAVERSE_TAB_NEXT; + browser.traverse (traversal); + } + } + }); + } + } + break; + } + } + return true; + } + + if (type.equals (DOMEVENT_KEYPRESS)) { + /* + * if keydown could not determine a keycode for this key then it's a + * key for which key events are not sent (eg.- the Windows key) + */ + if (lastKeyCode == 0) return true; + + lastCharCode = ((Double)arguments[2]).intValue (); + if (((Boolean)arguments[4]).booleanValue () && (0 <= lastCharCode && lastCharCode <= 0x7F)) { + if ('a' <= lastCharCode && lastCharCode <= 'z') lastCharCode -= 'a' - 'A'; + if (64 <= lastCharCode && lastCharCode <= 95) lastCharCode -= 64; + } + + Event keyEvent = new Event (); + keyEvent.widget = browser; + keyEvent.type = SWT.KeyDown; + keyEvent.keyCode = lastKeyCode; + keyEvent.character = (char)lastCharCode; + keyEvent.stateMask = + (((Boolean)arguments[3]).booleanValue () ? SWT.ALT : 0) | + (((Boolean)arguments[4]).booleanValue () ? SWT.CTRL : 0) | + (((Boolean)arguments[5]).booleanValue () ? SWT.SHIFT : 0) | + (((Boolean)arguments[6]).booleanValue () ? SWT.COMMAND : 0); + return sendKeyEvent (keyEvent) && !browser.isDisposed (); + } + + if (type.equals(DOMEVENT_KEYUP)) { + int keyCode = translateKey (((Double)arguments[1]).intValue ()); + if (keyCode == 0) { + /* indicates a key for which key events are not sent */ + return true; + } + if (keyCode != lastKeyCode) { + /* keyup does not correspond to the last keydown */ + lastKeyCode = keyCode; + lastCharCode = 0; + } + + Event keyEvent = new Event (); + keyEvent.widget = browser; + keyEvent.type = SWT.KeyUp; + keyEvent.keyCode = lastKeyCode; + keyEvent.character = (char)lastCharCode; + keyEvent.stateMask = + (((Boolean)arguments[3]).booleanValue () ? SWT.ALT : 0) | + (((Boolean)arguments[4]).booleanValue () ? SWT.CTRL : 0) | + (((Boolean)arguments[5]).booleanValue () ? SWT.SHIFT : 0) | + (((Boolean)arguments[6]).booleanValue () ? SWT.COMMAND : 0); + switch (lastKeyCode) { + case SWT.SHIFT: + case SWT.CONTROL: + case SWT.ALT: + case SWT.COMMAND: { + keyEvent.stateMask |= lastKeyCode; + } + } + browser.notifyListeners (keyEvent.type, keyEvent); + lastKeyCode = lastCharCode = 0; + return keyEvent.doit && !browser.isDisposed (); + } + + /* mouse events */ + + /* + * MouseOver and MouseOut events are fired any time the mouse enters or exits + * any element within the Browser. To ensure that SWT events are only + * fired for mouse movements into or out of the Browser, do not fire an + * event if there is a related target element. + */ + if (type.equals (DOMEVENT_MOUSEOVER) || type.equals (DOMEVENT_MOUSEOUT)) { + if (((Boolean)arguments[9]).booleanValue ()) return true; + } + + /* + * The position of mouse events is received in screen-relative co-ordinates + * in order to handle pages with frames, since frames express their event + * co-ordinates relative to themselves rather than relative to their top- + * level page. Convert screen-relative co-ordinates to be browser-relative. + */ + Point position = new Point (((Double)arguments[1]).intValue (), ((Double)arguments[2]).intValue ()); + position = browser.getDisplay ().map (null, browser, position); + + Event mouseEvent = new Event (); + mouseEvent.widget = browser; + mouseEvent.x = position.x; + mouseEvent.y = position.y; + int mask = + (((Boolean)arguments[5]).booleanValue () ? SWT.ALT : 0) | + (((Boolean)arguments[6]).booleanValue () ? SWT.CTRL : 0) | + (((Boolean)arguments[7]).booleanValue () ? SWT.SHIFT : 0) | + (((Boolean)arguments[8]).booleanValue () ? SWT.COMMAND : 0); + mouseEvent.stateMask = mask; + + if (type.equals (DOMEVENT_MOUSEDOWN)) { + mouseEvent.type = SWT.MouseDown; + mouseEvent.count = ((Double)arguments[3]).intValue (); + mouseEvent.button = ((Double)arguments[4]).intValue (); + browser.notifyListeners (mouseEvent.type, mouseEvent); + if (browser.isDisposed ()) return true; + if (((Double)arguments[3]).intValue () == 2) { + mouseEvent = new Event (); + mouseEvent.type = SWT.MouseDoubleClick; + mouseEvent.widget = browser; + mouseEvent.x = position.x; + mouseEvent.y = position.y; + mouseEvent.stateMask = mask; + mouseEvent.count = ((Double)arguments[3]).intValue (); + mouseEvent.button = ((Double)arguments[4]).intValue (); + browser.notifyListeners (mouseEvent.type, mouseEvent); + } + return true; + } + + if (type.equals (DOMEVENT_MOUSEUP)) { + mouseEvent.type = SWT.MouseUp; + mouseEvent.count = ((Double)arguments[3]).intValue (); + mouseEvent.button = ((Double)arguments[4]).intValue (); + } else if (type.equals (DOMEVENT_MOUSEMOVE)) { + mouseEvent.type = SWT.MouseMove; + } else if (type.equals (DOMEVENT_MOUSEWHEEL)) { + mouseEvent.type = SWT.MouseWheel; + mouseEvent.count = ((Double)arguments[3]).intValue (); + } else if (type.equals (DOMEVENT_MOUSEOVER)) { + mouseEvent.type = SWT.MouseEnter; + } else if (type.equals (DOMEVENT_MOUSEOUT)) { + mouseEvent.type = SWT.MouseExit; + } else if (type.equals (DOMEVENT_DRAGSTART)) { + mouseEvent.type = SWT.DragDetect; + mouseEvent.button = ((Double)arguments[4]).intValue () + 1; + switch (mouseEvent.button) { + case 1: mouseEvent.stateMask |= SWT.BUTTON1; break; + case 2: mouseEvent.stateMask |= SWT.BUTTON2; break; + case 3: mouseEvent.stateMask |= SWT.BUTTON3; break; + case 4: mouseEvent.stateMask |= SWT.BUTTON4; break; + case 5: mouseEvent.stateMask |= SWT.BUTTON5; break; + } + browser.notifyListeners (mouseEvent.type, mouseEvent); + /* + * Bug in WebKitGTK. Dragging an image quickly and repeatedly can cause + * WebKitGTK to take the mouse grab indefinitely and lock up the display, + * see https://bugs.webkit.org/show_bug.cgi?id=32840. The workaround is + * to veto all drag attempts. + */ + return false; + } + + browser.notifyListeners (mouseEvent.type, mouseEvent); + return true; +} + +int /*long*/ handleLoadCommitted (int /*long*/ uri, boolean top) { + int length = OS.strlen (uri); + byte[] bytes = new byte[length]; + OS.memmove (bytes, uri, length); + String url = new String (Converter.mbcsToWcs (null, bytes)); + /* + * If the URI indicates that the page is being rendered from memory + * (via setText()) then set it to about:blank to be consistent with IE. + */ + if (url.equals (URI_FILEROOT)) { + url = ABOUT_BLANK; + } else { + length = URI_FILEROOT.length (); + if (url.startsWith (URI_FILEROOT) && url.charAt (length) == '#') { + url = ABOUT_BLANK + url.substring (length); + } + } + + /* + * Each invocation of setText() causes webkit_notify_load_status to be invoked + * twice, once for the initial navigate to about:blank, and once for the auto-navigate + * to about:blank that WebKit does when webkit_web_view_load_string is invoked. If + * this is the first webkit_notify_load_status callback received for a setText() + * invocation then do not send any events or re-install registered BrowserFunctions. + */ + if (top && url.startsWith(ABOUT_BLANK) && htmlBytes != null) return 0; + + LocationEvent event = new LocationEvent (browser); + event.display = browser.getDisplay (); + event.widget = browser; + event.location = url; + event.top = top; + for (int i = 0; i < locationListeners.length; i++) { + locationListeners[i].changed (event); + } + return 0; +} + +int /*long*/ handleLoadFinished (int /*long*/ uri, boolean top) { + int length = OS.strlen (uri); + byte[] bytes = new byte[length]; + OS.memmove (bytes, uri, length); + String url = new String (Converter.mbcsToWcs (null, bytes)); + /* + * If the URI indicates that the page is being rendered from memory + * (via setText()) then set it to about:blank to be consistent with IE. + */ + if (url.equals (URI_FILEROOT)) { + url = ABOUT_BLANK; + } else { + length = URI_FILEROOT.length (); + if (url.startsWith (URI_FILEROOT) && url.charAt (length) == '#') { + url = ABOUT_BLANK + url.substring (length); + } + } + + /* + * If htmlBytes is not null then there is html from a previous setText() call + * waiting to be set into the about:blank page once it has completed loading. + */ + if (top && htmlBytes != null) { + if (url.startsWith(ABOUT_BLANK)) { + loadingText = true; + byte[] mimeType = Converter.wcsToMbcs (null, "text/html", true); //$NON-NLS-1$ + byte[] encoding = Converter.wcsToMbcs (null, CHARSET_UTF8, true); //$NON-NLS-1$ + byte[] uriBytes; + if (untrustedText) { + uriBytes = Converter.wcsToMbcs (null, ABOUT_BLANK, true); + } else { + uriBytes = Converter.wcsToMbcs (null, URI_FILEROOT, true); + } + WebKitGTK.webkit_web_view_load_string (webView, htmlBytes, mimeType, encoding, uriBytes); + htmlBytes = null; + } + } + + /* + * The webkit_web_view_load_string() invocation above will trigger a second + * webkit_web_view_load_string callback when it is completed. Wait for this + * second callback to come before sending the title or completed events. + */ + if (!loadingText) { + /* + * To be consistent with other platforms a title event should be fired + * when a top-level page has completed loading. A page with a <title> + * tag will do this automatically when the notify::title signal is received. + * However a page without a <title> tag will not do this by default, so fire + * the event here with the page's url as the title. + */ + if (top) { + int /*long*/ frame = WebKitGTK.webkit_web_view_get_main_frame (webView); + int /*long*/ title = WebKitGTK.webkit_web_frame_get_title (frame); + if (title == 0) { + TitleEvent newEvent = new TitleEvent (browser); + newEvent.display = browser.getDisplay (); + newEvent.widget = browser; + newEvent.title = url; + for (int i = 0; i < titleListeners.length; i++) { + titleListeners[i].changed (newEvent); + } + if (browser.isDisposed ()) return 0; + } + } + + ProgressEvent progress = new ProgressEvent (browser); + progress.display = browser.getDisplay (); + progress.widget = browser; + progress.current = MAX_PROGRESS; + progress.total = MAX_PROGRESS; + for (int i = 0; i < progressListeners.length; i++) { + progressListeners[i].completed (progress); + } + } + loadingText = false; + + return 0; +} + +public boolean isBackEnabled () { + return WebKitGTK.webkit_web_view_can_go_back (webView) != 0; +} + +public boolean isForwardEnabled () { + return WebKitGTK.webkit_web_view_can_go_forward (webView) != 0; +} + +void onDispose (Event e) { + /* Browser could have been disposed by one of the Dispose listeners */ + if (!browser.isDisposed()) { + /* invoke onbeforeunload handlers */ + if (!browser.isClosing) { + close (false); + } + } + + Enumeration elements = functions.elements (); + while (elements.hasMoreElements ()) { + ((BrowserFunction)elements.nextElement ()).dispose (false); + } + functions = null; + + C.free (webViewData); + postData = null; + headers = null; + htmlBytes = null; +} + +void onResize (Event e) { + Rectangle rect = browser.getClientArea (); + OS.gtk_widget_set_size_request (scrolledWindow, rect.width, rect.height); +} + +void openDownloadWindow (final int /*long*/ webkitDownload) { + final Shell shell = new Shell (); + String msg = Compatibility.getMessage ("SWT_FileDownload"); //$NON-NLS-1$ + shell.setText (msg); + GridLayout gridLayout = new GridLayout (); + gridLayout.marginHeight = 15; + gridLayout.marginWidth = 15; + gridLayout.verticalSpacing = 20; + shell.setLayout (gridLayout); + + int /*long*/ name = WebKitGTK.webkit_download_get_suggested_filename (webkitDownload); + int length = OS.strlen (name); + byte[] bytes = new byte[length]; + OS.memmove (bytes, name, length); + String nameString = new String (Converter.mbcsToWcs (null, bytes)); + int /*long*/ url = WebKitGTK.webkit_download_get_uri (webkitDownload); + length = OS.strlen (url); + bytes = new byte[length]; + OS.memmove (bytes, url, length); + String urlString = new String (Converter.mbcsToWcs (null, bytes)); + msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {nameString, urlString}); //$NON-NLS-1$ + Label nameLabel = new Label (shell, SWT.WRAP); + nameLabel.setText (msg); + GridData data = new GridData (); + Monitor monitor = browser.getMonitor (); + int maxWidth = monitor.getBounds ().width / 2; + int width = nameLabel.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; + data.widthHint = Math.min (width, maxWidth); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + nameLabel.setLayoutData (data); + + final Label statusLabel = new Label (shell, SWT.NONE); + statusLabel.setText (Compatibility.getMessage ("SWT_Download_Started")); //$NON-NLS-1$ + data = new GridData (GridData.FILL_BOTH); + statusLabel.setLayoutData (data); + + final Button cancel = new Button (shell, SWT.PUSH); + cancel.setText (Compatibility.getMessage ("SWT_Cancel")); //$NON-NLS-1$ + data = new GridData (); + data.horizontalAlignment = GridData.CENTER; + cancel.setLayoutData (data); + final Listener cancelListener = new Listener () { + public void handleEvent (Event event) { + WebKitGTK.webkit_download_cancel (webkitDownload); + } + }; + cancel.addListener (SWT.Selection, cancelListener); + + OS.g_object_ref (webkitDownload); + final Display display = browser.getDisplay (); + final int INTERVAL = 500; + display.timerExec (INTERVAL, new Runnable () { + public void run () { + int status = WebKitGTK.webkit_download_get_status (webkitDownload); + if (shell.isDisposed () || status == WebKitGTK.WEBKIT_DOWNLOAD_STATUS_FINISHED || status == WebKitGTK.WEBKIT_DOWNLOAD_STATUS_CANCELLED) { + shell.dispose (); + display.timerExec (-1, this); + OS.g_object_unref (webkitDownload); + return; + } + if (status == WebKitGTK.WEBKIT_DOWNLOAD_STATUS_ERROR) { + statusLabel.setText (Compatibility.getMessage ("SWT_Download_Error")); //$NON-NLS-1$ + display.timerExec (-1, this); + OS.g_object_unref (webkitDownload); + cancel.removeListener (SWT.Selection, cancelListener); + cancel.addListener (SWT.Selection, new Listener () { + public void handleEvent (Event event) { + shell.dispose (); + } + }); + return; + } + + long current = WebKitGTK.webkit_download_get_current_size (webkitDownload) / 1024L; + long total = WebKitGTK.webkit_download_get_total_size (webkitDownload) / 1024L; + String message = Compatibility.getMessage ("SWT_Download_Status", new Object[] {new Long(current), new Long(total)}); //$NON-NLS-1$ + statusLabel.setText (message); + display.timerExec (INTERVAL, this); + } + }); + + shell.pack (); + shell.open (); +} + +public void refresh () { + WebKitGTK.webkit_web_view_reload (webView); +} + +public boolean setText (String html, boolean trusted) { + /* convert the String containing HTML to an array of bytes with UTF-8 data */ + byte[] bytes = null; + try { + bytes = (html + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, html, true); + } + + /* + * If this.htmlBytes is not null then the about:blank page is already being loaded, + * so no navigate is required. Just set the html that is to be shown. + */ + boolean blankLoading = htmlBytes != null; + htmlBytes = bytes; + untrustedText = !trusted; + if (blankLoading) return true; + + byte[] uriBytes = Converter.wcsToMbcs (null, ABOUT_BLANK, true); + WebKitGTK.webkit_web_view_load_uri (webView, uriBytes); + return true; +} + +public boolean setUrl (String url, String postData, String[] headers) { + this.postData = postData; + this.headers = headers; + /* + * WebKit attempts to open the exact url string that is given to it, and + * will not infer an http protocol if it's not specified. Detect the case + * of a non-local file and prepend the http:// protocol if it's needed. + */ + if (url.charAt (0) != SEPARATOR_FILE) { + /* not a local file */ + try { + new URL(url); + } catch (MalformedURLException e) { + url = PROTOCOL_HTTP + url; + } + } + + /* + * Feature of WebKit. The user-agent header value cannot be overridden + * by changing it in the resource request. The workaround is to detect + * here whether the user-agent is being overridden, and if so, temporarily + * set the value on the WebView when initiating the load request and then + * remove it afterwards. + */ + int /*long*/ settings = WebKitGTK.webkit_web_view_get_settings (webView); + if (headers != null) { + for (int i = 0; i < headers.length; i++) { + String current = headers[i]; + if (current != null) { + int index = current.indexOf (':'); + if (index != -1) { + String key = current.substring (0, index).trim (); + String value = current.substring (index + 1).trim (); + if (key.length () > 0 && value.length () > 0) { + if (key.equalsIgnoreCase (USER_AGENT)) { + byte[] bytes = Converter.wcsToMbcs (null, value, true); + OS.g_object_set (settings, WebKitGTK.user_agent, bytes, 0); + } + } + } + } + } + } + byte[] uriBytes = Converter.wcsToMbcs (null, url, true); + WebKitGTK.webkit_web_view_load_uri (webView, uriBytes); + OS.g_object_set (settings, WebKitGTK.user_agent, 0, 0); + return true; +} + +public void stop () { + WebKitGTK.webkit_web_view_stop_loading (webView); +} + +int /*long*/ webframe_notify_load_status (int /*long*/ web_frame, int /*long*/ pspec) { + int status = WebKitGTK.webkit_web_frame_get_load_status (web_frame); + switch (status) { + case WebKitGTK.WEBKIT_LOAD_COMMITTED: { + int /*long*/ uri = WebKitGTK.webkit_web_frame_get_uri (web_frame); + return handleLoadCommitted (uri, false); + } + case WebKitGTK.WEBKIT_LOAD_FINISHED: { + /* + * If this frame navigation was isolated to this frame (eg.- a link was + * clicked in the frame, as opposed to this frame being created in + * response to navigating to a main document containing frames) then + * treat this as a completed load. + */ + int /*long*/ parentFrame = WebKitGTK.webkit_web_frame_get_parent (web_frame); + if (WebKitGTK.webkit_web_frame_get_load_status (parentFrame) == WebKitGTK.WEBKIT_LOAD_FINISHED) { + int /*long*/ uri = WebKitGTK.webkit_web_frame_get_uri (web_frame); + return handleLoadFinished (uri, false); + } + } + } + return 0; +} + +int /*long*/ webkit_close_web_view (int /*long*/ web_view) { + WindowEvent newEvent = new WindowEvent (browser); + newEvent.display = browser.getDisplay (); + newEvent.widget = browser; + for (int i = 0; i < closeWindowListeners.length; i++) { + closeWindowListeners[i].close (newEvent); + } + browser.dispose (); + return 0; +} + +int /*long*/ webkit_console_message (int /*long*/ web_view, int /*long*/ message, int /*long*/ line, int /*long*/ source_id) { + return 1; /* stop the message from being written to stderr */ +} + +int /*long*/ webkit_create_web_view (int /*long*/ web_view, int /*long*/ frame) { + WindowEvent newEvent = new WindowEvent (browser); + newEvent.display = browser.getDisplay (); + newEvent.widget = browser; + newEvent.required = true; + if (openWindowListeners != null) { + for (int i = 0; i < openWindowListeners.length; i++) { + openWindowListeners[i].open (newEvent); + } + } + Browser browser = null; + if (newEvent.browser != null && newEvent.browser.webBrowser instanceof WebKit) { + browser = newEvent.browser; + } + if (browser != null && !browser.isDisposed ()) { + return ((WebKit)browser.webBrowser).webView; + } + return 0; +} + +int /*long*/ webkit_download_requested (int /*long*/ web_view, int /*long*/ download) { + int /*long*/ name = WebKitGTK.webkit_download_get_suggested_filename (download); + int length = OS.strlen (name); + byte[] bytes = new byte[length]; + OS.memmove (bytes, name, length); + String nameString = new String (Converter.mbcsToWcs (null, bytes)); + FileDialog dialog = new FileDialog (browser.getShell (), SWT.OPEN); + dialog.setFileName (nameString); + String title = Compatibility.getMessage ("SWT_FileDownload"); //$NON-NLS-1$ + dialog.setText (title); + String path = dialog.open (); + + if (path != null) { + path = URI_FILEROOT + path; + byte[] uriBytes = Converter.wcsToMbcs (null, path, true); + WebKitGTK.webkit_download_set_destination_uri (download, uriBytes); + openDownloadWindow (download); + } else { + WebKitGTK.webkit_download_cancel (download); + } + return 1; +} + +int /*long*/ webkit_hovering_over_link (int /*long*/ web_view, int /*long*/ title, int /*long*/ uri) { + if (uri != 0) { + int length = OS.strlen (uri); + byte[] bytes = new byte[length]; + OS.memmove (bytes, uri, length); + String text = new String (Converter.mbcsToWcs (null, bytes)); + StatusTextEvent event = new StatusTextEvent (browser); + event.display = browser.getDisplay (); + event.widget = browser; + event.text = text; + for (int i = 0; i < statusTextListeners.length; i++) { + statusTextListeners[i].changed (event); + } + } + return 0; +} + +int /*long*/ webkit_mime_type_policy_decision_requested (int /*long*/ web_view, int /*long*/ frame, int /*long*/ request, int /*long*/ mimetype, int /*long*/ policy_decision) { + boolean canShow = WebKitGTK.webkit_web_view_can_show_mime_type (webView, mimetype) != 0; + if (!canShow) { + WebKitGTK.webkit_web_policy_decision_download (policy_decision); + return 1; + } + return 0; +} + +int /*long*/ webkit_navigation_policy_decision_requested (int /*long*/ web_view, int /*long*/ frame, int /*long*/ request, int /*long*/ navigation_action, int /*long*/ policy_decision) { + if (loadingText) { + /* + * WebKit is auto-navigating to about:blank in response to a + * webkit_web_view_load_string() invocation. This navigate + * should always proceed without sending an event since it is + * preceded by an explicit navigate to about:blank in setText(). + */ + return 0; + } + + int /*long*/ uri = WebKitGTK.webkit_network_request_get_uri (request); + int length = OS.strlen (uri); + byte[] bytes = new byte[length]; + OS.memmove (bytes, uri, length); + + String url = new String (Converter.mbcsToWcs (null, bytes)); + /* + * If the URI indicates that the page is being rendered from memory + * (via setText()) then set it to about:blank to be consistent with IE. + */ + if (url.equals (URI_FILEROOT)) { + url = ABOUT_BLANK; + } else { + length = URI_FILEROOT.length (); + if (url.startsWith (URI_FILEROOT) && url.charAt (length) == '#') { + url = ABOUT_BLANK + url.substring (length); + } + } + + LocationEvent newEvent = new LocationEvent (browser); + newEvent.display = browser.getDisplay (); + newEvent.widget = browser; + newEvent.location = url; + newEvent.doit = true; + if (locationListeners != null) { + for (int i = 0; i < locationListeners.length; i++) { + locationListeners[i].changing (newEvent); + } + } + if (newEvent.doit && !browser.isDisposed ()) { + if (jsEnabledChanged) { + jsEnabledChanged = false; + int /*long*/ settings = WebKitGTK.webkit_web_view_get_settings (webView); + OS.g_object_set (settings, WebKitGTK.enable_scripts, jsEnabled ? 1 : 0, 0); + } + + /* hook status change signal if frame is a newly-created sub-frame */ + int /*long*/ mainFrame = WebKitGTK.webkit_web_view_get_main_frame (webView); + if (frame != mainFrame) { + int id = OS.g_signal_handler_find (frame, OS.G_SIGNAL_MATCH_FUNC | OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, Proc3.getAddress (), NOTIFY_LOAD_STATUS); + if (id == 0) { + OS.g_signal_connect (frame, WebKitGTK.notify_load_status, Proc3.getAddress (), NOTIFY_LOAD_STATUS); + } + } + + /* + * The following line is intentionally commented. For some reason, invoking + * webkit_web_policy_decision_use(policy_decision) causes the Flash plug-in + * to crash when navigating to a page with Flash. Since returning from this + * callback without invoking webkit_web_policy_decision_ignore(policy_decision) + * implies that the page should be loaded, it's fine to not invoke + * webkit_web_policy_decision_use(policy_decision) here. + */ + //WebKitGTK.webkit_web_policy_decision_use (policy_decision); + } else { + WebKitGTK.webkit_web_policy_decision_ignore (policy_decision); + } + return 0; +} + +int /*long*/ webkit_notify_load_status (int /*long*/ web_view, int /*long*/ pspec) { + int status = WebKitGTK.webkit_web_view_get_load_status (webView); + switch (status) { + case WebKitGTK.WEBKIT_LOAD_COMMITTED: { + int /*long*/ uri = WebKitGTK.webkit_web_view_get_uri (webView); + return handleLoadCommitted (uri, true); + } + case WebKitGTK.WEBKIT_LOAD_FINISHED: { + int /*long*/ uri = WebKitGTK.webkit_web_view_get_uri (webView); + return handleLoadFinished (uri, true); + } + } + return 0; +} + +int /*long*/ webkit_notify_progress (int /*long*/ web_view, int /*long*/ pspec) { + ProgressEvent event = new ProgressEvent (browser); + event.display = browser.getDisplay (); + event.widget = browser; + event.current = (int)(WebKitGTK.webkit_web_view_get_progress (webView) * MAX_PROGRESS); + event.total = MAX_PROGRESS; + for (int i = 0; i < progressListeners.length; i++) { + progressListeners[i].changed (event); + } + return 0; +} + +int /*long*/ webkit_notify_title (int /*long*/ web_view, int /*long*/ pspec) { + int /*long*/ title = WebKitGTK.webkit_web_view_get_title (webView); + String titleString; + if (title == 0) { + titleString = ""; //$NON-NLS-1$ + } else { + int length = OS.strlen (title); + byte[] bytes = new byte[length]; + OS.memmove (bytes, title, length); + titleString = new String (Converter.mbcsToWcs (null, bytes)); + } + TitleEvent event = new TitleEvent (browser); + event.display = browser.getDisplay (); + event.widget = browser; + event.title = titleString; + for (int i = 0; i < titleListeners.length; i++) { + titleListeners[i].changed (event); + } + return 0; +} + +int /*long*/ webkit_populate_popup (int /*long*/ web_view, int /*long*/ webkit_menu) { + Point pt = browser.getDisplay ().getCursorLocation (); + Event event = new Event (); + event.x = pt.x; + event.y = pt.y; + browser.notifyListeners (SWT.MenuDetect, event); + if (!event.doit) { + /* clear the menu */ + int /*long*/ children = OS.gtk_container_get_children (webkit_menu); + int /*long*/ current = children; + while (current != 0) { + int /*long*/ item = OS.g_list_data (current); + OS.gtk_container_remove (webkit_menu, item); + current = OS.g_list_next (current); + } + OS.g_list_free (children); + return 0; + } + Menu menu = browser.getMenu (); + if (menu != null && !menu.isDisposed ()) { + if (pt.x != event.x || pt.y != event.y) { + menu.setLocation (event.x, event.y); + } + menu.setVisible (true); + /* clear the menu */ + int /*long*/ children = OS.gtk_container_get_children (webkit_menu); + int /*long*/ current = children; + while (current != 0) { + int /*long*/ item = OS.g_list_data (current); + OS.gtk_container_remove (webkit_menu, item); + current = OS.g_list_next (current); + } + OS.g_list_free (children); + } + return 0; +} + +int /*long*/ webkit_resource_request_starting (int /*long*/ web_view, int /*long*/ web_frame, int /*long*/ web_resource, int /*long*/ request, int /*long*/ response) { + if (postData != null || headers != null) { + int /*long*/ message = WebKitGTK.webkit_network_request_get_message (request); + if (message == 0) { + headers = null; + postData = null; + } else { + if (postData != null) { + WebKitGTK.SoupMessage_method (message, PostString); + int /*long*/ body = WebKitGTK.SoupMessage_request_body (message); + byte[] bytes = Converter.wcsToMbcs (null, postData, false); + int /*long*/ data = C.malloc (bytes.length); + C.memmove (data, bytes, bytes.length); + WebKitGTK.soup_message_body_append (body, WebKitGTK.SOUP_MEMORY_TAKE, data, bytes.length); + WebKitGTK.soup_message_body_flatten (body); + + if (headers == null) headers = new String[0]; + String[] temp = new String[headers.length + 1]; + System.arraycopy (headers, 0, temp, 0, headers.length); + temp[headers.length] = ENCODING_FORM; + headers = temp; + postData = null; + } + + /* headers */ + int /*long*/ requestHeaders = WebKitGTK.SoupMessage_request_headers (message); + for (int i = 0; i < headers.length; i++) { + String current = headers[i]; + if (current != null) { + int index = current.indexOf (':'); + if (index != -1) { + String key = current.substring (0, index).trim (); + String value = current.substring (index + 1).trim (); + if (key.length () > 0 && value.length () > 0) { + byte[] nameBytes = Converter.wcsToMbcs (null, key, true); + byte[] valueBytes = Converter.wcsToMbcs (null, value, true); + WebKitGTK.soup_message_headers_append (requestHeaders, nameBytes, valueBytes); + } + } + } + } + headers = null; + } + } + + return 0; +} + +int /*long*/ webkit_status_bar_text_changed (int /*long*/ web_view, int /*long*/ text) { + int length = OS.strlen (text); + byte[] bytes = new byte[length]; + OS.memmove (bytes, text, length); + StatusTextEvent statusText = new StatusTextEvent (browser); + statusText.display = browser.getDisplay (); + statusText.widget = browser; + statusText.text = new String (Converter.mbcsToWcs (null, bytes)); + for (int i = 0; i < statusTextListeners.length; i++) { + statusTextListeners[i].changed (statusText); + } + return 0; +} + +int /*long*/ webkit_web_view_ready (int /*long*/ web_view) { + WindowEvent newEvent = new WindowEvent (browser); + newEvent.display = browser.getDisplay (); + newEvent.widget = browser; + + int /*long*/ settings = WebKitGTK.webkit_web_view_get_window_features (webView); + int[] result = new int[1]; + OS.g_object_get (settings, WebKitGTK.locationbar_visible, result, 0); + newEvent.addressBar = result[0] != 0; + result[0] = 0; + OS.g_object_get (settings, WebKitGTK.menubar_visible, result, 0); + newEvent.menuBar = result[0] != 0; + result[0] = 0; + OS.g_object_get (settings, WebKitGTK.statusbar_visible, result, 0); + newEvent.statusBar = result[0] != 0; + result[0] = 0; + OS.g_object_get (settings, WebKitGTK.toolbar_visible, result, 0); + newEvent.toolBar = result[0] != 0; + result[0] = 0; + OS.g_object_get (settings, WebKitGTK.x, result, 0); + int x = result[0]; + result[0] = 0; + OS.g_object_get (settings, WebKitGTK.y, result, 0); + int y = result[0]; + result[0] = 0; + OS.g_object_get (settings, WebKitGTK.width, result, 0); + int width = result[0]; + result[0] = 0; + OS.g_object_get (settings, WebKitGTK.height, result, 0); + int height = result[0]; + result[0] = 0; + if (x != -1 && y != -1) { + newEvent.location = new Point (x,y); + } + if (width != -1 && height != -1) { + newEvent.size = new Point (width,height); + } + for (int i = 0; i < visibilityWindowListeners.length; i++) { + visibilityWindowListeners[i].show (newEvent); + } + return 0; +} + +int /*long*/ webkit_window_object_cleared (int /*long*/ web_view, int /*long*/ frame, int /*long*/ context, int /*long*/ window_object) { + int /*long*/ globalObject = WebKitGTK.JSContextGetGlobalObject (context); + int /*long*/ externalObject = WebKitGTK.JSObjectMake (context, ExternalClass, webViewData); + byte[] bytes = null; + try { + bytes = (OBJECTNAME_EXTERNAL + '\0').getBytes (CHARSET_UTF8); + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, OBJECTNAME_EXTERNAL, true); + } + int /*long*/ name = WebKitGTK.JSStringCreateWithUTF8CString (bytes); + WebKitGTK.JSObjectSetProperty (context, globalObject, name, externalObject, 0, null); + WebKitGTK.JSStringRelease (name); + Enumeration elements = functions.elements (); + while (elements.hasMoreElements ()) { + BrowserFunction current = (BrowserFunction)elements.nextElement (); + execute (current.functionString); + } + int /*long*/ mainFrame = WebKitGTK.webkit_web_view_get_main_frame (webView); + boolean top = mainFrame == frame; + addEventHandlers (top); + return 0; +} + +int /*long*/ callJava (int /*long*/ ctx, int /*long*/ func, int /*long*/ thisObject, int /*long*/ argumentCount, int /*long*/ arguments, int /*long*/ exception) { + Object returnValue = null; + if (argumentCount == 2) { + int /*long*/[] result = new int /*long*/[1]; + C.memmove (result, arguments, C.PTR_SIZEOF); + int type = WebKitGTK.JSValueGetType (ctx, result[0]); + if (type == WebKitGTK.kJSTypeNumber) { + int index = ((Double)convertToJava (ctx, result[0])).intValue (); + result[0] = 0; + if (index > 0) { + Object key = new Integer (index); + BrowserFunction function = (BrowserFunction)functions.get (key); + if (function != null) { + try { + C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF); + Object temp = convertToJava (ctx, result[0]); + if (temp instanceof Object[]) { + Object[] args = (Object[])temp; + try { + returnValue = function.function (args); + } catch (Exception e) { + /* exception during function invocation */ + returnValue = WebBrowser.CreateErrorString (e.getLocalizedMessage ()); + } + } + } catch (IllegalArgumentException e) { + /* invalid argument value type */ + if (function.isEvaluate) { + /* notify the function so that a java exception can be thrown */ + function.function (new String[] {WebBrowser.CreateErrorString (new SWTException (SWT.ERROR_INVALID_RETURN_VALUE).getLocalizedMessage ())}); + } + returnValue = WebBrowser.CreateErrorString (e.getLocalizedMessage ()); + } + } + } + } + } + return convertToJS (ctx, returnValue); +} + +int /*long*/ convertToJS (int /*long*/ ctx, Object value) { + if (value == null) { + return WebKitGTK.JSValueMakeUndefined (ctx); + } + if (value instanceof String) { + byte[] bytes = null; + try { + bytes = ((String)value + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, (String)value, true); + } + int /*long*/ stringRef = WebKitGTK.JSStringCreateWithUTF8CString (bytes); + int /*long*/ result = WebKitGTK.JSValueMakeString (ctx, stringRef); + WebKitGTK.JSStringRelease (stringRef); + return result; + } + if (value instanceof Boolean) { + return WebKitGTK.JSValueMakeBoolean (ctx, ((Boolean)value).booleanValue () ? 1 : 0); + } + if (value instanceof Number) { + return WebKitGTK.JSValueMakeNumber (ctx, ((Number)value).doubleValue ()); + } + if (value instanceof Object[]) { + Object[] arrayValue = (Object[]) value; + int length = arrayValue.length; + int /*long*/[] arguments = new int /*long*/[length]; + for (int i = 0; i < length; i++) { + Object javaObject = arrayValue[i]; + int /*long*/ jsObject = convertToJS (ctx, javaObject); + arguments[i] = jsObject; + } + return WebKitGTK.JSObjectMakeArray (ctx, length, arguments, null); + } + SWT.error (SWT.ERROR_INVALID_RETURN_VALUE); + return 0; +} + +Object convertToJava (int /*long*/ ctx, int /*long*/ value) { + int type = WebKitGTK.JSValueGetType (ctx, value); + switch (type) { + case WebKitGTK.kJSTypeBoolean: { + int result = WebKitGTK.JSValueToBoolean (ctx, value); + return new Boolean (result != 0); + } + case WebKitGTK.kJSTypeNumber: { + double result = WebKitGTK.JSValueToNumber (ctx, value, null); + return new Double(result); + } + case WebKitGTK.kJSTypeString: { + int /*long*/ string = WebKitGTK.JSValueToStringCopy (ctx, value, null); + if (string == 0) return ""; //$NON-NLS-1$ + int length = (int)/*64*/WebKitGTK.JSStringGetMaximumUTF8CStringSize (string); + byte[] bytes = new byte[length]; + length = WebKitGTK.JSStringGetUTF8CString (string, bytes, length); + WebKitGTK.JSStringRelease (string); + try { + /* length-1 is needed below to exclude the terminator character */ + return new String (bytes, 0, length - 1, CHARSET_UTF8); + } catch (UnsupportedEncodingException e) { + return new String (Converter.mbcsToWcs (null, bytes)); + } + } + case WebKitGTK.kJSTypeNull: + // FALL THROUGH + case WebKitGTK.kJSTypeUndefined: return null; + case WebKitGTK.kJSTypeObject: { + byte[] bytes = null; + try { + bytes = (PROPERTY_LENGTH + '\0').getBytes (CHARSET_UTF8); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + bytes = Converter.wcsToMbcs (null, PROPERTY_LENGTH, true); + } + int /*long*/ propertyName = WebKitGTK.JSStringCreateWithUTF8CString (bytes); + int /*long*/ valuePtr = WebKitGTK.JSObjectGetProperty (ctx, value, propertyName, null); + WebKitGTK.JSStringRelease (propertyName); + type = WebKitGTK.JSValueGetType (ctx, valuePtr); + if (type == WebKitGTK.kJSTypeNumber) { + int length = (int)WebKitGTK.JSValueToNumber (ctx, valuePtr, null); + Object[] result = new Object[length]; + for (int i = 0; i < length; i++) { + int /*long*/ current = WebKitGTK.JSObjectGetPropertyAtIndex (ctx, value, i, null); + if (current != 0) { + result[i] = convertToJava (ctx, current); + } + } + return result; + } + } + } + SWT.error (SWT.ERROR_INVALID_ARGUMENT); + return null; +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/JSClassDefinition.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/JSClassDefinition.java new file mode 100644 index 0000000000..c4d0727fa0 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/JSClassDefinition.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.webkit; + + +public class JSClassDefinition { + public int version; + /** @field cast=(JSClassAttributes) */ + public int attributes; + /** @field cast=(const char*) */ + public int /*long*/ className; + /** @field cast=(JSClassRef) */ + public int /*long*/ parentClass; + /** @field cast=(const JSStaticValue*) */ + public int /*long*/ staticValues; + /** @field cast=(const JSStaticFunction*) */ + public int /*long*/ staticFunctions; + /** @field cast=(JSObjectInitializeCallback) */ + public int /*long*/ initialize; + /** @field cast=(JSObjectFinalizeCallback) */ + public int /*long*/ finalize; + /** @field cast=(JSObjectHasPropertyCallback) */ + public int /*long*/ hasProperty; + /** @field cast=(JSObjectGetPropertyCallback) */ + public int /*long*/ getProperty; + /** @field cast=(JSObjectSetPropertyCallback) */ + public int /*long*/ setProperty; + /** @field cast=(JSObjectDeletePropertyCallback) */ + public int /*long*/ deleteProperty; + /** @field cast=(JSObjectGetPropertyNamesCallback) */ + public int /*long*/ getPropertyNames; + /** @field cast=(JSObjectCallAsFunctionCallback) */ + public int /*long*/ callAsFunction; + /** @field cast=(JSObjectCallAsConstructorCallback) */ + public int /*long*/ callAsConstructor; + /** @field cast=(JSObjectHasInstanceCallback) */ + public int /*long*/ hasInstance; + /** @field cast=(JSObjectConvertToTypeCallback) */ + public int /*long*/ convertToType; + + public static final int sizeof = WebKitGTK.JSClassDefinition_sizeof(); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java new file mode 100644 index 0000000000..28837d0496 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java @@ -0,0 +1,1368 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.webkit; + + +import org.eclipse.swt.internal.C; + +public class WebKitGTK extends C { + + /** Constants */ + public static final int kJSTypeUndefined = 0; + public static final int kJSTypeNull = 1; + public static final int kJSTypeBoolean = 2; + public static final int kJSTypeNumber = 3; + public static final int kJSTypeString = 4; + public static final int kJSTypeObject = 5; + public static final int SOUP_MEMORY_TAKE = 1; + public static final int WEBKIT_DOWNLOAD_STATUS_ERROR = -1; + public static final int WEBKIT_DOWNLOAD_STATUS_CANCELLED = 2; + public static final int WEBKIT_DOWNLOAD_STATUS_FINISHED = 3; + public static final int WEBKIT_LOAD_COMMITTED = 1; + public static final int WEBKIT_LOAD_FINISHED = 2; + + /** Signals */ + public static final byte[] authenticate = ascii ("authenticate"); // $NON-NLS-1$ + public static final byte[] close_web_view = ascii ("close-web-view"); // $NON-NLS-1$ + public static final byte[] console_message = ascii ("console-message"); // $NON-NLS-1$ + public static final byte[] create_web_view = ascii ("create-web-view"); // $NON-NLS-1$ + public static final byte[] download_requested = ascii ("download-requested"); // $NON-NLS-1$ + public static final byte[] hovering_over_link = ascii ("hovering-over-link"); // $NON-NLS-1$ + public static final byte[] mime_type_policy_decision_requested = ascii ("mime-type-policy-decision-requested"); // $NON-NLS-1$ + public static final byte[] navigation_policy_decision_requested = ascii ("navigation-policy-decision-requested"); // $NON-NLS-1$ + public static final byte[] notify_load_status = ascii ("notify::load-status"); // $NON-NLS-1$ + public static final byte[] notify_progress = ascii ("notify::progress"); // $NON-NLS-1$ + public static final byte[] notify_title = ascii ("notify::title"); // $NON-NLS-1$ + public static final byte[] populate_popup = ascii ("populate-popup"); // $NON-NLS-1$ + public static final byte[] resource_request_starting = ascii ("resource_request_starting"); // $NON-NLS-1$ + public static final byte[] status_bar_text_changed = ascii ("status-bar-text-changed"); // $NON-NLS-1$ + public static final byte[] web_view_ready = ascii ("web-view-ready"); // $NON-NLS-1$ + public static final byte[] window_object_cleared = ascii ("window-object-cleared"); // $NON-NLS-1$ + + /** Properties */ + public static final byte[] enable_scripts = ascii ("enable-scripts"); // $NON-NLS-1$ + public static final byte[] enable_universal_access_from_file_uris = ascii ("enable-universal-access-from-file-uris"); // $NON-NLS-1$ + public static final byte[] height = ascii ("height"); // $NON-NLS-1$ + public static final byte[] javascript_can_open_windows_automatically = ascii ("javascript-can-open-windows-automatically"); // $NON-NLS-1$ + public static final byte[] locationbar_visible = ascii ("locationbar-visible"); // $NON-NLS-1$ + public static final byte[] menubar_visible = ascii ("menubar-visible"); // $NON-NLS-1$ + public static final byte[] SOUP_SESSION_PROXY_URI = ascii ("proxy-uri"); // $NON-NLS-1$ + public static final byte[] statusbar_visible = ascii ("statusbar-visible"); // $NON-NLS-1$ + public static final byte[] toolbar_visible = ascii ("toolbar-visible"); // $NON-NLS-1$ + public static final byte[] user_agent = ascii ("user-agent"); // $NON-NLS-1$ + public static final byte[] width = ascii ("width"); // $NON-NLS-1$ + public static final byte[] x = ascii ("x"); // $NON-NLS-1$ + public static final byte[] y = ascii ("y"); // $NON-NLS-1$ + +protected static byte [] ascii (String name) { + int length = name.length (); + char [] chars = new char [length]; + name.getChars (0, length, chars, 0); + byte [] buffer = new byte [length + 1]; + for (int i=0; i<length; i++) { + buffer [i] = (byte) chars [i]; + } + return buffer; +} + + +/** + * @param definition cast=(const JSClassDefinition*) + */ +public static final native int /*long*/ _JSClassCreate (int /*long*/ definition); +public static final int /*long*/ JSClassCreate (int /*long*/ definition) { + lock.lock(); + try { + return _JSClassCreate (definition); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + */ +public static final native int /*long*/ _JSContextGetGlobalObject (int /*long*/ ctx); +public static final int /*long*/ JSContextGetGlobalObject (int /*long*/ ctx) { + lock.lock(); + try { + return _JSContextGetGlobalObject (ctx); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param script cast=(JSStringRef) + * @param thisObject cast=(JSObjectRef) + * @param sourceURL cast=(JSStringRef) + * @param exception cast=(JSValueRef *) + */ +public static final native int /*long*/ _JSEvaluateScript (int /*long*/ ctx, int /*long*/ script, int /*long*/ thisObject, int /*long*/ sourceURL, int startingLineNumber, int /*long*/[] exception); +public static final int /*long*/ JSEvaluateScript (int /*long*/ ctx, int /*long*/ script, int /*long*/ thisObject, int /*long*/ sourceURL, int startingLineNumber, int /*long*/[] exception) { + lock.lock(); + try { + return _JSEvaluateScript (ctx, script, thisObject, sourceURL, startingLineNumber, exception); + } finally { + lock.unlock(); + } +} + +/** + * @param object cast=(JSObjectRef) + */ +public static final native int /*long*/ _JSObjectGetPrivate (int /*long*/ object); +public static final int /*long*/ JSObjectGetPrivate (int /*long*/ object) { + lock.lock(); + try { + return _JSObjectGetPrivate (object); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param object cast=(JSObjectRef) + * @param propertyName cast=(JSStringRef) + * @param exception cast=(JSValueRef*) + */ +public static final native int _JSObjectGetProperty (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/[] exception); +public static final int JSObjectGetProperty (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/[] exception) { + lock.lock(); + try { + return _JSObjectGetProperty (ctx, object, propertyName, exception); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param object cast=(JSObjectRef) + * @param propertyIndex cast=(unsigned) + * @param exception cast=(JSValueRef*) + */ +public static final native int _JSObjectGetPropertyAtIndex (int /*long*/ ctx, int /*long*/ object, int propertyIndex, int /*long*/[] exception); +public static final int JSObjectGetPropertyAtIndex (int /*long*/ ctx, int /*long*/ object, int propertyIndex, int /*long*/[] exception) { + lock.lock(); + try { + return _JSObjectGetPropertyAtIndex (ctx, object, propertyIndex, exception); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param jsClass cast=(JSClassRef) + * @param data cast=(void *) + */ +public static final native int /*long*/ _JSObjectMake (int /*long*/ ctx, int /*long*/ jsClass, int /*long*/ data); +public static final int /*long*/ JSObjectMake (int /*long*/ ctx, int /*long*/ jsClass, int /*long*/ data) { + lock.lock(); + try { + return _JSObjectMake (ctx, jsClass, data); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param argumentCount cast=(size_t) + * @param arguments cast=(const struct OpaqueJSValue * const*) + * @param exception cast=(JSValueRef*) + */ +public static final native int /*long*/ _JSObjectMakeArray (int /*long*/ ctx, int /*long*/ argumentCount, int /*long*/[] arguments, int /*long*/[] exception); +public static final int /*long*/ JSObjectMakeArray (int /*long*/ ctx, int /*long*/ argumentCount, int /*long*/[] arguments, int /*long*/[] exception) { + lock.lock(); + try { + return _JSObjectMakeArray (ctx, argumentCount, arguments, exception); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param name cast=(JSStringRef) + * @param callAsFunction cast=(JSObjectCallAsFunctionCallback) + */ +public static final native int /*long*/ _JSObjectMakeFunctionWithCallback (int /*long*/ ctx, int /*long*/ name, int /*long*/ callAsFunction); +public static final int /*long*/ JSObjectMakeFunctionWithCallback (int /*long*/ ctx, int /*long*/ name, int /*long*/ callAsFunction) { + lock.lock(); + try { + return _JSObjectMakeFunctionWithCallback (ctx, name, callAsFunction); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param object cast=(JSObjectRef) + * @param propertyName cast=(JSStringRef) + * @param value cast=(JSValueRef) + * @param attributes cast=(JSPropertyAttributes) + * @param exception cast=(JSValueRef *) + */ +public static final native void _JSObjectSetProperty (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/ value, int attributes, int /*long*/[] exception); +public static final void JSObjectSetProperty (int /*long*/ ctx, int /*long*/ object, int /*long*/ propertyName, int /*long*/ value, int attributes, int /*long*/[] exception) { + lock.lock(); + try { + _JSObjectSetProperty (ctx, object, propertyName, value, attributes, exception); + } finally { + lock.unlock(); + } +} + +/** + * @param string cast=(const char *) + */ +public static final native int /*long*/ _JSStringCreateWithUTF8CString (byte[] string); +public static final int /*long*/ JSStringCreateWithUTF8CString (byte[] string) { + lock.lock(); + try { + return _JSStringCreateWithUTF8CString (string); + } finally { + lock.unlock(); + } +} + +/** + * @param string cast=(JSStringRef) + */ +public static final native int /*long*/ _JSStringGetLength (int /*long*/ string); +public static final int /*long*/ JSStringGetLength (int /*long*/ string) { + lock.lock(); + try { + return _JSStringGetLength (string); + } finally { + lock.unlock(); + } +} + +/** + * @param string cast=(JSStringRef) + */ +public static final native int /*long*/ _JSStringGetMaximumUTF8CStringSize (int /*long*/ string); +public static final int /*long*/ JSStringGetMaximumUTF8CStringSize (int /*long*/ string) { + lock.lock(); + try { + return _JSStringGetMaximumUTF8CStringSize (string); + } finally { + lock.unlock(); + } +} + +/** + * @param string cast=(JSStringRef) + * @param buffer cast=(char *) + * @param bufferSize cast=(size_t) + */ +public static final native int /*long*/ _JSStringGetUTF8CString (int /*long*/ string, byte[] buffer, int /*long*/ bufferSize); +public static final int /*long*/ JSStringGetUTF8CString (int /*long*/ string, byte[] buffer, int /*long*/ bufferSize) { + lock.lock(); + try { + return _JSStringGetUTF8CString (string, buffer, bufferSize); + } finally { + lock.unlock(); + } +} + +/** + * @param a cast=(JSStringRef) + * @param b cast=(const char *) + */ +public static final native int _JSStringIsEqualToUTF8CString (int /*long*/ a, byte[] b); +public static final int JSStringIsEqualToUTF8CString (int /*long*/ a, byte[] b) { + lock.lock(); + try { + return _JSStringIsEqualToUTF8CString (a, b); + } finally { + lock.unlock(); + } +} + +/** + * @param string cast=(JSStringRef) + */ +public static final native void _JSStringRelease (int /*long*/ string); +public static final void JSStringRelease (int /*long*/ string) { + lock.lock(); + try { + _JSStringRelease (string); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param value cast=(JSValueRef) + */ +public static final native int _JSValueGetType (int /*long*/ ctx, int /*long*/ value); +public static final int JSValueGetType (int /*long*/ ctx, int /*long*/ value) { + lock.lock(); + try { + return _JSValueGetType (ctx, value); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param value cast=(JSValueRef) + * @param jsClass cast=(JSClassRef) + */ +public static final native int _JSValueIsObjectOfClass (int /*long*/ ctx, int /*long*/ value, int /*long*/ jsClass); +public static final int JSValueIsObjectOfClass (int /*long*/ ctx, int /*long*/ value, int /*long*/ jsClass) { + lock.lock(); + try { + return _JSValueIsObjectOfClass (ctx, value, jsClass); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param bool cast=(bool) + */ +public static final native int /*long*/ _JSValueMakeBoolean (int /*long*/ ctx, int bool); +public static final int /*long*/ JSValueMakeBoolean (int /*long*/ ctx, int bool) { + lock.lock(); + try { + return _JSValueMakeBoolean (ctx, bool); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param number cast=(double) + */ +public static final native int /*long*/ _JSValueMakeNumber (int /*long*/ ctx, double number); +public static final int /*long*/ JSValueMakeNumber (int /*long*/ ctx, double number) { + lock.lock(); + try { + return _JSValueMakeNumber (ctx, number); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param string cast=(JSStringRef) + */ +public static final native int /*long*/ _JSValueMakeString (int /*long*/ ctx, int /*long*/ string); +public static final int /*long*/ JSValueMakeString (int /*long*/ ctx, int /*long*/ string) { + lock.lock(); + try { + return _JSValueMakeString (ctx, string); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + */ +public static final native int /*long*/ _JSValueMakeUndefined (int /*long*/ ctx); +public static final int /*long*/ JSValueMakeUndefined (int /*long*/ ctx) { + lock.lock(); + try { + return _JSValueMakeUndefined (ctx); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param value cast=(JSValueRef) + */ +public static final native int _JSValueToBoolean (int /*long*/ ctx, int /*long*/ value); +public static final int JSValueToBoolean (int /*long*/ ctx, int /*long*/ value) { + lock.lock(); + try { + return _JSValueToBoolean (ctx, value); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param value cast=(JSValueRef) + * @param exception cast=(JSValueRef*) + */ +public static final native double _JSValueToNumber (int /*long*/ ctx, int /*long*/ value, int /*long*/[] exception); +public static final double JSValueToNumber (int /*long*/ ctx, int /*long*/ value, int /*long*/[] exception) { + lock.lock(); + try { + return _JSValueToNumber (ctx, value, exception); + } finally { + lock.unlock(); + } +} + +/** + * @param ctx cast=(JSContextRef) + * @param value cast=(JSValueRef) + * @param exception cast=(JSValueRef*) + */ +public static final native int /*long*/ _JSValueToStringCopy (int /*long*/ ctx, int /*long*/ value, int /*long*/[] exception); +public static final int /*long*/ JSValueToStringCopy (int /*long*/ ctx, int /*long*/ value, int /*long*/[] exception) { + lock.lock(); + try { + return _JSValueToStringCopy (ctx, value, exception); + } finally { + lock.unlock(); + } +} + +/* --------------------- start libsoup natives --------------------- */ + +/** + * @param auth cast=(SoupAuth *) + * @param username cast=(const char *) + * @param password cast=(const char *) + */ +public static final native void _soup_auth_authenticate (int /*long*/ auth, byte[] username, byte[] password); +public static final void soup_auth_authenticate (int /*long*/ auth, byte[] username, byte[] password) { + lock.lock(); + try { + _soup_auth_authenticate (auth, username, password); + } finally { + lock.unlock(); + } +} + +/** + * @param auth cast=(SoupAuth *) + */ +public static final native int /*long*/ _soup_auth_get_host (int /*long*/ auth); +public static final int /*long*/ soup_auth_get_host (int /*long*/ auth) { + lock.lock(); + try { + return _soup_auth_get_host (auth); + } finally { + lock.unlock(); + } +} + +/** + * @param auth cast=(SoupAuth *) + */ +public static final native int /*long*/ _soup_auth_get_scheme_name (int /*long*/ auth); +public static final int /*long*/ soup_auth_get_scheme_name (int /*long*/ auth) { + lock.lock(); + try { + return _soup_auth_get_scheme_name (auth); + } finally { + lock.unlock(); + } +} + +/** + * @param jar cast=(SoupCookieJar *) + * @param cookie cast=(SoupCookie *) + */ +public static final native void _soup_cookie_jar_add_cookie (int /*long*/ jar, int /*long*/ cookie); +public static final void soup_cookie_jar_add_cookie (int /*long*/ jar, int /*long*/ cookie) { + lock.lock(); + try { + _soup_cookie_jar_add_cookie (jar, cookie); + } finally { + lock.unlock(); + } +} + +/** + * @param jar cast=(SoupCookieJar *) + */ +public static final native int /*long*/ _soup_cookie_jar_all_cookies (int /*long*/ jar); +public static final int /*long*/ soup_cookie_jar_all_cookies (int /*long*/ jar) { + lock.lock(); + try { + return _soup_cookie_jar_all_cookies (jar); + } finally { + lock.unlock(); + } +} + +/** + * @param jar cast=(SoupCookieJar *) + * @param cookie cast=(SoupCookie *) + */ +public static final native void _soup_cookie_jar_delete_cookie (int /*long*/ jar, int /*long*/ cookie); +public static final void soup_cookie_jar_delete_cookie (int /*long*/ jar, int /*long*/ cookie) { + lock.lock(); + try { + _soup_cookie_jar_delete_cookie (jar, cookie); + } finally { + lock.unlock(); + } +} + +/** + * @param jar cast=(SoupCookieJar *) + * @param uri cast=(SoupURI *) + */ +public static final native int /*long*/ _soup_cookie_jar_get_cookies (int /*long*/ jar, int /*long*/ uri, int for_http); +public static final int /*long*/ soup_cookie_jar_get_cookies (int /*long*/ jar, int /*long*/ uri, int for_http) { + lock.lock(); + try { + return _soup_cookie_jar_get_cookies (jar, uri, for_http); + } finally { + lock.unlock(); + } +} + +public static final native int _soup_cookie_jar_get_type (); +public static final int soup_cookie_jar_get_type () { + lock.lock(); + try { + return _soup_cookie_jar_get_type (); + } finally { + lock.unlock(); + } +} + +/** + * @param header cast=(const char *) + * @param origin cast=(SoupURI *) + */ +public static final native int /*long*/ _soup_cookie_parse (byte[] header, int /*long*/ origin); +public static final int /*long*/ soup_cookie_parse (byte[] header, int /*long*/ origin) { + lock.lock(); + try { + return _soup_cookie_parse (header, origin); + } finally { + lock.unlock(); + } +} + +/** + * @method flags=getter + * @param cookie cast=(SoupCookie *) + */ +public static final native int /*long*/ _SoupCookie_expires (int /*long*/ cookie); +public static final int /*long*/ SoupCookie_expires (int /*long*/ cookie) { + lock.lock(); + try { + return _SoupCookie_expires (cookie); + } finally { + lock.unlock(); + } +} + +public static final native boolean _SOUP_IS_SESSION (int /*long*/ object); +public static final boolean SOUP_IS_SESSION (int /*long*/ object) { + lock.lock(); + try { + return _SOUP_IS_SESSION (object); + } finally { + lock.unlock(); + } +} + +/** + * @method flags=setter + * @param message cast=(SoupMessage *) + * @param method cast=(const char *) + */ +public static final native void _SoupMessage_method (int /*long*/ message, int /*long*/ method); +public static final void SoupMessage_method (int /*long*/ message, int /*long*/ method) { + lock.lock(); + try { + _SoupMessage_method (message, method); + } finally { + lock.unlock(); + } +} + +/** + * @method flags=getter + * @param message cast=(SoupMessage *) + */ +public static final native int /*long*/ _SoupMessage_request_body (int /*long*/ message); +public static final int /*long*/ SoupMessage_request_body (int /*long*/ message) { + lock.lock(); + try { + return _SoupMessage_request_body (message); + } finally { + lock.unlock(); + } +} + +/** + * @method flags=getter + * @param message cast=(SoupMessage *) + */ +public static final native int /*long*/ _SoupMessage_request_headers (int /*long*/ message); +public static final int /*long*/ SoupMessage_request_headers (int /*long*/ message) { + lock.lock(); + try { + return _SoupMessage_request_headers (message); + } finally { + lock.unlock(); + } +} + +/** + * @param body cast=(SoupMessageBody *) + * @param use cast=(SoupMemoryUse) + * @param data cast=(gconstpointer) + * @param length cast=(gsize) + */ +public static final native void _soup_message_body_append (int /*long*/ body, int use, int /*long*/ data, int /*long*/ length); +public static final void soup_message_body_append (int /*long*/ body, int use, int /*long*/ data, int /*long*/ length) { + lock.lock(); + try { + _soup_message_body_append (body, use, data, length); + } finally { + lock.unlock(); + } +} + +/** + * @param body cast=(SoupMessageBody *) + */ +public static final native void _soup_message_body_flatten (int /*long*/ body); +public static final void soup_message_body_flatten (int /*long*/ body) { + lock.lock(); + try { + _soup_message_body_flatten (body); + } finally { + lock.unlock(); + } +} + +/** + * @param msg cast=(SoupMessage *) + */ +public static final native int /*long*/ _soup_message_get_uri (int /*long*/ msg); +public static final int /*long*/ soup_message_get_uri (int /*long*/ msg) { + lock.lock(); + try { + return _soup_message_get_uri (msg); + } finally { + lock.unlock(); + } +} + +/** + * @param headers cast=(SoupMessageHeaders *) + * @param name cast=(const char *) + * @param value cast=(const char *) + */ +public static final native void _soup_message_headers_append (int /*long*/ headers, byte[] name, byte[] value); +public static final void soup_message_headers_append (int /*long*/ headers, byte[] name, byte[] value) { + lock.lock(); + try { + _soup_message_headers_append (headers, name, value); + } finally { + lock.unlock(); + } +} + +/** + * @param session cast=(SoupSession *) + * @param type cast=(GType) + */ +public static final native void _soup_session_add_feature_by_type (int /*long*/ session, int type); +public static final void soup_session_add_feature_by_type (int /*long*/ session, int type) { + lock.lock(); + try { + _soup_session_add_feature_by_type (session, type); + } finally { + lock.unlock(); + } +} + +/** + * @param session cast=(SoupSession *) + * @param feature_type cast=(GType) + */ +public static final native int /*long*/ _soup_session_get_feature (int /*long*/ session, int feature_type); +public static final int /*long*/ soup_session_get_feature (int /*long*/ session, int feature_type) { + lock.lock(); + try { + return _soup_session_get_feature (session, feature_type); + } finally { + lock.unlock(); + } +} + +/** + * @param feature cast=(SoupSessionFeature *) + * @param session cast=(SoupSession *) + */ +public static final native void _soup_session_feature_attach (int /*long*/ feature, int /*long*/ session); +public static final void soup_session_feature_attach (int /*long*/ feature, int /*long*/ session) { + lock.lock(); + try { + _soup_session_feature_attach (feature, session); + } finally { + lock.unlock(); + } +} + +/** + * @param feature cast=(SoupSessionFeature *) + * @param session cast=(SoupSession *) + */ +public static final native void _soup_session_feature_detach (int /*long*/ feature, int /*long*/ session); +public static final void soup_session_feature_detach (int /*long*/ feature, int /*long*/ session) { + lock.lock(); + try { + _soup_session_feature_detach (feature, session); + } finally { + lock.unlock(); + } +} + +/** + * @param uri cast=(SoupURI *) + */ +public static final native void _soup_uri_free (int /*long*/ uri); +public static final void soup_uri_free (int /*long*/ uri) { + lock.lock(); + try { + _soup_uri_free (uri); + } finally { + lock.unlock(); + } +} + +/** + * @param uri_string cast=(const char *) + */ +public static final native int /*long*/ _soup_uri_new (byte[] uri_string); +public static final int /*long*/ soup_uri_new (byte[] uri_string) { + lock.lock(); + try { + return _soup_uri_new (uri_string); + } finally { + lock.unlock(); + } +} + +/** + * @param uri cast=(SoupURI *) + */ +public static final native int /*long*/ _soup_uri_to_string (int /*long*/ uri, int just_path_and_query); +public static final int /*long*/ soup_uri_to_string (int /*long*/ uri, int just_path_and_query) { + lock.lock(); + try { + return _soup_uri_to_string (uri, just_path_and_query); + } finally { + lock.unlock(); + } +} + +/* --------------------- start WebKitGTK natives --------------------- */ + +/** + * @param download cast=(WebKitDownload *) + */ +public static final native void _webkit_download_cancel (int /*long*/ download); +public static final void webkit_download_cancel (int /*long*/ download) { + lock.lock(); + try { + _webkit_download_cancel (download); + } finally { + lock.unlock(); + } +} + +/** + * @param download cast=(WebKitDownload *) + */ +public static final native long _webkit_download_get_current_size (int /*long*/ download); +public static final long webkit_download_get_current_size (int /*long*/ download) { + lock.lock(); + try { + return _webkit_download_get_current_size (download); + } finally { + lock.unlock(); + } +} + +/** + * @param download cast=(WebKitDownload *) + */ +public static final native int _webkit_download_get_status (int /*long*/ download); +public static final int webkit_download_get_status (int /*long*/ download) { + lock.lock(); + try { + return _webkit_download_get_status (download); + } finally { + lock.unlock(); + } +} + +/** + * @param download cast=(WebKitDownload *) + */ +public static final native int /*long*/ _webkit_download_get_suggested_filename (int /*long*/ download); +public static final int /*long*/ webkit_download_get_suggested_filename (int /*long*/ download) { + lock.lock(); + try { + return _webkit_download_get_suggested_filename (download); + } finally { + lock.unlock(); + } +} + +/** + * @param download cast=(WebKitDownload *) + */ +public static final native long _webkit_download_get_total_size (int /*long*/ download); +public static final long webkit_download_get_total_size (int /*long*/ download) { + lock.lock(); + try { + return _webkit_download_get_total_size (download); + } finally { + lock.unlock(); + } +} + +/** + * @param download cast=(WebKitDownload *) + */ +public static final native int /*long*/ _webkit_download_get_uri (int /*long*/ download); +public static final int /*long*/ webkit_download_get_uri (int /*long*/ download) { + lock.lock(); + try { + return _webkit_download_get_uri (download); + } finally { + lock.unlock(); + } +} + +/** + * @param download cast=(WebKitDownload *) + * @param destination_uri cast=(const gchar *) + */ +public static final native void _webkit_download_set_destination_uri (int /*long*/ download, byte[] destination_uri); +public static final void webkit_download_set_destination_uri (int /*long*/ download, byte[] destination_uri) { + lock.lock(); + try { + _webkit_download_set_destination_uri (download, destination_uri); + } finally { + lock.unlock(); + } +} + +public static final native int /*long*/ _webkit_get_default_session (); +public static final int /*long*/ webkit_get_default_session () { + lock.lock(); + try { + return _webkit_get_default_session (); + } finally { + lock.unlock(); + } +} + +public static final native boolean _WEBKIT_IS_WEB_FRAME (int /*long*/ object); +public static final boolean WEBKIT_IS_WEB_FRAME (int /*long*/ object) { + lock.lock(); + try { + return _WEBKIT_IS_WEB_FRAME (object); + } finally { + lock.unlock(); + } +} + +public static final native int _webkit_major_version (); +public static final int webkit_major_version () { + lock.lock(); + try { + return _webkit_major_version (); + } finally { + lock.unlock(); + } +} + +public static final native int _webkit_micro_version (); +public static final int webkit_micro_version () { + lock.lock(); + try { + return _webkit_micro_version (); + } finally { + lock.unlock(); + } +} + +public static final native int _webkit_minor_version (); +public static final int webkit_minor_version () { + lock.lock(); + try { + return _webkit_minor_version (); + } finally { + lock.unlock(); + } +} + +/** + * @param request cast=(WebKitNetworkRequest *) + */ +public static final native int /*long*/ _webkit_network_request_get_message (int /*long*/ request); +public static final int /*long*/ webkit_network_request_get_message (int /*long*/ request) { + lock.lock(); + try { + return _webkit_network_request_get_message (request); + } finally { + lock.unlock(); + } +} + +/** + * @param request cast=(WebKitNetworkRequest *) + */ +public static final native int /*long*/ _webkit_network_request_get_uri (int /*long*/ request); +public static final int /*long*/ webkit_network_request_get_uri (int /*long*/ request) { + lock.lock(); + try { + return _webkit_network_request_get_uri (request); + } finally { + lock.unlock(); + } +} + +/** + * @param uri cast=(const gchar *) + */ +public static final native int /*long*/ _webkit_network_request_new (byte[] uri); +public static final int /*long*/ webkit_network_request_new (byte[] uri) { + lock.lock(); + try { + return _webkit_network_request_new (uri); + } finally { + lock.unlock(); + } +} + +public static final native int _webkit_soup_auth_dialog_get_type (); +public static final int webkit_soup_auth_dialog_get_type () { + lock.lock(); + try { + return _webkit_soup_auth_dialog_get_type (); + } finally { + lock.unlock(); + } +} + +/** + * @param data_source cast=(WebKitWebDataSource *) + */ +public static final native int /*long*/ _webkit_web_data_source_get_data (int /*long*/ data_source); +public static final int /*long*/ webkit_web_data_source_get_data (int /*long*/ data_source) { + lock.lock(); + try { + return _webkit_web_data_source_get_data (data_source); + } finally { + lock.unlock(); + } +} + +/** + * @param data_source cast=(WebKitWebDataSource *) + */ +public static final native int /*long*/ _webkit_web_data_source_get_encoding (int /*long*/ data_source); +public static final int /*long*/ webkit_web_data_source_get_encoding (int /*long*/ data_source) { + lock.lock(); + try { + return _webkit_web_data_source_get_encoding (data_source); + } finally { + lock.unlock(); + } +} + +/** + * @param frame cast=(WebKitWebFrame *) + */ +public static final native int /*long*/ _webkit_web_frame_get_data_source (int /*long*/ frame); +public static final int /*long*/ webkit_web_frame_get_data_source (int /*long*/ frame) { + lock.lock(); + try { + return _webkit_web_frame_get_data_source (frame); + } finally { + lock.unlock(); + } +} + +/** + * @param frame cast=(WebKitWebFrame *) + */ +public static final native int /*long*/ _webkit_web_frame_get_global_context (int /*long*/ frame); +public static final int /*long*/ webkit_web_frame_get_global_context (int /*long*/ frame) { + lock.lock(); + try { + return _webkit_web_frame_get_global_context (frame); + } finally { + lock.unlock(); + } +} + +/** + * @param frame cast=(WebKitWebFrame *) + */ +public static final native int _webkit_web_frame_get_load_status (int /*long*/ frame); +public static final int webkit_web_frame_get_load_status (int /*long*/ frame) { + lock.lock(); + try { + return _webkit_web_frame_get_load_status (frame); + } finally { + lock.unlock(); + } +} + +/** + * @param frame cast=(WebKitWebFrame *) + */ +public static final native int /*long*/ _webkit_web_frame_get_parent (int /*long*/ frame); +public static final int /*long*/ webkit_web_frame_get_parent (int /*long*/ frame) { + lock.lock(); + try { + return _webkit_web_frame_get_parent (frame); + } finally { + lock.unlock(); + } +} + +/** + * @param frame cast=(WebKitWebFrame *) + */ +public static final native int /*long*/ _webkit_web_frame_get_title (int /*long*/ frame); +public static final int /*long*/ webkit_web_frame_get_title (int /*long*/ frame) { + lock.lock(); + try { + return _webkit_web_frame_get_title (frame); + } finally { + lock.unlock(); + } +} + +/** + * @param frame cast=(WebKitWebFrame *) + */ +public static final native int /*long*/ _webkit_web_frame_get_uri (int /*long*/ frame); +public static final int /*long*/ webkit_web_frame_get_uri (int /*long*/ frame) { + lock.lock(); + try { + return _webkit_web_frame_get_uri (frame); + } finally { + lock.unlock(); + } +} + +/** + * @param frame cast=(WebKitWebFrame *) + */ +public static final native int /*long*/ _webkit_web_frame_get_web_view (int /*long*/ frame); +public static final int /*long*/ webkit_web_frame_get_web_view (int /*long*/ frame) { + lock.lock(); + try { + return _webkit_web_frame_get_web_view (frame); + } finally { + lock.unlock(); + } +} + +/** + * @param decision cast=(WebKitWebPolicyDecision *) + */ +public static final native void _webkit_web_policy_decision_download (int /*long*/ decision); +public static final void webkit_web_policy_decision_download (int /*long*/ decision) { + lock.lock(); + try { + _webkit_web_policy_decision_download (decision); + } finally { + lock.unlock(); + } +} + +/** + * @param decision cast=(WebKitWebPolicyDecision *) + */ +public static final native void _webkit_web_policy_decision_ignore (int /*long*/ decision); +public static final void webkit_web_policy_decision_ignore (int /*long*/ decision) { + lock.lock(); + try { + _webkit_web_policy_decision_ignore (decision); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int _webkit_web_view_can_go_back (int /*long*/ web_view); +public static final int webkit_web_view_can_go_back (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_can_go_back (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int _webkit_web_view_can_go_forward (int /*long*/ web_view); +public static final int webkit_web_view_can_go_forward (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_can_go_forward (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + * @param mime_type cast=(const gchar *) + */ +public static final native int _webkit_web_view_can_show_mime_type (int /*long*/ web_view, int /*long*/ mime_type); +public static final int webkit_web_view_can_show_mime_type (int /*long*/ web_view, int /*long*/ mime_type) { + lock.lock(); + try { + return _webkit_web_view_can_show_mime_type (web_view, mime_type); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + * @param script cast=(const gchar *) + */ +public static final native void _webkit_web_view_execute_script (int /*long*/ web_view, byte[] script); +public static final void webkit_web_view_execute_script (int /*long*/ web_view, byte[] script) { + lock.lock(); + try { + _webkit_web_view_execute_script (web_view, script); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int _webkit_web_view_get_load_status (int /*long*/ web_view); +public static final int webkit_web_view_get_load_status (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_get_load_status (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int /*long*/ _webkit_web_view_get_main_frame (int /*long*/ web_view); +public static final int /*long*/ webkit_web_view_get_main_frame (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_get_main_frame (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native double _webkit_web_view_get_progress (int /*long*/ web_view); +public static final double webkit_web_view_get_progress (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_get_progress (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int /*long*/ _webkit_web_view_get_settings (int /*long*/ web_view); +public static final int /*long*/ webkit_web_view_get_settings (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_get_settings (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int /*long*/ _webkit_web_view_get_title (int /*long*/ web_view); +public static final int /*long*/ webkit_web_view_get_title (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_get_title (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int /*long*/ _webkit_web_view_get_uri (int /*long*/ web_view); +public static final int /*long*/ webkit_web_view_get_uri (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_get_uri (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native int /*long*/ _webkit_web_view_get_window_features (int /*long*/ web_view); +public static final int /*long*/ webkit_web_view_get_window_features (int /*long*/ web_view) { + lock.lock(); + try { + return _webkit_web_view_get_window_features (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native void _webkit_web_view_go_back (int /*long*/ web_view); +public static final void webkit_web_view_go_back (int /*long*/ web_view) { + lock.lock(); + try { + _webkit_web_view_go_back (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native void _webkit_web_view_go_forward (int /*long*/ web_view); +public static final void webkit_web_view_go_forward (int /*long*/ web_view) { + lock.lock(); + try { + _webkit_web_view_go_forward (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + * @param content cast=(const gchar *) + * @param mime_type cast=(const gchar *) + * @param encoding cast=(const gchar *) + * @param base_uri cast=(const gchar *) + */ +public static final native void _webkit_web_view_load_string (int /*long*/ web_view, byte[] content, byte[] mime_type, byte[] encoding, byte[] base_uri); +public static final void webkit_web_view_load_string (int /*long*/ web_view, byte[] content, byte[] mime_type, byte[] encoding, byte[] base_uri) { + lock.lock(); + try { + _webkit_web_view_load_string (web_view, content, mime_type, encoding, base_uri); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + * @param uri cast=(const gchar *) + */ +public static final native void _webkit_web_view_load_uri (int /*long*/ web_view, byte[] uri); +public static final void webkit_web_view_load_uri (int /*long*/ web_view, byte[] uri) { + lock.lock(); + try { + _webkit_web_view_load_uri (web_view, uri); + } finally { + lock.unlock(); + } +} + +public static final native int /*long*/ _webkit_web_view_new (); +public static final int /*long*/ webkit_web_view_new () { + lock.lock(); + try { + return _webkit_web_view_new (); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native void _webkit_web_view_reload (int /*long*/ web_view); +public static final void webkit_web_view_reload (int /*long*/ web_view) { + lock.lock(); + try { + _webkit_web_view_reload (web_view); + } finally { + lock.unlock(); + } +} + +/** + * @param web_view cast=(WebKitWebView *) + */ +public static final native void _webkit_web_view_stop_loading (int /*long*/ web_view); +public static final void webkit_web_view_stop_loading (int /*long*/ web_view) { + lock.lock(); + try { + _webkit_web_view_stop_loading (web_view); + } finally { + lock.unlock(); + } +} + +/* --------------------- start SWT natives --------------------- */ + +public static final native int JSClassDefinition_sizeof (); + +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ +public static final native void memmove (int /*long*/ dest, JSClassDefinition src, int /*long*/ size); + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties index 7fd2e607ea..c28198f32a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties @@ -66,6 +66,7 @@ SWT_Maximize=Maximize SWT_Restore=Restore SWT_ShowList=Show List SWT_FileDownload=File Download +SWT_Download_Error=Error occurred, download not completed SWT_Download_File=Download: {0} SWT_Download_Location=Saving {0} from {1} SWT_Download_Started=Downloading... @@ -79,5 +80,6 @@ SWT_InvalidCert_InvalidName=Certificate name is invalid or does not match site n SWT_InvalidCert_NotValid=Certificate is not currently valid. Valid date range: "{0}". SWT_InvalidCert_NotTrusted=Certificate is not from a trusted certifying authority. Certificate issuer: "{0}". SWT_InvalidCert_Connect=Would you like to connect to this site anyways? -SWT_OnBeforeUnload_Message=Are you sure you want to leave this page?{0}Click OK to continue, or Cancel to stay on this page. +SWT_OnBeforeUnload_Message1=Are you sure you want to leave this page? +SWT_OnBeforeUnload_Message2=Click OK to continue, or Cancel to stay on this page. SWT_ViewCertificate=View Certificate diff --git a/bundles/org.eclipse.swt/buildFragment.xml b/bundles/org.eclipse.swt/buildFragment.xml index da8aa4d58f..be8c915476 100644 --- a/bundles/org.eclipse.swt/buildFragment.xml +++ b/bundles/org.eclipse.swt/buildFragment.xml @@ -216,6 +216,7 @@ <fileset dir="${plugindir}/Eclipse SWT Program/gnome/"/> <fileset dir="${plugindir}/Eclipse SWT Program/gtk/"/> <fileset dir="${plugindir}/Eclipse SWT Theme/gtk/"/> + <fileset dir="${plugindir}/Eclipse SWT WebKit/gtk/"/> </copy> <antcall target="copy.translationfiles"/> <antcall target="replace64"/> |