From dd81ec5923ad0abd866591bb06e1521d5da291a2 Mon Sep 17 00:00:00 2001
From: Henri Sara
Date: Thu, 3 Jul 2014 08:43:44 +0300
Subject: [PATCH] Remove shadow div for Overlay elements except IE8 (#9303).
Change-Id: I7bdaf849e79191183013ca05e7420e10411f0b2e
---
client/src/com/vaadin/client/ui/VOverlay.java | 90 +++++++++++--------
.../ComboboxPageLengthZeroScrollTest.java | 9 ++
.../PopupViewResizeWhileOpenTest.java | 8 ++
3 files changed, 69 insertions(+), 38 deletions(-)
diff --git a/client/src/com/vaadin/client/ui/VOverlay.java b/client/src/com/vaadin/client/ui/VOverlay.java
index ae2faee238..f9aa2ef2f8 100644
--- a/client/src/com/vaadin/client/ui/VOverlay.java
+++ b/client/src/com/vaadin/client/ui/VOverlay.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* 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
@@ -51,7 +51,7 @@ import com.vaadin.client.Util;
* temporary float over other components like context menus etc. This is to deal
* stacking order correctly with VWindow objects.
*
- *
+ *
* Shadow
*
* The separate shadow element underneath the main overlay element is
@@ -62,7 +62,7 @@ import com.vaadin.client.Util;
* supports, add -webkit-box-shadow
and the standard
* box-shadow
properties.
*
- *
+ *
*
* For IE8, which doesn't support CSS box-shadow, you can use the proprietary
* DropShadow filter. It doesn't provide the exact same features as box-shadow,
@@ -70,7 +70,7 @@ import com.vaadin.client.Util;
* border or a pseudo-element underneath the overlay which mimics a shadow, or
* any combination of these.
*
- *
+ *
*
* Read more about the DropShadow filter from {
* Shadow element style. If an extending class wishes to use a different
* style of shadow, it can use setShadowStyle(String) to give the shadow
* element a new style name.
- *
+ *
* @deprecated See main JavaDoc for VOverlay
*/
@Deprecated
@@ -175,9 +175,9 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* The shadow element for this overlay.
- *
+ *
* @deprecated See main JavaDoc for VOverlay
- *
+ *
*/
@Deprecated
private Element shadow;
@@ -206,7 +206,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* The HTML snippet that is used to render the actual shadow. In consists of
* nine different DIV-elements with the following class names:
- *
+ *
*
* .v-shadow[-stylename]
* ----------------------------------------------
@@ -219,9 +219,9 @@ public class VOverlay extends PopupPanel implements CloseHandler {
* | .bottom-left | .bottom | .bottom-right |
* ----------------------------------------------
*
- *
+ *
* See default theme 'shadow.css' for implementation example.
- *
+ *
* @deprecated See main JavaDoc for VOverlay
*/
@Deprecated
@@ -260,18 +260,32 @@ public class VOverlay extends PopupPanel implements CloseHandler {
@Deprecated
public VOverlay(boolean autoHide, boolean modal, boolean showShadow) {
super(autoHide, modal);
- setShadowEnabled(showShadow);
+ setShadowEnabled(showShadow && useShadowDiv());
adjustZIndex();
}
/**
- * Method to controle whether DOM elements for shadow are added. With this
+ * Return true if a separate shadow div should be used. Since Vaadin 7.3,
+ * shadows are implemented with CSS box-shadow. Thus, a shadow div is only
+ * used for IE8 by default.
+ *
+ * @deprecated See main JavaDoc for VOverlay
+ * @since 7.3
+ * @return true to use a shadow div
+ */
+ @Deprecated
+ protected boolean useShadowDiv() {
+ return BrowserInfo.get().isIE8();
+ }
+
+ /**
+ * Method to control whether DOM elements for shadow are added. With this
* method subclasses can control displaying of shadow also after the
* constructor.
- *
+ *
* @param enabled
* true if shadow should be displayed
- *
+ *
* @deprecated See main JavaDoc for VOverlay
*/
@Deprecated
@@ -335,7 +349,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Set the z-index (visual stack position) for this overlay.
- *
+ *
* @param zIndex
* The new z-index
*/
@@ -430,7 +444,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
* A "thread local" of sorts, set temporarily so that VOverlayImpl knows
* which VOverlay is using it, so that it can be attached to the correct
* overlay container.
- *
+ *
* TODO this is a strange pattern that we should get rid of when possible.
*/
protected static VOverlay current;
@@ -548,12 +562,12 @@ public class VOverlay extends PopupPanel implements CloseHandler {
* Sets the shadow style for this overlay. Will override any previous style
* for the shadow. The default style name is defined by CLASSNAME_SHADOW.
* The given style will be prefixed with CLASSNAME_SHADOW.
- *
+ *
* @param style
* The new style name for the shadow element. Will be prefixed by
* CLASSNAME_SHADOW, e.g. style=='foobar' -> actual style
* name=='v-shadow-foobar'.
- *
+ *
* @deprecated See main JavaDoc for VOverlay
*/
@Deprecated
@@ -567,7 +581,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
* Extending classes should always call this method after they change the
* size of overlay without using normal 'setWidth(String)' and
* 'setHeight(String)' methods (if not calling super.setWidth/Height).
- *
+ *
*/
public void positionOrSizeUpdated() {
positionOrSizeUpdated(1.0);
@@ -586,7 +600,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
* elements. Can be used to animate the related elements, using the
* 'progress' parameter (used to animate the shadow in sync with GWT
* PopupPanel's default animation 'PopupPanel.AnimationType.CENTER').
- *
+ *
* @param progress
* A value between 0.0 and 1.0, indicating the progress of the
* animation (0=start, 1=end).
@@ -689,7 +703,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
* Returns true if we should add a shim iframe below the overlay to deal
* with zindex issues with PDFs and applets. Can be overriden to disable
* shim iframes if they are not needed.
- *
+ *
* @return true if a shim iframe should be added, false otherwise
*/
protected boolean needsShimElement() {
@@ -751,13 +765,13 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Enables or disables sinking the events of the shadow to the same
* onBrowserEvent as events to the actual overlay goes.
- *
+ *
* Please note, that if you enable this, you can't assume that e.g.
* event.getEventTarget returns an element inside the DOM structure of the
* overlay
- *
+ *
* @param sinkShadowEvents
- *
+ *
* @deprecated See main JavaDoc for VOverlay
*/
@Deprecated
@@ -781,7 +795,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Get owner (Widget that made this VOverlay, not the layout parent) of
* VOverlay
- *
+ *
* @return Owner (creator) or null if not defined
*/
public Widget getOwner() {
@@ -791,7 +805,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Set owner (Widget that made this VOverlay, not the layout parent) of
* VOverlay
- *
+ *
* @param owner
* Owner (creator) of VOverlay
*/
@@ -802,7 +816,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Get the {@link ApplicationConnection} that this overlay belongs to. If
* it's not set, {@link #getOwner()} is used to figure it out.
- *
+ *
* @return
*/
protected ApplicationConnection getApplicationConnection() {
@@ -822,7 +836,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Gets the 'overlay container' element. Tries to find the current
* {@link ApplicationConnection} using {@link #getApplicationConnection()}.
- *
+ *
* @return the overlay container element for the current
* {@link ApplicationConnection} or another element if the current
* {@link ApplicationConnection} cannot be determined.
@@ -846,7 +860,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
* {@link ApplicationConnection}. Each overlay should be created in a
* overlay container element, so that the correct theme and styles can be
* applied.
- *
+ *
* @param ac
* A reference to {@link ApplicationConnection}
* @return The overlay container
@@ -871,7 +885,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Set the label of the container element, where tooltip, notification and
* dialgs are added to.
- *
+ *
* @param applicationConnection
* the application connection for which to change the label
* @param overlayContainerLabel
@@ -904,10 +918,10 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Gets the visual viewport width, which is useful for e.g iOS where the
* view can be zoomed in while keeping the layout viewport intact.
- *
+ *
* Falls back to layout viewport; for those browsers/devices the difference
* is that the scrollbar with is included (if there is a scrollbar).
- *
+ *
* @since 7.0.7
* @return
*/
@@ -923,10 +937,10 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/**
* Gets the visual viewport height, which is useful for e.g iOS where the
* view can be zoomed in while keeping the layout viewport intact.
- *
+ *
* Falls back to layout viewport; for those browsers/devices the difference
* is that the scrollbar with is included (if there is a scrollbar).
- *
+ *
* @since 7.0.7
* @return
*/
@@ -951,7 +965,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/*
* (non-Javadoc)
- *
+ *
* @see com.google.gwt.user.client.ui.PopupPanel#hide()
*/
@Override
@@ -961,7 +975,7 @@ public class VOverlay extends PopupPanel implements CloseHandler {
/*
* (non-Javadoc)
- *
+ *
* @see com.google.gwt.user.client.ui.PopupPanel#hide(boolean)
*/
@Override
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboboxPageLengthZeroScrollTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPageLengthZeroScrollTest.java
index 9d863d2c0c..948acc5fe6 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboboxPageLengthZeroScrollTest.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPageLengthZeroScrollTest.java
@@ -15,12 +15,16 @@
*/
package com.vaadin.tests.components.combobox;
+import java.util.Collections;
+import java.util.List;
+
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -60,4 +64,9 @@ public class ComboboxPageLengthZeroScrollTest extends MultiBrowserTest {
cssValue);
}
+
+ @Override
+ public List getBrowsersToTest() {
+ return Collections.singletonList(Browser.IE8.getDesiredCapabilities());
+ }
}
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java
index 0c6f0abf3c..bca8fd4390 100644
--- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java
@@ -20,9 +20,13 @@ import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
+import java.util.Collections;
+import java.util.List;
+
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
+import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.PopupViewElement;
@@ -63,4 +67,8 @@ public class PopupViewResizeWhileOpenTest extends MultiBrowserTest {
assertThat(shadowSize.width, is(lessThan(layoutSize.width + 10)));
}
+ @Override
+ public List getBrowsersToTest() {
+ return Collections.singletonList(Browser.IE8.getDesiredCapabilities());
+ }
}
--
2.39.5