Use WebScreenInfo members to provide screen orientation information for layout test support.

BUG=162827

Review URL: https://codereview.chromium.org/284583003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271017 0039d316-1c4b-4281-b951-d872f2087c98
parent b7386240
...@@ -61,6 +61,7 @@ void SetMockDeviceOrientationData(const blink::WebDeviceOrientationData& data); ...@@ -61,6 +61,7 @@ void SetMockDeviceOrientationData(const blink::WebDeviceOrientationData& data);
// Sets WebScreenOrientationType that should be used as a mock orientation. // Sets WebScreenOrientationType that should be used as a mock orientation.
void SetMockScreenOrientation( void SetMockScreenOrientation(
RenderView* render_view,
const blink::WebScreenOrientationType& orientation); const blink::WebScreenOrientationType& orientation);
// Resets the mock screen orientation data. // Resets the mock screen orientation data.
......
...@@ -4005,6 +4005,36 @@ void RenderViewImpl::SetDeviceScaleFactorForTesting(float factor) { ...@@ -4005,6 +4005,36 @@ void RenderViewImpl::SetDeviceScaleFactorForTesting(float factor) {
OnResize(params); OnResize(params);
} }
void RenderViewImpl::SetScreenOrientationForTesting(
const blink::WebScreenOrientationType& orientation) {
ViewMsg_Resize_Params params;
params.screen_info = screen_info_;
params.screen_info.orientationType = orientation;
// FIXME(ostap): This relationship between orientationType and
// orientationAngle is temporary. The test should be able to specify
// the angle in addition to the orientation type.
switch (orientation) {
case blink::WebScreenOrientationLandscapePrimary:
params.screen_info.orientationAngle = 90;
break;
case blink::WebScreenOrientationLandscapeSecondary:
params.screen_info.orientationAngle = -90;
break;
case blink::WebScreenOrientationPortraitSecondary:
params.screen_info.orientationAngle = 180;
break;
default:
params.screen_info.orientationAngle = 0;
}
params.new_size = size();
params.physical_backing_size = gfx::ToCeiledSize(
gfx::ScaleSize(size(), params.screen_info.deviceScaleFactor));
params.overdraw_bottom_height = 0.f;
params.resizer_rect = WebRect();
params.is_fullscreen = is_fullscreen();
OnResize(params);
}
void RenderViewImpl::SetDeviceColorProfileForTesting( void RenderViewImpl::SetDeviceColorProfileForTesting(
const std::vector<char>& color_profile) { const std::vector<char>& color_profile) {
// TODO(noel): Add RenderViewImpl::SetDeviceColorProfile(color_profile). // TODO(noel): Add RenderViewImpl::SetDeviceColorProfile(color_profile).
......
...@@ -360,6 +360,10 @@ class CONTENT_EXPORT RenderViewImpl ...@@ -360,6 +360,10 @@ class CONTENT_EXPORT RenderViewImpl
// Change the device scale factor and force the compositor to resize. // Change the device scale factor and force the compositor to resize.
void SetDeviceScaleFactorForTesting(float factor); void SetDeviceScaleFactorForTesting(float factor);
// Change screen orientation and force the compositor to resize.
void SetScreenOrientationForTesting(
const blink::WebScreenOrientationType& orientation);
// Change the device ICC color profile while running a layout test. // Change the device ICC color profile while running a layout test.
void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
......
...@@ -228,7 +228,7 @@ void WebKitTestRunner::setDeviceOrientationData( ...@@ -228,7 +228,7 @@ void WebKitTestRunner::setDeviceOrientationData(
void WebKitTestRunner::setScreenOrientation( void WebKitTestRunner::setScreenOrientation(
const WebScreenOrientationType& orientation) { const WebScreenOrientationType& orientation) {
SetMockScreenOrientation(orientation); SetMockScreenOrientation(render_view(), orientation);
} }
void WebKitTestRunner::resetScreenOrientation() { void WebKitTestRunner::resetScreenOrientation() {
......
...@@ -103,7 +103,11 @@ void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { ...@@ -103,7 +103,11 @@ void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) {
} }
void SetMockScreenOrientation( void SetMockScreenOrientation(
RenderView* render_view,
const blink::WebScreenOrientationType& orientation) { const blink::WebScreenOrientationType& orientation) {
static_cast<RenderViewImpl*>(render_view)
->SetScreenOrientationForTesting(orientation);
// FIXME(ostap): Remove this when blink side gets updated.
RendererWebKitPlatformSupportImpl:: RendererWebKitPlatformSupportImpl::
SetMockScreenOrientationForTesting(orientation); SetMockScreenOrientationForTesting(orientation);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment