Commit 041271d5 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

panel_orienation should return rotation() when it's not set.

Add DCHECK to make sure that panel rotation returns the correct
value when a display is updated on Android.

Bug: 1048294
Change-Id: Iad2747325ea724a23a66ce340c3c3984ace54a24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037640Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738443}
parent 67e1e05b
...@@ -91,6 +91,8 @@ void DisplayAndroidManager::DoUpdateDisplay(display::Display* display, ...@@ -91,6 +91,8 @@ void DisplayAndroidManager::DoUpdateDisplay(display::Display* display,
display->set_size_in_pixels(size_in_pixels); display->set_size_in_pixels(size_in_pixels);
display->SetRotationAsDegree(rotationDegrees); display->SetRotationAsDegree(rotationDegrees);
DCHECK_EQ(rotationDegrees, display->RotationAsDegree());
DCHECK_EQ(rotationDegrees, display->PanelRotationAsDegree());
display->set_color_depth(bitsPerPixel); display->set_color_depth(bitsPerPixel);
display->set_depth_per_component(bitsPerComponent); display->set_depth_per_component(bitsPerComponent);
display->set_is_monochrome(bitsPerComponent == 0); display->set_is_monochrome(bitsPerComponent == 0);
......
...@@ -286,7 +286,7 @@ void Display::SetRotationAsDegree(int rotation) { ...@@ -286,7 +286,7 @@ void Display::SetRotationAsDegree(int rotation) {
} }
int Display::PanelRotationAsDegree() const { int Display::PanelRotationAsDegree() const {
return RotationToDegrees(panel_rotation_); return RotationToDegrees(panel_rotation());
} }
gfx::Insets Display::GetWorkAreaInsets() const { gfx::Insets Display::GetWorkAreaInsets() const {
...@@ -365,7 +365,7 @@ std::string Display::ToString() const { ...@@ -365,7 +365,7 @@ std::string Display::ToString() const {
"panel_rotation=%s %s.", "panel_rotation=%s %s.",
static_cast<long long int>(id_), bounds_.ToString().c_str(), static_cast<long long int>(id_), bounds_.ToString().c_str(),
work_area_.ToString().c_str(), device_scale_factor_, work_area_.ToString().c_str(), device_scale_factor_,
ToRotationString(rotation_), ToRotationString(panel_rotation_), ToRotationString(rotation_), ToRotationString(panel_rotation()),
IsInternal() ? "internal" : "external"); IsInternal() ? "internal" : "external");
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <stdint.h> #include <stdint.h>
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/optional.h"
#include "mojo/public/cpp/bindings/struct_traits.h" #include "mojo/public/cpp/bindings/struct_traits.h"
#include "ui/display/display_export.h" #include "ui/display/display_export.h"
#include "ui/display/types/display_constants.h" #include "ui/display/types/display_constants.h"
...@@ -161,7 +162,9 @@ class DISPLAY_EXPORT Display final { ...@@ -161,7 +162,9 @@ class DISPLAY_EXPORT Display final {
void SetRotationAsDegree(int rotation); void SetRotationAsDegree(int rotation);
// Panel's native rotation. This is same as |rotation()| in normal case. // Panel's native rotation. This is same as |rotation()| in normal case.
Rotation panel_rotation() const { return panel_rotation_; } Rotation panel_rotation() const {
return panel_rotation_ ? *panel_rotation_ : rotation_;
}
void set_panel_rotation(Rotation rotation) { panel_rotation_ = rotation; } void set_panel_rotation(Rotation rotation) { panel_rotation_ = rotation; }
int PanelRotationAsDegree() const; int PanelRotationAsDegree() const;
...@@ -291,7 +294,7 @@ class DISPLAY_EXPORT Display final { ...@@ -291,7 +294,7 @@ class DISPLAY_EXPORT Display final {
gfx::Rect work_area_; gfx::Rect work_area_;
float device_scale_factor_; float device_scale_factor_;
Rotation rotation_ = ROTATE_0; Rotation rotation_ = ROTATE_0;
Rotation panel_rotation_ = ROTATE_0; base::Optional<Rotation> panel_rotation_;
TouchSupport touch_support_ = TouchSupport::UNKNOWN; TouchSupport touch_support_ = TouchSupport::UNKNOWN;
AccelerometerSupport accelerometer_support_ = AccelerometerSupport::UNKNOWN; AccelerometerSupport accelerometer_support_ = AccelerometerSupport::UNKNOWN;
gfx::Size maximum_cursor_size_; gfx::Size maximum_cursor_size_;
......
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