Bug 160620

Summary: Browser widget accessibility font options
Product: [Eclipse Project] Platform Reporter: Andy Cheadle <amc4>
Component: SWTAssignee: Grant Gayed <grant_gayed>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: carolynmacleod4, chrriis, daniel_megert, dvoytenko, zanetu
Version: 3.2.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Andy Cheadle CLA 2006-10-12 02:08:48 EDT
Hi,

Firstly, big thanks to all you guys out there that make eclipse and SWT tick!

I'm developing an RCP application based on a web browser based prototype.
The RCP environment is a much better hosting environment for the application. However, although the browser widget has rather limited functionality, the only
thing that really seems to be missing is the ability to control font sizes for accessibility options. This is somemthing that is impractical to be controlled from style sheets.

Is there any plan to add control over font /  font style / font size to the widget? If not, this is an enhancement request for such a feature.

Many thanks!

Andy
Comment 1 Grant Gayed CLA 2006-10-12 09:35:16 EDT
I'm not sure if this would become Browser api, but it should become doable once the eclipse 3.3 plan item in bug 154124 is addressed.

Note to self: nsIDOMWindow->SetTextZoom .
Comment 2 Grant Gayed CLA 2007-03-14 15:01:44 EDT
*** Bug 177365 has been marked as a duplicate of this bug. ***
Comment 3 Grant Gayed CLA 2009-09-30 12:42:05 EDT
FYI here's how zooming is done with a SWT.MOZILLA style Browser (requires XULRunner >= 1.9):

public class Snippet329 {
	static int zoom = 10;
	static Browser browser;

public static void main(String [] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout(2, true));

	try {
		browser = new Browser(shell, SWT.MOZILLA);
	} catch (SWTError e) {
		System.out.println("Could not instantiate Browser: " + e.getMessage());
		display.dispose();
		return;
	}
	GridData data = new GridData();
	data.heightHint = data.widthHint = 400;
	data.horizontalSpan = 2;
	browser.setLayoutData(data);

	Button zoomIn = new Button(shell, SWT.PUSH);
	zoomIn.setText("Zoom In");
	zoomIn.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event event) {
			setZoom(++zoom);
		}
	});
	Button zoomOut = new Button(shell, SWT.PUSH);
	zoomOut.setText("Zoom Out");
	zoomOut.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event event) {
			if (zoom > 1) {
				setZoom(--zoom);
			}
		}
	});

	shell.pack();
	shell.open();
	browser.setUrl("http://www.eclipse.org");
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
static void setZoom(int zoom) {
	nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser();
	nsIInterfaceRequestor req = (nsIInterfaceRequestor)webBrowser.queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID);
	nsIDocShell docShell = (nsIDocShell)req.getInterface(nsIDocShell.NS_IDOCSHELL_IID);
	nsIContentViewer contentView = docShell.getContentViewer();
	nsIMarkupDocumentViewer docView = (nsIMarkupDocumentViewer)contentView.queryInterface(nsIMarkupDocumentViewer.NS_IMARKUPDOCUMENTVIEWER_IID);
	float value = zoom / 10f;
	System.out.println("zoom: " + value);
	docView.setFullZoom(value);
}
}
Comment 4 Carolyn MacLeod CLA 2011-12-16 11:58:59 EST
Not sure if this is helpful for zooming programmatically in IE.
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/e542c4e6-acb6-44d4-b742-beab5528ac74