Commit 19908d78 authored by mlamouri@chromium.org's avatar mlamouri@chromium.org

Update screen.orientation to follow the latest version of the specs.

It also returns 'portrait-primary' when the frame is detached
instead of empty string (current behaviour).

BUG=162827

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169932 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e43015d6
......@@ -44,7 +44,7 @@ PASS window.cached_screen.availHeight is 0
PASS window.cached_screen.availWidth is 0
PASS window.cached_screen.colorDepth is 0
PASS window.cached_screen.height is 0
PASS window.cached_screen.orientation is ''
PASS window.cached_screen.orientation is 'portrait-primary'
PASS window.cached_screen.pixelDepth is 0
PASS window.cached_screen.width is 0
PASS window.cached_scrollbars.visible is false
......
......@@ -41,7 +41,7 @@ PASS window.cached_screen.availHeight is 0
PASS window.cached_screen.availWidth is 0
PASS window.cached_screen.colorDepth is 0
PASS window.cached_screen.height is 0
PASS window.cached_screen.orientation is ''
PASS window.cached_screen.orientation is 'portrait-primary'
PASS window.cached_screen.pixelDepth is 0
PASS window.cached_screen.width is 0
PASS window.cached_scrollbars.visible is false
......
......@@ -41,7 +41,7 @@ PASS window.cached_screen.availHeight is 0
PASS window.cached_screen.availWidth is 0
PASS window.cached_screen.colorDepth is 0
PASS window.cached_screen.height is 0
PASS window.cached_screen.orientation is ''
PASS window.cached_screen.orientation is 'portrait-primary'
PASS window.cached_screen.pixelDepth is 0
PASS window.cached_screen.width is 0
PASS window.cached_scrollbars.visible is false
......
......@@ -49,7 +49,7 @@ PASS childWindow.screen.availHeight is 0
PASS childWindow.screen.availWidth is 0
PASS childWindow.screen.colorDepth is 0
PASS childWindow.screen.height is 0
PASS childWindow.screen.orientation is ''
PASS childWindow.screen.orientation is 'portrait-primary'
PASS childWindow.screen.pixelDepth is 0
PASS childWindow.screen.width is 0
PASS childWindow.scrollbars.visible is false
......
......@@ -48,7 +48,7 @@ PASS childWindow.screen.availHeight is 0
PASS childWindow.screen.availWidth is 0
PASS childWindow.screen.colorDepth is 0
PASS childWindow.screen.height is 0
PASS childWindow.screen.orientation is ''
PASS childWindow.screen.orientation is 'portrait-primary'
PASS childWindow.screen.pixelDepth is 0
PASS childWindow.screen.width is 0
PASS childWindow.scrollbars.visible is false
......
......@@ -60,6 +60,9 @@ function emitExpectedResult(path, expected)
case "navigator.vendor":
expected = "window." + propertyPath;
break;
case "screen.orientation":
expected = "'portrait-primary'";
break;
}
insertExpectedResult(path, expected);
......
......@@ -45,7 +45,7 @@ PASS window.cached_screen.availTop is 0
PASS window.cached_screen.availWidth is 0
PASS window.cached_screen.colorDepth is 0
PASS window.cached_screen.height is 0
PASS window.cached_screen.orientation is ''
PASS window.cached_screen.orientation is 'portrait-primary'
PASS window.cached_screen.pixelDepth is 0
PASS window.cached_screen.width is 0
PASS window.cached_scrollbars.visible is false
......
......@@ -42,7 +42,7 @@ PASS window.cached_screen.availTop is 0
PASS window.cached_screen.availWidth is 0
PASS window.cached_screen.colorDepth is 0
PASS window.cached_screen.height is 0
PASS window.cached_screen.orientation is ''
PASS window.cached_screen.orientation is 'portrait-primary'
PASS window.cached_screen.pixelDepth is 0
PASS window.cached_screen.width is 0
PASS window.cached_scrollbars.visible is false
......
......@@ -42,7 +42,7 @@ PASS window.cached_screen.availTop is 0
PASS window.cached_screen.availWidth is 0
PASS window.cached_screen.colorDepth is 0
PASS window.cached_screen.height is 0
PASS window.cached_screen.orientation is ''
PASS window.cached_screen.orientation is 'portrait-primary'
PASS window.cached_screen.pixelDepth is 0
PASS window.cached_screen.width is 0
PASS window.cached_scrollbars.visible is false
......
......@@ -50,7 +50,7 @@ PASS childWindow.screen.availTop is 0
PASS childWindow.screen.availWidth is 0
PASS childWindow.screen.colorDepth is 0
PASS childWindow.screen.height is 0
PASS childWindow.screen.orientation is ''
PASS childWindow.screen.orientation is 'portrait-primary'
PASS childWindow.screen.pixelDepth is 0
PASS childWindow.screen.width is 0
PASS childWindow.scrollbars.visible is false
......
......@@ -49,7 +49,7 @@ PASS childWindow.screen.availTop is 0
PASS childWindow.screen.availWidth is 0
PASS childWindow.screen.colorDepth is 0
PASS childWindow.screen.height is 0
PASS childWindow.screen.orientation is ''
PASS childWindow.screen.orientation is 'portrait-primary'
PASS childWindow.screen.pixelDepth is 0
PASS childWindow.screen.width is 0
PASS childWindow.scrollbars.visible is false
......
......@@ -124,8 +124,10 @@ ScreenOrientation::~ScreenOrientation()
const AtomicString& ScreenOrientation::orientation(Screen& screen)
{
ScreenOrientation& screenOrientation = ScreenOrientation::from(screen);
if (!screenOrientation.document())
return emptyAtom;
if (!screenOrientation.document()) {
// FIXME: we should try to return a better guess, like the latest known value.
return orientationToString(blink::WebScreenOrientationPortraitPrimary);
}
ScreenOrientationController& controller = ScreenOrientationController::from(*screenOrientation.document());
return orientationToString(controller.orientation());
}
......
......@@ -2,10 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
enum OrientationType {
"portrait-primary",
"portrait-secondary",
"landscape-primary",
"landscape-secondary"
};
[
RuntimeEnabled=ScreenOrientation
] partial interface Screen {
readonly attribute DOMString orientation;
readonly attribute OrientationType orientation;
boolean lockOrientation(DOMString 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