From 2f9e56f46e59152d9bed498eb72586fb3f9e15dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Wed, 9 May 2012 11:44:20 +0000 Subject: [PATCH] TouchScrollHandler: added debug info, restored setElements() svn changeset:23697/svn branch:6.8 --- .../gwt/client/ui/TouchScrollDelegate.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java index 65d8029593..580313f433 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java +++ b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java @@ -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, -- 2.39.5