Revision: 6306 Author: [email protected] Date: Tue Oct 6 14:10:56 2009 Log: Fixes various mail issues, primarily on IE: - Mail.html: Adds doctype. - Contacts: Fixes weird layout issue on IE7 (lots of extra padding). - Fixes missing space between "Sign Out" and "About". - Accounts for non-integral unit ratios in layout. - Fixes inability to drag splitters on IE7.
Review: http://gwt-code-reviews.appspot.com/76803 http://code.google.com/p/google-web-toolkit/source/detail?r=6306 Modified: /trunk/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java /trunk/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.ui.xml /trunk/samples/mail/src/com/google/gwt/sample/mail/client/MailList.java /trunk/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.ui.xml /trunk/samples/mail/war/Mail.html /trunk/user/src/com/google/gwt/layout/client/LayoutImpl.java /trunk/user/src/com/google/gwt/user/client/ui/SplitLayoutPanel.java ======================================= --- /trunk/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java Tue Sep 22 14:34:43 2009 +++ /trunk/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java Tue Oct 6 14:10:56 2009 @@ -23,9 +23,9 @@ import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiTemplate; import com.google.gwt.user.client.ui.Anchor; +import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.PopupPanel; -import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; /** @@ -68,7 +68,7 @@ } } - interface Binder extends UiBinder<VerticalPanel, Contacts> { } + interface Binder extends UiBinder<Widget, Contacts> { } private static final Binder binder = GWT.create(Binder.class); private Contact[] contacts = new Contact[] { @@ -81,10 +81,10 @@ new Contact("Alan Turing", "[email protected]"), new Contact("John von Neumann", "[email protected]")}; - private VerticalPanel panel; + @UiField ComplexPanel panel; public Contacts() { - initWidget(panel = binder.createAndBindUi(this)); + initWidget(binder.createAndBindUi(this)); // Add all the contacts to the list. for (int i = 0; i < contacts.length; ++i) { ======================================= --- /trunk/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.ui.xml Tue Sep 22 14:34:43 2009 +++ /trunk/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.ui.xml Tue Oct 6 14:10:56 2009 @@ -9,5 +9,9 @@ } </ui:style> - <g:VerticalPanel styleName='{style.contacts}'/> + <!-- We need to apply padding to an outer panel because VerticalPanel is a + table, and applying padding to a table behaves strangely on IE6/7. --> + <g:FlowPanel styleName='{style.contacts}'> + <g:VerticalPanel ui:field='panel'/> + </g:FlowPanel> </ui:UiBinder> ======================================= --- /trunk/samples/mail/src/com/google/gwt/sample/mail/client/MailList.java Wed Sep 23 12:29:03 2009 +++ /trunk/samples/mail/src/com/google/gwt/sample/mail/client/MailList.java Tue Oct 6 14:10:56 2009 @@ -56,7 +56,6 @@ // Setup the table. table.setCellSpacing(0); table.setCellPadding(0); - table.setWidth("100%"); // Hook up events. table.addClickHandler(this); ======================================= --- /trunk/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.ui.xml Tue Sep 22 14:34:43 2009 +++ /trunk/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.ui.xml Tue Oct 6 14:10:56 2009 @@ -1,3 +1,6 @@ +<!DOCTYPE ui:UiBinder + SYSTEM "http://google-web-toolkit.googlecode.com/files/xhtml.ent" +> <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' @@ -31,6 +34,7 @@ <div class='{style.linksDiv}'> <g:Anchor href='javascript:;' ui:field='signOutLink'>Sign Out</g:Anchor> + <g:Anchor href='javascript:;' ui:field='aboutLink'>About</g:Anchor> </div> </div> ======================================= --- /trunk/samples/mail/war/Mail.html Mon Oct 5 14:02:49 2009 +++ /trunk/samples/mail/war/Mail.html Tue Oct 6 14:10:56 2009 @@ -1,3 +1,5 @@ +<!doctype html> + <!-- --> <!-- Copyright 2008 Google Inc. --> <!-- Licensed under the Apache License, Version 2.0 (the "License"); you --> ======================================= --- /trunk/user/src/com/google/gwt/layout/client/LayoutImpl.java Thu Sep 3 12:28:14 2009 +++ /trunk/user/src/com/google/gwt/layout/client/LayoutImpl.java Tue Oct 6 14:10:56 2009 @@ -54,8 +54,12 @@ style.setPosition(Position.ABSOLUTE); style.setZIndex(-32767); style.setLeft(-10000, PX); - style.setWidth(1, widthUnit); - style.setHeight(1, heightUnit); + + // Note that we are making the ruler element 10x10, because some browsers + // generate non-integral ratios (e.g., 1em == 13.3px), so we need a little + // extra precision. + style.setWidth(10, widthUnit); + style.setHeight(10, heightUnit); return ruler; } @@ -100,19 +104,19 @@ case PCT: return (vertical ? parent.getClientHeight() : parent.getClientWidth()) / 100.0; case EM: - return relativeRuler.getOffsetWidth(); + return relativeRuler.getOffsetWidth() / 10.0; case EX: - return relativeRuler.getOffsetHeight(); + return relativeRuler.getOffsetHeight() / 10.0; case CM: - return fixedRuler.getOffsetWidth(); - case MM: return fixedRuler.getOffsetWidth() / 10.0; + case MM: + return fixedRuler.getOffsetWidth() / 100.0; case IN: - return fixedRuler.getOffsetWidth() / 2.54; + return fixedRuler.getOffsetWidth() / 25.4; case PT: - return fixedRuler.getOffsetWidth() / 28.4; + return fixedRuler.getOffsetWidth() / 284; case PC: - return fixedRuler.getOffsetWidth() / 2.36; + return fixedRuler.getOffsetWidth() / 23.6; default: case PX: return 1; ======================================= --- /trunk/user/src/com/google/gwt/user/client/ui/SplitLayoutPanel.java Wed Sep 23 10:09:22 2009 +++ /trunk/user/src/com/google/gwt/user/client/ui/SplitLayoutPanel.java Tue Oct 6 14:10:56 2009 @@ -99,6 +99,11 @@ setElement(Document.get().createDivElement()); sinkEvents(Event.ONMOUSEDOWN | Event.ONMOUSEUP | Event.ONMOUSEMOVE | Event.ONDBLCLICK); + + // TODO: This is a temporary hack to work around the fact that IE6/7 + // don't send mouse events for transparent elements. Whatever solution + // we come up with for styling splitters must take this into account. + getElement().getStyle().setBackgroundColor("white"); } @Override @@ -126,7 +131,6 @@ } else { size = getEventPosition(event) - getTargetPosition() - offset; } - setAssociatedWidgetSize(size); event.preventDefault(); } --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
