OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/autofill/popup_controller_common.h" | 5 #include "chrome/browser/ui/autofill/popup_controller_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 key_press_event_target_ = NULL; | 53 key_press_event_target_ = NULL; |
54 } | 54 } |
55 | 55 |
56 gfx::Display PopupControllerCommon::GetDisplayNearestPoint( | 56 gfx::Display PopupControllerCommon::GetDisplayNearestPoint( |
57 const gfx::Point& point) const { | 57 const gfx::Point& point) const { |
58 return gfx::Screen::GetScreenFor(container_view_)->GetDisplayNearestPoint( | 58 return gfx::Screen::GetScreenFor(container_view_)->GetDisplayNearestPoint( |
59 point); | 59 point); |
60 } | 60 } |
61 | 61 |
62 const gfx::Rect PopupControllerCommon::RoundedElementBounds() const { | 62 const gfx::Rect PopupControllerCommon::RoundedElementBounds() const { |
63 return gfx::ToEnclosingRect(element_bounds_); | 63 return gfx::ToNearestRect(element_bounds_); |
64 } | 64 } |
65 | 65 |
66 std::pair<int, int> PopupControllerCommon::CalculatePopupXAndWidth( | 66 std::pair<int, int> PopupControllerCommon::CalculatePopupXAndWidth( |
67 const gfx::Display& left_display, | 67 const gfx::Display& left_display, |
68 const gfx::Display& right_display, | 68 const gfx::Display& right_display, |
69 int popup_required_width) const { | 69 int popup_required_width) const { |
70 int leftmost_display_x = left_display.bounds().x(); | 70 int leftmost_display_x = left_display.bounds().x(); |
71 int rightmost_display_x = | 71 int rightmost_display_x = |
72 right_display.GetSizeInPixel().width() + right_display.bounds().x(); | 72 right_display.GetSizeInPixel().width() + right_display.bounds().x(); |
73 | 73 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bottom_right_display, | 164 bottom_right_display, |
165 desired_height); | 165 desired_height); |
166 | 166 |
167 return gfx::Rect(popup_x_and_width.first, | 167 return gfx::Rect(popup_x_and_width.first, |
168 popup_y_and_height.first, | 168 popup_y_and_height.first, |
169 popup_x_and_width.second, | 169 popup_x_and_width.second, |
170 popup_y_and_height.second); | 170 popup_y_and_height.second); |
171 } | 171 } |
172 | 172 |
173 } // namespace autofill | 173 } // namespace autofill |
OLD | NEW |