Upstream version 10.38.208.0
[platform/framework/web/crosswalk.git] / src / ui / views / bubble / bubble_border.cc
index 03b422a..9092bab 100644 (file)
@@ -7,11 +7,9 @@
 #include <algorithm>
 
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "grit/ui_resources.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gfx/canvas.h"
-#include "ui/gfx/image/image_skia.h"
 #include "ui/gfx/rect.h"
 #include "ui/gfx/skia_util.h"
 #include "ui/views/painter.h"
@@ -21,31 +19,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 +41,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 +122,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 +252,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));
@@ -360,6 +334,10 @@ void BubbleBorder::DrawArrow(gfx::Canvas* canvas,
   canvas->DrawPath(path, paint);
 }
 
+internal::BorderImages* BubbleBorder::GetImagesForTest() const {
+  return images_;
+}
+
 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
   if (border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER)
     canvas->DrawColor(border_->background_color());