OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 aura::Window* root = window_->GetRootWindow(); | 616 aura::Window* root = window_->GetRootWindow(); |
617 if (root) { | 617 if (root) { |
618 aura::client::ScreenPositionClient* screen_position_client = | 618 aura::client::ScreenPositionClient* screen_position_client = |
619 aura::client::GetScreenPositionClient(root); | 619 aura::client::GetScreenPositionClient(root); |
620 if (screen_position_client) { | 620 if (screen_position_client) { |
621 screen_position_client->ConvertPointFromScreen( | 621 screen_position_client->ConvertPointFromScreen( |
622 window_->parent(), &relative_origin); | 622 window_->parent(), &relative_origin); |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 SnapToPhysicalPixelBoundary(); | |
627 InternalSetBounds(gfx::Rect(relative_origin, rect.size())); | 626 InternalSetBounds(gfx::Rect(relative_origin, rect.size())); |
628 } | 627 } |
629 | 628 |
630 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 629 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
631 return window_; | 630 return window_; |
632 } | 631 } |
633 | 632 |
634 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { | 633 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { |
635 #if defined(OS_WIN) | 634 #if defined(OS_WIN) |
636 aura::WindowTreeHost* host = window_->GetHost(); | 635 aura::WindowTreeHost* host = window_->GetHost(); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 // in the +x, +y direction to land on the nearest pixel boundary. This may | 979 // in the +x, +y direction to land on the nearest pixel boundary. This may |
981 // cause the bottom and right edges to be clipped slightly, but that's ok. | 980 // cause the bottom and right edges to be clipped slightly, but that's ok. |
982 gfx::Point view_offset_dips = window_->GetBoundsInRootWindow().origin(); | 981 gfx::Point view_offset_dips = window_->GetBoundsInRootWindow().origin(); |
983 gfx::PointF view_offset = view_offset_dips; | 982 gfx::PointF view_offset = view_offset_dips; |
984 view_offset.Scale(current_device_scale_factor_); | 983 view_offset.Scale(current_device_scale_factor_); |
985 gfx::PointF view_offset_snapped(std::ceil(view_offset.x()), | 984 gfx::PointF view_offset_snapped(std::ceil(view_offset.x()), |
986 std::ceil(view_offset.y())); | 985 std::ceil(view_offset.y())); |
987 | 986 |
988 gfx::Vector2dF fudge = view_offset_snapped - view_offset; | 987 gfx::Vector2dF fudge = view_offset_snapped - view_offset; |
989 fudge.Scale(1.0 / current_device_scale_factor_); | 988 fudge.Scale(1.0 / current_device_scale_factor_); |
990 gfx::Transform fudge_transform; | 989 GetLayer()->SetSubpixelPositionOffset(fudge); |
991 fudge_transform.Translate(fudge.x(), fudge.y()); | |
992 GetLayer()->cc_layer()->SetTransform(fudge_transform); | |
993 } | 990 } |
994 | 991 |
995 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { | 992 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { |
996 if (HasDisplayPropertyChanged(window_)) | 993 if (HasDisplayPropertyChanged(window_)) |
997 host_->InvalidateScreenInfo(); | 994 host_->InvalidateScreenInfo(); |
998 | 995 |
| 996 SnapToPhysicalPixelBoundary(); |
999 // Don't recursively call SetBounds if this bounds update is the result of | 997 // Don't recursively call SetBounds if this bounds update is the result of |
1000 // a Window::SetBoundsInternal call. | 998 // a Window::SetBoundsInternal call. |
1001 if (!in_bounds_changed_) | 999 if (!in_bounds_changed_) |
1002 window_->SetBounds(rect); | 1000 window_->SetBounds(rect); |
1003 host_->WasResized(); | 1001 host_->WasResized(); |
1004 delegated_frame_host_->WasResized(); | 1002 delegated_frame_host_->WasResized(); |
1005 if (touch_editing_client_) { | 1003 if (touch_editing_client_) { |
1006 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 1004 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
1007 selection_focus_rect_); | 1005 selection_focus_rect_); |
1008 } | 1006 } |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 | 2461 |
2464 //////////////////////////////////////////////////////////////////////////////// | 2462 //////////////////////////////////////////////////////////////////////////////// |
2465 // RenderWidgetHostViewBase, public: | 2463 // RenderWidgetHostViewBase, public: |
2466 | 2464 |
2467 // static | 2465 // static |
2468 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2466 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2469 GetScreenInfoForWindow(results, NULL); | 2467 GetScreenInfoForWindow(results, NULL); |
2470 } | 2468 } |
2471 | 2469 |
2472 } // namespace content | 2470 } // namespace content |
OLD | NEW |