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
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6306 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java b/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java
index df69bdf..713a155 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.java
@@ -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", "alan@example.com"),
new Contact("John von Neumann", "john@example.com")};
- 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) {
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.ui.xml b/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.ui.xml
index 5349613..d387342 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.ui.xml
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/Contacts.ui.xml
@@ -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>
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/MailList.java b/samples/mail/src/com/google/gwt/sample/mail/client/MailList.java
index b02edc8..b017fad 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/MailList.java
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/MailList.java
@@ -56,7 +56,6 @@
// Setup the table.
table.setCellSpacing(0);
table.setCellPadding(0);
- table.setWidth("100%");
// Hook up events.
table.addClickHandler(this);
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.ui.xml b/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.ui.xml
index 1981a59..3c67f51 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.ui.xml
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/TopPanel.ui.xml
@@ -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>
diff --git a/samples/mail/war/Mail.html b/samples/mail/war/Mail.html
index d7e1d5d..f4b58e0 100644
--- a/samples/mail/war/Mail.html
+++ b/samples/mail/war/Mail.html
@@ -1,3 +1,5 @@
+<!doctype html>
+
<!-- -->
<!-- Copyright 2008 Google Inc. -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you -->
diff --git a/user/src/com/google/gwt/layout/client/LayoutImpl.java b/user/src/com/google/gwt/layout/client/LayoutImpl.java
index cf423fa..3dcfda4 100644
--- a/user/src/com/google/gwt/layout/client/LayoutImpl.java
+++ b/user/src/com/google/gwt/layout/client/LayoutImpl.java
@@ -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;
diff --git a/user/src/com/google/gwt/user/client/ui/SplitLayoutPanel.java b/user/src/com/google/gwt/user/client/ui/SplitLayoutPanel.java
index 7f6f3d8..2ed68d5 100644
--- a/user/src/com/google/gwt/user/client/ui/SplitLayoutPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/SplitLayoutPanel.java
@@ -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();
}