Chromium Code Reviews| 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 b0ef71c4d045b0090f81800a40932018fa3d68c5..47f8a54a72f8c5716e803a78a8b66c5f32a64fef 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| @@ -187,7 +187,7 @@ void LocationBarView::Init() { |
| IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); |
| border_painter_.reset( |
| views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages)); |
| - } else { |
| + } else if (!ui::MaterialDesignController::IsModeMaterial()) { |
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| const gfx::Insets omnibox_border_insets(14, 9, 14, 9); |
| border_painter_.reset(views::Painter::CreateImagePainter( |
| @@ -528,11 +528,13 @@ void LocationBarView::GetAccessibleState(ui::AXViewState* state) { |
| gfx::Size LocationBarView::GetPreferredSize() const { |
| // Compute minimum height. |
| - gfx::Size min_size(border_painter_->GetMinimumSize()); |
| + gfx::Size min_size; |
| // For non-material the size of the asset determines the size of the |
| // LocationBarView. |
| if (ui::MaterialDesignController::IsModeMaterial()) |
| min_size.set_height(GetLayoutConstant(LOCATION_BAR_HEIGHT)); |
| + else |
| + min_size = border_painter_->GetMinimumSize(); |
| if (!IsInitialized()) |
| return min_size; |
| @@ -1273,8 +1275,31 @@ void LocationBarView::PaintChildren(const ui::PaintContext& context) { |
| gfx::Rect border_rect(GetContentsBounds()); |
| if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) |
| border_rect.Inset(-kPopupEdgeThickness, 0); |
| - views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
| - border_rect); |
| + |
| + if (ui::MaterialDesignController::IsModeMaterial()) { |
| + recorder.canvas()->Save(); |
| + SkScalar scale_factor = 1.0f / recorder.canvas()->image_scale(); |
| + recorder.canvas()->sk_canvas()->scale(scale_factor, scale_factor); |
| + |
| + SkPaint paint; |
| + paint.setStyle(SkPaint::Style::kStroke_Style); |
| + paint.setColor(SkColorSetARGBInline(0x40, 0x0, 0x0, 0x0)); |
|
Peter Kasting
2015/09/28 23:01:10
Don't explicitly call the inline version, just use
jonross
2015/09/29 17:25:02
Done.
|
| + paint.setStrokeWidth(0); |
|
Peter Kasting
2015/09/28 23:01:10
Use stroke width 1 rather than 0.
jonross
2015/09/29 17:25:02
Done.
|
| + paint.setAntiAlias(true); |
| + |
| + const float kOffset = 0.5f; |
| + gfx::RectF border_rect_f(border_rect); |
| + gfx::InsetsF insets(kOffset, kOffset, kOffset, kOffset); |
| + border_rect_f.Inset(insets); |
| + |
| + const SkScalar kCornerRadius = SkDoubleToScalar(2.5f); |
|
Peter Kasting
2015/09/28 23:01:10
Not sure this is right. This will give the corner
jonross
2015/09/29 17:25:02
Changing the scale of the sk_canvas keeps these co
|
| + recorder.canvas()->sk_canvas()->drawRoundRect( |
| + gfx::RectFToSkRect(border_rect_f), kCornerRadius, kCornerRadius, paint); |
| + recorder.canvas()->Restore(); |
| + } else { |
| + views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
| + border_rect); |
| + } |
| } |
| //////////////////////////////////////////////////////////////////////////////// |