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

Unified Diff: Source/modules/device_orientation/NewDeviceOrientationController.cpp

Issue 21256002: Fire null Device Motion events only once. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
Index: Source/modules/device_orientation/NewDeviceOrientationController.cpp
diff --git a/Source/modules/device_orientation/NewDeviceOrientationController.cpp b/Source/modules/device_orientation/NewDeviceOrientationController.cpp
index 3cf3197694528942473a2ab27e6856b88a34a9ed..5513d63f8b88b8c4652f64c8e5b565ab2f1c8d07 100644
--- a/Source/modules/device_orientation/NewDeviceOrientationController.cpp
+++ b/Source/modules/device_orientation/NewDeviceOrientationController.cpp
@@ -28,9 +28,11 @@
#include "modules/device_orientation/NewDeviceOrientationController.h"
#include "core/dom/Document.h"
+#include "modules/device_orientation/DeviceOrientationData.h"
#include "modules/device_orientation/DeviceOrientationDispatcher.h"
#include "modules/device_orientation/DeviceOrientationEvent.h"
+
abarth-chromium 2013/07/31 00:56:19 This blank line looks spurious.
timvolodine 2013/07/31 13:59:00 Done.
namespace WebCore {
NewDeviceOrientationController::NewDeviceOrientationController(Document* document)
@@ -83,4 +85,11 @@ void NewDeviceOrientationController::unregisterWithDispatcher()
DeviceOrientationDispatcher::instance().removeDeviceOrientationController(this);
}
+bool NewDeviceOrientationController::isNullEvent(Event* event)
+{
+ DeviceOrientationEvent* orientationEvent = static_cast<DeviceOrientationEvent*>(event);
abarth-chromium 2013/07/31 00:56:19 Same comment about this blind static_cast.
timvolodine 2013/07/31 13:59:00 added assert (analogous to the motion case).
+ DeviceOrientationData* data = orientationEvent->orientation();
+ return !data->canProvideAlpha() && !data->canProvideBeta() && !data->canProvideGamma();
abarth-chromium 2013/07/31 00:56:19 Do we have any mechanism to keep this check up to
timvolodine 2013/07/31 13:59:00 hmm, good point -- I've moved some of the code to
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698