OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 recorder.canvas()->DrawFocusRect(omnibox_view_->bounds()); | 1283 recorder.canvas()->DrawFocusRect(omnibox_view_->bounds()); |
1284 | 1284 |
1285 // Maximized popup windows don't draw the horizontal edges. We implement this | 1285 // Maximized popup windows don't draw the horizontal edges. We implement this |
1286 // by simply expanding the paint area outside the view by the edge thickness. | 1286 // by simply expanding the paint area outside the view by the edge thickness. |
1287 gfx::Rect border_rect(GetContentsBounds()); | 1287 gfx::Rect border_rect(GetContentsBounds()); |
1288 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) | 1288 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) |
1289 border_rect.Inset(-kPopupEdgeThickness, 0); | 1289 border_rect.Inset(-kPopupEdgeThickness, 0); |
1290 | 1290 |
1291 if (ui::MaterialDesignController::IsModeMaterial()) { | 1291 if (ui::MaterialDesignController::IsModeMaterial()) { |
1292 gfx::Canvas* canvas = recorder.canvas(); | 1292 gfx::Canvas* canvas = recorder.canvas(); |
1293 const float display_scale = canvas->image_scale(); | 1293 const float scale = canvas->SaveAndUnscale(); |
1294 canvas->Save(); | |
1295 SkScalar scale_factor = 1.0f / display_scale; | |
1296 canvas->sk_canvas()->scale(scale_factor, scale_factor); | |
1297 | 1294 |
1298 SkPaint paint; | 1295 SkPaint paint; |
1299 paint.setStyle(SkPaint::Style::kStroke_Style); | 1296 paint.setStyle(SkPaint::Style::kStroke_Style); |
1300 paint.setColor(SkColorSetARGB(0x40, 0x00, 0x00, 0x00)); | 1297 paint.setColor(SkColorSetARGB(0x40, 0x00, 0x00, 0x00)); |
1301 paint.setStrokeWidth(1); | 1298 paint.setStrokeWidth(1); |
1302 paint.setAntiAlias(true); | 1299 paint.setAntiAlias(true); |
1303 | 1300 |
1304 const float kOffset = 0.5f; | 1301 const float kOffset = 0.5f; |
1305 gfx::RectF border_rect_f(border_rect); | 1302 gfx::RectF border_rect_f(border_rect); |
1306 border_rect_f.Scale(display_scale); | 1303 border_rect_f.Scale(scale); |
1307 gfx::InsetsF insets(kOffset, kOffset, kOffset, kOffset); | 1304 gfx::InsetsF insets(kOffset, kOffset, kOffset, kOffset); |
1308 border_rect_f.Inset(insets); | 1305 border_rect_f.Inset(insets); |
1309 | 1306 |
1310 const SkScalar kCornerRadius = SkDoubleToScalar(2.5f * display_scale); | 1307 const SkScalar kCornerRadius = SkDoubleToScalar(2.5f * scale); |
1311 canvas->sk_canvas()->drawRoundRect(gfx::RectFToSkRect(border_rect_f), | 1308 canvas->sk_canvas()->drawRoundRect(gfx::RectFToSkRect(border_rect_f), |
1312 kCornerRadius, kCornerRadius, paint); | 1309 kCornerRadius, kCornerRadius, paint); |
1313 recorder.canvas()->Restore(); | 1310 recorder.canvas()->Restore(); |
1314 } else { | 1311 } else { |
1315 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), | 1312 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
1316 border_rect); | 1313 border_rect); |
1317 } | 1314 } |
1318 } | 1315 } |
1319 | 1316 |
1320 //////////////////////////////////////////////////////////////////////////////// | 1317 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 | 1418 |
1422 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1419 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
1423 const SearchModel::State& new_state) { | 1420 const SearchModel::State& new_state) { |
1424 const bool visible = !GetToolbarModel()->input_in_progress() && | 1421 const bool visible = !GetToolbarModel()->input_in_progress() && |
1425 new_state.voice_search_supported; | 1422 new_state.voice_search_supported; |
1426 if (mic_search_view_->visible() != visible) { | 1423 if (mic_search_view_->visible() != visible) { |
1427 mic_search_view_->SetVisible(visible); | 1424 mic_search_view_->SetVisible(visible); |
1428 Layout(); | 1425 Layout(); |
1429 } | 1426 } |
1430 } | 1427 } |
OLD | NEW |