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

Side by Side Diff: trunk/src/ui/views/bubble/bubble_border.cc

Issue 14765016: Revert 198491 "Render opaque border with no shadow for web conte..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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/views/bubble/bubble_border.h" 5 #include "ui/views/bubble/bubble_border.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (set) 105 if (set)
106 return set; 106 return set;
107 107
108 switch (shadow) { 108 switch (shadow) {
109 case BubbleBorder::SHADOW: 109 case BubbleBorder::SHADOW:
110 // Note: SHADOW's border interior thickness is actually 10, but 0 is used 110 // Note: SHADOW's border interior thickness is actually 10, but 0 is used
111 // here to match the legacy appearance of SHADOW's extra large inset. 111 // here to match the legacy appearance of SHADOW's extra large inset.
112 set = new BorderImages(kShadowImages, kShadowArrows, 0, 0, 3); 112 set = new BorderImages(kShadowImages, kShadowArrows, 0, 0, 3);
113 break; 113 break;
114 case BubbleBorder::NO_SHADOW: 114 case BubbleBorder::NO_SHADOW:
115 case BubbleBorder::NO_SHADOW_OPAQUE_BORDER:
116 set = new BorderImages(kNoShadowImages, kNoShadowArrows, 6, 7, 4); 115 set = new BorderImages(kNoShadowImages, kNoShadowArrows, 6, 7, 4);
117 break; 116 break;
118 case BubbleBorder::BIG_SHADOW: 117 case BubbleBorder::BIG_SHADOW:
119 set = new BorderImages(kBigShadowImages, kBigShadowArrows, 23, 9, 2); 118 set = new BorderImages(kBigShadowImages, kBigShadowArrows, 23, 9, 2);
120 break; 119 break;
121 case BubbleBorder::SMALL_SHADOW: 120 case BubbleBorder::SMALL_SHADOW:
122 set = new BorderImages(kSmallShadowImages, kSmallShadowArrows, 5, 6, 2); 121 set = new BorderImages(kSmallShadowImages, kSmallShadowArrows, 5, 6, 2);
123 break; 122 break;
124 case BubbleBorder::SHADOW_COUNT: 123 case BubbleBorder::SHADOW_COUNT:
125 NOTREACHED(); 124 NOTREACHED();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 path.close(); 325 path.close();
327 326
328 SkPaint paint; 327 SkPaint paint;
329 paint.setStyle(SkPaint::kFill_Style); 328 paint.setStyle(SkPaint::kFill_Style);
330 paint.setColor(background_color_); 329 paint.setColor(background_color_);
331 330
332 canvas->DrawPath(path, paint); 331 canvas->DrawPath(path, paint);
333 } 332 }
334 333
335 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { 334 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
336 if (border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER)
337 canvas->DrawColor(border_->background_color());
338
339 // Clip out the client bounds to prevent overlapping transparent widgets. 335 // Clip out the client bounds to prevent overlapping transparent widgets.
340 if (!border_->client_bounds().IsEmpty()) { 336 if (!border_->client_bounds().IsEmpty()) {
341 SkRect client_rect(gfx::RectToSkRect(border_->client_bounds())); 337 SkRect client_rect(gfx::RectToSkRect(border_->client_bounds()));
342 canvas->sk_canvas()->clipRect(client_rect, SkRegion::kDifference_Op); 338 canvas->sk_canvas()->clipRect(client_rect, SkRegion::kDifference_Op);
343 } 339 }
344 340
345 // Fill the contents with a round-rect region to match the border images. 341 // Fill the contents with a round-rect region to match the border images.
346 SkPaint paint; 342 SkPaint paint;
347 paint.setAntiAlias(true); 343 paint.setAntiAlias(true);
348 paint.setStyle(SkPaint::kFill_Style); 344 paint.setStyle(SkPaint::kFill_Style);
349 paint.setColor(border_->background_color()); 345 paint.setColor(border_->background_color());
350 SkPath path; 346 SkPath path;
351 gfx::Rect bounds(view->GetLocalBounds()); 347 gfx::Rect bounds(view->GetLocalBounds());
352 bounds.Inset(border_->GetInsets()); 348 bounds.Inset(border_->GetInsets());
353 349
354 // Note: This matches the legacy appearance of SHADOW's extra large inset. 350 // Note: This matches the legacy appearance of SHADOW's extra large inset.
355 if (border_->shadow() == BubbleBorder::SHADOW) 351 if (border_->shadow() == BubbleBorder::SHADOW)
356 bounds.Inset(-10, -10); 352 bounds.Inset(-10, -10);
357 353
358 SkScalar radius = SkIntToScalar(border_->GetBorderCornerRadius()); 354 SkScalar radius = SkIntToScalar(border_->GetBorderCornerRadius());
359 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); 355 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius);
360 canvas->DrawPath(path, paint); 356 canvas->DrawPath(path, paint);
361 } 357 }
362 358
363 } // namespace views 359 } // namespace views
OLDNEW
« no previous file with comments | « trunk/src/ui/views/bubble/bubble_border.h ('k') | trunk/src/ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698