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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 2001433002: Update appearance of omnibox focus for MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 6b4235d1f1b8bcacf45da01c17582ccdf9de49a4..83f13ff9a51c2146441888ec0d145fabd64d9405 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -1258,16 +1258,31 @@ void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
}
void LocationBarView::OnFocus() {
- // Explicitly focus the omnibox so a focus ring will be displayed around it on
- // Windows.
omnibox_view_->SetFocus();
}
+void LocationBarView::OnBlur() {
+ SchedulePaint();
sky 2016/05/20 16:08:00 Is this only necessary if modematerial and show_fo
Evan Stade 2016/05/20 18:02:00 hmm, turns out this didn't actually work (although
+}
+
void LocationBarView::OnPaint(gfx::Canvas* canvas) {
View::OnPaint(canvas);
- if (ui::MaterialDesignController::IsModeMaterial() && !is_popup_mode_)
- return; // The background and border are painted by our Background.
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ if (show_focus_rect_ && HasFocus()) {
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setColor(GetNativeTheme()->GetSystemColor(
+ ui::NativeTheme::NativeTheme::kColorId_FocusedBorderColor));
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(1);
+ gfx::RectF focus_rect(GetLocalBounds());
+ focus_rect.Inset(gfx::InsetsF(0.5f));
+ canvas->DrawRoundRect(focus_rect, 2.5f, paint);
+ }
+ if (!is_popup_mode_)
+ return; // The background and border are painted by our Background.
+ }
// Fill the location bar background color behind the border. Parts of the
// border images are meant to rest atop the toolbar background and parts atop
@@ -1302,8 +1317,10 @@ void LocationBarView::PaintChildren(const ui::PaintContext& context) {
// the focus rect to appear on top of children we paint here rather than
// OnPaint().
// Note: |Canvas::DrawFocusRect| paints a dashed rect with gray color.
- if (show_focus_rect_ && HasFocus())
+ if (!ui::MaterialDesignController::IsModeMaterial() && show_focus_rect_ &&
+ HasFocus()) {
recorder.canvas()->DrawFocusRect(omnibox_view_->bounds());
+ }
if (!ui::MaterialDesignController::IsModeMaterial() && !is_popup_mode_) {
views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(),

Powered by Google App Engine
This is Rietveld 408576698