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

Unified Diff: chrome/browser/ui/views/autofill/autofill_popup_base_view.cc

Issue 2694183005: Ensure autofill popup border is visible (Closed)
Patch Set: fixes Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/autofill/autofill_popup_base_view.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc b/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc
index 2f0d3864dd0c2cd67a58662c07da6c57abcf5c3d..c912180cf576ebde7f9cb1ec09d10874d97ab4cc 100644
--- a/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc
+++ b/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc
@@ -61,12 +61,6 @@ void AutofillPopupBaseView::DoShow() {
show_time_ = base::Time::Now();
}
- // TODO(crbug.com/676164): Show different border color when focused/unfocused
- SetBorder(views::CreateSolidBorder(
- kPopupBorderThickness,
- GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_UnfocusedBorderColor)));
-
DoUpdateBoundsAndRedrawPopup();
GetWidget()->Show();
@@ -107,9 +101,31 @@ void AutofillPopupBaseView::RemoveObserver() {
void AutofillPopupBaseView::DoUpdateBoundsAndRedrawPopup() {
GetWidget()->SetBounds(delegate_->popup_bounds());
+
+ // We update the border whenever bounds are updated. Due to rounding when
+ // calculating the actual view size (bounds()) from the requested view size
+ // (delegate_.popup_bounds()), we may end up with extra space at the bottom
+ // and right of the view. We fill this with extra border pixels.
Peter Kasting 2017/02/16 00:30:26 Rob, can you comment here? It seems like the issu
+ int extra_border_thickness_x =
+ bounds().width() - delegate_->popup_bounds().width();
+ int extra_border_thickness_y =
+ bounds().height() - delegate_->popup_bounds().height();
+
+ // TODO(crbug.com/676164): Show different border color when focused/unfocused
+ SetBorder(views::CreateSolidSidedBorder(
+ kPopupBorderThickness, kPopupBorderThickness,
+ kPopupBorderThickness + extra_border_thickness_y,
+ kPopupBorderThickness + extra_border_thickness_x,
+ GetNativeTheme()->GetSystemColor(
+ ui::NativeTheme::kColorId_UnfocusedBorderColor)));
+
SchedulePaint();
}
+gfx::Rect AutofillPopupBaseView::GetPopupBounds() const {
+ return delegate_->popup_bounds();
+}
+
void AutofillPopupBaseView::OnNativeFocusChanged(gfx::NativeView focused_now) {
if (GetWidget() && GetWidget()->GetNativeView() != focused_now)
HideController();

Powered by Google App Engine
This is Rietveld 408576698