SWT browser not rendering until shell resize on ma

2019-09-18 04:20发布

问题:

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.