Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(915)

Unified Diff: tools/dom/templates/html/impl/impl_TouchEvent.darttemplate

Issue 12084033: Adding supported checks for touch event. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding missing test file. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/touchevent_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_TouchEvent.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_TouchEvent.darttemplate b/tools/dom/templates/html/impl/impl_TouchEvent.darttemplate
index ea0bef98c19d041c140b3ea30e98b681f5f9a254..3944652d590734e79b42d34880d6ee64acc9a635 100644
--- a/tools/dom/templates/html/impl/impl_TouchEvent.darttemplate
+++ b/tools/dom/templates/html/impl/impl_TouchEvent.darttemplate
@@ -21,4 +21,24 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
return e;
}
$!MEMBERS
+
+ /**
+ * Checks if touch events supported on the current platform.
+ *
+ * Note that touch events are only supported if the user is using a touch
+ * device.
+ */
+ static bool get supported {
+$if DART2JS
+ if (JS('bool', '"ontouchstart" in window')) {
+ return Event._isTypeSupported('TouchEvent');
+ }
+ return false;
+$else
+ // TODO: add equivalent 'ontouchstart' check for Dartium.
Emily Fortuna 2013/01/29 18:19:21 TOOD(blois): ...
+ // Basically, this is a fairly common check and it'd be great if it did not
+ // throw exceptions.
+ return Event._isTypeSupported('TouchEvent');
+$endif
+ }
}
« no previous file with comments | « tests/html/touchevent_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698