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

Unified Diff: Source/core/events/TouchEvent.cpp

Issue 273503004: Add console warning for canceling uncancelable TouchEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tweak style Created 6 years, 7 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 | « Source/core/events/TouchEvent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/TouchEvent.cpp
diff --git a/Source/core/events/TouchEvent.cpp b/Source/core/events/TouchEvent.cpp
index f252c9a155de4d8f7ae1a1d6ad339e77be6bbb3e..0abb4a303d5513755c6306316a9a1bc9ddaed655 100644
--- a/Source/core/events/TouchEvent.cpp
+++ b/Source/core/events/TouchEvent.cpp
@@ -29,6 +29,8 @@
#include "core/events/TouchEvent.h"
#include "core/events/EventDispatcher.h"
+#include "core/frame/FrameConsole.h"
+#include "core/frame/LocalFrame.h"
namespace WebCore {
@@ -91,6 +93,18 @@ bool TouchEvent::isTouchEvent() const
return true;
}
+void TouchEvent::preventDefault()
+{
+ MouseRelatedEvent::preventDefault();
+
+ // A common developer error is to wait too long before attempting to stop
+ // scrolling by consuming a touchmove event. Generate a warning if this
+ // event is uncancelable.
+ if (!cancelable() && view() && view()->frame()) {
+ view()->frame()->console().addMessage(JSMessageSource, WarningMessageLevel,
+ "Ignored attempt to cancel a " + type() + " event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.");
+ }
+}
void TouchEvent::trace(Visitor* visitor)
{
visitor->trace(m_touches);
« no previous file with comments | « Source/core/events/TouchEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698