diff --git a/user/src/com/google/gwt/dom/client/DOMImpl.java b/user/src/com/google/gwt/dom/client/DOMImpl.java index a4d5a8d5717..5dd8578751c 100644 --- a/user/src/com/google/gwt/dom/client/DOMImpl.java +++ b/user/src/com/google/gwt/dom/client/DOMImpl.java @@ -194,14 +194,6 @@ public native String getAttribute(Element elem, String name) /*-{ return elem.getAttribute(name) || ''; }-*/; - public native int getBodyOffsetLeft(Document doc) /*-{ - return 0; - }-*/; - - public native int getBodyOffsetTop(Document doc) /*-{ - return 0; - }-*/; - public native JsArray getChangedTouches(NativeEvent evt) /*-{ return evt.changedTouches; }-*/; diff --git a/user/src/com/google/gwt/dom/client/DOMImplMozilla.java b/user/src/com/google/gwt/dom/client/DOMImplMozilla.java index 1c48b0b3b0e..77066a6b7b3 100644 --- a/user/src/com/google/gwt/dom/client/DOMImplMozilla.java +++ b/user/src/com/google/gwt/dom/client/DOMImplMozilla.java @@ -20,86 +20,6 @@ */ class DOMImplMozilla extends DOMImplStandard { - private static int cachedGeckoVersion = -2; - - private static int getGeckoVersion() { - if (cachedGeckoVersion == -2) { - cachedGeckoVersion = getNativeGeckoVersion(); - } - return cachedGeckoVersion; - } - - private static native int getNativeGeckoVersion() /*-{ - var result = /rv:([0-9]+)\.([0-9]+)(\.([0-9]+))?.*?/.exec(navigator.userAgent.toLowerCase()); - if (result && result.length >= 3) { - var version = (parseInt(result[1]) * 1000000) + (parseInt(result[2]) * 1000) + - parseInt(result.length >= 5 && !isNaN(result[4]) ? result[4] : 0); - return version; - } - return -1; // not gecko - }-*/; - - /** - * Return true if using Gecko 1.9 (Firefox 3) or later. - * - * @return true if using Gecko 1.9 (Firefox 3) or later - */ - private static boolean isGecko19() { - int geckoVersion = getGeckoVersion(); - return (geckoVersion != -1) && (geckoVersion >= 1009000); - } - - /** - * Return true if using Gecko 1.9.0 (Firefox 3) or earlier. - * - * @return true if using Gecko 1.9.0 (Firefox 3) or earlier - */ - private static boolean isGecko190OrBefore() { - int geckoVersion = getGeckoVersion(); - return (geckoVersion != -1) && (geckoVersion <= 1009000); - } - - /** - * Return true if using Gecko 1.9.1 (Firefox 3.5) or earlier. - * - * @return true if using Gecko 1.9.1 (Firefox 3.5) or earlier - */ - private static boolean isGecko191OrBefore() { - int geckoVersion = getGeckoVersion(); - return (geckoVersion != -1) && (geckoVersion <= 1009001); - } - - /** - * Return true if using Gecko 1.9.2 (Firefox 3.6) or earlier. - * - * @return true if using Gecko 1.9.2 (Firefox 3.6) or earlier - */ - private static boolean isGecko192OrBefore() { - int geckoVersion = getGeckoVersion(); - return (geckoVersion != -1) && (geckoVersion <= 1009002); - } - - /** - * Return true if using Gecko 2.0.0 (Firefox 4.0) or earlier. - * - * @return true if using Gecko 2.0.0 (Firefox 4.0) or earlier - */ - private static boolean isGecko2OrBefore() { - int geckoVersion = getGeckoVersion(); - return (geckoVersion != -1) && (geckoVersion < 2000000); - } - - @Override - public native void buttonClick(ButtonElement button) /*-{ - var doc = button.ownerDocument; - if (doc != null) { - var evt = doc.createEvent('MouseEvents'); - evt.initMouseEvent('click', true, true, null, 0, 0, - 0, 0, 0, false, false, false, false, 0, null); - button.dispatchEvent(evt); - } - }-*/; - @Override public NativeEvent createKeyCodeEvent(Document doc, String type, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, @@ -124,23 +44,6 @@ public NativeEvent createKeyPressEvent(Document doc, boolean ctrlKey, shiftKey, metaKey, 0, charCode); } - @Override - public native EventTarget eventGetRelatedTarget(NativeEvent evt) /*-{ - // Hack around Mozilla bug 497780 (relatedTarget sometimes returns XUL - // elements). Trying to access relatedTarget.nodeName will throw an - // exception if it's a XUL element. - var relatedTarget = evt.relatedTarget; - if (!relatedTarget) { - return null; - } - try { - var nodeName = relatedTarget.nodeName; - return relatedTarget; - } catch (e) { - return null; - } - }-*/; - @Override public int getAbsoluteLeft(Element elem) { return getAbsoluteLeftImpl(elem.getOwnerDocument().getViewportElement(), @@ -153,26 +56,6 @@ public int getAbsoluteTop(Element elem) { elem); } - @Override - public native int getBodyOffsetLeft(Document doc) /*-{ - var style = $wnd.getComputedStyle(doc.documentElement, null); - if (style == null) { - // Works around https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - return 0; - } - return parseInt(style.marginLeft, 10) + parseInt(style.borderLeftWidth, 10); - }-*/; - - @Override - public native int getBodyOffsetTop(Document doc) /*-{ - var style = $wnd.getComputedStyle(doc.documentElement, null); - if (style == null) { - // Works around https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - return 0; - } - return parseInt(style.marginTop, 10) + parseInt(style.borderTopWidth, 10); - }-*/; - @Override public native int getNodeType(Node node) /*-{ try { @@ -184,121 +67,32 @@ public native int getNodeType(Node node) /*-{ // // See https://bugzilla.mozilla.org/show_bug.cgi?id=208427 // and http://code.google.com/p/google-web-toolkit/issues/detail?id=1909 + // Fixed FF 148, reevaluate once ESR > 148 return 0; } }-*/; - @Override - public int getScrollLeft(Element elem) { - if (!isGecko19() && isRTL(elem)) { - return super.getScrollLeft(elem) - - (elem.getScrollWidth() - elem.getClientWidth()); - } - return super.getScrollLeft(elem); - } - - @Override - public native boolean isOrHasChild(Node parent, Node child) /*-{ - // For more information about compareDocumentPosition, see: - // http://www.quirksmode.org/blog/archives/2006/01/contains_for_mo.html - return (parent === child) || !!(parent.compareDocumentPosition(child) & 16); - }-*/; - - @Override - public void setScrollLeft(Element elem, int left) { - if (!isGecko19() && isRTL(elem)) { - left += elem.getScrollWidth() - elem.getClientWidth(); - } - super.setScrollLeft(elem, left); - } - - @Override - public native String toString(Element elem) /*-{ - // Basic idea is to use the innerHTML property by copying the node into a - // div and getting the innerHTML - var doc = elem.ownerDocument; - var temp = elem.cloneNode(true); - var tempDiv = doc.createElement("DIV"); - tempDiv.appendChild(temp); - outer = tempDiv.innerHTML; - temp.innerHTML = ""; - return outer; - }-*/; - private native NativeEvent createKeyEventImpl(Document doc, String type, boolean canBubble, boolean cancelable, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode) /*-{ - if (!!window.KeyboardEvent) { - return new KeyboardEvent(type, { - ctrlKey: ctrlKey, - altKey: altKey, - shiftKey: shiftKey, - metaKey: metaKey, - keyCode: keyCode, - charCode: charCode, - bubbles: canBubble, - cancelable: cancelable - }); - } - var evt = doc.createEvent('KeyboardEvent'); - if (evt.initKeyEvent) { - // Gecko - evt.initKeyEvent(type, canBubble, cancelable, null, ctrlKey, altKey, - shiftKey, metaKey, keyCode, charCode); - } else { - // This happens to be IE11+ as of today - if ($wnd.console) { - $wnd.console.error("Synthetic keyboard events are not supported in this browser"); - } - } - return evt; + return new KeyboardEvent(type, { + ctrlKey: ctrlKey, + altKey: altKey, + shiftKey: shiftKey, + metaKey: metaKey, + keyCode: keyCode, + charCode: charCode, + bubbles: canBubble, + cancelable: cancelable + }); }-*/; private native int getAbsoluteLeftImpl(Element viewport, Element elem) /*-{ - // Firefox 3 is actively throwing errors when getBoxObjectFor() is called, - // so we use getBoundingClientRect() whenever possible (but it's not - // supported on older versions). If changing this code, make sure to check - // the museum entry for issue 1932. - // (x) | 0 is used to coerce the value to an integer - if (Element.prototype.getBoundingClientRect) { - return (elem.getBoundingClientRect().left + viewport.scrollLeft) | 0; - } else { - // We cannot use DOMImpl here because offsetLeft/Top return erroneous - // values when overflow is not visible. We have to difference screenX - // here due to a change in getBoxObjectFor which causes inconsistencies - // on whether the calculations are inside or outside of the element's - // border. - // If the element is in a scrollable div, getBoxObjectFor(elem) can return - // a value that varies by 1 pixel. - var doc = elem.ownerDocument; - return doc.getBoxObjectFor(elem).screenX - - doc.getBoxObjectFor(doc.documentElement).screenX; - } + return (elem.getBoundingClientRect().left + viewport.scrollLeft) | 0; }-*/; private native int getAbsoluteTopImpl(Element viewport, Element elem) /*-{ - // Firefox 3 is actively throwing errors when getBoxObjectFor() is called, - // so we use getBoundingClientRect() whenever possible (but it's not - // supported on older versions). If changing this code, make sure to check - // the museum entry for issue 1932. - // (x) | 0 is used to coerce the value to an integer - if (Element.prototype.getBoundingClientRect) { - return (elem.getBoundingClientRect().top + viewport.scrollTop) | 0; - } else { - // We cannot use DOMImpl here because offsetLeft/Top return erroneous - // values when overflow is not visible. We have to difference screenX - // here due to a change in getBoxObjectFor which causes inconsistencies - // on whether the calculations are inside or outside of the element's - // border. - var doc = elem.ownerDocument; - return doc.getBoxObjectFor(elem).screenY - - doc.getBoxObjectFor(doc.documentElement).screenY; - } - }-*/; - - private native boolean isRTL(Element elem) /*-{ - var style = elem.ownerDocument.defaultView.getComputedStyle(elem, null); - return style.direction == 'rtl'; + return (elem.getBoundingClientRect().top + viewport.scrollTop) | 0; }-*/; } diff --git a/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java b/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java index 1ba6dd3357d..631c35db5f9 100644 --- a/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java +++ b/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java @@ -146,7 +146,7 @@ private static native double getAbsoluteTopUsingOffsets(Element elem) /*-{ }-*/; private static native ClientRect getBoundingClientRect(Element element) /*-{ - return element.getBoundingClientRect && element.getBoundingClientRect(); + return element.getBoundingClientRect(); }-*/; /** @@ -207,18 +207,16 @@ public native EventTarget eventGetCurrentTarget(NativeEvent event) /*-{ @Override public int getAbsoluteLeft(Element elem) { ClientRect rect = getBoundingClientRect(elem); - double left = rect != null ? rect.getSubPixelLeft() - + getScrollLeft(elem.getOwnerDocument()) - : getAbsoluteLeftUsingOffsets(elem); + double left = rect.getSubPixelLeft() + + getScrollLeft(elem.getOwnerDocument()); return toInt32(left); } @Override public int getAbsoluteTop(Element elem) { ClientRect rect = getBoundingClientRect(elem); - double top = rect != null ? rect.getSubPixelTop() - + getScrollTop(elem.getOwnerDocument()) - : getAbsoluteTopUsingOffsets(elem); + double top = rect.getSubPixelTop() + + getScrollTop(elem.getOwnerDocument()); return toInt32(top); } diff --git a/user/src/com/google/gwt/dom/client/Document.java b/user/src/com/google/gwt/dom/client/Document.java index e72c8233a4c..d00b302331f 100644 --- a/user/src/com/google/gwt/dom/client/Document.java +++ b/user/src/com/google/gwt/dom/client/Document.java @@ -1270,46 +1270,27 @@ public final native BodyElement getBody() /*-{ }-*/; /** - * Returns the left offset between the absolute coordinate system and the - * body's positioning context. This method is useful for positioning children - * of the body element in absolute coordinates. + * This used to account for the difference between absolute position of elements + * and client coordinates of mouse events, but those are the same in modern browsers. + * Kept for compatibility. * - *

- * For example, to position an element directly under the mouse cursor - * (assuming you are handling a mouse event), do the following: - *

- * - *
-   * Event event;
-   * Document doc;
-   * DivElement child;  // assume absolutely-positioned child of the body
-   * 
-   * // Get the event location in absolute coordinates.
-   * int absX = event.getClientX() + Window.getScrollLeft();
-   * int absY = event.getClientY() + Window.getScrollTop();
-   * 
-   * // Position the child element, adjusting for the difference between the
-   * // absolute coordinate system and the body's positioning coordinates.
-   * child.getStyle().setPropertyPx("left", absX - doc.getBodyOffsetLeft());
-   * child.getStyle().setPropertyPx("top", absY - doc.getBodyOffsetTop());
-   * 
- * - * @return the left offset of the body's positioning coordinate system + * @return 0 + * @deprecated can be replaced with constant 0 */ + @Deprecated public final int getBodyOffsetLeft() { - return DOMImpl.impl.getBodyOffsetLeft(this); + return 0; } /** - * Returns the top offset between the absolute coordinate system and the - * body's positioning context. This method is useful for positioning children - * of the body element in absolute coordinates. + * Kept for compatibility, analogous to {@link #getBodyOffsetLeft`()}. * - * @return the top offset of the body's positioning coordinate system - * @see #getBodyOffsetLeft() + * @return 0 + * @deprecated can be replaced with constant 0 */ + @Deprecated public final int getBodyOffsetTop() { - return DOMImpl.impl.getBodyOffsetTop(this); + return 0; } /** diff --git a/user/src/com/google/gwt/storage/client/Storage.java b/user/src/com/google/gwt/storage/client/Storage.java index 42ba6b63751..744fb1535dd 100644 --- a/user/src/com/google/gwt/storage/client/Storage.java +++ b/user/src/com/google/gwt/storage/client/Storage.java @@ -259,9 +259,6 @@ public void removeItem(String key) { * Storage - Storage.setItem(k,v) */ public void setItem(String key, String data) { - // prevent the empty string due to a Firefox bug: - // bugzilla.mozilla.org/show_bug.cgi?id=510849 - assert key.length() > 0; impl.setItem(storage, key, data); } } diff --git a/user/src/com/google/gwt/user/Window.gwt.xml b/user/src/com/google/gwt/user/Window.gwt.xml index 079990c4637..4c114798545 100644 --- a/user/src/com/google/gwt/user/Window.gwt.xml +++ b/user/src/com/google/gwt/user/Window.gwt.xml @@ -19,9 +19,4 @@ - - - - - diff --git a/user/src/com/google/gwt/user/cellview/CellView.gwt.xml b/user/src/com/google/gwt/user/cellview/CellView.gwt.xml index 79fdd63c347..a3c2a5dda50 100644 --- a/user/src/com/google/gwt/user/cellview/CellView.gwt.xml +++ b/user/src/com/google/gwt/user/cellview/CellView.gwt.xml @@ -37,12 +37,4 @@ - - - - - - - - diff --git a/user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java b/user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java index 59738224886..cd53f80be12 100644 --- a/user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java +++ b/user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java @@ -638,44 +638,14 @@ protected void replaceAllRowsImpl(AbstractCellTable table, TableSectionElemen } } - /** - * Implementation of {@link CellTable} used by Firefox. - */ - @SuppressWarnings("unused") - private static class ImplMozilla extends Impl { - /** - * Firefox 3.6 and earlier convert td elements to divs if the tbody is - * removed from the table element. - */ - @Override - protected void detachSectionElement(TableSectionElement section) { - if (isGecko192OrBefore()) { - return; - } - super.detachSectionElement(section); - } - - @Override - protected void reattachSectionElement(Element parent, TableSectionElement section, - Element nextSection) { - if (isGecko192OrBefore()) { - return; - } - super.reattachSectionElement(parent, section, nextSection); - } - - /** - * Return true if using Gecko 1.9.2 (Firefox 3.6) or earlier. - */ - private native boolean isGecko192OrBefore() /*-{ - return @com.google.gwt.dom.client.DOMImplMozilla::isGecko192OrBefore()(); - }-*/; - } - /** * Implementation of {@link AbstractCellTable} used by IE. + * + * @deprecated Unused since 2.10.0, left in place to permit downstream users to continue to + * use it in GWT module files. */ @SuppressWarnings("unused") + @Deprecated private static class ImplTrident extends Impl { /** @@ -1664,7 +1634,7 @@ public void setSkipRowHoverFloatElementCheck(boolean skipRowHoverFloatElementChe * Sets the skipRowHoverStyleUpdate flag. If set, the CellTable will not update * the row's style on row-level hover events (MOUSEOVER and MOUSEOUT). * - * @param skipRowHoverCheck the new flag value + * @param skipRowHoverStyleUpdate the new flag value */ public void setSkipRowHoverStyleUpdate(boolean skipRowHoverStyleUpdate) { this.skipRowHoverStyleUpdate = skipRowHoverStyleUpdate; @@ -1949,8 +1919,8 @@ protected void onBrowserEvent2(Event event) { boolean unhover = true; if (!skipRowHoverFloatElementCheck) { // Ignore events happening directly over the hovering row. If there are floating element - // on top of the row, mouseout event should not be triggered. This is to avoid the flickring - // effect if the floating element is shown/hide based on hover event. + // on top of the row, mouseout event should not be triggered. This is to avoid the + // flickering effect if the floating element is shown/hide based on hover event. int clientX = event.getClientX() + Window.getScrollLeft(); int clientY = event.getClientY() + Window.getScrollTop(); int rowLeft = hoveringRow.getAbsoluteLeft(); @@ -1959,7 +1929,8 @@ protected void onBrowserEvent2(Event event) { int rowHeight = hoveringRow.getOffsetHeight(); int rowBottom = rowTop + rowHeight; int rowRight = rowLeft + rowWidth; - unhover = clientX < rowLeft || clientX > rowRight || clientY < rowTop || clientY > rowBottom; + unhover = clientX < rowLeft || clientX > rowRight + || clientY < rowTop || clientY > rowBottom; } if (unhover) { setRowHover(hoveringRow, event, false, isRowChange); @@ -2587,7 +2558,7 @@ private boolean resetFocusOnCellImpl(Context context, T value, HasCell } /** - * Set a row's hovering style and fire a {@link RowHoverEvent} + * Set a row's hovering style and fire a {@link RowHoverEvent}. * * @param tr the row element * @param event the original event diff --git a/user/src/com/google/gwt/user/client/impl/WindowImplMozilla.java b/user/src/com/google/gwt/user/client/impl/WindowImplMozilla.java index f1cd82d3063..8e9289740d4 100644 --- a/user/src/com/google/gwt/user/client/impl/WindowImplMozilla.java +++ b/user/src/com/google/gwt/user/client/impl/WindowImplMozilla.java @@ -17,20 +17,10 @@ /** * Mozilla implementation of {@link com.google.gwt.user.client.impl.WindowImpl}. + * @deprecated This class is no longer used and has no differences from its superclass, and will + * be removed in a future release. */ +@Deprecated public class WindowImplMozilla extends WindowImpl { - /** - * For Mozilla, reading from $wnd.location.hash decodes the fragment. - * https://bugzilla.mozilla.org/show_bug.cgi?id=483304 - * https://bugzilla.mozilla.org/show_bug.cgi?id=135309 - * To avoid this bug, we use location.href instead. - */ - @Override - public native String getHash() /*-{ - var href = $wnd.location.href; - var hashLoc = href.indexOf("#"); - return (hashLoc > 0) ? href.substring(hashLoc) : ""; - }-*/; - } diff --git a/user/src/com/google/gwt/user/client/ui/DialogBox.java b/user/src/com/google/gwt/user/client/ui/DialogBox.java index 9ac75477674..f810959de06 100644 --- a/user/src/com/google/gwt/user/client/ui/DialogBox.java +++ b/user/src/com/google/gwt/user/client/ui/DialogBox.java @@ -15,7 +15,6 @@ */ package com.google.gwt.user.client.ui; -import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.EventTarget; import com.google.gwt.dom.client.NativeEvent; @@ -186,8 +185,8 @@ public void onMouseUp(MouseUpEvent event) { private boolean dragging; private int dragStartX, dragStartY; private int windowWidth; - private int clientLeft; - private int clientTop; + private final int clientLeft; + private final int clientTop; // Visible for Testing HandlerRegistration resizeHandlerRegistration; @@ -265,8 +264,8 @@ public DialogBox(boolean autoHide, boolean modal, Caption captionWidget) { setStyleName(DEFAULT_STYLENAME); windowWidth = Window.getClientWidth(); - clientLeft = Document.get().getBodyOffsetLeft(); - clientTop = Document.get().getBodyOffsetTop(); + clientLeft = 0; + clientTop = 0; MouseHandler mouseHandler = new MouseHandler(); addDomHandler(mouseHandler, MouseDownEvent.getType()); diff --git a/user/src/com/google/gwt/user/client/ui/PopupPanel.java b/user/src/com/google/gwt/user/client/ui/PopupPanel.java index f08eee2a263..a376021f65f 100644 --- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java +++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java @@ -119,7 +119,7 @@ public interface PositionCallback { *
  • ROLL_DOWN - Expand from the top to the bottom, do not animate hiding
  • * */ - public static enum AnimationType { + public enum AnimationType { CENTER, ONE_WAY_CORNER, ROLL_DOWN } @@ -166,7 +166,7 @@ static class ResizeAnimation extends Animation { * * @param panel the panel to affect */ - public ResizeAnimation(PopupPanel panel) { + ResizeAnimation(PopupPanel panel) { this.curPanel = panel; } @@ -875,11 +875,6 @@ public void setPopupPosition(int left, int top) { leftPosition = left; topPosition = top; - // Account for the difference between absolute position and the - // body's positioning context. - left -= Document.get().getBodyOffsetLeft(); - top -= Document.get().getBodyOffsetTop(); - // Set the popup's position manually, allowing setPopupPosition() to be // called before show() is called (so a popup can be positioned without it // 'jumping' on the screen). diff --git a/user/src/com/google/gwt/user/client/ui/ResizeLayoutPanel.java b/user/src/com/google/gwt/user/client/ui/ResizeLayoutPanel.java index dfaf374cf87..4959df40182 100644 --- a/user/src/com/google/gwt/user/client/ui/ResizeLayoutPanel.java +++ b/user/src/com/google/gwt/user/client/ui/ResizeLayoutPanel.java @@ -263,6 +263,7 @@ private boolean resetScrollables() { /** * Implementation of resize event used by IE. */ + @Deprecated static class ImplTrident extends Impl { @Override diff --git a/user/src/com/google/gwt/user/client/ui/RootPanel.java b/user/src/com/google/gwt/user/client/ui/RootPanel.java index 7397544b394..aaa3451246a 100644 --- a/user/src/com/google/gwt/user/client/ui/RootPanel.java +++ b/user/src/com/google/gwt/user/client/ui/RootPanel.java @@ -40,26 +40,6 @@ */ public class RootPanel extends AbsolutePanel { - /** - * A default RootPanel implementation that wraps the body element. - */ - private static class DefaultRootPanel extends RootPanel { - - public DefaultRootPanel() { - super(getBodyElement()); - } - - @Override - protected void setWidgetPositionImpl(Widget w, int left, int top) { - // Account for the difference between absolute position and the - // body's positioning context. - left -= Document.get().getBodyOffsetLeft(); - top -= Document.get().getBodyOffsetTop(); - - super.setWidgetPositionImpl(w, left, top); - } - } - /** * The singleton command used to detach widgets. */ @@ -203,7 +183,7 @@ public static RootPanel get(String id) { // Create the panel and put it in the map. if (elem == null) { // 'null' means use document's body element. - rp = new DefaultRootPanel(); + rp = new RootPanel(getBodyElement()); } else { // Otherwise, wrap the existing element. rp = new RootPanel(elem); diff --git a/user/src/com/google/gwt/user/client/ui/ScrollImpl.java b/user/src/com/google/gwt/user/client/ui/ScrollImpl.java index 93cc023e16a..60738da700b 100644 --- a/user/src/com/google/gwt/user/client/ui/ScrollImpl.java +++ b/user/src/com/google/gwt/user/client/ui/ScrollImpl.java @@ -30,6 +30,7 @@ class ScrollImpl { * container is resized, so we synthesize one as needed. IE scrolls in the * positive direction, even in RTL mode. */ + @Deprecated static class ScrollImplTrident extends ScrollImpl { private static JavaScriptObject scrollHandler; @@ -137,7 +138,7 @@ public int getMinimumHorizontalScrollPosition(Element scrollable) { * @param container the container */ public void initialize(Element scrollable, Element container) { - // Overridden by ScrollImplTrident. + // No-op, formerly used to handle IE-specific behavior } /** diff --git a/user/src/com/google/gwt/user/client/ui/impl/PopupImplMozilla.java b/user/src/com/google/gwt/user/client/ui/impl/PopupImplMozilla.java index ea15bfcb59c..f51c81cfb55 100644 --- a/user/src/com/google/gwt/user/client/ui/impl/PopupImplMozilla.java +++ b/user/src/com/google/gwt/user/client/ui/impl/PopupImplMozilla.java @@ -15,12 +15,8 @@ */ package com.google.gwt.user.client.ui.impl; -import com.google.gwt.core.client.Scheduler; -import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style.Display; -import com.google.gwt.dom.client.Style.Overflow; -import com.google.gwt.user.client.DOM; /** * Implementation class used by {@link com.google.gwt.user.client.ui.PopupPanel}. @@ -47,78 +43,6 @@ */ public class PopupImplMozilla extends PopupImpl { - /** - * Cache the value to avoid repeated calls. - */ - private static boolean isFF2Mac = isFF2Mac(); - - private static native boolean isFF2Mac() /*-{ - function makeVersion(result) { - return (parseInt(result[1]) * 1000) + parseInt(result[2]); - } - - var ua = navigator.userAgent; - if (ua.indexOf("Macintosh") != -1) { - // Version logic taken from UserAgentPropertyGenerator - var result = /rv:([0-9]+)\.([0-9]+)/.exec(ua); - if (result && result.length == 3) { - // Gecko 1.8 and earlier had the scrollbar bug on OS X. - // (Firefox3 == Gecko 1.9) - if (makeVersion(result) <= 1008) { - return true; - } - } - } - - return false; - }-*/; - - @Override - public Element createElement() { - final Element outerElem = DOM.createDiv(); - - if (isFF2Mac) { - // To solve the scrollbar rendering problem on the Mac, we have to make - // the PopupPanel a 'heavyweight' element by setting a style of - // 'overflow:auto' on the outermost div. This ensures that all of the - // elements that are children of this div will be rendered on top of - // any underlying scrollbars. - - // Unfortunately, if we add a border to the outer div (which has - // a style of 'overflow:auto'), the border will not be rendered on top - // of underlying scrollbars. To get around this problem, we introduce an - // inner div which acts as the new containing element for the PopupPanel, - // and this element is the one to which all styling is applied to. - outerElem.setInnerHTML("
    "); - - // Mozilla determines the default stacking order for heavyweight elements - // by their order on the page. If the PopupPanel is declared before - // another - // heavyweight element on the page, then the scrollbars of the heavyweight - // element will still shine through the PopupPanel. By setting - // 'overflow:auto' after all of the elements on the page have been - // rendered, - // the PopupPanel becomes the highest element in the stacking order. - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - public void execute() { - outerElem.getStyle().setOverflow(Overflow.AUTO); - } - }); - } - - return outerElem; - } - - @Override - public Element getContainerElement(Element outerElem) { - return isFF2Mac ? outerElem.getFirstChildElement() : outerElem; - } - - @Override - public Element getStyleElement(Element outerElem) { - return isFF2Mac ? outerElem : super.getStyleElement(outerElem); - } - @Override public void setClip(Element popup, String rect) { super.setClip(popup, rect); diff --git a/user/test/com/google/gwt/core/client/JsonUtilsTest.java b/user/test/com/google/gwt/core/client/JsonUtilsTest.java index e79050a7919..b2146d66546 100644 --- a/user/test/com/google/gwt/core/client/JsonUtilsTest.java +++ b/user/test/com/google/gwt/core/client/JsonUtilsTest.java @@ -27,9 +27,6 @@ public String getModuleName() { } public void testStringify() throws Exception { - if (isFirefox40OrEarlier()) { - return; - } assertEquals("{\"a\":2}", JsonUtils.stringify(createJson())); assertEquals("{\n\t\"a\": 2\n}", JsonUtils.stringify(createJson(), "\t")); assertEquals("{\nXYZ\"a\": 2\n}", JsonUtils.stringify(createJson(), "XYZ")); @@ -38,8 +35,4 @@ public void testStringify() throws Exception { private native JavaScriptObject createJson() /*-{ return { a: 2 }; }-*/; - - private static native boolean isFirefox40OrEarlier() /*-{ - return @com.google.gwt.dom.client.DOMImplMozilla::isGecko2OrBefore()(); - }-*/; } diff --git a/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java b/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java index 40ef8b4d8ee..6729a165cfb 100644 --- a/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java +++ b/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java @@ -333,11 +333,6 @@ public String getModuleName() { } public void testArrayAccessSideEffect() { - if (System.getProperty("user.agent", "safari").equals("gecko1_8")) { - // Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1259605 - return; - } - int index = 1; int[] array = null; try { diff --git a/user/test/com/google/gwt/dom/client/ElementTest.java b/user/test/com/google/gwt/dom/client/ElementTest.java index b476824733f..00c73665c17 100644 --- a/user/test/com/google/gwt/dom/client/ElementTest.java +++ b/user/test/com/google/gwt/dom/client/ElementTest.java @@ -267,8 +267,8 @@ public void testGetAbsolutePosition() { elem.getStyle().setProperty("padding", padding + "px"); elem.getStyle().setProperty("margin", margin + "px"); - elem.getStyle().setPropertyPx("top", top - doc.getBodyOffsetLeft()); - elem.getStyle().setPropertyPx("left", left - doc.getBodyOffsetTop()); + elem.getStyle().setPropertyPx("top", top); + elem.getStyle().setPropertyPx("left", left); elem.getStyle().setPropertyPx("width", width); elem.getStyle().setPropertyPx("height", height); diff --git a/user/test/com/google/gwt/media/client/MediaTest.java b/user/test/com/google/gwt/media/client/MediaTest.java index 4cf9783f659..65b941e6433 100644 --- a/user/test/com/google/gwt/media/client/MediaTest.java +++ b/user/test/com/google/gwt/media/client/MediaTest.java @@ -47,20 +47,12 @@ static native boolean isFirefox35OrLater() /*-{ return (geckoVersion != -1) && (geckoVersion >= 1009001); }-*/; - static native boolean isFirefox40OrEarlier() /*-{ - return @com.google.gwt.dom.client.DOMImplMozilla::isGecko2OrBefore()(); - }-*/; - public void disabled_testPreload() { final MediaBase media = getMedia(); if (media == null) { return; // don't continue if not supported } - if (isFirefox40OrEarlier()) { - return; // don't continue on older versions of Firefox. - } - String state = media.getPreload(); assertNotNull(state); assertTrue("Illegal preload state", state.equals(MediaElement.PRELOAD_AUTO) diff --git a/user/test/com/google/gwt/user/client/ui/AbsolutePanelTest.java b/user/test/com/google/gwt/user/client/ui/AbsolutePanelTest.java index fb07d8f2977..28f94847999 100644 --- a/user/test/com/google/gwt/user/client/ui/AbsolutePanelTest.java +++ b/user/test/com/google/gwt/user/client/ui/AbsolutePanelTest.java @@ -15,7 +15,6 @@ */ package com.google.gwt.user.client.ui; -import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.junit.DoNotRunWith; import com.google.gwt.junit.Platform; @@ -97,8 +96,8 @@ public void testPositioning() { // wacky positioning of its children. int x = abs.getWidgetLeft(lbl); int y = abs.getWidgetTop(lbl); - int absX = lbl.getAbsoluteLeft() - Document.get().getBodyOffsetLeft(); - int absY = lbl.getAbsoluteTop() - Document.get().getBodyOffsetTop(); + int absX = lbl.getAbsoluteLeft(); + int absY = lbl.getAbsoluteTop(); assertEquals(3, x); assertEquals(7, y); assertEquals( diff --git a/user/test/com/google/gwt/user/client/ui/DOMTest.java b/user/test/com/google/gwt/user/client/ui/DOMTest.java index 6dafda4f9e0..a6afac25f92 100644 --- a/user/test/com/google/gwt/user/client/ui/DOMTest.java +++ b/user/test/com/google/gwt/user/client/ui/DOMTest.java @@ -146,8 +146,8 @@ public void testGetAbsolutePosition() { DOM.setStyleAttribute(elem, "margin", margin + "px"); Document doc = Document.get(); - DOM.setStyleAttribute(elem, "top", (top - doc.getBodyOffsetLeft()) + "px"); - DOM.setStyleAttribute(elem, "left", (left - doc.getBodyOffsetTop()) + "px"); + DOM.setStyleAttribute(elem, "top", top + "px"); + DOM.setStyleAttribute(elem, "left", left + "px"); delayTestFinish(1000); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @@ -190,9 +190,8 @@ public void testGetAbsolutePositionWhenScrolled() { assertTrue(DOM.getElementPropertyInt(outer, "scrollTop") > 0); assertTrue(DOM.getElementPropertyInt(outer, "scrollLeft") > 0); - Document doc = Document.get(); - assertEquals(doc.getBodyOffsetLeft(), DOM.getAbsoluteLeft(outer)); - assertEquals(doc.getBodyOffsetTop(), DOM.getAbsoluteTop(outer)); + assertEquals(0, DOM.getAbsoluteLeft(outer)); + assertEquals(0, DOM.getAbsoluteTop(outer)); } /**