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

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

Issue 454173002: Fixed BubbleBorder sizing problems & added unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked BubbleBorderTests to be data driven. Created 6 years, 4 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
Index: ui/views/bubble/bubble_border.cc
diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc
index 03b422aefb285f83b7d39f88271f1ebbab087b19..0669bf80681a35a63c3967d9ac182d5537c1f365 100644
--- a/ui/views/bubble/bubble_border.cc
+++ b/ui/views/bubble/bubble_border.cc
@@ -21,31 +21,6 @@ namespace views {
namespace internal {
-// A helper that combines each border image-set painter with arrows and metrics.
-struct BorderImages {
- BorderImages(const int border_image_ids[],
- const int arrow_image_ids[],
- int border_interior_thickness,
- int arrow_interior_thickness,
- int corner_radius);
-
- scoped_ptr<Painter> border_painter;
- gfx::ImageSkia left_arrow;
- gfx::ImageSkia top_arrow;
- gfx::ImageSkia right_arrow;
- gfx::ImageSkia bottom_arrow;
-
- // The thickness of border and arrow images and their interior areas.
- // Thickness is the width of left/right and the height of top/bottom images.
- // The interior is measured without including stroke or shadow pixels.
- int border_thickness;
- int border_interior_thickness;
- int arrow_thickness;
- int arrow_interior_thickness;
- // The corner radius of the bubble's rounded-rect interior area.
- int corner_radius;
-};
-
BorderImages::BorderImages(const int border_image_ids[],
const int arrow_image_ids[],
int border_interior_thickness,
@@ -68,13 +43,12 @@ BorderImages::BorderImages(const int border_image_ids[],
}
}
+BorderImages::~BorderImages() {}
+
} // namespace internal
namespace {
-// The border and arrow stroke size used in image assets, in pixels.
-const int kStroke = 1;
-
// Bubble border and arrow image resource ids. They don't use the IMAGE_GRID
// macro because there is no center image.
const int kNoShadowImages[] = {
@@ -150,6 +124,8 @@ BorderImages* GetBorderImages(BubbleBorder::Shadow shadow) {
} // namespace
+const int BubbleBorder::kStroke = 1;
+
BubbleBorder::BubbleBorder(Arrow arrow, Shadow shadow, SkColor color)
: arrow_(arrow),
arrow_offset_(0),
@@ -278,7 +254,7 @@ gfx::Size BubbleBorder::GetSizeForContentsSize(
std::max(images_->arrow_thickness + images_->border_interior_thickness,
images_->border_thickness);
// Only take arrow image sizes into account when the bubble tip is shown.
- if (arrow_paint_type_ == PAINT_TRANSPARENT || !has_arrow(arrow_))
+ if (arrow_paint_type_ == PAINT_NONE || !has_arrow(arrow_))
size.SetToMax(gfx::Size(min, min));
else if (is_arrow_on_horizontal(arrow_))
size.SetToMax(gfx::Size(min_with_arrow_width, min_with_arrow_thickness));

Powered by Google App Engine
This is Rietveld 408576698