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

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

Issue 1737443002: Make DeviceOrientationEvent.prototype.absolute non-nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address feedback Created 4 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 2010, The Android Open Source Project 2 * Copyright 2010, The Android Open Source Project
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 * * Redistributions of source code must retain the above copyright 7 * * 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 * * Redistributions in binary form must reproduce the above copyright 9 * * 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 26 matching lines...) Expand all
37 : m_orientation(DeviceOrientationData::create()) 37 : m_orientation(DeviceOrientationData::create())
38 { 38 {
39 } 39 }
40 40
41 DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, De viceOrientationData* orientation) 41 DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, De viceOrientationData* orientation)
42 : Event(eventType, false, false) // Can't bubble, not cancelable 42 : Event(eventType, false, false) // Can't bubble, not cancelable
43 , m_orientation(orientation) 43 , m_orientation(orientation)
44 { 44 {
45 } 45 }
46 46
47 void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type , bool bubbles, bool cancelable, const Nullable<double>& alpha, const Nullable<d ouble>& beta, const Nullable<double>& gamma, const Nullable<bool>& absolute) 47 void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type , bool bubbles, bool cancelable, const Nullable<double>& alpha, const Nullable<d ouble>& beta, const Nullable<double>& gamma, bool absolute)
48 { 48 {
49 if (dispatched()) 49 if (dispatched())
50 return; 50 return;
51 51
52 initEvent(type, bubbles, cancelable); 52 initEvent(type, bubbles, cancelable);
53 m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute); 53 m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute);
54 } 54 }
55 55
56 double DeviceOrientationEvent::alpha(bool& isNull) const 56 double DeviceOrientationEvent::alpha(bool& isNull) const
57 { 57 {
(...skipping 15 matching lines...) Expand all
73 73
74 double DeviceOrientationEvent::gamma(bool& isNull) const 74 double DeviceOrientationEvent::gamma(bool& isNull) const
75 { 75 {
76 if (m_orientation->canProvideGamma()) 76 if (m_orientation->canProvideGamma())
77 return m_orientation->gamma(); 77 return m_orientation->gamma();
78 78
79 isNull = true; 79 isNull = true;
80 return 0; 80 return 0;
81 } 81 }
82 82
83 bool DeviceOrientationEvent::absolute(bool& isNull) const 83 bool DeviceOrientationEvent::absolute() const
84 { 84 {
85 if (m_orientation->canProvideAbsolute()) 85 return m_orientation->absolute();
86 return m_orientation->absolute();
87
88 isNull = true;
89 return 0;
90 } 86 }
91 87
92 const AtomicString& DeviceOrientationEvent::interfaceName() const 88 const AtomicString& DeviceOrientationEvent::interfaceName() const
93 { 89 {
94 return EventNames::DeviceOrientationEvent; 90 return EventNames::DeviceOrientationEvent;
95 } 91 }
96 92
97 DEFINE_TRACE(DeviceOrientationEvent) 93 DEFINE_TRACE(DeviceOrientationEvent)
98 { 94 {
99 visitor->trace(m_orientation); 95 visitor->trace(m_orientation);
100 Event::trace(visitor); 96 Event::trace(visitor);
101 } 97 }
102 98
103 } // namespace blink 99 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698