forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make screen.orientation.angle relative to the display panel's natural…
… orientation This CL updates the screen.orientation.angle web API to output relative to the device panel. screen.orientation.angle is used by web apps using a desynchronised WebGL canvas to achieve low latency performance via hardware overlays. This requires alignment with the device output panel. Fixed: 998131 Test: PanelRotationBrowserTest.ScreenOrientationAPI Change-Id: I05efbfb8aecd5015b18f0e4f434ab67df6ca50b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911344 Commit-Queue: Alan Cutter <alancutter@chromium.org> Auto-Submit: Alan Cutter <alancutter@chromium.org> Reviewed-by: Mitsuru Oshima <oshima@chromium.org> Reviewed-by: Ken Buchanan <kenrb@chromium.org> Cr-Commit-Position: refs/heads/master@{#716876}
- Loading branch information
1 parent
56b806c
commit 4cfd0c5
Showing
14 changed files
with
124 additions
and
31 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
44 changes: 44 additions & 0 deletions
44
content/browser/renderer_host/panel_rotation_browsertest.cc
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "base/strings/stringprintf.h" | ||
#include "content/public/test/browser_test_utils.h" | ||
#include "content/public/test/content_browser_test.h" | ||
#include "content/shell/browser/shell.h" | ||
#include "ui/display/display.h" | ||
#include "ui/display/screen.h" | ||
|
||
namespace content { | ||
|
||
// TODO(https://crbug.com/998131): Add test coverage across all platforms. | ||
#if defined(OS_CHROMEOS) | ||
class PanelRotationBrowserTest : public ContentBrowserTest { | ||
protected: | ||
void SetPanelRotation(display::Display::Rotation rotation) { | ||
display::Screen* screen = display::Screen::GetScreen(); | ||
screen->SetPanelRotationForTesting(screen->GetPrimaryDisplay().id(), | ||
rotation); | ||
} | ||
int ReadScreenOrientationAngle() { | ||
return EvalJs(CreateBrowser()->web_contents(), "screen.orientation.angle") | ||
.ExtractInt(); | ||
} | ||
}; | ||
|
||
IN_PROC_BROWSER_TEST_F(PanelRotationBrowserTest, ScreenOrientationAPI) { | ||
SetPanelRotation(display::Display::ROTATE_0); | ||
EXPECT_EQ(ReadScreenOrientationAngle(), 0); | ||
|
||
SetPanelRotation(display::Display::ROTATE_90); | ||
EXPECT_EQ(ReadScreenOrientationAngle(), 270); | ||
|
||
SetPanelRotation(display::Display::ROTATE_180); | ||
EXPECT_EQ(ReadScreenOrientationAngle(), 180); | ||
|
||
SetPanelRotation(display::Display::ROTATE_270); | ||
EXPECT_EQ(ReadScreenOrientationAngle(), 90); | ||
} | ||
#endif // defined(OS_CHROMEOS) | ||
|
||
} // namespace content |
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
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
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