OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Apple Inc. All rights reserved. | 2 * Copyright 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const char* DeviceOrientationController::supplementName() | 58 const char* DeviceOrientationController::supplementName() |
59 { | 59 { |
60 return "DeviceOrientationController"; | 60 return "DeviceOrientationController"; |
61 } | 61 } |
62 | 62 |
63 DeviceOrientationController& DeviceOrientationController::from(Document& documen
t) | 63 DeviceOrientationController& DeviceOrientationController::from(Document& documen
t) |
64 { | 64 { |
65 DeviceOrientationController* controller = static_cast<DeviceOrientationContr
oller*>(DocumentSupplement::from(document, supplementName())); | 65 DeviceOrientationController* controller = static_cast<DeviceOrientationContr
oller*>(DocumentSupplement::from(document, supplementName())); |
66 if (!controller) { | 66 if (!controller) { |
67 controller = new DeviceOrientationController(document); | 67 controller = new DeviceOrientationController(document); |
68 DocumentSupplement::provideTo(document, supplementName(), adoptPtr(contr
oller)); | 68 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe
Noop(controller)); |
69 } | 69 } |
70 return *controller; | 70 return *controller; |
71 } | 71 } |
72 | 72 |
73 DeviceOrientationData* DeviceOrientationController::lastData() | 73 DeviceOrientationData* DeviceOrientationController::lastData() |
74 { | 74 { |
75 return m_overrideOrientationData ? m_overrideOrientationData.get() : DeviceO
rientationDispatcher::instance().latestDeviceOrientationData(); | 75 return m_overrideOrientationData ? m_overrideOrientationData.get() : DeviceO
rientationDispatcher::instance().latestDeviceOrientationData(); |
76 } | 76 } |
77 | 77 |
78 bool DeviceOrientationController::hasLastData() | 78 bool DeviceOrientationController::hasLastData() |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 void DeviceOrientationController::clearOverride() | 142 void DeviceOrientationController::clearOverride() |
143 { | 143 { |
144 if (!m_overrideOrientationData) | 144 if (!m_overrideOrientationData) |
145 return; | 145 return; |
146 m_overrideOrientationData.clear(); | 146 m_overrideOrientationData.clear(); |
147 DeviceOrientationData* orientation = lastData(); | 147 DeviceOrientationData* orientation = lastData(); |
148 if (orientation) | 148 if (orientation) |
149 didChangeDeviceOrientation(orientation); | 149 didChangeDeviceOrientation(orientation); |
150 } | 150 } |
151 | 151 |
| 152 void DeviceOrientationController::trace(Visitor* visitor) |
| 153 { |
| 154 visitor->trace(m_overrideOrientationData); |
| 155 } |
| 156 |
152 } // namespace WebCore | 157 } // namespace WebCore |
OLD | NEW |