]> source.dussan.org Git - vaadin-framework.git/commitdiff
Disabled shim iframe for all but IE8+ (#9284, #6219)
authorArtur Signell <artur.signell@itmill.com>
Fri, 10 Aug 2012 14:09:57 +0000 (14:09 +0000)
committerArtur Signell <artur.signell@itmill.com>
Fri, 10 Aug 2012 14:09:57 +0000 (14:09 +0000)
The shim iframe causes crashes in IE6 and does not really help in Opera/Safari/Firefox.

svn changeset:24146/svn branch:6.8

WebContent/statictestfiles/applet.html [new file with mode: 0644]
WebContent/statictestfiles/com/vaadin/tests/components/embedded/TestApplet.class [new file with mode: 0644]
src/com/vaadin/terminal/gwt/client/ui/VOverlay.java
tests/testbench/com/vaadin/tests/components/embedded/EmbeddedApplet.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/embedded/EmbeddedApplet.java [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/embedded/TestApplet.java [new file with mode: 0644]

diff --git a/WebContent/statictestfiles/applet.html b/WebContent/statictestfiles/applet.html
new file mode 100644 (file)
index 0000000..05e1785
--- /dev/null
@@ -0,0 +1,5 @@
+<html>
+<body>
+       <applet code="com/vaadin/tests/components/embedded/TestApplet/class"></applet>
+</body>
+</html>
\ No newline at end of file
diff --git a/WebContent/statictestfiles/com/vaadin/tests/components/embedded/TestApplet.class b/WebContent/statictestfiles/com/vaadin/tests/components/embedded/TestApplet.class
new file mode 100644 (file)
index 0000000..7650e1f
Binary files /dev/null and b/WebContent/statictestfiles/com/vaadin/tests/components/embedded/TestApplet.class differ
index 60829f1cc8e0205b5e241ac4b794e84c8003f047..92f2d6540b7c5b6553a8a3a0fc23347474123381 100644 (file)
@@ -244,7 +244,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
     }
 
     private IFrameElement getShimElement() {
-        if (shimElement == null) {
+        if (shimElement == null && useShimIframe()) {
             shimElement = Document.get().createIFrameElement();
 
             // Insert shim iframe before the main overlay element. It does not
@@ -463,8 +463,10 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
             DOM.setStyleAttribute(shadow, "display", progress < 0.9 ? "none"
                     : "");
         }
-        updatePositionAndSize((Element) Element.as(getShimElement()),
-                positionAndSize);
+        if (useShimIframe()) {
+            updatePositionAndSize((Element) Element.as(getShimElement()),
+                    positionAndSize);
+        }
 
         // Opera fix, part 2 (ticket #2704)
         if (BrowserInfo.get().isOpera() && isShadowEnabled()) {
@@ -488,13 +490,25 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
             RootPanel.get().getElement().insertBefore(shadow, getElement());
             sinkShadowEvents();
         }
-        if (!isShimAttached()) {
+        if (useShimIframe() && !isShimAttached()) {
             RootPanel.get().getElement()
                     .insertBefore(shimElement, getElement());
         }
 
     }
 
+    /**
+     * 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 useShimIframe() {
+        BrowserInfo info = BrowserInfo.get();
+        return info.isIE() && info.isBrowserVersionNewerOrEqual(8, 0);
+    }
+
     private void updatePositionAndSize(Element e,
             PositionAndSize positionAndSize) {
         e.getStyle().setLeft(positionAndSize.getLeft(), Unit.PX);
diff --git a/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedApplet.html b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedApplet.html
new file mode 100644 (file)
index 0000000..d8fb059
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>EmbeddedClickListenerRelativeCoordinates</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">EmbeddedClickListenerRelativeCoordinates</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.embedded.EmbeddedApplet?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>with-applet</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedApplet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td>without-applet</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedApplet.java b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedApplet.java
new file mode 100644 (file)
index 0000000..7460e15
--- /dev/null
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.embedded;
+
+import com.vaadin.terminal.ExternalResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Embedded;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class EmbeddedApplet extends TestBase {
+
+    @Override
+    protected String getDescription() {
+        return "The sub window should be shown on top of the embedded applet";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 8399;
+    }
+
+    @Override
+    public void setup() {
+        final Embedded applet = new Embedded();
+        applet.setType(Embedded.TYPE_BROWSER);
+        applet.setWidth("400px");
+        applet.setHeight("300px");
+        applet.setSource(new ExternalResource("/statictestfiles/applet.html"));
+        addComponent(applet);
+
+        addComponent(new Button("Remove applet", new Button.ClickListener() {
+            public void buttonClick(ClickEvent event) {
+                removeComponent(applet);
+            }
+        }));
+
+        Window window = new Window("Testwindow");
+        window.addComponent(new Label("I am inside the window"));
+        applet.getWindow().addWindow(window);
+    }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/embedded/TestApplet.java b/tests/testbench/com/vaadin/tests/components/embedded/TestApplet.java
new file mode 100644 (file)
index 0000000..3cf7cf8
--- /dev/null
@@ -0,0 +1,11 @@
+package com.vaadin.tests.components.embedded;
+
+import java.applet.Applet;
+import java.awt.Graphics;
+
+public class TestApplet extends Applet {
+    @Override
+    public void paint(Graphics g) {
+        g.drawString("Hello, I am an applet! Look at me!", 10, 20);
+    }
+}