LayoutTests/ChangeLog

 12010-10-06 Hans Wennborg <hans@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Chromium] DeviceMotion plumbing
 6 https://bugs.webkit.org/show_bug.cgi?id=47078
 7
 8 Since DeviceMotion is no longer disabled by test_shell and DRT, these
 9 baselines need an update.
 10
 11 * platform/chromium-linux/fast/dom/Window/window-properties-device-orientation-expected.txt:
 12 * platform/chromium-mac/fast/dom/Window/window-properties-device-orientation-expected.txt:
 13 * platform/chromium-win/fast/dom/Window/window-properties-device-orientation-expected.txt:
 14
1152010-10-06 Kent Tamura <tkent@chromium.org>
216
317 Unreviewed, test expectation update.

LayoutTests/platform/chromium-linux/fast/dom/Window/window-properties-device-orientation-expected.txt

11This test dumps all of the properties that are reachable from the window.DeviceMotionEvent window.ondevicemotion, window.DeviceOrientationEvent and window.ondeviceorientation objects, along with their types. These properties are currently guarded by ENABLE_DEVICE_ORIENTATION.
22
3 window.DeviceMotionEvent [undefined]
4 window.ondevicemotion [undefined]
 3window.DeviceMotionEvent [function]
 4window.ondevicemotion [null]
55window.DeviceOrientationEvent [function]
66window.ondeviceorientation [null]

LayoutTests/platform/chromium-mac/fast/dom/Window/window-properties-device-orientation-expected.txt

11This test dumps all of the properties that are reachable from the window.DeviceMotionEvent window.ondevicemotion, window.DeviceOrientationEvent and window.ondeviceorientation objects, along with their types. These properties are currently guarded by ENABLE_DEVICE_ORIENTATION.
22
3 window.DeviceMotionEvent [undefined]
4 window.ondevicemotion [undefined]
 3window.DeviceMotionEvent [function]
 4window.ondevicemotion [null]
55window.DeviceOrientationEvent [function]
66window.ondeviceorientation [null]

LayoutTests/platform/chromium-win/fast/dom/Window/window-properties-device-orientation-expected.txt

11This test dumps all of the properties that are reachable from the window.DeviceMotionEvent window.ondevicemotion, window.DeviceOrientationEvent and window.ondeviceorientation objects, along with their types. These properties are currently guarded by ENABLE_DEVICE_ORIENTATION.
22
3 window.DeviceMotionEvent [undefined]
4 window.ondevicemotion [undefined]
 3window.DeviceMotionEvent [function]
 4window.ondevicemotion [null]
55window.DeviceOrientationEvent [function]
66window.ondeviceorientation [null]

WebKit/chromium/ChangeLog

 12010-10-06 Hans Wennborg <hans@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [Chromium] DeviceMotion plumbing
 6 https://bugs.webkit.org/show_bug.cgi?id=47078
 7
 8 Plumbing for DeviceMotion. The pattern is the same as for
 9 DeviceOrientation:
 10
 11 DeviceMotionProxy implements WebCore::DeviceMotionClient.
 12 This is passed into the Page, and proxies function calls to
 13 a WebDeviceMotionClient, which can then be implemented Chromium side,
 14 and is provided by the WebViewClient.
 15 Wrappers are provided for all classes that need it.
 16
 17 This patch also removes the hard disable of the runtime flag for
 18 DeviceMotion. The feature is still disabled in Chromium, but enabled
 19 otherwhere, e.g. in test_shell and DRT.
 20
 21 * WebKit.gyp:
 22 * public/WebDeviceMotionClient.h: Added.
 23 (WebKit::WebDeviceMotionClient::~WebDeviceMotionClient):
 24 * public/WebDeviceMotionController.h: Added.
 25 * public/WebDeviceMotionData.h: Added.
 26 (WebKit::WebDeviceMotionData::WebDeviceMotionData):
 27 * public/WebViewClient.h:
 28 (WebKit::WebViewClient::deviceMotionClient):
 29 * src/DeviceMotionClientProxy.cpp: Added.
 30 (WebKit::DeviceMotionClientProxy::DeviceMotionClientProxy):
 31 (WebKit::DeviceMotionClientProxy::~DeviceMotionClientProxy):
 32 (WebKit::DeviceMotionClientProxy::setController):
 33 (WebKit::DeviceMotionClientProxy::startUpdating):
 34 (WebKit::DeviceMotionClientProxy::stopUpdating):
 35 (WebKit::DeviceMotionClientProxy::currentDeviceMotion):
 36 (WebKit::DeviceMotionClientProxy::deviceMotionControllerDestroyed):
 37 * src/DeviceMotionClientProxy.h: Added.
 38 * src/WebDeviceMotionController.cpp: Added.
 39 (WebKit::WebDeviceMotionController::WebDeviceMotionController):
 40 (WebKit::WebDeviceMotionController::didChangeDeviceMotion):
 41 (WebKit::WebDeviceMotionController::controller):
 42 * src/WebDeviceMotionData.cpp: Added.
 43 (WebKit::WebDeviceMotionData::create):
 44 (WebKit::WebDeviceMotionData::WebDeviceMotionData):
 45 (WebKit::WebDeviceMotionData::operator=):
 46 (WebKit::WebDeviceMotionData::operator PassRefPtr<WebCore::DeviceMotionData>):
 47 * src/WebViewImpl.cpp:
 48 (WebKit::WebView::create):
 49 (WebKit::WebViewImpl::WebViewImpl):
 50 * src/WebViewImpl.h:
 51
1522010-09-29 Alpha Lam <hclam@chromium.org>
253
354 Reviewed by James Robinson.

WebKit/chromium/WebKit.gyp

127127 'public/WebCrossOriginPreflightResultCache.h',
128128 'public/WebCString.h',
129129 'public/WebCursorInfo.h',
 130 'public/WebDeviceMotionData.h',
130131 'public/WebDOMEvent.h',
131132 'public/WebDOMEventListener.h',
132133 'public/WebDOMMouseEvent.h',

140141 'public/WebDevToolsAgentClient.h',
141142 'public/WebDevToolsFrontend.h',
142143 'public/WebDevToolsFrontendClient.h',
 144 'public/WebDeviceMotionClient.h',
143145 'public/WebDeviceOrientation.h',
144146 'public/WebDeviceOrientationClient.h',
145147 'public/WebDeviceOrientationClientMock.h',

311313 'src/DebuggerAgentImpl.h',
312314 'src/DebuggerAgentManager.cpp',
313315 'src/DebuggerAgentManager.h',
 316 'src/DeviceMotionClientProxy.cpp',
 317 'src/DeviceMotionClientProxy.h',
314318 'src/DeviceOrientationClientProxy.cpp',
315319 'src/DeviceOrientationClientProxy.h',
316320 'src/DOMUtilitiesPrivate.cpp',

410414 'src/WebDevToolsAgentImpl.h',
411415 'src/WebDevToolsFrontendImpl.cpp',
412416 'src/WebDevToolsFrontendImpl.h',
 417 'src/WebDeviceMotionController.cpp',
 418 'src/WebDeviceMotionData.cpp',
413419 'src/WebDeviceOrientation.cpp',
414420 'src/WebDeviceOrientationClientMock.cpp',
415421 'src/WebDeviceOrientationController.cpp',

WebKit/chromium/public/WebDeviceMotionClient.h

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef WebDeviceMotionClient_h
 27#define WebDeviceMotionClient_h
 28
 29#include "WebCommon.h"
 30
 31namespace WebKit {
 32
 33class WebDeviceMotionController;
 34class WebDeviceMotionData;
 35
 36class WebDeviceMotionClient {
 37public:
 38 virtual ~WebDeviceMotionClient() {}
 39
 40 virtual void setController(WebDeviceMotionController*) { WEBKIT_ASSERT_NOT_REACHED(); }
 41 virtual void startUpdating() { WEBKIT_ASSERT_NOT_REACHED(); }
 42 virtual void stopUpdating() { WEBKIT_ASSERT_NOT_REACHED(); }
 43 virtual WebDeviceMotionData* currentDeviceMotion() const
 44 {
 45 WEBKIT_ASSERT_NOT_REACHED();
 46 return 0;
 47 }
 48};
 49
 50} // namespace WebKit
 51
 52#endif // WebDeviceMotionClient_h

WebKit/chromium/public/WebDeviceMotionController.h

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef WebDeviceMotionController_h
 27#define WebDeviceMotionController_h
 28
 29#include "WebCommon.h"
 30
 31namespace WebCore { class DeviceMotionController; }
 32
 33namespace WebKit {
 34
 35class WebDeviceMotionData;
 36
 37class WebDeviceMotionController {
 38public:
 39 WebDeviceMotionController(WebCore::DeviceMotionController*);
 40 WEBKIT_API void didChangeDeviceMotion(const WebDeviceMotionData*);
 41
 42#if WEBKIT_IMPLEMENTATION
 43 WebCore::DeviceMotionController* controller() const;
 44#endif
 45
 46private:
 47 WebCore::DeviceMotionController* m_controller;
 48};
 49
 50} // namespace WebKit
 51
 52#endif // WebDeviceMotionController_h

WebKit/chromium/public/WebDeviceMotionData.h

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef WebDeviceMotionData_h
 27#define WebDeviceMotionData_h
 28
 29#include "WebCommon.h"
 30#include "WebPrivatePtr.h"
 31
 32namespace WebCore { class DeviceMotionData; }
 33#if WEBKIT_IMPLEMENTATION
 34namespace WTF { template <typename T> class PassRefPtr; }
 35#endif
 36
 37namespace WebKit {
 38
 39class WebDeviceMotionData {
 40public:
 41 WebDeviceMotionData() { init(); }
 42 WebDeviceMotionData(bool canProvideXAcceleration, double xAcceleration,
 43 bool canProvideYAcceleration, double yAcceleration,
 44 bool canProvideZAcceleration, double zAcceleration,
 45 bool canProvideXAccelerationIncludingGravity, double xAccelerationIncludingGravity,
 46 bool canProvideYAccelerationIncludingGravity, double yAccelerationIncludingGravity,
 47 bool canProvideZAccelerationIncludingGravity, double zAccelerationIncludingGravity,
 48 bool canProvideAlphaRotationRate, double alphaRotationRate,
 49 bool canProvideBetaRotationRate, double betaRotationRate,
 50 bool canProvideGammaRotationRate, double gammaRotationRate,
 51 bool canProvideInterval, double interval)
 52 {
 53 init(canProvideXAcceleration, xAcceleration,
 54 canProvideYAcceleration, yAcceleration,
 55 canProvideZAcceleration, zAcceleration,
 56 canProvideXAccelerationIncludingGravity, xAccelerationIncludingGravity,
 57 canProvideYAccelerationIncludingGravity, yAccelerationIncludingGravity,
 58 canProvideZAccelerationIncludingGravity, zAccelerationIncludingGravity,
 59 canProvideAlphaRotationRate, alphaRotationRate,
 60 canProvideBetaRotationRate, betaRotationRate,
 61 canProvideGammaRotationRate, gammaRotationRate,
 62 canProvideInterval, interval);
 63 }
 64
 65 ~WebDeviceMotionData() { reset(); }
 66
 67#if WEBKIT_IMPLEMENTATION
 68 WebDeviceMotionData(const WTF::PassRefPtr<WebCore::DeviceMotionData>&);
 69 WebDeviceMotionData& operator=(const WTF::PassRefPtr<WebCore::DeviceMotionData>&);
 70 operator WTF::PassRefPtr<WebCore::DeviceMotionData>() const;
 71#endif
 72
 73private:
 74 WEBKIT_API void init();
 75 WEBKIT_API void init(bool canProvideXAcceleration, double xAcceleration,
 76 bool canProvideYAcceleration, double yAcceleration,
 77 bool canProvideZAcceleration, double zAcceleration,
 78 bool canProvideXAccelerationIncludingGravity, double xAccelerationIncludingGravity,
 79 bool canProvideYAccelerationIncludingGravity, double yAccelerationIncludingGravity,
 80 bool canProvideZAccelerationIncludingGravity, double zAccelerationIncludingGravity,
 81 bool canProvideAlphaRotationRate, double alphaRotationRate,
 82 bool canProvideBetaRotationRate, double betaRotationRate,
 83 bool canProvideGammaRotationRate, double gammaRotationRate,
 84 bool canProvideInterval, double interval);
 85 WEBKIT_API void reset();
 86
 87 WebPrivatePtr<WebCore::DeviceMotionData> m_deviceMotionData;
 88};
 89
 90} // namespace WebKit
 91
 92#endif // WebDeviceMotionData_h

WebKit/chromium/public/WebViewClient.h

4545namespace WebKit {
4646
4747class WebAccessibilityObject;
 48class WebDeviceMotionClient;
4849class WebDeviceOrientationClient;
4950class WebDragData;
5051class WebElement;

@@public:
348349 // Access the embedder API for device orientation services.
349350 virtual WebDeviceOrientationClient* deviceOrientationClient() { return 0; }
350351
 352 // Access the embedder API for device motion services.
 353 virtual WebDeviceMotionClient* deviceMotionClient() { return 0; }
351354
352355 // Zoom ----------------------------------------------------------------
353356

WebKit/chromium/src/DeviceMotionClientProxy.cpp

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "DeviceMotionClientProxy.h"
 28
 29#include "DeviceMotionData.h"
 30#include "WebDeviceMotionController.h"
 31#include "WebDeviceMotionData.h"
 32#include <wtf/RefPtr.h>
 33
 34namespace WebCore { class DeviceMotionController; }
 35
 36namespace WebKit {
 37
 38DeviceMotionClientProxy::DeviceMotionClientProxy(WebDeviceMotionClient* client)
 39 : m_client(client)
 40{
 41}
 42
 43DeviceMotionClientProxy::~DeviceMotionClientProxy()
 44{
 45}
 46
 47void DeviceMotionClientProxy::setController(WebCore::DeviceMotionController* controller)
 48{
 49 if (!m_client) // FIXME: Get rid of these null checks once device motion is enabled by default.
 50 return;
 51 m_client->setController(new WebDeviceMotionController(controller));
 52}
 53
 54void DeviceMotionClientProxy::startUpdating()
 55{
 56 if (!m_client)
 57 return;
 58 m_client->startUpdating();
 59}
 60
 61void DeviceMotionClientProxy::stopUpdating()
 62{
 63 if (!m_client)
 64 return;
 65 m_client->stopUpdating();
 66}
 67
 68WebCore::DeviceMotionData* DeviceMotionClientProxy::currentDeviceMotion() const
 69{
 70 if (!m_client)
 71 return 0;
 72 if (!m_client->currentDeviceMotion())
 73 return 0;
 74
 75 // Cache the DeviceMotionData pointer so its reference count does not drop to zero upon return.
 76 m_currentDeviceMotion = *m_client->currentDeviceMotion();
 77 return m_currentDeviceMotion.get();
 78}
 79
 80void DeviceMotionClientProxy::deviceMotionControllerDestroyed()
 81{
 82 // Our lifetime is bound to the WebViewImpl.
 83}
 84
 85} // namespace WebKit

WebKit/chromium/src/DeviceMotionClientProxy.h

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#ifndef DeviceMotionClientProxy_h
 27#define DeviceMotionClientProxy_h
 28
 29#include "DeviceMotionClient.h"
 30#include "WebDeviceMotionClient.h"
 31#include <wtf/RefPtr.h>
 32
 33namespace WebCore {
 34class DeviceMotionController;
 35class DeviceMotionData;
 36}
 37
 38namespace WebKit {
 39
 40class DeviceMotionClientProxy : public WebCore::DeviceMotionClient {
 41public:
 42 DeviceMotionClientProxy(WebDeviceMotionClient*);
 43 virtual ~DeviceMotionClientProxy();
 44
 45 // DeviceMotionClient
 46 virtual void setController(WebCore::DeviceMotionController*);
 47 virtual void startUpdating();
 48 virtual void stopUpdating();
 49 virtual WebCore::DeviceMotionData* currentDeviceMotion() const;
 50 virtual void deviceMotionControllerDestroyed();
 51
 52private:
 53 WebDeviceMotionClient* m_client;
 54 mutable RefPtr<WebCore::DeviceMotionData> m_currentDeviceMotion;
 55};
 56
 57} // namespace WebKit
 58
 59#endif // DeviceMotionClientProxy_h

WebKit/chromium/src/WebDeviceMotionController.cpp

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "WebDeviceMotionController.h"
 28
 29#include "DeviceMotionController.h"
 30#include "DeviceMotionData.h"
 31#include "WebDeviceMotionData.h"
 32#include <wtf/PassRefPtr.h>
 33
 34namespace WebKit {
 35
 36WebDeviceMotionController::WebDeviceMotionController(WebCore::DeviceMotionController* controller)
 37 : m_controller(controller)
 38{
 39}
 40
 41void WebDeviceMotionController::didChangeDeviceMotion(const WebDeviceMotionData* deviceMotionData)
 42{
 43 PassRefPtr<WebCore::DeviceMotionData> motion(*deviceMotionData);
 44 m_controller->didChangeDeviceMotion(motion.get());
 45}
 46
 47WebCore::DeviceMotionController* WebDeviceMotionController::controller() const
 48{
 49 return m_controller;
 50}
 51
 52} // namespace WebKit

WebKit/chromium/src/WebDeviceMotionData.cpp

 1/*
 2 * Copyright (C) 2010 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "WebDeviceMotionData.h"
 28
 29#include "DeviceMotionData.h"
 30#include <wtf/PassRefPtr.h>
 31#include <wtf/RefPtr.h>
 32
 33using WebCore::DeviceMotionData;
 34
 35namespace WebKit {
 36
 37void WebDeviceMotionData::init()
 38{
 39 m_deviceMotionData = DeviceMotionData::create();
 40}
 41
 42void WebDeviceMotionData::init(bool canProvideXAcceleration, double xAcceleration,
 43 bool canProvideYAcceleration, double yAcceleration,
 44 bool canProvideZAcceleration, double zAcceleration,
 45 bool canProvideXAccelerationIncludingGravity, double xAccelerationIncludingGravity,
 46 bool canProvideYAccelerationIncludingGravity, double yAccelerationIncludingGravity,
 47 bool canProvideZAccelerationIncludingGravity, double zAccelerationIncludingGravity,
 48 bool canProvideAlphaRotationRate, double alphaRotationRate,
 49 bool canProvideBetaRotationRate, double betaRotationRate,
 50 bool canProvideGammaRotationRate, double gammaRotationRate,
 51 bool canProvideInterval, double interval)
 52{
 53 RefPtr<DeviceMotionData::Acceleration> acceleration;
 54 if (canProvideXAcceleration || canProvideYAcceleration || canProvideZAcceleration) {
 55 acceleration = DeviceMotionData::Acceleration::create(canProvideXAcceleration, xAcceleration,
 56 canProvideYAcceleration, yAcceleration,
 57 canProvideZAcceleration, zAcceleration);
 58 }
 59
 60 RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity;
 61 if (canProvideXAccelerationIncludingGravity || canProvideYAccelerationIncludingGravity || canProvideZAccelerationIncludingGravity) {
 62 accelerationIncludingGravity = DeviceMotionData::Acceleration::create(canProvideXAccelerationIncludingGravity, xAccelerationIncludingGravity,
 63 canProvideYAccelerationIncludingGravity, yAccelerationIncludingGravity,
 64 canProvideZAccelerationIncludingGravity, zAccelerationIncludingGravity);
 65 }
 66
 67 RefPtr<DeviceMotionData::RotationRate> rotationRate;
 68 if (canProvideAlphaRotationRate || canProvideBetaRotationRate || canProvideGammaRotationRate) {
 69 rotationRate = DeviceMotionData::RotationRate::create(canProvideAlphaRotationRate, alphaRotationRate,
 70 canProvideBetaRotationRate, betaRotationRate,
 71 canProvideGammaRotationRate, gammaRotationRate);
 72 }
 73
 74 m_deviceMotionData = DeviceMotionData::create(acceleration.get(), accelerationIncludingGravity.get(), rotationRate.get(), canProvideInterval, interval);
 75}
 76
 77void WebDeviceMotionData::reset()
 78{
 79 m_deviceMotionData.reset();
 80}
 81
 82WebDeviceMotionData::WebDeviceMotionData(const PassRefPtr<WebCore::DeviceMotionData>& deviceMotionData)
 83 : m_deviceMotionData(deviceMotionData)
 84{
 85}
 86
 87WebDeviceMotionData& WebDeviceMotionData::operator=(const WTF::PassRefPtr<WebCore::DeviceMotionData>& deviceMotionData)
 88{
 89 m_deviceMotionData = deviceMotionData;
 90 return *this;
 91}
 92
 93WebDeviceMotionData::operator PassRefPtr<WebCore::DeviceMotionData>() const
 94{
 95 return m_deviceMotionData.get();
 96}
 97
 98} // namespace WebKit

WebKit/chromium/src/WebViewImpl.cpp

4242#include "CSSStyleSelector.h"
4343#include "CSSValueKeywords.h"
4444#include "Cursor.h"
 45#include "DeviceMotionClientProxy.h"
4546#include "DeviceOrientationClientProxy.h"
4647#include "Document.h"
4748#include "DocumentLoader.h"

@@static const PopupContainerSettings autoFillPopupSettings = {
186187
187188WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devToolsClient)
188189{
189  // Keep runtime flag for device motion turned off until it's implemented.
190  WebRuntimeFeatures::enableDeviceMotion(false);
191 
192190 // Pass the WebViewImpl's self-reference to the caller.
193191 return adoptRef(new WebViewImpl(client, devToolsClient)).leakRef();
194192}

@@WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
278276 , m_speechInputClient(client)
279277#endif
280278 , m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0))
 279 , m_deviceMotionClientProxy(new DeviceMotionClientProxy(client ? client->deviceMotionClient() : 0))
281280{
282281 // WebKit/win/WebView.cpp does the same thing, except they call the
283282 // KJS specific wrapper around this method. We need to have threading

@@WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools
301300 pageClients.speechInputClient = &m_speechInputClient;
302301#endif
303302 pageClients.deviceOrientationClient = m_deviceOrientationClientProxy.get();
 303 pageClients.deviceMotionClient = m_deviceMotionClientProxy.get();
304304
305305 m_page.set(new Page(pageClients));
306306

WebKit/chromium/src/WebViewImpl.h

@@namespace WebKit {
7272class AutocompletePopupMenuClient;
7373class AutoFillPopupMenuClient;
7474class ContextMenuClientImpl;
 75class DeviceMotionClientProxy;
7576class DeviceOrientationClientProxy;
7677class DragScrollTimer;
7778class WebAccessibilityObject;

@@private:
544545 // early. This member holds on to the GC3D in this case.
545546 OwnPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
546547 OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy;
 548 OwnPtr<DeviceMotionClientProxy> m_deviceMotionClientProxy;
547549};
548550
549551} // namespace WebKit