Return the correct style element for PopupPanels in FireFox on Mac, which uses an extra div. The JavaDoc explains that all style should apply to the inner div.
Patch by: jlabanca
Review by: rjrjr
Issue: 3214
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.6@4379 8db76d5a-ed1c-0410-87a9-c151d255dfc7
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 8cfeeba..6064c12 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -769,7 +769,12 @@
@Override
protected Element getContainerElement() {
- return impl.getContainerElement(DOM.getFirstChild(super.getContainerElement()));
+ return impl.getContainerElement(getPopupImplElement());
+ }
+
+ @Override
+ protected Element getStyleElement() {
+ return impl.getStyleElement(getPopupImplElement());
}
/**
@@ -847,6 +852,18 @@
}
/**
+ * Get the element that {@link PopupImpl} uses. PopupImpl creates an element
+ * that goes inside of the outer element, so all methods in PopupImpl are
+ * relative to the first child of the outer element, not the outer element
+ * itself.
+ *
+ * @return the Element that {@link PopupImpl} creates and expects
+ */
+ private Element getPopupImplElement() {
+ return DOM.getFirstChild(super.getContainerElement());
+ }
+
+ /**
* Positions the popup, called after the offset width and height of the popup are known.
*
* @param relativeObject the ui object to position relative to
diff --git a/user/src/com/google/gwt/user/client/ui/impl/PopupImpl.java b/user/src/com/google/gwt/user/client/ui/impl/PopupImpl.java
index 9af98c1..d8897cc 100644
--- a/user/src/com/google/gwt/user/client/ui/impl/PopupImpl.java
+++ b/user/src/com/google/gwt/user/client/ui/impl/PopupImpl.java
@@ -31,6 +31,10 @@
return popup;
}
+ public Element getStyleElement(Element popup) {
+ return DOM.getParent(popup);
+ }
+
public void onHide(Element popup) {
}
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 a11fe48..eaa6c94 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
@@ -99,6 +99,11 @@
}
@Override
+ public Element getStyleElement(Element outerElem) {
+ return isMac ? outerElem : super.getStyleElement(outerElem);
+ }
+
+ @Override
public void setClip(Element popup, String rect) {
super.setClip(popup, rect);
DOM.setStyleAttribute(popup, "display", "none");