Chromium Code Reviews| Index: ui/views/controls/menu/submenu_view.cc |
| diff --git a/ui/views/controls/menu/submenu_view.cc b/ui/views/controls/menu/submenu_view.cc |
| index 78501f95dfd475189193e4cc111d2f6c5a721f35..52e2909aa9b9d3370ba0f3e9906cae8e5afd8c1b 100644 |
| --- a/ui/views/controls/menu/submenu_view.cc |
| +++ b/ui/views/controls/menu/submenu_view.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/compiler_specific.h" |
| #include "ui/accessibility/ax_view_state.h" |
| #include "ui/compositor/paint_context.h" |
| +#include "ui/compositor/paint_recorder.h" |
| #include "ui/events/event.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/geometry/safe_integer_conversions.h" |
| @@ -191,8 +192,25 @@ ui::TextInputClient* SubmenuView::GetTextInputClient() { |
| void SubmenuView::PaintChildren(const ui::PaintContext& context) { |
| View::PaintChildren(context); |
| - if (drop_item_ && drop_position_ != MenuDelegate::DROP_ON) |
| - PaintDropIndicator(context.canvas(), drop_item_, drop_position_); |
|
sadrul
2015/04/07 18:49:01
I assume PaintContext::canvas() will be removed so
danakj
2015/04/07 18:49:25
yep!
|
| + bool paint_drop_indicator = false; |
| + if (drop_item_) { |
| + switch (drop_position_) { |
| + case MenuDelegate::DROP_NONE: |
| + case MenuDelegate::DROP_ON: |
| + break; |
| + case MenuDelegate::DROP_UNKNOWN: |
| + case MenuDelegate::DROP_BEFORE: |
| + case MenuDelegate::DROP_AFTER: |
| + paint_drop_indicator = true; |
| + break; |
| + } |
| + } |
| + |
| + if (paint_drop_indicator) { |
| + gfx::Rect bounds = CalculateDropIndicatorBounds(drop_item_, drop_position_); |
| + ui::PaintRecorder recorder(context); |
| + recorder.canvas()->FillRect(bounds, kDropIndicatorColor); |
| + } |
| } |
| bool SubmenuView::GetDropFormats( |
| @@ -445,16 +463,6 @@ void SubmenuView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| SchedulePaint(); |
| } |
| -void SubmenuView::PaintDropIndicator(gfx::Canvas* canvas, |
| - MenuItemView* item, |
| - MenuDelegate::DropPosition position) { |
| - if (position == MenuDelegate::DROP_NONE) |
| - return; |
| - |
| - gfx::Rect bounds = CalculateDropIndicatorBounds(item, position); |
| - canvas->FillRect(bounds, kDropIndicatorColor); |
| -} |
| - |
| void SubmenuView::SchedulePaintForDropIndicator( |
| MenuItemView* item, |
| MenuDelegate::DropPosition position) { |