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

Unified Diff: ui/native_theme/native_theme_base.cc

Issue 1187503002: Constrain native theme menu list arrow to the paint rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typeo Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/native_theme/native_theme_base.cc
diff --git a/ui/native_theme/native_theme_base.cc b/ui/native_theme/native_theme_base.cc
index dcf742cc64d70b4a405b9db12a2463fd58888e77..db2ec00497960251b2e2a1061c424559613a297f 100644
--- a/ui/native_theme/native_theme_base.cc
+++ b/ui/native_theme/native_theme_base.cc
@@ -772,10 +772,22 @@ void NativeThemeBase::PaintMenuList(
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kFill_Style);
+ static const int arrow_width = 6;
+ static const int arrow_height = 6;
sadrul 2015/06/16 14:25:52 This should be like: const int kArrowWidth = 6;
+
+ gfx::Rect arrow(
+ menu_list.arrow_x,
+ menu_list.arrow_y - (arrow_height / 2),
+ arrow_width,
+ arrow_height);
+
+ // Constrain to the paint rect.
+ arrow.Intersect(rect);
+
SkPath path;
- path.moveTo(menu_list.arrow_x, menu_list.arrow_y - 3);
- path.rLineTo(6, 0);
- path.rLineTo(-3, 6);
+ path.moveTo(arrow.x(), arrow.y());
+ path.lineTo(arrow.right(), arrow.y());
+ path.lineTo(arrow.x() + arrow.width() / 2, arrow.bottom());
path.close();
canvas->drawPath(path, paint);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698