Rolling back changes that broke the continuous build.
$ svn merge -r6024:6018 .
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6028 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java b/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java
index fa4b01b..01fe650 100644
--- a/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java
+++ b/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java
@@ -1,12 +1,12 @@
/*
* Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -28,13 +28,12 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
-import java.util.Random;
import java.util.TreeMap;
/**
* A variation on Jar which handles duplicate entries by only archiving the most
* recent of any given path. This is done by keeping a map of paths (as shown in
- * the jar file) against {@link EntryInfo} objects identifying the input source
+ * the jar file) against {@link #EntryInfo} objects identifying the input source
* and its timestamp. Most of the actual archiving is deferred until archive
* finalization, when we've decided on the actual de-duplicated set of entries.
*/
@@ -55,7 +54,7 @@
/**
* Called to actually add the entry to a given zip stream.
- *
+ *
* @param out
* @param path
* @throws IOException
@@ -102,7 +101,7 @@
public FileEntryInfo(InputStream in, long lastModified, File fromArchive,
int mode) throws IOException {
super(lastModified, mode);
- tmpFile = createTempFile("gwtjar", "");
+ tmpFile = File.createTempFile("gwtjar", "");
tmpFile.deleteOnExit();
OutputStream fos = new FileOutputStream(tmpFile);
int readLen = in.read(buffer);
@@ -126,54 +125,6 @@
}
}
- /**
- * Used to generate temporary file names.
- */
- private static long counter = -1;
-
- /**
- * Creates a temporary file.
- *
- * @param prefix the file prefix
- * @param suffix the file suffix
- * @return the new file
- * @throws IOException if the file cannot be created
- */
- private static File createTempFile(String prefix, String suffix)
- throws IOException {
- if (suffix == null) {
- suffix = ".tmp";
- }
-
- // Get the temp file directory.
- File tmpDir = new File(System.getProperty("java.io.tmpdir"));
- tmpDir.mkdirs();
-
- // Generate a random name.
- if (counter == -1) {
- counter = new Random().nextLong();
- }
- boolean created = false;
- File tmpFile;
- do {
- counter++;
- tmpFile = new File(tmpDir, prefix + Long.toString(counter) + suffix);
- if (!tmpFile.exists()) {
- created = tmpFile.createNewFile();
- if (!created) {
- // If we fail the create the temp file, it must have been created by
- // another thread between lines 161 and 162. We re-seed to avoid
- // further race conditions.
- counter = new Random().nextLong();
- }
- }
- } while (!created);
-
- // Create the file.
- tmpFile.createNewFile();
- return tmpFile;
- }
-
private byte buffer[] = new byte[16 * 1024];
private Map<String, EntryInfo> paths = new TreeMap<String, EntryInfo>();
@@ -237,10 +188,10 @@
/**
* Checks whether an entry should be replaced, by touch dates and duplicates
* setting.
- *
+ *
* @param path the path of an entry being considered
* @param touchTime the lastModified of the candiate replacement
- * @return true if the file should be replaced
+ * @return
*/
private boolean shouldReplace(String path, long touchTime) {
EntryInfo oldInfo = paths.get(path);
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java
index 7527e09..d441444 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java
@@ -49,8 +49,6 @@
addIssue(new Issue2553());
addIssue(new Issue2855());
addIssue(new Issue3172());
- addIssue(new Issue3962());
- addIssue(new Issue3973());
}
public void addVisuals() {
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3962.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3962.java
deleted file mode 100644
index b0e6587..0000000
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3962.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.museum.client.defaultmuseum;
-
-import com.google.gwt.museum.client.common.AbstractIssue;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FormPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
-import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;
-
-/**
- * Buttons default to type=submit in WebKit (Safari and Chrome) and IE8 (in IE8
- * mode).
- */
-public class Issue3962 extends AbstractIssue {
- private FormPanel form;
-
- @Override
- public Widget createIssue() {
- form = new FormPanel();
- form.addSubmitHandler(new SubmitHandler() {
- public void onSubmit(SubmitEvent event) {
- Window.alert("Form is being submitted.");
- event.cancel();
- }
- });
- form.setWidget(new Button("Submit"));
- return form;
- }
-
- @Override
- public String getInstructions() {
- return "Click the button, it should have no effect.";
- }
-
- @Override
- public String getSummary() {
- return "In IE8 (in IE8 mode) and WebKit (Safari and Chrome), buttons default"
- + " to type submit.";
- }
-
- @Override
- public boolean hasCSS() {
- return false;
- }
-}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3973.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3973.java
deleted file mode 100644
index a5eef5e..0000000
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3973.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.museum.client.defaultmuseum;
-
-import com.google.gwt.museum.client.common.AbstractIssue;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.FormPanel;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
-import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;
-
-/**
- * When a {@link FormPanel} does not use a synthesized hidden iframe and is
- * being submit by means other than {@link FormPanel#submit()}, it doesn't fire
- * submit events.
- */
-public class Issue3973 extends AbstractIssue {
- private FormPanel form;
-
- @Override
- public Widget createIssue() {
- form = new FormPanel("_blank");
- form.setAction("http://www.google.com/search");
- form.addSubmitHandler(new SubmitHandler() {
- public void onSubmit(SubmitEvent event) {
- Window.alert("Did you see me?");
- event.cancel();
- }
- });
- TextBox box = new TextBox();
- box.setName("q");
- form.setWidget(box);
- return form;
- }
-
- @Override
- public String getInstructions() {
- return "Enter some text and press the ENTER key, it should show an alert. It shouldn't open Google within a new window/tab!";
- }
-
- @Override
- public String getSummary() {
- return "FormPanel doesn't hook events when not using a synthesized hidden iframe.";
- }
-
- @Override
- public boolean hasCSS() {
- return false;
- }
-}
diff --git a/user/src/com/google/gwt/dom/client/DOMImpl.java b/user/src/com/google/gwt/dom/client/DOMImpl.java
index b9ba351..e5ae74b 100644
--- a/user/src/com/google/gwt/dom/client/DOMImpl.java
+++ b/user/src/com/google/gwt/dom/client/DOMImpl.java
@@ -25,12 +25,6 @@
button.click();
}-*/;
- public native ButtonElement createButtonElement(Document doc, String type) /*-{
- var e = doc.createElement("BUTTON");
- e.type = type;
- return e;
- }-*/;
-
public native Element createElement(Document doc, String tag) /*-{
return doc.createElement(tag);
}-*/;
diff --git a/user/src/com/google/gwt/dom/client/DOMImplTrident.java b/user/src/com/google/gwt/dom/client/DOMImplTrident.java
index 4bc7ae9..74b4e19 100644
--- a/user/src/com/google/gwt/dom/client/DOMImplTrident.java
+++ b/user/src/com/google/gwt/dom/client/DOMImplTrident.java
@@ -21,18 +21,12 @@
* This field *must* be filled in from JSNI code before dispatching an event
* on IE. It should be set to the 'this' context of the handler that receives
* the event, then restored to its initial value when the dispatcher is done.
- * See
- * {@link com.google.gwt.user.client.impl.DOMImplTrident#initEventSystem()}
+ * See {@link com.google.gwt.user.client.impl.DOMImplTrident#initEventSystem()}
* for an example of how this should be done.
*/
private static EventTarget currentEventTarget;
@Override
- public native ButtonElement createButtonElement(Document doc, String type) /*-{
- return doc.createElement("<BUTTON type='" + type + "'></BUTTON>");
- }-*/;
-
- @Override
public Element createElement(Document doc, String tagName) {
if (tagName.contains(":")) {
// Special implementation for tag names with namespace-prefixes. The only
@@ -54,8 +48,8 @@
}
@Override
- public native NativeEvent createHtmlEvent(Document doc, String type,
- boolean canBubble, boolean cancelable) /*-{
+ public native NativeEvent createHtmlEvent(Document doc, String type, boolean canBubble,
+ boolean cancelable) /*-{
// NOTE: IE doesn't support changing bubbling and canceling behavior (this
// is documented publicly in Document.createHtmlEvent()).
var evt = doc.createEventObject();
@@ -69,9 +63,9 @@
}-*/;
@Override
- public native NativeEvent createKeyEvent(Document doc, String type,
- boolean canBubble, boolean cancelable, boolean ctrlKey, boolean altKey,
- boolean shiftKey, boolean metaKey, int keyCode, int charCode) /*-{
+ public native NativeEvent createKeyEvent(Document doc, String type, boolean canBubble,
+ boolean cancelable, boolean ctrlKey, boolean altKey, boolean shiftKey,
+ boolean metaKey, int keyCode, int charCode) /*-{
// NOTE: IE doesn't support changing bubbling and canceling behavior (this
// is documented publicly in Document.createKeyEvent()).
var evt = doc.createEventObject();
@@ -87,10 +81,10 @@
}-*/;
@Override
- public native NativeEvent createMouseEvent(Document doc, String type,
- boolean canBubble, boolean cancelable, int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
- boolean shiftKey, boolean metaKey, int button, Element relatedTarget) /*-{
+ public native NativeEvent createMouseEvent(Document doc, String type, boolean canBubble,
+ boolean cancelable, int detail, int screenX, int screenY, int clientX,
+ int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey,
+ boolean metaKey, int button, Element relatedTarget) /*-{
// NOTE: IE doesn't support changing bubbling and canceling behavior (this
// is documented publicly in Document.createMouseEvent()).
var evt = doc.createEventObject();
@@ -174,7 +168,7 @@
/**
* IE returns a numeric type for some attributes that are really properties,
- * such as offsetWidth. We need to coerce these to strings to prevent a
+ * such as offsetWidth. We need to coerce these to strings to prevent a
* runtime JS exception.
*/
@Override
@@ -198,7 +192,6 @@
return elem.innerText;
}-*/;
- @Override
public String getTagName(Element elem) {
String tagName = getTagNameInternal(elem);
String scopeName = getScopeNameInternal(elem);
diff --git a/user/src/com/google/gwt/dom/client/Document.java b/user/src/com/google/gwt/dom/client/Document.java
index d9ce69d..b962621 100644
--- a/user/src/com/google/gwt/dom/client/Document.java
+++ b/user/src/com/google/gwt/dom/client/Document.java
@@ -68,8 +68,7 @@
* @return the newly created element
*/
public final QuoteElement createBlockQuoteElement() {
- return (QuoteElement) DOMImpl.impl.createElement(this,
- QuoteElement.TAG_BLOCKQUOTE);
+ return (QuoteElement) DOMImpl.impl.createElement(this, QuoteElement.TAG_BLOCKQUOTE);
}
/**
@@ -90,37 +89,20 @@
/**
* Creates a <button> element.
- * <p>
- * <b>Warning!</b> The button type is actually implementation-dependent and is
- * read-only.
*
* @return the newly created element
- * @deprecated use {@link #createPushButtonElement()},
- * {@link #createResetButtonElement()} or
- * {@link #createSubmitButtonElement()} instead.
*/
- @Deprecated
public final ButtonElement createButtonElement() {
return (ButtonElement) DOMImpl.impl.createElement(this, ButtonElement.TAG);
}
/**
- * Creates an <input type='button'> element.
- *
- * @return the newly created element
- */
- public final InputElement createButtonInputElement() {
- return DOMImpl.impl.createInputElement(this, "button");
- }
-
- /**
* Creates a <caption> element.
*
* @return the newly created element
*/
public final TableCaptionElement createCaptionElement() {
- return (TableCaptionElement) DOMImpl.impl.createElement(this,
- TableCaptionElement.TAG);
+ return (TableCaptionElement) DOMImpl.impl.createElement(this, TableCaptionElement.TAG);
}
/**
@@ -158,8 +140,8 @@
* @param metaKey <code>true</code> if the meta key is depressed
* @return the event object
*/
- public final NativeEvent createClickEvent(int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
+ public final NativeEvent createClickEvent(int detail, int screenX, int screenY,
+ int clientX, int clientY, boolean ctrlKey, boolean altKey,
boolean shiftKey, boolean metaKey) {
// We disallow setting the button here, because IE doesn't provide the
// button property for click events.
@@ -174,8 +156,7 @@
* @return the newly created element
*/
public final TableColElement createColElement() {
- return (TableColElement) DOMImpl.impl.createElement(this,
- TableColElement.TAG_COL);
+ return (TableColElement) DOMImpl.impl.createElement(this, TableColElement.TAG_COL);
}
/**
@@ -184,8 +165,7 @@
* @return the newly created element
*/
public final TableColElement createColGroupElement() {
- return (TableColElement) DOMImpl.impl.createElement(this,
- TableColElement.TAG_COLGROUP);
+ return (TableColElement) DOMImpl.impl.createElement(this, TableColElement.TAG_COLGROUP);
}
/**
@@ -224,8 +204,8 @@
* @param metaKey <code>true</code> if the meta key is depressed
* @return the event object
*/
- public final NativeEvent createDblClickEvent(int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
+ public final NativeEvent createDblClickEvent(int detail, int screenX, int screenY,
+ int clientX, int clientY, boolean ctrlKey, boolean altKey,
boolean shiftKey, boolean metaKey) {
// We disallow setting the button here, because IE doesn't provide the
// button property for click events.
@@ -286,8 +266,7 @@
* @return the newly created element
*/
public final FieldSetElement createFieldSetElement() {
- return (FieldSetElement) DOMImpl.impl.createElement(this,
- FieldSetElement.TAG);
+ return (FieldSetElement) DOMImpl.impl.createElement(this, FieldSetElement.TAG);
}
/**
@@ -332,8 +311,7 @@
* @return the newly created element
*/
public final FrameSetElement createFrameSetElement() {
- return (FrameSetElement) DOMImpl.impl.createElement(this,
- FrameSetElement.TAG);
+ return (FrameSetElement) DOMImpl.impl.createElement(this, FrameSetElement.TAG);
}
/**
@@ -599,8 +577,8 @@
* {@link NativeEvent#BUTTON_LEFT} et al)
* @return the event object
*/
- public final NativeEvent createMouseDownEvent(int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
+ public final NativeEvent createMouseDownEvent(int detail, int screenX, int screenY,
+ int clientX, int clientY, boolean ctrlKey, boolean altKey,
boolean shiftKey, boolean metaKey, int button) {
return createMouseEvent("mousedown", true, true, detail, screenX, screenY,
clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, null);
@@ -665,8 +643,8 @@
* {@link NativeEvent#BUTTON_LEFT} et al)
* @return the event object
*/
- public final NativeEvent createMouseMoveEvent(int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
+ public final NativeEvent createMouseMoveEvent(int detail, int screenX, int screenY,
+ int clientX, int clientY, boolean ctrlKey, boolean altKey,
boolean shiftKey, boolean metaKey, int button) {
return createMouseEvent("mousemove", true, true, detail, screenX, screenY,
clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, null);
@@ -692,8 +670,8 @@
* @param relatedTarget the event's related target
* @return the event object
*/
- public final NativeEvent createMouseOutEvent(int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
+ public final NativeEvent createMouseOutEvent(int detail, int screenX, int screenY,
+ int clientX, int clientY, boolean ctrlKey, boolean altKey,
boolean shiftKey, boolean metaKey, int button, Element relatedTarget) {
return createMouseEvent("mouseout", true, true, detail, screenX, screenY,
clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button,
@@ -720,8 +698,8 @@
* @param relatedTarget the event's related target
* @return the event object
*/
- public final NativeEvent createMouseOverEvent(int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
+ public final NativeEvent createMouseOverEvent(int detail, int screenX, int screenY,
+ int clientX, int clientY, boolean ctrlKey, boolean altKey,
boolean shiftKey, boolean metaKey, int button, Element relatedTarget) {
return createMouseEvent("mouseover", true, true, detail, screenX, screenY,
clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button,
@@ -744,8 +722,8 @@
* {@link NativeEvent#BUTTON_LEFT} et al)
* @return the event object
*/
- public final NativeEvent createMouseUpEvent(int detail, int screenX,
- int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey,
+ public final NativeEvent createMouseUpEvent(int detail, int screenX, int screenY,
+ int clientX, int clientY, boolean ctrlKey, boolean altKey,
boolean shiftKey, boolean metaKey, int button) {
return createMouseEvent("mouseup", true, true, detail, screenX, screenY,
clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, null);
@@ -775,8 +753,7 @@
* @return the newly created element
*/
public final OptGroupElement createOptGroupElement() {
- return (OptGroupElement) DOMImpl.impl.createElement(this,
- OptGroupElement.TAG);
+ return (OptGroupElement) DOMImpl.impl.createElement(this, OptGroupElement.TAG);
}
/**
@@ -812,8 +789,7 @@
* @return the newly created element
*/
public final ParagraphElement createPElement() {
- return (ParagraphElement) DOMImpl.impl.createElement(this,
- ParagraphElement.TAG);
+ return (ParagraphElement) DOMImpl.impl.createElement(this, ParagraphElement.TAG);
}
/**
@@ -826,15 +802,6 @@
}
/**
- * Creates a <button type='button'> element.
- *
- * @return the newly created element
- */
- public final ButtonElement createPushButtonElement() {
- return DOMImpl.impl.createButtonElement(this, "button");
- }
-
- /**
* Creates a <q> element.
*
* @return the newly created element
@@ -854,24 +821,6 @@
}
/**
- * Creates a <button type='reset'> element.
- *
- * @return the newly created element
- */
- public final ButtonElement createResetButtonElement() {
- return DOMImpl.impl.createButtonElement(this, "reset");
- }
-
- /**
- * Creates an <input type='reset'> element.
- *
- * @return the newly created element
- */
- public final InputElement createResetInputElement() {
- return DOMImpl.impl.createInputElement(this, "reset");
- }
-
- /**
* Creates a <script> element.
*
* @return the newly created element
@@ -940,15 +889,6 @@
}
/**
- * Creates a <button type='submit'> element.
- *
- * @return the newly created element
- */
- public final ButtonElement createSubmitButtonElement() {
- return DOMImpl.impl.createButtonElement(this, "submit");
- }
-
- /**
* Creates an <input type='submit'> element.
*
* @return the newly created element
@@ -972,8 +912,7 @@
* @return the newly created element
*/
public final TableSectionElement createTBodyElement() {
- return (TableSectionElement) DOMImpl.impl.createElement(this,
- TableSectionElement.TAG_TBODY);
+ return (TableSectionElement) DOMImpl.impl.createElement(this, TableSectionElement.TAG_TBODY);
}
/**
@@ -982,8 +921,7 @@
* @return the newly created element
*/
public final TableCellElement createTDElement() {
- return (TableCellElement) DOMImpl.impl.createElement(this,
- TableCellElement.TAG_TD);
+ return (TableCellElement) DOMImpl.impl.createElement(this, TableCellElement.TAG_TD);
}
/**
@@ -992,8 +930,7 @@
* @return the newly created element
*/
public final TextAreaElement createTextAreaElement() {
- return (TextAreaElement) DOMImpl.impl.createElement(this,
- TextAreaElement.TAG);
+ return (TextAreaElement) DOMImpl.impl.createElement(this, TextAreaElement.TAG);
}
/**
@@ -1021,8 +958,7 @@
* @return the newly created element
*/
public final TableSectionElement createTFootElement() {
- return (TableSectionElement) DOMImpl.impl.createElement(this,
- TableSectionElement.TAG_TFOOT);
+ return (TableSectionElement) DOMImpl.impl.createElement(this, TableSectionElement.TAG_TFOOT);
}
/**
@@ -1031,8 +967,7 @@
* @return the newly created element
*/
public final TableSectionElement createTHeadElement() {
- return (TableSectionElement) DOMImpl.impl.createElement(this,
- TableSectionElement.TAG_THEAD);
+ return (TableSectionElement) DOMImpl.impl.createElement(this, TableSectionElement.TAG_THEAD);
}
/**
@@ -1041,8 +976,7 @@
* @return the newly created element
*/
public final TableCellElement createTHElement() {
- return (TableCellElement) DOMImpl.impl.createElement(this,
- TableCellElement.TAG_TH);
+ return (TableCellElement) DOMImpl.impl.createElement(this, TableCellElement.TAG_TH);
}
/**
@@ -1060,8 +994,7 @@
* @return the newly created element
*/
public final TableRowElement createTRElement() {
- return (TableRowElement) DOMImpl.impl.createElement(this,
- TableRowElement.TAG);
+ return (TableRowElement) DOMImpl.impl.createElement(this, TableRowElement.TAG);
}
/**
diff --git a/user/src/com/google/gwt/user/client/ui/Button.java b/user/src/com/google/gwt/user/client/ui/Button.java
index 895483b..0f7863c 100644
--- a/user/src/com/google/gwt/user/client/ui/Button.java
+++ b/user/src/com/google/gwt/user/client/ui/Button.java
@@ -28,10 +28,9 @@
* </p>
*
* <h3>CSS Style Rules</h3>
- * <dl>
- * <dt>.gwt-Button</dt>
- * <dd>the outer element</dd>
- * </dl>
+ * <ul class="css">
+ * <li>.gwt-Button { }</li>
+ * </ul>
*
* <p>
* <h3>Example</h3>
@@ -54,7 +53,6 @@
assert Document.get().getBody().isOrHasChild(element);
Button button = new Button(element);
- assert "button".equalsIgnoreCase(button.getButtonElement().getType());
// Mark it attached and remember it for cleanup.
button.onAttach();
@@ -63,11 +61,22 @@
return button;
}
+ static native void adjustType(Element button) /*-{
+ // Check before setting this attribute, as not all browsers define it.
+ if (button.type == 'submit') {
+ try {
+ button.setAttribute("type", "button");
+ } catch (e) {
+ }
+ }
+ }-*/;
+
/**
* Creates a button with no caption.
*/
public Button() {
- super(Document.get().createPushButtonElement());
+ super(Document.get().createButtonElement());
+ adjustType(getElement());
setStyleName("gwt-Button");
}
@@ -123,12 +132,8 @@
getButtonElement().click();
}
- /**
- * Get the underlying button element.
- *
- * @return the {@link ButtonElement}
- */
- protected ButtonElement getButtonElement() {
+ private ButtonElement getButtonElement() {
return getElement().cast();
}
}
+
diff --git a/user/src/com/google/gwt/user/client/ui/FormPanel.java b/user/src/com/google/gwt/user/client/ui/FormPanel.java
index cf7407a..404fcbb 100644
--- a/user/src/com/google/gwt/user/client/ui/FormPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/FormPanel.java
@@ -569,23 +569,24 @@
// Create and attach a hidden iframe to the body element.
createFrame();
Document.get().getBody().appendChild(synthesizedFrame);
+
+ // Hook up the underlying iframe's onLoad event when attached to the DOM.
+ // Making this connection only when attached avoids memory-leak issues.
+ // The FormPanel cannot use the built-in GWT event-handling mechanism
+ // because there is no standard onLoad event on iframes that works across
+ // browsers.
+ impl.hookEvents(synthesizedFrame, getElement(), this);
}
- // Hook up the underlying iframe's onLoad event when attached to the DOM.
- // Making this connection only when attached avoids memory-leak issues.
- // The FormPanel cannot use the built-in GWT event-handling mechanism
- // because there is no standard onLoad event on iframes that works across
- // browsers.
- impl.hookEvents(synthesizedFrame, getElement(), this);
}
@Override
protected void onDetach() {
super.onDetach();
- // Unhook the iframe's onLoad when detached.
- impl.unhookEvents(synthesizedFrame, getElement());
-
if (synthesizedFrame != null) {
+ // Unhook the iframe's onLoad when detached.
+ impl.unhookEvents(synthesizedFrame, getElement());
+
// And remove it from the document.
Document.get().getBody().removeChild(synthesizedFrame);
synthesizedFrame = null;
diff --git a/user/src/com/google/gwt/user/client/ui/ResetButton.java b/user/src/com/google/gwt/user/client/ui/ResetButton.java
deleted file mode 100644
index 83bc66c..0000000
--- a/user/src/com/google/gwt/user/client/ui/ResetButton.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.user.client.ui;
-
-import com.google.gwt.dom.client.ButtonElement;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.event.dom.client.ClickHandler;
-
-/**
- * A standard push-button widget which will automatically reset its enclosing
- * {@link FormPanel} if any.
- *
- * <h3>CSS Style Rules</h3>
- * <dl>
- * <dt>.gwt-ResetButton</dt>
- * <dd>the outer element</dd>
- * </dl>
- */
-public class ResetButton extends Button {
-
- /**
- * Creates a ResetButton widget that wraps an existing <button> element.
- *
- * This element must already be attached to the document. If the element is
- * removed from the document, you must call
- * {@link RootPanel#detachNow(Widget)}.
- *
- * @param element the element to be wrapped
- */
- public static Button wrap(com.google.gwt.dom.client.Element element) {
- // Assert that the element is attached.
- assert Document.get().getBody().isOrHasChild(element);
-
- ResetButton button = new ResetButton(element);
-
- // Mark it attached and remember it for cleanup.
- button.onAttach();
- RootPanel.detachOnWindowClose(button);
-
- return button;
- }
-
- /**
- * Creates a button with no caption.
- */
- public ResetButton() {
- super(Document.get().createResetButtonElement());
- setStyleName("gwt-ResetButton");
- }
-
- /**
- * Creates a button with the given HTML caption.
- *
- * @param html the HTML caption
- */
- public ResetButton(String html) {
- this();
- setHTML(html);
- }
-
- /**
- * Creates a button with the given HTML caption and click listener.
- *
- * @param html the HTML caption
- * @param handler the click handler
- */
- public ResetButton(String html, ClickHandler handler) {
- this(html);
- addClickHandler(handler);
- }
-
- /**
- * This constructor may be used by subclasses to explicitly use an existing
- * element. This element must be a <button> element with type reset.
- *
- * @param element the element to be used
- */
- protected ResetButton(com.google.gwt.dom.client.Element element) {
- super(element);
- assert "reset".equalsIgnoreCase(element.<ButtonElement> cast().getType());
- }
-}
diff --git a/user/src/com/google/gwt/user/client/ui/SubmitButton.java b/user/src/com/google/gwt/user/client/ui/SubmitButton.java
deleted file mode 100644
index c86f466..0000000
--- a/user/src/com/google/gwt/user/client/ui/SubmitButton.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.user.client.ui;
-
-import com.google.gwt.dom.client.ButtonElement;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.event.dom.client.ClickHandler;
-
-/**
- * A standard push-button widget which will automatically submit its enclosing
- * {@link FormPanel} if any.
- *
- * <h3>CSS Style Rules</h3>
- * <dl>
- * <dt>.gwt-SubmitButton</dt>
- * <dd>the outer element</dd>
- * </dl>
- */
-public class SubmitButton extends Button {
-
- /**
- * Creates a SubmitButton widget that wraps an existing <button>
- * element.
- *
- * This element must already be attached to the document. If the element is
- * removed from the document, you must call
- * {@link RootPanel#detachNow(Widget)}.
- *
- * @param element the element to be wrapped
- */
- public static Button wrap(com.google.gwt.dom.client.Element element) {
- // Assert that the element is attached.
- assert Document.get().getBody().isOrHasChild(element);
-
- SubmitButton button = new SubmitButton(element);
- assert "submit".equalsIgnoreCase(button.getButtonElement().getType());
-
- // Mark it attached and remember it for cleanup.
- button.onAttach();
- RootPanel.detachOnWindowClose(button);
-
- return button;
- }
-
- /**
- * Creates a button with no caption.
- */
- public SubmitButton() {
- super(Document.get().createSubmitButtonElement());
- setStyleName("gwt-SubmitButton");
- }
-
- /**
- * Creates a button with the given HTML caption.
- *
- * @param html the HTML caption
- */
- public SubmitButton(String html) {
- this();
- setHTML(html);
- }
-
- /**
- * Creates a button with the given HTML caption and click listener.
- *
- * @param html the HTML caption
- * @param handler the click handler
- */
- public SubmitButton(String html, ClickHandler handler) {
- this(html);
- addClickHandler(handler);
- }
-
- /**
- * This constructor may be used by subclasses to explicitly use an existing
- * element. This element must be a <button> element with type submit.
- *
- * @param element the element to be used
- */
- protected SubmitButton(com.google.gwt.dom.client.Element element) {
- super(element);
- assert "submit".equalsIgnoreCase(element.<ButtonElement> cast().getType());
- }
-}
diff --git a/user/test/com/google/gwt/dom/client/DocumentTest.java b/user/test/com/google/gwt/dom/client/DocumentTest.java
index dc66082..2cf11b8 100644
--- a/user/test/com/google/gwt/dom/client/DocumentTest.java
+++ b/user/test/com/google/gwt/dom/client/DocumentTest.java
@@ -37,6 +37,7 @@
assertEquals("blockquote",
doc.createBlockQuoteElement().getTagName().toLowerCase());
assertEquals("br", doc.createBRElement().getTagName().toLowerCase());
+ assertEquals("button", doc.createButtonElement().getTagName().toLowerCase());
assertEquals("caption",
doc.createCaptionElement().getTagName().toLowerCase());
assertEquals("col", doc.createColElement().getTagName().toLowerCase());
@@ -90,20 +91,6 @@
assertEquals("tr", doc.createTRElement().getTagName().toLowerCase());
assertEquals("ul", doc.createULElement().getTagName().toLowerCase());
- assertEquals("button",
- doc.createPushButtonElement().getTagName().toLowerCase());
- assertEquals("button",
- doc.createResetButtonElement().getTagName().toLowerCase());
- assertEquals("button",
- doc.createSubmitButtonElement().getTagName().toLowerCase());
-
- assertEquals("button",
- doc.createPushButtonElement().getType().toLowerCase());
- assertEquals("reset",
- doc.createResetButtonElement().getType().toLowerCase());
- assertEquals("submit",
- doc.createSubmitButtonElement().getType().toLowerCase());
-
assertEquals("input",
doc.createCheckInputElement().getTagName().toLowerCase());
assertEquals("input",
@@ -119,8 +106,6 @@
assertEquals("input",
doc.createTextInputElement().getTagName().toLowerCase());
- assertEquals("button",
- doc.createButtonInputElement().getType().toLowerCase());
assertEquals("checkbox",
doc.createCheckInputElement().getType().toLowerCase());
assertEquals("file", doc.createFileInputElement().getType().toLowerCase());
@@ -131,9 +116,6 @@
doc.createPasswordInputElement().getType().toLowerCase());
assertEquals("radio",
doc.createRadioInputElement("foo").getType().toLowerCase());
- assertEquals("reset", doc.createResetInputElement().getType().toLowerCase());
- assertEquals("submit",
- doc.createSubmitInputElement().getType().toLowerCase());
assertEquals("text", doc.createTextInputElement().getType().toLowerCase());
}
diff --git a/user/test/com/google/gwt/dom/client/ElementTest.java b/user/test/com/google/gwt/dom/client/ElementTest.java
index b332018..6d19163 100644
--- a/user/test/com/google/gwt/dom/client/ElementTest.java
+++ b/user/test/com/google/gwt/dom/client/ElementTest.java
@@ -75,7 +75,7 @@
* Test round-trip of the 'disabled' property.
*/
public void testDisabled() {
- ButtonElement button = Document.get().createPushButtonElement();
+ ButtonElement button = Document.get().createButtonElement();
assertFalse(button.isDisabled());
button.setDisabled(true);
assertTrue(button.isDisabled());
diff --git a/user/test/com/google/gwt/user/UISuite.java b/user/test/com/google/gwt/user/UISuite.java
index 235b5e6..f15e74e 100644
--- a/user/test/com/google/gwt/user/UISuite.java
+++ b/user/test/com/google/gwt/user/UISuite.java
@@ -133,7 +133,6 @@
suite.addTestSuite(FlexTableTest.class);
suite.addTestSuite(FlowPanelTest.class);
suite.addTestSuite(FocusPanelTest.class);
- // Old Mozilla complains about the cross-site forms in FormPanelTest.
// suite.addTestSuite(FormPanelTest.class);
suite.addTestSuite(GridTest.class);
suite.addTestSuite(HiddenTest.class);
diff --git a/user/test/com/google/gwt/user/client/ui/ButtonTest.java b/user/test/com/google/gwt/user/client/ui/ButtonTest.java
index f570f20..0fcf4dd 100644
--- a/user/test/com/google/gwt/user/client/ui/ButtonTest.java
+++ b/user/test/com/google/gwt/user/client/ui/ButtonTest.java
@@ -19,16 +19,12 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
-import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;
/**
* Tests for {@link Button}.
*/
public class ButtonTest extends GWTTestCase {
- @Override
public String getModuleName() {
return "com.google.gwt.user.User";
}
@@ -43,26 +39,6 @@
}
}
- private static class H2 implements SubmitHandler {
- boolean submitted;
-
- public void onSubmit(SubmitEvent event) {
- submitted = true;
- event.cancel();
- }
- }
-
- public void testButton() {
- Button pushButton = new Button();
- assertEquals("button", pushButton.getButtonElement().getType());
-
- ResetButton resetButton = new ResetButton();
- assertEquals("reset", resetButton.getButtonElement().getType());
-
- SubmitButton submitButton = new SubmitButton();
- assertEquals("submit", submitButton.getButtonElement().getType());
- }
-
public void testClick() {
Button b = new Button();
RootPanel.get().add(b);
@@ -77,30 +53,5 @@
// synthesized clicks. This tests the workaround in DOMImplMozillaOld.
assertEquals(b.getElement(), h.target);
}
-
- /**
- * Tests issues 1585 and 3962: a button shouldn't submit a form.
- */
- public void testPushButton() {
- FormPanel f = new FormPanel();
- f.setAction("javascript:''");
- RootPanel.get().add(f);
-
- Button b = new Button();
- f.setWidget(b);
-
- final H2 h = new H2();
- f.addSubmitHandler(h);
-
- delayTestFinish(5000);
- new Timer() {
- @Override
- public void run() {
- assertFalse(h.submitted);
- finishTest();
- }
- }.schedule(2500);
-
- b.click();
- }
}
+
diff --git a/user/test/com/google/gwt/user/client/ui/FormPanelTest.java b/user/test/com/google/gwt/user/client/ui/FormPanelTest.java
index bd8684a..90f6ba4 100644
--- a/user/test/com/google/gwt/user/client/ui/FormPanelTest.java
+++ b/user/test/com/google/gwt/user/client/ui/FormPanelTest.java
@@ -18,22 +18,18 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.InputElement;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
-import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;
import com.google.gwt.user.client.ui.HasWidgetsTester.WidgetAdder;
/**
* Tests the FormPanel.
*
- * @see com.google.gwt.user.server.ui.FormPanelTestServlet
+ * @see FormPanelTestServlet
*/
public class FormPanelTest extends GWTTestCase {
public static boolean clicked = false;
- @Override
public String getModuleName() {
return "com.google.gwt.user.FormPanelTest";
}
@@ -166,47 +162,14 @@
form.submit();
}
- public void testNamedTargetSubmitEvent() {
- // Create a form and frame in the document we can wrap.
- String uid = Document.get().createUniqueId();
- HTML formAndFrame = new HTML(
- "<form id='"
- + uid
- + "' method='post' target='targetFrame' action='"
- + GWT.getModuleBaseURL()
- + "formHandler?sendHappyHtml'>"
- + "<input type='submit' id='submitBtn'></input></form>"
- + "<iframe src='javascript:\'\'' id='targetMe' name='targetFrame'></iframe>");
- RootPanel.get().add(formAndFrame);
-
- // Wrap the form and make sure its target frame is intact.
- FormPanel form = FormPanel.wrap(Document.get().getElementById(uid));
- assertEquals("targetFrame", form.getTarget());
-
- // Ensure that no synthesized iframe was created.
- assertNull(form.getSynthesizedIFrame());
-
- // Submit the form using the submit button and make sure the submit event fires.
- delayTestFinish(5000);
- form.addSubmitHandler(new SubmitHandler() {
- public void onSubmit(SubmitEvent event) {
- finishTest();
- }
- });
-
- Document.get().getElementById("submitBtn").<InputElement>cast().click();
- }
-
public void testReset() {
FormPanel form = new FormPanel();
- RootPanel.get().add(form);
TextBox textBox = new TextBox();
textBox.setText("Hello World");
form.setWidget(textBox);
assertEquals("Hello World", textBox.getText());
form.reset();
assertEquals("", textBox.getText());
- RootPanel.get().remove(form);
}
public void testSubmitAndHideDialog() {
@@ -256,7 +219,6 @@
delayTestFinish(10000);
Timer t = new Timer() {
- @Override
public void run() {
// Make sure the frame got the contents we expected.
assertTrue(isHappyDivPresent(frame.getElement()));