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

Unified Diff: ui/views/controls/menu/submenu_view.cc

Issue 1064763002: views: Make SubmenuView::PaintChildren use the canvas via PaintRecorder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: submenu: . Created 5 years, 8 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
« no previous file with comments | « ui/views/controls/menu/submenu_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « ui/views/controls/menu/submenu_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698