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 "ui/views/controls/menu/menu_scroll_view_container.h" | 5 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 int OnPerformDrop(const ui::DropTargetEvent& event) override { | 70 int OnPerformDrop(const ui::DropTargetEvent& event) override { |
71 return ui::DragDropTypes::DRAG_NONE; | 71 return ui::DragDropTypes::DRAG_NONE; |
72 } | 72 } |
73 | 73 |
74 void OnPaint(gfx::Canvas* canvas) override { | 74 void OnPaint(gfx::Canvas* canvas) override { |
75 const MenuConfig& config = MenuConfig::instance(); | 75 const MenuConfig& config = MenuConfig::instance(); |
76 | 76 |
77 // The background. | 77 // The background. |
78 gfx::Rect item_bounds(0, 0, width(), height()); | 78 gfx::Rect item_bounds(0, 0, width(), height()); |
| 79 // Avoids painting over the menu border. |
| 80 item_bounds.Inset(views::RoundRectPainter::kBorderWidth, 0); |
79 NativeTheme::ExtraParams extra; | 81 NativeTheme::ExtraParams extra; |
80 GetNativeTheme()->Paint(canvas->sk_canvas(), | 82 GetNativeTheme()->Paint(canvas->sk_canvas(), |
81 NativeTheme::kMenuItemBackground, | 83 NativeTheme::kMenuItemBackground, |
82 NativeTheme::kNormal, item_bounds, extra); | 84 NativeTheme::kNormal, item_bounds, extra); |
83 | 85 |
84 // Then the arrow. | 86 // Then the arrow. |
85 int x = width() / 2; | 87 int x = width() / 2; |
86 int y = (height() - config.scroll_arrow_height) / 2; | 88 int y = (height() - config.scroll_arrow_height) / 2; |
87 | 89 |
88 int x_left = x - config.scroll_arrow_height; | 90 int x_left = x - config.scroll_arrow_height; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 case MENU_ANCHOR_BUBBLE_ABOVE: | 322 case MENU_ANCHOR_BUBBLE_ABOVE: |
321 return BubbleBorder::BOTTOM_CENTER; | 323 return BubbleBorder::BOTTOM_CENTER; |
322 case MENU_ANCHOR_BUBBLE_BELOW: | 324 case MENU_ANCHOR_BUBBLE_BELOW: |
323 return BubbleBorder::TOP_CENTER; | 325 return BubbleBorder::TOP_CENTER; |
324 default: | 326 default: |
325 return BubbleBorder::NONE; | 327 return BubbleBorder::NONE; |
326 } | 328 } |
327 } | 329 } |
328 | 330 |
329 } // namespace views | 331 } // namespace views |
OLD | NEW |