]> source.dussan.org Git - vaadin-framework.git/commitdiff
TouchScrollHandler: added debug info, restored setElements()
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Wed, 9 May 2012 11:44:20 +0000 (11:44 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Wed, 9 May 2012 11:44:20 +0000 (11:44 +0000)
svn changeset:23697/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java

index 65d8029593ff054bda7dfb957509adb1b8b9c61a..580313f433d093c9f363998160a81028dee578b7 100644 (file)
@@ -98,11 +98,20 @@ public class TouchScrollDelegate implements NativePreviewHandler {
 
         public TouchScrollHandler(Widget widget, Element... scrollables) {
             if (requiresDelegate) {
+                VConsole.log("REQUIRES DELEGATE");
                 delegate = new TouchScrollDelegate();
                 widget.addDomHandler(this, TouchStartEvent.getType());
             } else {
+                VConsole.log("DOES NOT REQUIRE DELEGATE");
                 delegate = null;
             }
+            VConsole.log(BrowserInfo.getBrowserString());
+            BrowserInfo bi = BrowserInfo.get();
+            VConsole.log("Is Android: " + bi.isAndroid());
+            VConsole.log("Is Android with broken scrolltop: "
+                    + bi.isAndroidWithBrokenScrollTop());
+            VConsole.log("Is IOS: " + bi.isIOS());
+            VConsole.log("Is Webkit: " + bi.isWebkit());
             for (Element scrollable : scrollables) {
                 addElement(scrollable);
             }
@@ -113,11 +122,22 @@ public class TouchScrollDelegate implements NativePreviewHandler {
             delegate.onTouchStart(event);
         }
 
+        public void debug(Element e) {
+            VConsole.log("Classes: " + e.getClassName() + " overflow: "
+                    + e.getStyle().getProperty("overflow") + " w-o-s: "
+                    + e.getStyle().getProperty("-webkit-overflow-scrolling"));
+        }
+
         public void addElement(Element scrollable) {
             scrollable.addClassName("v-scrollable");
+            scrollable.getStyle().setProperty("-webkit-overflow-scrolling",
+                    "touch");
+            scrollable.getStyle().setProperty("overflow-y", "auto");
+            scrollable.getStyle().setProperty("overflow-x", "hidden");
             if (requiresDelegate) {
                 delegate.scrollableElements.add(scrollable);
             }
+            VConsole.log("Added scrollable: " + scrollable.getClassName());
         }
 
         public void removeElement(Element scrollable) {
@@ -126,6 +146,15 @@ public class TouchScrollDelegate implements NativePreviewHandler {
                 delegate.scrollableElements.remove(scrollable);
             }
         }
+
+        public void setElements(Element... scrollables) {
+            if (requiresDelegate) {
+                delegate.scrollableElements.clear();
+            }
+            for (Element e : scrollables) {
+                addElement(e);
+            }
+        }
     }
 
     public static TouchScrollHandler enableTouchScrolling(Widget widget,