|
|
|
|
Re: compute size of org.eclipse.swt.browser.Browser dependent on its content [message #750051 is a reply to message #750040] |
Tue, 25 October 2011 15:52 |
|
This is really a limitation in HTML in general. From the parent page, there is no way to know what the size of the content in an iframe should be. The only thing I can think might work is to have the content of the iframe run a javascript function when it is done loading to compute its rendered size. Then callback into the parent (you could use BrowserFunction in SWT/RAP) to adjust the size of the Browser widget. Of course, this requires coordination from the nested content and will only work if both the parent and the content are from the same domain (desktop SWT would not have the crossdomain limitation since there is no origin domain).
Hope that helps,
Cole
|
|
|
Re: compute size of org.eclipse.swt.browser.Browser dependent on its content [message #753644 is a reply to message #750051] |
Fri, 28 October 2011 07:50 |
Werner Hihn Messages: 32 Registered: July 2009 |
Member |
|
|
Thanks for the hints, they already pointed me in the right direction!
@Rüdiger: Yes, using a heightHint seems to be the only possible
solution. But as I don' t know the content I have to combine that with
the solution proposed by Cole.
So I'm using this javascript function [1] to determine the needed height
via browser.evaluate(function), use that as heightHint for the
gridData, and call layout() on the parent composite.
This seems to work in general, but there is still one drawback:
the browser is flickering a little (you can see the original size with
the scrollbar for a moment, before the new gridData is set).
I still have to spend a little time on that.
Thanks and Regards,
Werner
[1] -
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight)
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight)
Math.max(D.body.clientHeight, D.documentElement.clientHeight));
|
|
|
Powered by
FUDForum. Page generated in 0.03249 seconds