[377462] enable to use IE8 component in WebBrowserIEImpl
diff --git a/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEComposite.java b/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEComposite.java
index 07c4aa8..698335e 100644
--- a/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEComposite.java
+++ b/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEComposite.java
@@ -127,6 +127,7 @@
/*
* Misc settings
*/
+ setBrowserBoolean("RegisterAsBrowser", true); //$NON-NLS-1$
setBrowserBoolean("RegisterAsDropTarget", true); //$NON-NLS-1$
/*
@@ -622,7 +623,7 @@
protected void onWindowClosing(WindowClosingParameters param) {
// param.setCancel(true);
- //
+ //
for (int i = 0; i < eventListeners.length; i++) {
eventListeners[i].windowClosing(param);
}
@@ -657,8 +658,8 @@
*/
private Set<BrowserEventListener> getEventListeners() {
- return new LinkedHashSet<BrowserEventListener>(Arrays
- .asList(eventListeners));
+ return new LinkedHashSet<BrowserEventListener>(
+ Arrays.asList(eventListeners));
}
private void setEventListeners(Set<BrowserEventListener> set) {
diff --git a/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEControlSite.java b/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEControlSite.java
index e83bb5a..41a92d4 100644
--- a/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEControlSite.java
+++ b/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEControlSite.java
@@ -255,21 +255,22 @@
GUID guid = new GUID();
COM.MoveMemory(guid, riid, GUID.sizeof);
if (COM.IsEqualGUID(guid, COM.IIDIDocHostUIHandler)) {
- MemoryUtil.MoveMemory(ppvObject, new int[] { iDocHostUIHandler
- .getAddress() }, 4);
+ MemoryUtil.MoveMemory(ppvObject,
+ new int[] { iDocHostUIHandler.getAddress() }, OS.PTR_SIZEOF);
AddRef();
return S_OK;
}
if (COM.IsEqualGUID(guid, COM.IIDIOleCommandTarget)) {
- MemoryUtil.MoveMemory(ppvObject, new int[] { iOleCommandTarget
- .getAddress() }, 4);
+ MemoryUtil.MoveMemory(ppvObject,
+ new int[] { iOleCommandTarget.getAddress() }, OS.PTR_SIZEOF);
AddRef();
return S_OK;
}
if (COM.IsEqualGUID(guid, COM.IIDIServiceProvider)) {
- COM.MoveMemory(ppvObject, new int /* long */[] { iServiceProvider
- .getAddress() }, OS.PTR_SIZEOF);
+ COM.MoveMemory(ppvObject,
+ new int /* long */[] { iServiceProvider.getAddress() },
+ OS.PTR_SIZEOF);
AddRef();
return COM.S_OK;
}
@@ -442,8 +443,11 @@
}
int MapUrlToZone(int /* long */pwszUrl, int /* long */pdwZone, int dwFlags) {
- COM.MoveMemory(pdwZone, new int[] { URLZONE_INTRANET }, 4);
- return COM.S_OK;
+ // TODO about:blank and non trusted text case
+ // COM.MoveMemory(pdwZone, new int[] { URLZONE_INTRANET }, 4);
+ // return COM.S_OK;
+
+ return INET_E_DEFAULT_ACTION;
}
int GetSecurityId(int /* long */pwszUrl, int /* long */pbSecurityId,
diff --git a/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEImpl.java b/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEImpl.java
index 4769b88..188a398 100644
--- a/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEImpl.java
+++ b/plugins/org.eclipse.actf.model.ui.editors.ie/src/org/eclipse/actf/model/internal/ui/editors/ie/WebBrowserIEImpl.java
@@ -43,6 +43,7 @@
import org.eclipse.actf.model.ui.util.ScrollBarSizeUtil;
import org.eclipse.actf.util.logging.DebugPrintUtil;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -98,6 +99,24 @@
gridLayout.marginWidth = 0;
parent.setLayout(gridLayout);
+ //dummySwtBrowser to use IE8 component
+ //To avoid conflict, we embed dummy SWT browser to control registry.
+ Composite dummyComp = new Composite(parent, SWT.NONE);
+ gridLayout = new GridLayout();
+ gridLayout.marginBottom = 0;
+ gridLayout.verticalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.numColumns = 1;
+ dummyComp.setLayout(gridLayout);
+ dummyComp.setSize(0, 0);
+ dummyComp.redraw();
+ dummyComp.setVisible(false);
+ dummyComp.setLayoutData(new GridData(0, 0));
+ Browser browser = new Browser(dummyComp, SWT.NONE);
+ browser.setVisible(false);
+
toolbar = new WebBrowserToolbar(this, parent, SWT.NONE);
browserComposite = new WebBrowserIEComposite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -113,7 +132,7 @@
}
toolbar.setAddressTextString(startURL);
- browserComposite.setDisableScriptDebugger(true);
+ setDisableScriptDebugger(true);
browserComposite.addBrowserEventListener(this);
@@ -601,14 +620,15 @@
for (int i = 0; i < tmpNL.getLength(); i++) {
try {
IElementEx tmpE = ((IElementEx) tmpNL.item(i));
- list.add(new ImagePositionInfo(tmpE.getLocation(), tmpE.getAttribute("src"), tmpE));
+ list.add(new ImagePositionInfo(tmpE.getLocation(), tmpE
+ .getAttribute("src"), tmpE));
} catch (Exception e) {
}
}
ImagePositionInfo[] result = new ImagePositionInfo[list.size()];
list.toArray(result);
return result;
-
+
// return browserComposite.getAllImagePosition();
}