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

Side by Side Diff: ui/views/bubble/bubble_border_2.cc

Issue 10834140: aura: Fix launcher tooltips: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/app_list_bubble_border.h" 5 #include "ui/views/bubble/bubble_border_2.h"
6 6
7 #include "third_party/skia/include/core/SkPath.h" 7 #include <algorithm> // for std::max
8 #include "third_party/skia/include/core/SkPaint.h" 8
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "base/logging.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/path.h" 11 #include "ui/gfx/path.h"
12 #include "ui/gfx/rect.h"
13 #include "ui/gfx/screen.h"
12 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
13 15
14 namespace { 16 namespace {
15 17
16 // Bubble border corner radius. 18 // Bubble border corner radius.
17 const int kCornerRadius = 2; 19 const int kCornerRadius = 2;
18 20
19 // Arrow width and height. 21 // Arrow width and height.
20 const int kArrowHeight = 10; 22 const int kArrowHeight = 10;
21 const int kArrowWidth = 20; 23 const int kArrowWidth = 20;
22 24
23 // Bubble border color and width. 25 const int kBorderSize = 1;
24 const SkColor kBorderColor = SkColorSetARGB(0x26, 0, 0, 0); 26 const SkColor kBorderColor = SkColorSetARGB(0x26, 0, 0, 0);
25 const int kBorderSize = 1; 27 const SkColor kBackgroundColor = SK_ColorWHITE;
26 28
27 const SkColor kSearchBoxBackground = SK_ColorWHITE; 29 const int kShadowOffsetX = 0;
28 const SkColor kContentsBackground = SkColorSetRGB(0xFC, 0xFC, 0xFC); 30 const int kShadowOffsetY = 5;
29 31 const double kShadowBlur = 30;
30 // Colors and sizes of top separator between searchbox and grid view. 32 const SkColor kShadowColor = SkColorSetARGB(0x72, 0, 0, 0);
31 const SkColor kTopSeparatorColor = SkColorSetRGB(0xF0, 0xF0, 0xF0);
32 const int kTopSeparatorSize = 1;
33 33
34 // Builds a bubble shape for given |bounds|. 34 // Builds a bubble shape for given |bounds|.
35 void BuildShape(const gfx::Rect& bounds, 35 void BuildShape(const gfx::Rect& bounds,
36 views::BubbleBorder::ArrowLocation arrow_location, 36 views::BubbleBorder::ArrowLocation arrow_location,
37 SkScalar arrow_offset, 37 SkScalar arrow_offset,
38 SkScalar padding, 38 SkScalar padding,
39 SkPath* path) { 39 SkPath* path,
40 const SkScalar corner_radius = SkIntToScalar(kCornerRadius); 40 int corner_radius_int,
41 int arrow_height_int,
42 int arrow_width_int) {
43 const SkScalar corner_radius = SkIntToScalar(corner_radius_int);
41 44
42 const SkScalar left = SkIntToScalar(bounds.x()) + padding; 45 const SkScalar left = SkIntToScalar(bounds.x()) + padding;
43 const SkScalar top = SkIntToScalar(bounds.y()) + padding; 46 const SkScalar top = SkIntToScalar(bounds.y()) + padding;
44 const SkScalar right = SkIntToScalar(bounds.right()) - padding; 47 const SkScalar right = SkIntToScalar(bounds.right()) - padding;
45 const SkScalar bottom = SkIntToScalar(bounds.bottom()) - padding; 48 const SkScalar bottom = SkIntToScalar(bounds.bottom()) - padding;
46 49
47 const SkScalar center_x = SkIntToScalar((bounds.x() + bounds.right()) / 2); 50 const SkScalar center_x = SkIntToScalar((bounds.x() + bounds.right()) / 2);
48 const SkScalar center_y = SkIntToScalar((bounds.y() + bounds.bottom()) / 2); 51 const SkScalar center_y = SkIntToScalar((bounds.y() + bounds.bottom()) / 2);
49 52
50 const SkScalar half_arrow_width = (SkIntToScalar(kArrowWidth) - padding) / 2; 53 const SkScalar half_arrow_width =
51 const SkScalar arrow_height = SkIntToScalar(kArrowHeight) - padding; 54 (SkIntToScalar(arrow_width_int) - padding) / 2;
55 const SkScalar arrow_height = SkIntToScalar(arrow_height_int) - padding;
52 56
53 path->reset(); 57 path->reset();
54 path->incReserve(12); 58 path->incReserve(12);
55 59
56 switch (arrow_location) { 60 switch (arrow_location) {
57 case views::BubbleBorder::TOP_LEFT: 61 case views::BubbleBorder::TOP_LEFT:
58 case views::BubbleBorder::TOP_RIGHT: 62 case views::BubbleBorder::TOP_RIGHT:
59 path->moveTo(center_x, bottom); 63 path->moveTo(center_x, bottom);
60 path->arcTo(right, bottom, right, center_y, corner_radius); 64 path->arcTo(right, bottom, right, center_y, corner_radius);
61 path->arcTo(right, top, center_x - half_arrow_width, top, 65 path->arcTo(right, top, center_x - half_arrow_width, top,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 corner_radius, 113 corner_radius,
110 corner_radius); 114 corner_radius);
111 break; 115 break;
112 } 116 }
113 117
114 path->close(); 118 path->close();
115 } 119 }
116 120
117 } // namespace 121 } // namespace
118 122
119 namespace app_list { 123 namespace views {
120 124
121 AppListBubbleBorder::AppListBubbleBorder(views::View* app_list_view, 125 BubbleBorder2::BubbleBorder2(ArrowLocation arrow_location)
122 views::View* search_box_view) 126 : BubbleBorder(arrow_location, views::BubbleBorder::NO_SHADOW),
123 : views::BubbleBorder(views::BubbleBorder::BOTTOM_RIGHT, 127 corner_radius_(kCornerRadius),
124 views::BubbleBorder::NO_SHADOW), 128 border_size_(kBorderSize),
125 app_list_view_(app_list_view), 129 arrow_height_(kArrowHeight),
126 search_box_view_(search_box_view) { 130 arrow_width_(kArrowWidth),
127 const gfx::ShadowValue kShadows[] = { 131 background_color_(kBackgroundColor),
128 // Offset (0, 5), blur=30, color=0.36 black 132 border_color_(kBorderColor) {
129 gfx::ShadowValue(gfx::Point(0, 5), 30, SkColorSetARGB(0x72, 0, 0, 0)), 133 SetShadow(gfx::ShadowValue(gfx::Point(kShadowOffsetX, kShadowOffsetY),
130 }; 134 kShadowBlur, kShadowColor));
131 shadows_.assign(kShadows, kShadows + arraysize(kShadows));
132 } 135 }
133 136
134 AppListBubbleBorder::~AppListBubbleBorder() { 137 BubbleBorder2::~BubbleBorder2() {}
138
139 gfx::Rect BubbleBorder2::ComputeOffsetAndUpdateBubbleRect(
140 gfx::Rect bubble_rect,
141 const gfx::Rect& anchor_view_rect) {
142 offset_ = gfx::Point();
143
144 gfx::Rect monitor_rect = gfx::Screen::GetDisplayNearestPoint(
145 anchor_view_rect.CenterPoint()).bounds();
146 if (monitor_rect.IsEmpty() || monitor_rect.Contains(bubble_rect))
147 return bubble_rect;
148
149 gfx::Point offset;
150
151 if (has_arrow(arrow_location())) {
152 if (is_arrow_on_horizontal(arrow_location())) {
153 if (bubble_rect.x() < monitor_rect.x())
154 offset.set_x(monitor_rect.x() - bubble_rect.x());
155 else if (bubble_rect.right() > monitor_rect.right())
156 offset.set_x(monitor_rect.right() - bubble_rect.right());
157 } else {
158 if (bubble_rect.y() < monitor_rect.y())
159 offset.set_y(monitor_rect.y() - bubble_rect.y());
160 else if (bubble_rect.bottom() > monitor_rect.bottom())
161 offset.set_y(monitor_rect.bottom() - bubble_rect.bottom());
162 }
163 }
164
165 bubble_rect.Offset(offset);
166 set_offset(offset);
167
168 return bubble_rect;
135 } 169 }
136 170
137 bool AppListBubbleBorder::ArrowAtTopOrBottom() const { 171 void BubbleBorder2::GetMask(const gfx::Rect& bounds,
138 return arrow_location() == views::BubbleBorder::TOP_LEFT || 172 gfx::Path* mask) const {
139 arrow_location() == views::BubbleBorder::TOP_RIGHT ||
140 arrow_location() == views::BubbleBorder::BOTTOM_LEFT ||
141 arrow_location() == views::BubbleBorder::BOTTOM_RIGHT;
142 }
143
144 bool AppListBubbleBorder::ArrowOnLeftOrRight() const {
145 return arrow_location() == views::BubbleBorder::LEFT_TOP ||
146 arrow_location() == views::BubbleBorder::LEFT_BOTTOM ||
147 arrow_location() == views::BubbleBorder::RIGHT_TOP ||
148 arrow_location() == views::BubbleBorder::RIGHT_BOTTOM;
149 }
150
151 void AppListBubbleBorder::GetMask(const gfx::Rect& bounds,
152 gfx::Path* mask) const {
153 gfx::Insets insets; 173 gfx::Insets insets;
154 GetInsets(&insets); 174 GetInsets(&insets);
155 175
156 gfx::Rect content_bounds(bounds); 176 gfx::Rect content_bounds(bounds);
157 content_bounds.Inset(insets); 177 content_bounds.Inset(insets);
158 178
159 BuildShape(content_bounds, 179 BuildShape(content_bounds,
160 arrow_location(), 180 arrow_location(),
161 SkIntToScalar(GetArrowOffset()), 181 SkIntToScalar(GetArrowOffset()),
162 SkIntToScalar(kBorderSize), 182 SkIntToScalar(kBorderSize),
163 mask); 183 mask,
184 corner_radius_,
185 arrow_height_,
186 arrow_width_);
164 } 187 }
165 188
166 int AppListBubbleBorder::GetArrowOffset() const { 189 void BubbleBorder2::SetShadow(gfx::ShadowValue shadow) {
167 if (ArrowAtTopOrBottom()) { 190 shadows_.clear();
168 // Picks x offset and moves bubble arrow in the opposite direction. 191 shadows_.push_back(shadow);
169 // i.e. If bubble bounds is moved to right (positive offset), we need to 192 }
170 // move arrow to left so that it points to the same position. 193
171 return -offset_.x(); 194 int BubbleBorder2::border_thickness() const {
172 } else if (ArrowOnLeftOrRight()) { 195 return 0;
173 // Picks y offset and moves bubble arrow in the opposite direction. 196 }
174 return -offset_.y(); 197
198 void BubbleBorder2::PaintBackground(gfx::Canvas* canvas,
199 const gfx::Rect& bounds) const {
200 canvas->FillRect(bounds, background_color_);
201 }
202
203 int BubbleBorder2::GetArrowOffset() const {
204 if (has_arrow(arrow_location())) {
205 if (is_arrow_on_horizontal(arrow_location())) {
206 // Picks x offset and moves bubble arrow in the opposite direction.
207 // i.e. If bubble bounds is moved to right (positive offset), we need to
208 // move arrow to left so that it points to the same position.
209 return -offset_.x();
210 } else {
211 // Picks y offset and moves bubble arrow in the opposite direction.
212 return -offset_.y();
213 }
175 } 214 }
176 215
177 // Other style does not have an arrow, so return 0. 216 // Other style does not have an arrow, so return 0.
178 return 0; 217 return 0;
179 } 218 }
180 219
181 void AppListBubbleBorder::PaintBackground(gfx::Canvas* canvas, 220 void BubbleBorder2::GetInsets(gfx::Insets* insets) const {
182 const gfx::Rect& bounds) const {
183 const gfx::Rect search_box_view_bounds =
184 app_list_view_->ConvertRectToWidget(search_box_view_->bounds());
185 gfx::Rect search_box_rect(bounds.x(),
186 bounds.y(),
187 bounds.width(),
188 search_box_view_bounds.bottom() - bounds.y());
189
190 SkPaint paint;
191 paint.setStyle(SkPaint::kFill_Style);
192 paint.setColor(kSearchBoxBackground);
193 canvas->DrawRect(search_box_rect, paint);
194
195 gfx::Rect seperator_rect(search_box_rect);
196 seperator_rect.set_y(seperator_rect.bottom());
197 seperator_rect.set_height(kTopSeparatorSize);
198 canvas->FillRect(seperator_rect, kTopSeparatorColor);
199
200 gfx::Rect contents_rect(bounds.x(),
201 seperator_rect.bottom(),
202 bounds.width(),
203 bounds.bottom() - seperator_rect.bottom());
204
205 paint.setColor(kContentsBackground);
206 canvas->DrawRect(contents_rect, paint);
207 }
208
209 void AppListBubbleBorder::GetInsets(gfx::Insets* insets) const {
210 // Negate to change from outer margin to inner padding. 221 // Negate to change from outer margin to inner padding.
211 gfx::Insets shadow_padding(-gfx::ShadowValue::GetMargin(shadows_)); 222 gfx::Insets shadow_padding(-gfx::ShadowValue::GetMargin(shadows_));
212 223
213 if (arrow_location() == views::BubbleBorder::TOP_LEFT || 224 if (arrow_location() == views::BubbleBorder::TOP_LEFT ||
214 arrow_location() == views::BubbleBorder::TOP_RIGHT) { 225 arrow_location() == views::BubbleBorder::TOP_RIGHT) {
215 // Arrow at top. 226 // Arrow at top.
216 insets->Set(shadow_padding.top() + kArrowHeight, 227 insets->Set(shadow_padding.top() + arrow_height_,
msw 2012/08/03 20:42:00 nit: if the use of this arrow_height_ was incorrec
varunjain 2012/08/03 20:54:23 The use of arrow_height_ is correct over here sinc
217 shadow_padding.left(), 228 shadow_padding.left(),
218 shadow_padding.bottom(), 229 shadow_padding.bottom(),
219 shadow_padding.right()); 230 shadow_padding.right());
220 } else if (arrow_location() == views::BubbleBorder::BOTTOM_LEFT || 231 } else if (arrow_location() == views::BubbleBorder::BOTTOM_LEFT ||
221 arrow_location() == views::BubbleBorder::BOTTOM_RIGHT) { 232 arrow_location() == views::BubbleBorder::BOTTOM_RIGHT) {
222 // Arrow at bottom. 233 // Arrow at bottom.
223 insets->Set(shadow_padding.top(), 234 insets->Set(shadow_padding.top(),
224 shadow_padding.left(), 235 shadow_padding.left(),
225 shadow_padding.bottom() + kArrowHeight, 236 shadow_padding.bottom() + arrow_height_,
226 shadow_padding.right()); 237 shadow_padding.right());
227 } else if (arrow_location() == views::BubbleBorder::LEFT_TOP || 238 } else if (arrow_location() == views::BubbleBorder::LEFT_TOP ||
228 arrow_location() == views::BubbleBorder::LEFT_BOTTOM) { 239 arrow_location() == views::BubbleBorder::LEFT_BOTTOM) {
229 // Arrow on left. 240 // Arrow on left.
230 insets->Set(shadow_padding.top(), 241 insets->Set(shadow_padding.top(),
231 shadow_padding.left() + kArrowHeight, 242 shadow_padding.left() + arrow_height_,
232 shadow_padding.bottom(), 243 shadow_padding.bottom(),
233 shadow_padding.right()); 244 shadow_padding.right());
234 } else if (arrow_location() == views::BubbleBorder::RIGHT_TOP || 245 } else if (arrow_location() == views::BubbleBorder::RIGHT_TOP ||
235 arrow_location() == views::BubbleBorder::RIGHT_BOTTOM) { 246 arrow_location() == views::BubbleBorder::RIGHT_BOTTOM) {
236 // Arrow on right. 247 // Arrow on right.
237 insets->Set(shadow_padding.top(), 248 insets->Set(shadow_padding.top(),
238 shadow_padding.left(), 249 shadow_padding.left(),
239 shadow_padding.bottom(), 250 shadow_padding.bottom(),
240 shadow_padding.right() + kArrowHeight); 251 shadow_padding.right() + arrow_height_);
241 } 252 }
242 } 253 }
243 254
244 gfx::Rect AppListBubbleBorder::GetBounds( 255 gfx::Rect BubbleBorder2::GetBounds(const gfx::Rect& position_relative_to,
245 const gfx::Rect& position_relative_to, 256 const gfx::Size& contents_size) const {
246 const gfx::Size& contents_size) const {
247 gfx::Size border_size(contents_size); 257 gfx::Size border_size(contents_size);
248 gfx::Insets insets; 258 gfx::Insets insets;
249 GetInsets(&insets); 259 GetInsets(&insets);
250 border_size.Enlarge(insets.width(), insets.height()); 260 border_size.Enlarge(insets.width(), insets.height());
251 261
252 // Negate to change from outer margin to inner padding. 262 // Negate to change from outer margin to inner padding.
253 gfx::Insets shadow_padding(-gfx::ShadowValue::GetMargin(shadows_)); 263 gfx::Insets shadow_padding(-gfx::ShadowValue::GetMargin(shadows_));
254 264
255 // Anchor center that arrow aligns with. 265 // Anchor center that arrow aligns with.
256 const int anchor_center_x = 266 const int anchor_center_x =
(...skipping 10 matching lines...) Expand all
267 int arrow_tip_x = insets.left() + contents_size.width() / 2 + 277 int arrow_tip_x = insets.left() + contents_size.width() / 2 +
268 GetArrowOffset(); 278 GetArrowOffset();
269 int arrow_tip_y = insets.top() + contents_size.height() / 2 + 279 int arrow_tip_y = insets.top() + contents_size.height() / 2 +
270 GetArrowOffset() + 1; 280 GetArrowOffset() + 1;
271 281
272 if (arrow_location() == views::BubbleBorder::TOP_LEFT || 282 if (arrow_location() == views::BubbleBorder::TOP_LEFT ||
273 arrow_location() == views::BubbleBorder::TOP_RIGHT) { 283 arrow_location() == views::BubbleBorder::TOP_RIGHT) {
274 // Arrow at top. 284 // Arrow at top.
275 return gfx::Rect( 285 return gfx::Rect(
276 gfx::Point(anchor_center_x - arrow_tip_x, 286 gfx::Point(anchor_center_x - arrow_tip_x,
277 position_relative_to.bottom() - shadow_padding.top() - 287 position_relative_to.bottom() - shadow_padding.top()),
278 kArrowHeight),
279 border_size); 288 border_size);
280 } else if (arrow_location() == views::BubbleBorder::BOTTOM_LEFT || 289 } else if (arrow_location() == views::BubbleBorder::BOTTOM_LEFT ||
281 arrow_location() == views::BubbleBorder::BOTTOM_RIGHT) { 290 arrow_location() == views::BubbleBorder::BOTTOM_RIGHT) {
282 // Arrow at bottom. 291 // Arrow at bottom.
283 return gfx::Rect( 292 return gfx::Rect(
284 gfx::Point(anchor_center_x - arrow_tip_x, 293 gfx::Point(anchor_center_x - arrow_tip_x,
285 position_relative_to.y() - border_size.height() + 294 position_relative_to.y() - border_size.height() +
286 shadow_padding.bottom() + kArrowHeight), 295 shadow_padding.bottom()),
287 border_size); 296 border_size);
288 } else if (arrow_location() == views::BubbleBorder::LEFT_TOP || 297 } else if (arrow_location() == views::BubbleBorder::LEFT_TOP ||
289 arrow_location() == views::BubbleBorder::LEFT_BOTTOM) { 298 arrow_location() == views::BubbleBorder::LEFT_BOTTOM) {
290 // Arrow on left. 299 // Arrow on left.
291 return gfx::Rect( 300 return gfx::Rect(
292 gfx::Point(position_relative_to.right() - shadow_padding.left() - 301 gfx::Point(position_relative_to.right() - shadow_padding.left(),
293 kArrowHeight,
294 anchor_center_y - arrow_tip_y), 302 anchor_center_y - arrow_tip_y),
295 border_size); 303 border_size);
296 } else if (arrow_location() == views::BubbleBorder::RIGHT_TOP || 304 } else if (arrow_location() == views::BubbleBorder::RIGHT_TOP ||
297 arrow_location() == views::BubbleBorder::RIGHT_BOTTOM) { 305 arrow_location() == views::BubbleBorder::RIGHT_BOTTOM) {
298 // Arrow on right. 306 // Arrow on right.
299 return gfx::Rect( 307 return gfx::Rect(
300 gfx::Point(position_relative_to.x() - border_size.width() + 308 gfx::Point(position_relative_to.x() - border_size.width() +
301 shadow_padding.right() + kArrowHeight, 309 shadow_padding.right(),
302 anchor_center_y - arrow_tip_y), 310 anchor_center_y - arrow_tip_y),
303 border_size); 311 border_size);
304 } 312 }
305 313
306 // No arrow bubble, center align with anchor. 314 // No arrow bubble, center align with anchor.
307 return position_relative_to.Center(border_size); 315 return position_relative_to.Center(border_size);
308 } 316 }
309 317
310 void AppListBubbleBorder::Paint(const views::View& view, 318 void BubbleBorder2::GetInsetsForArrowLocation(gfx::Insets* insets,
311 gfx::Canvas* canvas) const { 319 ArrowLocation arrow_loc) const {
320 int top = border_size_;
321 int bottom = border_size_;
322 int left = border_size_;
323 int right = border_size_;
324 switch (arrow_loc) {
325 case TOP_LEFT:
326 case TOP_RIGHT:
327 top = std::max(top, arrow_height_);
328 break;
329
330 case BOTTOM_LEFT:
331 case BOTTOM_RIGHT:
332 bottom = std::max(bottom, arrow_height_);
333 break;
334
335 case LEFT_TOP:
336 case LEFT_BOTTOM:
337 left = std::max(left, arrow_height_);
338 break;
339
340 case RIGHT_TOP:
341 case RIGHT_BOTTOM:
342 right = std::max(right, arrow_height_);
343 break;
344
345 case NONE:
346 case FLOAT:
347 // Nothing to do.
348 break;
349 }
350 insets->Set(top, left, bottom, right);
351 }
352
353 void BubbleBorder2::Paint(const views::View& view, gfx::Canvas* canvas) const {
312 gfx::Insets insets; 354 gfx::Insets insets;
313 GetInsets(&insets); 355 GetInsets(&insets);
314 356
315 gfx::Rect content_bounds = view.bounds(); 357 gfx::Rect content_bounds = view.bounds();
316 content_bounds.Inset(insets); 358 content_bounds.Inset(insets);
317 359
318 SkPath path; 360 SkPath path;
319 // Pads with 0.5 pixel since anti alias is used. 361 // Pads with 0.5 pixel since anti alias is used.
320 BuildShape(content_bounds, 362 BuildShape(content_bounds,
321 arrow_location(), 363 arrow_location(),
322 SkIntToScalar(GetArrowOffset()), 364 SkIntToScalar(GetArrowOffset()),
323 SkDoubleToScalar(0.5), 365 SkDoubleToScalar(0.5),
324 &path); 366 &path,
367 corner_radius_,
368 arrow_height_,
369 arrow_width_);
325 370
326 // Draw border and shadow. Note fill is needed to generate enough shadow. 371 // Draw border and shadow. Note fill is needed to generate enough shadow.
327 SkPaint paint; 372 SkPaint paint;
328 paint.setAntiAlias(true); 373 paint.setAntiAlias(true);
329 paint.setStyle(SkPaint::kStrokeAndFill_Style); 374 paint.setStyle(SkPaint::kStrokeAndFill_Style);
330 paint.setStrokeWidth(SkIntToScalar(kBorderSize)); 375 paint.setStrokeWidth(SkIntToScalar(border_size_));
331 paint.setColor(kBorderColor); 376 paint.setColor(border_color_);
332 SkSafeUnref(paint.setLooper(gfx::CreateShadowDrawLooper(shadows_))); 377 SkSafeUnref(paint.setLooper(gfx::CreateShadowDrawLooper(shadows_)));
333 canvas->DrawPath(path, paint); 378 canvas->DrawPath(path, paint);
334 379
335 // Pads with kBoprderSize pixels to leave space for border lines. 380 // Pads with |border_size_| pixels to leave space for border lines.
336 BuildShape(content_bounds, 381 BuildShape(content_bounds,
337 arrow_location(), 382 arrow_location(),
338 SkIntToScalar(GetArrowOffset()), 383 SkIntToScalar(GetArrowOffset()),
339 SkIntToScalar(kBorderSize), 384 SkIntToScalar(border_size_),
340 &path); 385 &path,
386 corner_radius_,
387 arrow_height_,
388 arrow_width_);
341 canvas->Save(); 389 canvas->Save();
342 canvas->ClipPath(path); 390 canvas->ClipPath(path);
343 391
344 // Use full bounds so that arrow is also painted. 392 // Use full bounds so that arrow is also painted.
345 const gfx::Rect& bounds = view.bounds(); 393 const gfx::Rect& bounds = view.bounds();
346 PaintBackground(canvas, bounds); 394 PaintBackground(canvas, bounds);
347 395
348 canvas->Restore(); 396 canvas->Restore();
349 } 397 }
350 398
351 } // namespace app_list 399 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698