Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Rendering issues in strict mode with Chrome and FF due to missing width and height at

    Since we need SVG support, we've enabled strict mode by adding <!DOCTYPE HTML> on the start page.
    This is required for IE9 to show SVG, other common browsers do not require this.
    However, it seems to have some implications in Chrome (16.0.912.75 m) and FF (9.0.1) when it comes to rendering widgets in complex layouts.
    Some divs don't have widths and heights assigned, which does not seem to be a problem in quirks mode. In strict mode however, this seems to be an issue for Chrome and Firefox.
    Example (Screenshot taken from Firebug):
    The width and height underlined in green is not there normally. In quirks mode, this does not seem to be a problem. In strict mode, the child divs are not shown in Chrome and Firefox (IE makes not problem here).
    Adding width and height manually using Firebug also induces Firefox to render child divs.
    Since it looks like the marked div is somehow generated by SmartGWT, I wonder, whether there is an option to set width and height in this div right from the beginning or to have an implicit width and height of 100% here.
    I have not found a way to do so from SmartGWT code, where simply an Openlayers MapWidget is added to a Window using addItem(). The MapWidget's size is set to 91%, 100%, and there are no other Canvases than this MapWidget. The same problem occurs with GMaps. Without SmartGWT, both work in strict mode without problems.

    SC_SNAPSHOT-2012-01-20_v8.2p, GWT 2.4
    Attached Files

    #2
    OK, got around this with an addItem overwrite in the Window class which explicitly sets the widget's size to the parent WidgetCanvas' size like this:
    Code:
    @Override
    /**
     * Adds a widget to the window.
     *
     * @param widget the widget to be added
     */
    public void addItem(final Widget widget) {
        if (widget instanceof Canvas) {
            addItem((Canvas) widget);
        } else {
        	final WidgetCanvas pe = new WidgetCanvas(widget);
        	widget.setWidth(pe.getInnerWidth()+"px");
        	widget.setHeight(pe.getInnerHeight()+"px");
        	pe.addResizedHandler(new ResizedHandler() {				
    			@Override
    			public void onResized(ResizedEvent event) {
    				widget.setWidth(pe.getInnerWidth()+"px");
                	widget.setHeight(pe.getInnerHeight()+"px");
    			}
    		});
        	addItem(pe);
        }
    }

    Comment

    Working...
    X