summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 18:38:41 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 18:38:41 +0000
commitb0c5dfb609b0c2f77e8f3ce28b43975717512942 (patch)
tree7bba98ddb0da200435709fc5764fd611a4f1aabe
parent87a3a05a96589aa6913bc8877e91d1c49cfcaa02 (diff)
downloadchromium_src-b0c5dfb609b0c2f77e8f3ce28b43975717512942.zip
chromium_src-b0c5dfb609b0c2f77e8f3ce28b43975717512942.tar.gz
chromium_src-b0c5dfb609b0c2f77e8f3ce28b43975717512942.tar.bz2
Fix BubbleBorder wrong arrow for BOTTOM_LEFT and RIGHT_TOP.
BUG=136603 TEST=Verify bubble arrow is drawn correctly when arrow location is BOTTOM_LEFT and RIGHT_TOP. Review URL: https://chromiumcodereview.appspot.com/10689145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146155 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/views/bubble/bubble_border.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc
index be2e836..ab3e89f 100644
--- a/ui/views/bubble/bubble_border.cc
+++ b/ui/views/bubble/bubble_border.cc
@@ -455,8 +455,10 @@ void BubbleBorder::DrawEdgeWithArrow(gfx::Canvas* canvas,
void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas,
float tip_x,
float tip_y) const {
- const int offset_to_next_vertex =
- (is_arrow_on_left(arrow_location_) || is_arrow_on_top(arrow_location_)) ?
+ const bool is_horizontal = is_arrow_on_horizontal(arrow_location_);
+ const bool positive_offset = is_horizontal ?
+ is_arrow_on_top(arrow_location_) : is_arrow_on_left(arrow_location_);
+ const int offset_to_next_vertex = positive_offset ?
kArrowInteriorHeight : -kArrowInteriorHeight;
SkPath path;
@@ -464,7 +466,7 @@ void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas,
path.moveTo(SkDoubleToScalar(tip_x), SkDoubleToScalar(tip_y));
path.lineTo(SkDoubleToScalar(tip_x + offset_to_next_vertex),
SkDoubleToScalar(tip_y + offset_to_next_vertex));
- if (is_arrow_on_horizontal(arrow_location_)) {
+ if (is_horizontal) {
path.lineTo(SkDoubleToScalar(tip_x - offset_to_next_vertex),
SkDoubleToScalar(tip_y + offset_to_next_vertex));
} else {