Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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): Canonical link: https://commits.webkit.org/57444@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66685 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
19 changed files
with
679 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,57 @@ | ||
/* | ||
* 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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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 |
Oops, something went wrong.