Commit 7ff58d47 authored by steveblock@google.com's avatar steveblock@google.com

2010-09-02 Steve Block <steveblock@google.com>

        Reviewed by Adam Barth.

        Hook up LayoutTestController.setMockDeviceOrientation() on Mac.
        https://bugs.webkit.org/show_bug.cgi?id=43181

        * WebKit.xcodeproj/project.pbxproj:
2010-09-02  Steve Block  <steveblock@google.com>

        Reviewed by Adam Barth.

        Hook up LayoutTestController.setMockDeviceOrientation() on Mac.
        https://bugs.webkit.org/show_bug.cgi?id=43181

        This patch hooks up the mock device orientation client on Mac for use
        in DumpRenderTree.

        The patch adds a new WebDeviceOrientationClient for Mac. This client acts
        as a proxy to either a real or mock device orientation provider, both of
        which implement a new WebDeviceOrientationProvider interface.

        The provider is created by the embedder and passed to the WebView, from
        where WebDeviceOrientationClient can access it.

        The mock provider, WebDeviceOrientationProviderMock, is a wrapper around
        the existing WebCore mock.

        * WebCoreSupport/WebDeviceOrientationClient.h: Added.
        * WebCoreSupport/WebDeviceOrientationClient.mm: Added.
        (WebDeviceOrientationClient::WebDeviceOrientationClient):
        (WebDeviceOrientationClient::setController):
        (WebDeviceOrientationClient::startUpdating):
        (WebDeviceOrientationClient::stopUpdating):
        (WebDeviceOrientationClient::lastOrientation):
        * WebKit.exp:
        * WebView/WebDeviceOrientation.h: Added.
        * WebView/WebDeviceOrientation.mm: Added.
        (-[WebDeviceOrientation initWithCoreDeviceOrientation:WebCore::]):
        (core):
        (-[WebDeviceOrientation initWithCanProvideAlpha:alpha:canProvideBeta:beta:canProvideGamma:gamma:]):
        (-[WebDeviceOrientation dealloc]):
        * WebView/WebDeviceOrientationInternal.h: Added.
        * WebView/WebDeviceOrientationProvider.h: Added.
        * WebView/WebDeviceOrientationProviderMock.h: Added.
        * WebView/WebDeviceOrientationProviderMock.mm: Added.
        (-[WebDeviceOrientationProviderMockInternal setOrientation:]):
        (-[WebDeviceOrientationProviderMockInternal setController:]):
        (-[WebDeviceOrientationProviderMockInternal startUpdating]):
        (-[WebDeviceOrientationProviderMockInternal stopUpdating]):
        (-[WebDeviceOrientationProviderMockInternal lastOrientation]):
        (-[WebDeviceOrientationProviderMock init]):
        (-[WebDeviceOrientationProviderMock dealloc]):
        (-[WebDeviceOrientationProviderMock setOrientation:]):
        (-[WebDeviceOrientationProviderMock setController:]):
        (-[WebDeviceOrientationProviderMock startUpdating]):
        (-[WebDeviceOrientationProviderMock stopUpdating]):
        (-[WebDeviceOrientationProviderMock lastOrientation]):
        * WebView/WebDeviceOrientationProviderMockInternal.h: Added.
        * WebView/WebView.mm:
        (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
        (-[WebView _setDeviceOrientationProvider:]):
        (-[WebView _deviceOrientationProvider]):
        * WebView/WebViewData.h:
        * WebView/WebViewPrivate.h:
2010-09-02  Steve Block  <steveblock@google.com>

        Reviewed by Adam Barth.

        Hook up LayoutTestController.setMockDeviceOrientation() on Mac.
        https://bugs.webkit.org/show_bug.cgi?id=43181

        * DumpRenderTree/mac/DumpRenderTree.mm:
        (createWebViewAndOffscreenWindow):
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::setMockDeviceOrientation):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66685 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e16d41e
2010-09-02 Steve Block <steveblock@google.com>
Reviewed by Adam Barth.
Hook up LayoutTestController.setMockDeviceOrientation() on Mac.
https://bugs.webkit.org/show_bug.cgi?id=43181
* WebKit.xcodeproj/project.pbxproj:
2010-08-30 Andy Estes <aestes@apple.com>
Reviewed by Darin Adler.
......
......@@ -111,6 +111,15 @@
51FDC4D30B0AF5C100F84EB3 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
5241ADF50B1BC48A004012BD /* WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5241ADF30B1BC48A004012BD /* WebCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5241ADF40B1BC48A004012BD /* WebCache.mm */; };
598AD91A1201CEC900ABAE4E /* WebDeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9191201CEC900ABAE4E /* WebDeviceOrientationClient.h */; };
598AD91E1201CECF00ABAE4E /* WebDeviceOrientationClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD91D1201CECF00ABAE4E /* WebDeviceOrientationClient.mm */; };
598AD9201201CF0700ABAE4E /* WebDeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD91F1201CF0700ABAE4E /* WebDeviceOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
598AD9221201CF1000ABAE4E /* WebDeviceOrientation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD9211201CF1000ABAE4E /* WebDeviceOrientation.mm */; };
598AD9241201CF1900ABAE4E /* WebDeviceOrientationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9231201CF1900ABAE4E /* WebDeviceOrientationInternal.h */; };
598AD9261201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9251201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */; };
598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */; };
598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; };
5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A740D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib */; };
......@@ -523,6 +532,15 @@
51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemPrivate.h; sourceTree = "<group>"; };
5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; };
5241ADF40B1BC48A004012BD /* WebCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCache.mm; sourceTree = "<group>"; };
598AD9191201CEC900ABAE4E /* WebDeviceOrientationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationClient.h; sourceTree = "<group>"; };
598AD91D1201CECF00ABAE4E /* WebDeviceOrientationClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientationClient.mm; sourceTree = "<group>"; };
598AD91F1201CF0700ABAE4E /* WebDeviceOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientation.h; sourceTree = "<group>"; };
598AD9211201CF1000ABAE4E /* WebDeviceOrientation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientation.mm; sourceTree = "<group>"; };
598AD9231201CF1900ABAE4E /* WebDeviceOrientationInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationInternal.h; sourceTree = "<group>"; };
598AD9251201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProviderMock.h; sourceTree = "<group>"; };
598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientationProviderMock.mm; sourceTree = "<group>"; };
598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProviderMockInternal.h; sourceTree = "<group>"; };
598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProvider.h; sourceTree = "<group>"; };
5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; };
5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; };
5DE83A750D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebJavaScriptTextInputPanel.nib; sourceTree = SOURCE_ROOT; };
......@@ -1124,6 +1142,13 @@
9C7CABBB0190A37C0ECA16EA /* WebView */ = {
isa = PBXGroup;
children = (
598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */,
598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */,
598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */,
598AD9251201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h */,
598AD9231201CF1900ABAE4E /* WebDeviceOrientationInternal.h */,
598AD9211201CF1000ABAE4E /* WebDeviceOrientation.mm */,
598AD91F1201CF0700ABAE4E /* WebDeviceOrientation.h */,
F52CA6BD02DF9D0F018635CA /* HTML */,
51E94C0706C02CA300A9B09E /* PDF */,
8373435A0624EE0D00F3B289 /* WebArchive.h */,
......@@ -1249,6 +1274,8 @@
F5B36B400281DE87018635CB /* WebCoreSupport */ = {
isa = PBXGroup;
children = (
598AD91D1201CECF00ABAE4E /* WebDeviceOrientationClient.mm */,
598AD9191201CEC900ABAE4E /* WebDeviceOrientationClient.h */,
B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */,
B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */,
A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */,
......@@ -1589,6 +1616,12 @@
A57E2F24120749E600048DF3 /* WebQuotaManager.h in Headers */,
B804176F1217A83100466BAE /* WebInspectorFrontend.h in Headers */,
9391F275121B38BD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */,
598AD91A1201CEC900ABAE4E /* WebDeviceOrientationClient.h in Headers */,
598AD9201201CF0700ABAE4E /* WebDeviceOrientation.h in Headers */,
598AD9241201CF1900ABAE4E /* WebDeviceOrientationInternal.h in Headers */,
598AD9261201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h in Headers */,
598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */,
598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1952,6 +1985,9 @@
A5DEFC1411D5344B00885273 /* WebApplicationCacheQuotaManager.mm in Sources */,
B80417701217A83100466BAE /* WebInspectorFrontend.mm in Sources */,
9391F276121B38BD00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */,
598AD91E1201CECF00ABAE4E /* WebDeviceOrientationClient.mm in Sources */,
598AD9221201CF1000ABAE4E /* WebDeviceOrientation.mm in Sources */,
598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
2010-09-02 Steve Block <steveblock@google.com>
Reviewed by Adam Barth.
Hook up LayoutTestController.setMockDeviceOrientation() on Mac.
https://bugs.webkit.org/show_bug.cgi?id=43181
This patch hooks up the mock device orientation client on Mac for use
in DumpRenderTree.
The patch adds a new WebDeviceOrientationClient for Mac. This client acts
as a proxy to either a real or mock device orientation provider, both of
which implement a new WebDeviceOrientationProvider interface.
The provider is created by the embedder and passed to the WebView, from
where WebDeviceOrientationClient can access it.
The mock provider, WebDeviceOrientationProviderMock, is a wrapper around
the existing WebCore mock.
* WebCoreSupport/WebDeviceOrientationClient.h: Added.
* WebCoreSupport/WebDeviceOrientationClient.mm: Added.
(WebDeviceOrientationClient::WebDeviceOrientationClient):
(WebDeviceOrientationClient::setController):
(WebDeviceOrientationClient::startUpdating):
(WebDeviceOrientationClient::stopUpdating):
(WebDeviceOrientationClient::lastOrientation):
* WebKit.exp:
* WebView/WebDeviceOrientation.h: Added.
* WebView/WebDeviceOrientation.mm: Added.
(-[WebDeviceOrientation initWithCoreDeviceOrientation:WebCore::]):
(core):
(-[WebDeviceOrientation initWithCanProvideAlpha:alpha:canProvideBeta:beta:canProvideGamma:gamma:]):
(-[WebDeviceOrientation dealloc]):
* WebView/WebDeviceOrientationInternal.h: Added.
* WebView/WebDeviceOrientationProvider.h: Added.
* WebView/WebDeviceOrientationProviderMock.h: Added.
* WebView/WebDeviceOrientationProviderMock.mm: Added.
(-[WebDeviceOrientationProviderMockInternal setOrientation:]):
(-[WebDeviceOrientationProviderMockInternal setController:]):
(-[WebDeviceOrientationProviderMockInternal startUpdating]):
(-[WebDeviceOrientationProviderMockInternal stopUpdating]):
(-[WebDeviceOrientationProviderMockInternal lastOrientation]):
(-[WebDeviceOrientationProviderMock init]):
(-[WebDeviceOrientationProviderMock dealloc]):
(-[WebDeviceOrientationProviderMock setOrientation:]):
(-[WebDeviceOrientationProviderMock setController:]):
(-[WebDeviceOrientationProviderMock startUpdating]):
(-[WebDeviceOrientationProviderMock stopUpdating]):
(-[WebDeviceOrientationProviderMock lastOrientation]):
* WebView/WebDeviceOrientationProviderMockInternal.h: Added.
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
(-[WebView _setDeviceOrientationProvider:]):
(-[WebView _deviceOrientationProvider]):
* WebView/WebViewData.h:
* WebView/WebViewPrivate.h:
2010-09-01 Jia Pu <jpu@apple.com>
Reviewed by Dan Bernstein.
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WebDeviceOrientationProvider.h"
#import <WebCore/DeviceOrientationClient.h>
namespace WebCore {
class DeviceOrientationController;
}
@class WebView;
// This class is the Mac implementation of DeviceOrientationClient. It is
// passed to the Page constructor by the WebView. It is a simple proxy to
// either the real or mock client which is passed to the WebView. It is
// required because the WebView must pass a client to the Page constructor,
// but the real or mock client can not be specified until after the Page has
// been constructed.
class WebDeviceOrientationClient : public WebCore::DeviceOrientationClient {
public:
WebDeviceOrientationClient(WebView*);
// DeviceOrientationClient methods
virtual void setController(WebCore::DeviceOrientationController*);
virtual void startUpdating();
virtual void stopUpdating();
virtual WebCore::DeviceOrientation* lastOrientation() const;
private:
id<WebDeviceOrientationProvider> getProvider() const;
WebView* m_webView;
WebCore::DeviceOrientationController* m_controller;
mutable id<WebDeviceOrientationProvider> m_provider;
};
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WebDeviceOrientationClient.h"
#import "WebDeviceOrientationInternal.h"
#import "WebDeviceOrientationProvider.h"
#import "WebViewInternal.h"
#import <objc/objc-runtime.h>
using namespace WebCore;
WebDeviceOrientationClient::WebDeviceOrientationClient(WebView* webView)
: m_webView(webView)
, m_controller(0)
{
}
void WebDeviceOrientationClient::setController(DeviceOrientationController* controller)
{
// This is called by the Page constructor before our WebView has the provider set up.
// Cache the controller for later use.
m_controller = controller;
}
void WebDeviceOrientationClient::startUpdating()
{
[getProvider() startUpdating];
}
void WebDeviceOrientationClient::stopUpdating()
{
[getProvider() stopUpdating];
}
DeviceOrientation* WebDeviceOrientationClient::lastOrientation() const
{
return core([getProvider() lastOrientation]);
}
id<WebDeviceOrientationProvider> WebDeviceOrientationClient::getProvider() const
{
if (!m_provider) {
m_provider = [m_webView _deviceOrientationProvider];
if ([m_provider respondsToSelector:@selector(setController:)])
objc_msgSend(m_provider, @selector(setController:), m_controller);
}
return m_provider;
}
......@@ -7,6 +7,8 @@
.objc_class_name_WebDataSource
.objc_class_name_WebDatabaseManager
.objc_class_name_WebDefaultPolicyDelegate
.objc_class_name_WebDeviceOrientation
.objc_class_name_WebDeviceOrientationProviderMock
.objc_class_name_WebDownload
.objc_class_name_WebDynamicScrollBarsView
.objc_class_name_WebFormDelegate
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@class WebDeviceOrientationInternal;
@interface WebDeviceOrientation : NSObject {
WebDeviceOrientationInternal* m_internal;
}
- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma;
@end
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WebDeviceOrientationInternal.h"
using namespace WebCore;
@implementation WebDeviceOrientationInternal
- (id)initWithCoreDeviceOrientation:(PassRefPtr<DeviceOrientation>)coreDeviceOrientation
{
self = [super init];
if (!self)
return nil;
m_orientation = coreDeviceOrientation;
return self;
}
@end
@implementation WebDeviceOrientation (Internal)
- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation
{
self = [super init];
if (!self)
return nil;
m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:coreDeviceOrientation];
return self;
}
@end
@implementation WebDeviceOrientation
DeviceOrientation* core(WebDeviceOrientation* orientation)
{
return orientation ? orientation->m_internal->m_orientation.get() : 0;
}
- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma
{
self = [super init];
if (!self)
return nil;
m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientation::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)];
return self;
}
- (void)dealloc
{
[m_internal release];
[super dealloc];
}
@end
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WebDeviceOrientation.h"
#import <WebCore/DeviceOrientation.h>
#import <wtf/RefPtr.h>
@interface WebDeviceOrientationInternal : NSObject {
@public
RefPtr<WebCore::DeviceOrientation> m_orientation;
}
- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation;
@end
@interface WebDeviceOrientation (Internal)
- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation;
@end
WebCore::DeviceOrientation* core(WebDeviceOrientation*);
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@class WebDeviceOrientation;
@protocol WebDeviceOrientationProvider <NSObject>
- (void)startUpdating;
- (void)stopUpdating;
- (WebDeviceOrientation*)lastOrientation;
@end
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WebDeviceOrientationProvider.h"
@class WebDeviceOrientationProviderMockInternal;
@class WebDeviceOrientation;
@interface WebDeviceOrientationProviderMock : NSObject<WebDeviceOrientationProvider> {
WebDeviceOrientationProviderMockInternal* m_internal;
}
- (id)init;
- (void)setOrientation:(WebDeviceOrientation*)orientation;
@end
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WebDeviceOrientationProviderMockInternal.h"
#import "WebDeviceOrientationInternal.h"
using namespace WebCore;
@implementation WebDeviceOrientationProviderMockInternal
- (id)init
{
self = [super init];
if (!self)
return nil;
m_core.set(new DeviceOrientationClientMock());
return self;
}
- (void)setOrientation:(WebDeviceOrientation*)orientation
{
m_core->setOrientation(core(orientation));
}
- (void)setController:(DeviceOrientationController*)controller
{
m_core->setController(controller);
}
- (void)startUpdating
{
m_core->startUpdating();
}
- (void)stopUpdating
{
m_core->stopUpdating();
}
- (WebDeviceOrientation*)lastOrientation
{
return [[WebDeviceOrientation alloc] initWithCoreDeviceOrientation:m_core->lastOrientation()];
}
@end
@implementation WebDeviceOrientationProviderMock (Internal)
- (void)setController:(WebCore::DeviceOrientationController*)controller
{
[m_internal setController:controller];
}
@end
@implementation WebDeviceOrientationProviderMock
- (id)init;
{
self = [super init];
if (!self)
return nil;
m_internal = [[WebDeviceOrientationProviderMockInternal alloc] init];
return self;
}
- (void)dealloc
{
[super dealloc];
[m_internal release];
}
- (void)setOrientation:(WebDeviceOrientation*)orientation
{
[m_internal setOrientation:orientation];
}
- (void)startUpdating
{
[m_internal startUpdating];
}
- (void)stopUpdating
{
[m_internal stopUpdating];
}
- (WebDeviceOrientation*)lastOrientation
{
return [m_internal lastOrientation];
}
@end
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.