]> source.dussan.org Git - vaadin-framework.git/commitdiff
Revert "Make Panel scroll the correct div (#12736)"
authorArtur Signell <artur@vaadin.com>
Wed, 6 Nov 2013 13:26:42 +0000 (15:26 +0200)
committerArtur Signell <artur@vaadin.com>
Wed, 6 Nov 2013 13:26:42 +0000 (15:26 +0200)
Revert "Reverted change in how hack works (#12727, #12736)"
Revert "Fixes the handling of the scroll position of a Window (#12736)"
Revert "Recovering scroll position after regression problems. (#12727)"
Revert "Ticket #12727 - Panels get unnecessary scroll bars in WebKit when content is 100% wide."

This reverts commit 6a63d12afc5a4bf3971dd016f8e2761cd27bcc74.
This reverts commit c48c94dc23da22b6d885c69b0bc697257f9dbf11.
This reverts commit 017bd0684c7d6c8475c8b43514e6f3998095c8d6.
This reverts commit 51a46a038fe0353f4babfd8218153eb68e2602ca.
This reverts commit ab5b20cf502f99944c82f619ffef387f0525e8ba.

Test cases were left as-is as the issue (#12736) still needs a workaround

Change-Id: I0b6c2afb4a9be8629f2a8f880a8ae8d0a6d5088f

client/src/com/vaadin/client/Util.java
client/src/com/vaadin/client/ui/VPanel.java
client/src/com/vaadin/client/ui/VWindow.java

index fd7a354569895c54dedd6b7e3c151a7357e262a5..7c7978be0922bad81d6b6754ed74ba848c94b9e8 100644 (file)
@@ -32,7 +32,6 @@ import com.google.gwt.dom.client.Node;
 import com.google.gwt.dom.client.NodeList;
 import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.dom.client.Style.Unit;
 import com.google.gwt.dom.client.Touch;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.DOM;
@@ -555,56 +554,6 @@ public class Util {
 
     }
 
-    /**
-     * Prevents some browsers from adding scroll bars to a component (such as a
-     * Window) whose contents fit in the component.
-     * <p>
-     * See: bugs #11994 and #12736.
-     * 
-     * @param contentNode
-     *            an element that is scrollable
-     * 
-     * @since 7.1.8
-     */
-    public static void removeUnneededScrollbars(final Element scrollable) {
-        if (BrowserInfo.get().isWebkit()) {
-
-            /*
-             * Shake up the DOM a bit to make the window shed unnecessary
-             * scrollbars and resize correctly afterwards. This resulting code
-             * took over a week to summon forth, and involved some pretty hairy
-             * black magic. Don't touch it unless you know what you're doing!
-             * Fixes ticket #11994. Later modified to fix ticket #12736.
-             */
-            Scheduler.get().scheduleFinally(new ScheduledCommand() {
-
-                @Override
-                public void execute() {
-                    // Adjusting the width or height may change the scroll
-                    // position, so store the current position
-                    int horizontalScrollPosition = scrollable.getScrollLeft();
-                    int verticalScrollPosition = scrollable.getScrollTop();
-
-                    final String oldWidth = scrollable.getStyle().getWidth();
-                    final String oldHeight = scrollable.getStyle().getHeight();
-
-                    scrollable.getStyle().setWidth(110, Unit.PCT);
-                    scrollable.getOffsetWidth();
-                    scrollable.getStyle().setProperty("width", oldWidth);
-                    scrollable.getStyle().setHeight(110, Unit.PCT);
-                    scrollable.getOffsetHeight();
-                    scrollable.getStyle().setProperty("height", oldHeight);
-
-                    // Restore the scroll position
-                    scrollable.setScrollLeft(horizontalScrollPosition);
-                    scrollable.setScrollTop(verticalScrollPosition);
-
-                }
-            });
-
-        }
-    }
-
     /**
      * Parses shared state and fetches the relative size of the component. If a
      * dimension is not specified as relative it will return -1. If the shared
index 307a2e4a916189064e7a951823c7b17f6dd15d36..6b02f079d17a7cce5de163ad3bde2f8e7320f8d0 100644 (file)
@@ -24,7 +24,6 @@ import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.ui.SimplePanel;
 import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.Focusable;
-import com.vaadin.client.Util;
 import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
 import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler;
 
@@ -207,6 +206,5 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner,
             touchScrollHandler = TouchScrollDelegate.enableTouchScrolling(this);
         }
         touchScrollHandler.addElement(contentNode);
-        Util.removeUnneededScrollbars(contentNode);
     }
 }
index 62937b6a6767c43172d16896e4f7e8f2160d0336..396169eb8c1a950d067b401f84f953550b30daed 100644 (file)
@@ -345,11 +345,36 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         if (!visibilityChangesDisabled) {
             super.setVisible(visible);
         }
+
         if (visible && BrowserInfo.get().isWebkit()) {
-            Util.removeUnneededScrollbars((Element) contents
-                    .getFirstChildElement());
-            updateContentsSize();
-            positionOrSizeUpdated();
+
+            /*
+             * Shake up the DOM a bit to make the window shed unnecessary
+             * scrollbars and resize correctly afterwards. This resulting code
+             * took over a week to summon forth, and involved some pretty hairy
+             * black magic. Don't touch it unless you know what you're doing!
+             * Fixes ticket #11994
+             */
+            Scheduler.get().scheduleFinally(new ScheduledCommand() {
+                @Override
+                public void execute() {
+                    final com.google.gwt.dom.client.Element scrollable = contents
+                            .getFirstChildElement();
+                    final String oldWidth = scrollable.getStyle().getWidth();
+                    final String oldHeight = scrollable.getStyle().getHeight();
+
+                    scrollable.getStyle().setWidth(110, Unit.PCT);
+                    scrollable.getOffsetWidth();
+                    scrollable.getStyle().setProperty("width", oldWidth);
+
+                    scrollable.getStyle().setHeight(110, Unit.PCT);
+                    scrollable.getOffsetHeight();
+                    scrollable.getStyle().setProperty("height", oldHeight);
+
+                    updateContentsSize();
+                    positionOrSizeUpdated();
+                }
+            });
         }
     }