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

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: Include event type in log message for added clarity 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..6c28ef62ec1011334c9988789201df4f271e7028 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();
+
+ if (!cancelable()) {
pfeldman 2014/05/07 15:36:21 Blink's recommendation is to stack guard expressio
+ LocalFrame* frame = view() ? view()->frame() : 0;
+ if (frame) {
+ 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