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

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

Issue 73533002: Remove the Views bubble double widget hack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « ui/views/bubble/bubble_border.h ('k') | ui/views/bubble/bubble_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 paint.setStyle(SkPaint::kFill_Style); 347 paint.setStyle(SkPaint::kFill_Style);
348 paint.setColor(background_color_); 348 paint.setColor(background_color_);
349 349
350 canvas->DrawPath(path, paint); 350 canvas->DrawPath(path, paint);
351 } 351 }
352 352
353 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { 353 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
354 if (border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER) 354 if (border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER)
355 canvas->DrawColor(border_->background_color()); 355 canvas->DrawColor(border_->background_color());
356 356
357 // Clip out the client bounds to prevent overlapping transparent widgets.
358 if (!border_->client_bounds().IsEmpty()) {
359 SkRect client_rect(gfx::RectToSkRect(border_->client_bounds()));
360 canvas->sk_canvas()->clipRect(client_rect, SkRegion::kDifference_Op);
361 }
362
363 // Fill the contents with a round-rect region to match the border images. 357 // Fill the contents with a round-rect region to match the border images.
364 SkPaint paint; 358 SkPaint paint;
365 paint.setAntiAlias(true); 359 paint.setAntiAlias(true);
366 paint.setStyle(SkPaint::kFill_Style); 360 paint.setStyle(SkPaint::kFill_Style);
367 paint.setColor(border_->background_color()); 361 paint.setColor(border_->background_color());
368 SkPath path; 362 SkPath path;
369 gfx::Rect bounds(view->GetLocalBounds()); 363 gfx::Rect bounds(view->GetLocalBounds());
370 bounds.Inset(border_->GetInsets()); 364 bounds.Inset(border_->GetInsets());
371 365
372 SkScalar radius = SkIntToScalar(border_->GetBorderCornerRadius()); 366 SkScalar radius = SkIntToScalar(border_->GetBorderCornerRadius());
373 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); 367 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius);
374 canvas->DrawPath(path, paint); 368 canvas->DrawPath(path, paint);
375 } 369 }
376 370
377 } // namespace views 371 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_border.h ('k') | ui/views/bubble/bubble_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698