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 /bundles/org.eclipse.swt/Eclipse SWT Browser | |
parent | 159d68c5cdc07d0c012524712583b496e401e2e1 (diff) | |
download | eclipse.platform.swt-552c8bd58eca97b6fa31432ec71e7c05f64afc6d.tar.gz eclipse.platform.swt-552c8bd58eca97b6fa31432ec71e7c05f64afc6d.tar.xz eclipse.platform.swt-552c8bd58eca97b6fa31432ec71e7c05f64afc6d.zip |
WebKitGTK initial
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Browser')
7 files changed, 44 insertions, 28 deletions
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() { |