compute size of org.eclipse.swt.browser.Browser dependent on its content [message #749907] |
Tue, 25 October 2011 10:06  |
Eclipse User |
|
|
|
Hi everybody,
I'm integrating Browser widgets in a pretty complex GridLayout.
What I would like to achieve is this: The size of the browser should
be calculated depending on its content, i.e. it should grab as much
vertical space it needs and not display a scrollbar.
After some research I noticed that this is a known issue in swt [1].
I understand that it' s probably not possible to achieve this with
the known swt layouting techniques. So does anybody know a workaround
for this?
I already tried to use css styles ('overflow:visible'), but without success.
Thanks in advance for any hints,
Werner
[1] - https://bugs.eclipse.org/bugs/show_bug.cgi?id=232501
|
|
|
|
|
|
|
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 03:50  |
Eclipse User |
|
|
|
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.06579 seconds