| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 * * 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 if (init.hasGamma()) | 54 if (init.hasGamma()) |
| 55 gamma = init.gamma(); | 55 gamma = init.gamma(); |
| 56 return DeviceOrientationData::create(alpha, beta, gamma, init.absolute()); | 56 return DeviceOrientationData::create(alpha, beta, gamma, init.absolute()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 DeviceOrientationData* DeviceOrientationData::create( | 59 DeviceOrientationData* DeviceOrientationData::create( |
| 60 const device::OrientationData& data) { | 60 const device::OrientationData& data) { |
| 61 Nullable<double> alpha; | 61 Nullable<double> alpha; |
| 62 Nullable<double> beta; | 62 Nullable<double> beta; |
| 63 Nullable<double> gamma; | 63 Nullable<double> gamma; |
| 64 if (data.hasAlpha) | 64 if (data.has_alpha) |
| 65 alpha = data.alpha; | 65 alpha = data.alpha; |
| 66 if (data.hasBeta) | 66 if (data.has_beta) |
| 67 beta = data.beta; | 67 beta = data.beta; |
| 68 if (data.hasGamma) | 68 if (data.has_gamma) |
| 69 gamma = data.gamma; | 69 gamma = data.gamma; |
| 70 return DeviceOrientationData::create(alpha, beta, gamma, data.absolute); | 70 return DeviceOrientationData::create(alpha, beta, gamma, data.absolute); |
| 71 } | 71 } |
| 72 | 72 |
| 73 DeviceOrientationData::DeviceOrientationData() {} | 73 DeviceOrientationData::DeviceOrientationData() {} |
| 74 | 74 |
| 75 DeviceOrientationData::DeviceOrientationData(const Nullable<double>& alpha, | 75 DeviceOrientationData::DeviceOrientationData(const Nullable<double>& alpha, |
| 76 const Nullable<double>& beta, | 76 const Nullable<double>& beta, |
| 77 const Nullable<double>& gamma, | 77 const Nullable<double>& gamma, |
| 78 bool absolute) | 78 bool absolute) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 | 104 |
| 105 bool DeviceOrientationData::canProvideGamma() const { | 105 bool DeviceOrientationData::canProvideGamma() const { |
| 106 return !m_gamma.isNull(); | 106 return !m_gamma.isNull(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool DeviceOrientationData::canProvideEventData() const { | 109 bool DeviceOrientationData::canProvideEventData() const { |
| 110 return canProvideAlpha() || canProvideBeta() || canProvideGamma(); | 110 return canProvideAlpha() || canProvideBeta() || canProvideGamma(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |