| Index: ui/aura/window_tree_host.cc
|
| diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc
|
| index ef626257d735d2d0a96387217a894573dfe41d8b..c4cdb792a806e8eccf493a10185d9fbaa93e74ff 100644
|
| --- a/ui/aura/window_tree_host.cc
|
| +++ b/ui/aura/window_tree_host.cc
|
| @@ -61,7 +61,7 @@ WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget(
|
|
|
| void WindowTreeHost::InitHost() {
|
| InitCompositor();
|
| - UpdateRootWindowSize(GetBounds().size());
|
| + UpdateRootWindowSizeInPixel(GetBounds().size());
|
| Env::GetInstance()->NotifyHostInitialized(this);
|
| window()->Show();
|
| }
|
| @@ -96,7 +96,7 @@ gfx::Transform WindowTreeHost::GetRootTransform() const {
|
|
|
| void WindowTreeHost::SetRootTransform(const gfx::Transform& transform) {
|
| window()->SetTransform(transform);
|
| - UpdateRootWindowSize(GetBounds().size());
|
| + UpdateRootWindowSizeInPixel(GetBounds().size());
|
| }
|
|
|
| gfx::Transform WindowTreeHost::GetInverseRootTransform() const {
|
| @@ -107,18 +107,20 @@ gfx::Transform WindowTreeHost::GetInverseRootTransform() const {
|
| return invert;
|
| }
|
|
|
| -void WindowTreeHost::SetOutputSurfacePadding(const gfx::Insets& padding) {
|
| - if (output_surface_padding_ == padding)
|
| +void WindowTreeHost::SetOutputSurfacePaddingInPixel(
|
| + const gfx::Insets& padding_in_pixel) {
|
| + if (output_surface_padding_in_pixel_ == padding_in_pixel)
|
| return;
|
|
|
| - output_surface_padding_ = padding;
|
| - OnHostResized(GetBounds().size());
|
| + output_surface_padding_in_pixel_ = padding_in_pixel;
|
| + OnHostResizedInPixel(GetBounds().size());
|
| }
|
|
|
| -void WindowTreeHost::UpdateRootWindowSize(const gfx::Size& host_size) {
|
| - gfx::Rect bounds(output_surface_padding_.left(),
|
| - output_surface_padding_.top(), host_size.width(),
|
| - host_size.height());
|
| +void WindowTreeHost::UpdateRootWindowSizeInPixel(
|
| + const gfx::Size& host_size_in_pixel) {
|
| + gfx::Rect bounds(output_surface_padding_in_pixel_.left(),
|
| + output_surface_padding_in_pixel_.top(),
|
| + host_size_in_pixel.width(), host_size_in_pixel.height());
|
| float scale_factor = ui::GetDeviceScaleFactor(window()->layer());
|
| gfx::RectF new_bounds =
|
| gfx::ScaleRect(gfx::RectF(bounds), 1.0f / scale_factor);
|
| @@ -126,25 +128,27 @@ void WindowTreeHost::UpdateRootWindowSize(const gfx::Size& host_size) {
|
| window()->SetBounds(gfx::ToEnclosingRect(new_bounds));
|
| }
|
|
|
| -void WindowTreeHost::ConvertPointToNativeScreen(gfx::Point* point) const {
|
| - ConvertPointToHost(point);
|
| - gfx::Point location = GetLocationOnNativeScreen();
|
| +void WindowTreeHost::ConvertPointFromDIPToNativeScreen(
|
| + gfx::Point* point) const {
|
| + ConvertPointFromDIPToHost(point);
|
| + gfx::Point location = GetLocationOnNativeScreenInPixel();
|
| point->Offset(location.x(), location.y());
|
| }
|
|
|
| -void WindowTreeHost::ConvertPointFromNativeScreen(gfx::Point* point) const {
|
| - gfx::Point location = GetLocationOnNativeScreen();
|
| +void WindowTreeHost::ConvertPointFromNativeScreenToDIP(
|
| + gfx::Point* point) const {
|
| + gfx::Point location = GetLocationOnNativeScreenInPixel();
|
| point->Offset(-location.x(), -location.y());
|
| - ConvertPointFromHost(point);
|
| + ConvertPointFromHostToDIP(point);
|
| }
|
|
|
| -void WindowTreeHost::ConvertPointToHost(gfx::Point* point) const {
|
| +void WindowTreeHost::ConvertPointFromDIPToHost(gfx::Point* point) const {
|
| auto point_3f = gfx::Point3F(gfx::PointF(*point));
|
| GetRootTransform().TransformPoint(&point_3f);
|
| *point = gfx::ToFlooredPoint(point_3f.AsPointF());
|
| }
|
|
|
| -void WindowTreeHost::ConvertPointFromHost(gfx::Point* point) const {
|
| +void WindowTreeHost::ConvertPointFromHostToDIP(gfx::Point* point) const {
|
| auto point_3f = gfx::Point3F(gfx::PointF(*point));
|
| GetInverseRootTransform().TransformPoint(&point_3f);
|
| *point = gfx::ToFlooredPoint(point_3f.AsPointF());
|
| @@ -172,16 +176,18 @@ void WindowTreeHost::OnCursorVisibilityChanged(bool show) {
|
| OnCursorVisibilityChangedNative(show);
|
| }
|
|
|
| -void WindowTreeHost::MoveCursorTo(const gfx::Point& location_in_dip) {
|
| +void WindowTreeHost::MoveCursorToLocationInDIP(
|
| + const gfx::Point& location_in_dip) {
|
| gfx::Point host_location(location_in_dip);
|
| - ConvertPointToHost(&host_location);
|
| + ConvertPointFromDIPToHost(&host_location);
|
| MoveCursorToInternal(location_in_dip, host_location);
|
| }
|
|
|
| -void WindowTreeHost::MoveCursorToHostLocation(const gfx::Point& host_location) {
|
| - gfx::Point root_location(host_location);
|
| - ConvertPointFromHost(&root_location);
|
| - MoveCursorToInternal(root_location, host_location);
|
| +void WindowTreeHost::MoveCursorToHostLocationInPixel(
|
| + const gfx::Point& host_location_in_pixel) {
|
| + gfx::Point root_location(host_location_in_pixel);
|
| + ConvertPointFromHostToDIP(&root_location);
|
| + MoveCursorToInternal(root_location, host_location_in_pixel);
|
| }
|
|
|
| ui::InputMethod* WindowTreeHost::GetInputMethod() {
|
| @@ -268,18 +274,19 @@ void WindowTreeHost::OnAcceleratedWidgetAvailable() {
|
| kWindowTreeHostForAcceleratedWidget, this));
|
| }
|
|
|
| -void WindowTreeHost::OnHostMoved(const gfx::Point& new_location) {
|
| - TRACE_EVENT1("ui", "WindowTreeHost::OnHostMoved",
|
| - "origin", new_location.ToString());
|
| +void WindowTreeHost::OnHostMovedInPixel(
|
| + const gfx::Point& new_location_in_pixel) {
|
| + TRACE_EVENT1("ui", "WindowTreeHost::OnHostMovedInPixel", "origin",
|
| + new_location_in_pixel.ToString());
|
|
|
| for (WindowTreeHostObserver& observer : observers_)
|
| - observer.OnHostMoved(this, new_location);
|
| + observer.OnHostMovedInPixel(this, new_location_in_pixel);
|
| }
|
|
|
| -void WindowTreeHost::OnHostResized(const gfx::Size& new_size) {
|
| - gfx::Size adjusted_size(new_size);
|
| - adjusted_size.Enlarge(output_surface_padding_.width(),
|
| - output_surface_padding_.height());
|
| +void WindowTreeHost::OnHostResizedInPixel(const gfx::Size& new_size_in_pixel) {
|
| + gfx::Size adjusted_size(new_size_in_pixel);
|
| + adjusted_size.Enlarge(output_surface_padding_in_pixel_.width(),
|
| + output_surface_padding_in_pixel_.height());
|
| // The compositor should have the same size as the native root window host.
|
| // Get the latest scale from display because it might have been changed.
|
| compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()),
|
| @@ -288,7 +295,7 @@ void WindowTreeHost::OnHostResized(const gfx::Size& new_size) {
|
| gfx::Size layer_size = GetBounds().size();
|
| // The layer, and the observers should be notified of the
|
| // transformed size of the root window.
|
| - UpdateRootWindowSize(layer_size);
|
| + UpdateRootWindowSizeInPixel(layer_size);
|
| for (WindowTreeHostObserver& observer : observers_)
|
| observer.OnHostResized(this);
|
| }
|
| @@ -329,7 +336,7 @@ ui::EventProcessor* WindowTreeHost::GetEventProcessor() {
|
| void WindowTreeHost::MoveCursorToInternal(const gfx::Point& root_location,
|
| const gfx::Point& host_location) {
|
| last_cursor_request_position_in_host_ = host_location;
|
| - MoveCursorToNative(host_location);
|
| + MoveCursorToNativeInPixel(host_location);
|
| client::CursorClient* cursor_client = client::GetCursorClient(window());
|
| if (cursor_client) {
|
| const display::Display& display =
|
|
|