The following code creates a Canvas, and places it in a SimplePanel,
with some borders to highlight spacing issues. For some reason there
are a few pixels of margin/padding under the canvas. If I go into
firebug or Chrome's inspector, the paddings and margins are all zero,
and if I copy the HTML from there to a static file, the extra space
doesn't appear in the static file. This seems like a bug, but I'm
dizzy from looking at it too long... anyone else seen this?
I see it in Firefox 9 (compiled), Safari (compiled) and Chrome 16
(compiled and hosted mode), all of these on Mac OS X 10.7. No other
systems or browsers tested.
package com....client;
import com.google.gwt.canvas.client.Canvas;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.BorderStyle;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;
public class MyModule implements EntryPoint {
public void onModuleLoad() {
// Create a simple panel with red border.
SimplePanel p = new SimplePanel();
Style s = p.getElement().getStyle();
s.setBorderColor("red");
s.setBorderWidth(1.0, Style.Unit.PX);
s.setBorderStyle(BorderStyle.SOLID);
// Create canvas and set it's size. Why does margin show
up under it?
Canvas c = Canvas.createIfSupported();
c.getElement().getStyle().setBackgroundColor("blue");
s = c.getElement().getStyle();
s.setBorderColor("orange");
s.setBorderWidth(1.0, Style.Unit.PX);
s.setBorderStyle(BorderStyle.SOLID);
int h = 18;
int w = 15;
c.setPixelSize(w, h);
c.setCoordinateSpaceHeight(h);
c.setCoordinateSpaceWidth(w);
p.add(c);
RootPanel.get().add(p);
}
}
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment