Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(828)

Side by Side Diff: chrome/browser/ui/autofill/popup_controller_common.cc

Issue 1516723003: [Element / Autofill] Add boundsInViewportFloat() to fix <input> popup misalignment. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refator to use boundsInViewportFloat() eventually, but keep boundsInViewportInt(). Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/autofill/content/renderer/autofill_agent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/autofill_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698