SWT browser not rendering until shell resize on mac

情到浓时终转凉″ 提交于 2019-12-11 23:33:45

问题


I have a problem with the SWT browser. I am using Mac OS X Yosemite. The browser is deeply placed in a composite hierarchy. i.e., The shell has say composite A, and composite A has composite B, and composite B has composite C and the Browser is placed inside this composite C. I've added location listeners and progress listeners for the browser.

GridDataFactory, GridLayoutFactory are from org.eclipse.jface.layout package.

Composite compositeC= new Composite(compositeB, SWT.BORDER);

GridLayoutFactory.fillDefaults().numColumns(1).applyTo(compositeC);
GridDataFactory.fillDefaults().grab(true, true).applyTo(compositeC);

Browser browser = new Browser(compositeC, SWT.None);
GridDataFactory.fillDefaults().grab(true, true).applyTo(browser);


browser.addLocationListener(new LocationListener() {
            @Override
            public void changing(LocationEvent event) {

            }

            @Override
            public void changed(LocationEvent event) {

            }

        });

        browser.addListener(SWT.Resize, new Listener() {
            @Override
            public void handleEvent(Event e) {

            }
        });

        browser.addProgressListener(new ProgressListener() {

            @Override
            public void completed(ProgressEvent event) {
                browser.layout(true, true);

            }

            @Override
            public void changed(ProgressEvent event) {


            }
        });

        browser.setUrl("http://eclipse.org");

        compositeC.layout(true);
        compositeC.redraw();

But the page that loads in the browser is not visible until I resize the Shell. I tried redrawing the shell in the completed() method of Progress Listener. But nothing seems to be working.

The same code works perfectly fine in Windows. Is there something I am doing wrong here or some issue with the Webkit rendered on MAC.

来源:https://stackoverflow.com/questions/30504741/swt-browser-not-rendering-until-shell-resize-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!