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

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

Issue 256773006: Measure Event.returnValue usage in more detail (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 8 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/Event.h ('k') | Source/core/events/Event.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/Event.cpp
diff --git a/Source/core/events/Event.cpp b/Source/core/events/Event.cpp
index fcd6644dcd569c3a27580082af10c4441f625892..205ae2b828d3de4f2911ece1104b3dafc939968f 100644
--- a/Source/core/events/Event.cpp
+++ b/Source/core/events/Event.cpp
@@ -25,6 +25,7 @@
#include "core/dom/StaticNodeList.h"
#include "core/events/EventTarget.h"
+#include "core/frame/UseCounter.h"
#include "wtf/CurrentTime.h"
namespace WebCore {
@@ -101,6 +102,25 @@ void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool
m_cancelable = cancelableArg;
}
+bool Event::legacyReturnValue(ExecutionContext* executionContext) const
+{
+ bool returnValue = !defaultPrevented();
+ if (returnValue)
+ UseCounter::count(executionContext, UseCounter::EventGetReturnValueTrue);
+ else
+ UseCounter::count(executionContext, UseCounter::EventGetReturnValueFalse);
+ return returnValue;
+}
+
+void Event::setLegacyReturnValue(ExecutionContext* executionContext, bool returnValue)
+{
+ if (returnValue)
+ UseCounter::count(executionContext, UseCounter::EventSetReturnValueTrue);
+ else
+ UseCounter::count(executionContext, UseCounter::EventSetReturnValueFalse);
+ setDefaultPrevented(!returnValue);
+}
+
const AtomicString& Event::interfaceName() const
{
return EventNames::Event;
« no previous file with comments | « Source/core/events/Event.h ('k') | Source/core/events/Event.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698