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

Unified Diff: ui/views/bubble/bubble_border.cc

Issue 12310022: More flexibility in BubbleBorder arrow rendering. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address msw style nits. Created 7 years, 10 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/bubble/bubble_border.h ('k') | ui/views/bubble/tray_bubble_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_border.cc
diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc
index cbe770213efde8ab228a1ffb7f18c7dbb99f9542..82242819baaa4246a157a82d7e283946411be716 100644
--- a/ui/views/bubble/bubble_border.cc
+++ b/ui/views/bubble/bubble_border.cc
@@ -136,7 +136,7 @@ struct BubbleBorder::BorderImages*
BubbleBorder::BubbleBorder(ArrowLocation arrow, Shadow shadow, SkColor color)
: override_arrow_offset_(0),
arrow_location_(arrow),
- paint_arrow_(true),
+ arrow_paint_type_(PAINT_NORMAL),
alignment_(ALIGN_ARROW_TO_MID_ANCHOR),
background_color_(color) {
DCHECK(shadow < SHADOW_COUNT);
@@ -182,7 +182,7 @@ gfx::Rect BubbleBorder::GetBounds(const gfx::Rect& position_relative_to,
int w = position_relative_to.width();
int h = position_relative_to.height();
- const int arrow_size = images_->arrow_interior_height + kBorderStrokeSize;
+ const int arrow_size = GetArrowSize();
const int arrow_offset = GetArrowOffset(border_size);
// Calculate bubble x coordinate.
@@ -320,6 +320,12 @@ int BubbleBorder::GetBorderCornerRadius() const {
return images_->corner_radius;
}
+int BubbleBorder::GetArrowSize() const {
+ if (arrow_paint_type_ == PAINT_NONE)
+ return 0;
+ return images_->arrow_interior_height + kBorderStrokeSize;
+}
+
int BubbleBorder::GetArrowOffset(const gfx::Size& border_size) const {
int arrow_offset = arrow_offset_;
if (override_arrow_offset_) {
@@ -414,7 +420,8 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) {
}
}
- const ArrowLocation arrow_location = paint_arrow_ ? arrow_location_ : NONE;
+ const ArrowLocation arrow_location =
+ arrow_paint_type_ == PAINT_NORMAL ? arrow_location_ : NONE;
// Left edge.
if (arrow_location == LEFT_TOP ||
« no previous file with comments | « ui/views/bubble/bubble_border.h ('k') | ui/views/bubble/tray_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698