Skip to content

Control: remove dependency on Browser and OleClientSite #2182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1267,4 +1267,10 @@ public void stop () {
checkWidget();
webBrowser.stop ();
}

//@Override not marked as overridden because the super method does not exist for GTK/Cocoa
protected boolean embedsWin32Control () {
// The Edge browser embeds webView2
return !isDisposed() && isVisible() && "edge".equals(getBrowserType());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1511,4 +1511,10 @@ private SIZE xFormPixelsToHimetric(SIZE aSize) {
size.cy = cy;
return size;
}

@Override
protected boolean embedsWin32Control () {
// OLE objects are always embedded by windows
return !isDisposed() && isVisible();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1986,4 +1986,17 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
}
composite.redrawInPixels (null, true);
}

@Override
protected boolean embedsWin32Control () {
if (isDisposed() || !isVisible()) {
return false;
}
for (Control child : getChildren()) {
if (child.embedsWin32Control()) {
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import org.eclipse.swt.*;
import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
Expand Down Expand Up @@ -3698,25 +3697,7 @@ public void setRedraw (boolean redraw) {
}
}

private boolean embedsWin32Control () {
if (this.isDisposed() || !this.isVisible()) {
return false;
}
if (this instanceof Browser browser) {
// The Edge browser embeds webView2
return "edge".equals(browser.getBrowserType());
}

if (this instanceof OleClientSite) {
// OLE objects are always embedded by windows
return true;
}

// This needs to be checked AFTER OleClientSite because OleClientSite itself is a Composite
if (this instanceof Composite comp) {
return Stream.of(comp.getChildren()).anyMatch(Control::embedsWin32Control);
}

protected boolean embedsWin32Control () {
return false;
}

Expand Down
Loading