| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // The popup can appear below the field. | 116 // The popup can appear below the field. |
| 117 return std::make_pair(bottom_growth_start, popup_required_height); | 117 return std::make_pair(bottom_growth_start, popup_required_height); |
| 118 } else { | 118 } else { |
| 119 // The popup must appear above the field. | 119 // The popup must appear above the field. |
| 120 return std::make_pair(top_growth_end - popup_required_height, | 120 return std::make_pair(top_growth_end - popup_required_height, |
| 121 popup_required_height); | 121 popup_required_height); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 gfx::Rect PopupControllerCommon::GetPopupBounds( | 125 gfx::Rect PopupControllerCommon::GetPopupBounds( |
| 126 int popup_required_height, | 126 int popup_required_width, |
| 127 int popup_required_width) const { | 127 int popup_required_height) const { |
| 128 // This is the top left point of the popup if the popup is above the element | 128 // This is the top left point of the popup if the popup is above the element |
| 129 // and grows to the left (since that is the highest and furthest left the | 129 // and grows to the left (since that is the highest and furthest left the |
| 130 // popup go could). | 130 // popup go could). |
| 131 gfx::Point top_left_corner_of_popup = RoundedElementBounds().origin() + | 131 gfx::Point top_left_corner_of_popup = RoundedElementBounds().origin() + |
| 132 gfx::Vector2d(RoundedElementBounds().width() - popup_required_width, | 132 gfx::Vector2d(RoundedElementBounds().width() - popup_required_width, |
| 133 -popup_required_height); | 133 -popup_required_height); |
| 134 | 134 |
| 135 // This is the bottom right point of the popup if the popup is below the | 135 // This is the bottom right point of the popup if the popup is below the |
| 136 // element and grows to the right (since the is the lowest and furthest right | 136 // element and grows to the right (since the is the lowest and furthest right |
| 137 // the popup could go). | 137 // the popup could go). |
| (...skipping 15 matching lines...) Expand all Loading... |
| 153 bottom_right_display, | 153 bottom_right_display, |
| 154 popup_required_height); | 154 popup_required_height); |
| 155 | 155 |
| 156 return gfx::Rect(popup_x_and_width.first, | 156 return gfx::Rect(popup_x_and_width.first, |
| 157 popup_y_and_height.first, | 157 popup_y_and_height.first, |
| 158 popup_x_and_width.second, | 158 popup_x_and_width.second, |
| 159 popup_y_and_height.second); | 159 popup_y_and_height.second); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace autofill | 162 } // namespace autofill |
| OLD | NEW |