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

Side by Side Diff: third_party/WebKit/Source/modules/device_orientation/DeviceMotionEvent.cpp

Issue 2728963004: Remove non-standard DeviceOrientation Event initializers. (Closed)
Patch Set: Rebased. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 29 matching lines...) Expand all
40 DeviceMotionEvent::DeviceMotionEvent(const AtomicString& eventType, 40 DeviceMotionEvent::DeviceMotionEvent(const AtomicString& eventType,
41 const DeviceMotionEventInit& initializer) 41 const DeviceMotionEventInit& initializer)
42 : Event(eventType, initializer), 42 : Event(eventType, initializer),
43 m_deviceMotionData(DeviceMotionData::create(initializer)) {} 43 m_deviceMotionData(DeviceMotionData::create(initializer)) {}
44 44
45 DeviceMotionEvent::DeviceMotionEvent(const AtomicString& eventType, 45 DeviceMotionEvent::DeviceMotionEvent(const AtomicString& eventType,
46 DeviceMotionData* deviceMotionData) 46 DeviceMotionData* deviceMotionData)
47 : Event(eventType, false, false), // Can't bubble, not cancelable 47 : Event(eventType, false, false), // Can't bubble, not cancelable
48 m_deviceMotionData(deviceMotionData) {} 48 m_deviceMotionData(deviceMotionData) {}
49 49
50 void DeviceMotionEvent::initDeviceMotionEvent(
51 const AtomicString& type,
52 bool bubbles,
53 bool cancelable,
54 DeviceMotionData* deviceMotionData) {
55 if (isBeingDispatched())
56 return;
57
58 initEvent(type, bubbles, cancelable);
59 m_deviceMotionData = deviceMotionData;
60
61 m_acceleration.clear();
62 m_accelerationIncludingGravity.clear();
63 m_rotationRate.clear();
64 }
65
66 DeviceAcceleration* DeviceMotionEvent::acceleration() { 50 DeviceAcceleration* DeviceMotionEvent::acceleration() {
67 if (!m_deviceMotionData->getAcceleration()) 51 if (!m_deviceMotionData->getAcceleration())
68 return nullptr; 52 return nullptr;
69 53
70 if (!m_acceleration) 54 if (!m_acceleration)
71 m_acceleration = 55 m_acceleration =
72 DeviceAcceleration::create(m_deviceMotionData->getAcceleration()); 56 DeviceAcceleration::create(m_deviceMotionData->getAcceleration());
73 57
74 return m_acceleration.get(); 58 return m_acceleration.get();
75 } 59 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 94
111 DEFINE_TRACE(DeviceMotionEvent) { 95 DEFINE_TRACE(DeviceMotionEvent) {
112 visitor->trace(m_deviceMotionData); 96 visitor->trace(m_deviceMotionData);
113 visitor->trace(m_acceleration); 97 visitor->trace(m_acceleration);
114 visitor->trace(m_accelerationIncludingGravity); 98 visitor->trace(m_accelerationIncludingGravity);
115 visitor->trace(m_rotationRate); 99 visitor->trace(m_rotationRate);
116 Event::trace(visitor); 100 Event::trace(visitor);
117 } 101 }
118 102
119 } // namespace blink 103 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698