diff options
author | michaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 11:24:09 +0000 |
---|---|---|
committer | michaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 11:24:09 +0000 |
commit | c0dc4b1762ad2ebde1992d1c28ab89da17905a49 (patch) | |
tree | c7716c0c023a7e94e1ae752cd8cbc68c42739162 /ui/views/bubble | |
parent | 7e8d9d5c6e9b3d04781fd0809c5a568e48ac5249 (diff) | |
download | chromium_src-c0dc4b1762ad2ebde1992d1c28ab89da17905a49.zip chromium_src-c0dc4b1762ad2ebde1992d1c28ab89da17905a49.tar.gz chromium_src-c0dc4b1762ad2ebde1992d1c28ab89da17905a49.tar.bz2 |
Revert "Retain tray bubble's rounded corners when the bubble animates out"
This reverts commit 7b1cac3592db1009adf4e11c2d9f87a81626630f.
BUG=330744, 330745, 331852
TBR=piman@chromium.org, msw@chromium.org
Review URL: https://codereview.chromium.org/125433002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/bubble')
-rw-r--r-- | ui/views/bubble/tray_bubble_view.cc | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/ui/views/bubble/tray_bubble_view.cc b/ui/views/bubble/tray_bubble_view.cc index 9259489..3f947ab 100644 --- a/ui/views/bubble/tray_bubble_view.cc +++ b/ui/views/bubble/tray_bubble_view.cc @@ -179,7 +179,7 @@ class TrayBubbleContentMask : public ui::LayerDelegate { explicit TrayBubbleContentMask(int corner_radius); virtual ~TrayBubbleContentMask(); - void set_bounds(gfx::Rect bounds) { bounds_ = bounds; } + ui::Layer* layer() { return &layer_; } // Overridden from LayerDelegate. virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; @@ -187,22 +187,25 @@ class TrayBubbleContentMask : public ui::LayerDelegate { virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; private: - gfx::Rect bounds_; + ui::Layer layer_; SkScalar corner_radius_; DISALLOW_COPY_AND_ASSIGN(TrayBubbleContentMask); }; TrayBubbleContentMask::TrayBubbleContentMask(int corner_radius) - : corner_radius_(corner_radius) { + : layer_(ui::LAYER_TEXTURED), + corner_radius_(corner_radius) { + layer_.set_delegate(this); } TrayBubbleContentMask::~TrayBubbleContentMask() { + layer_.set_delegate(NULL); } void TrayBubbleContentMask::OnPaintLayer(gfx::Canvas* canvas) { SkPath path; - path.addRoundRect(gfx::RectToSkRect(gfx::Rect(bounds_.size())), + path.addRoundRect(gfx::RectToSkRect(gfx::Rect(layer()->bounds().size())), corner_radius_, corner_radius_); SkPaint paint; paint.setAlpha(255); @@ -337,10 +340,6 @@ TrayBubbleView::TrayBubbleView(gfx::NativeView parent_window, TrayBubbleView::~TrayBubbleView() { mouse_watcher_.reset(); - - if (layer()->parent()->layer_mask_layer()) - layer()->parent()->layer_mask_layer()->set_delegate(NULL); - // Inform host items (models) that their views are being destroyed. if (delegate_) delegate_->BubbleViewDestroyed(); @@ -351,11 +350,8 @@ void TrayBubbleView::InitializeAndShowBubble() { SetAlignment(params_.arrow_alignment); bubble_border_->UpdateArrowOffset(); - if (get_use_acceleration_when_possible()) { - scoped_ptr<ui::Layer> mask_layer(new ui::Layer(ui::LAYER_TEXTURED)); - mask_layer->set_delegate(bubble_content_mask_.get()); - layer()->parent()->SetMaskLayer(mask_layer.Pass()); - } + if (get_use_acceleration_when_possible()) + layer()->parent()->SetMaskLayer(bubble_content_mask_->layer()); GetWidget()->Show(); UpdateBubble(); @@ -363,11 +359,8 @@ void TrayBubbleView::InitializeAndShowBubble() { void TrayBubbleView::UpdateBubble() { SizeToContents(); - if (get_use_acceleration_when_possible()) { - bubble_content_mask_->set_bounds(layer()->bounds()); - if (layer()->parent()->layer_mask_layer()) - layer()->parent()->layer_mask_layer()->SetBounds(layer()->bounds()); - } + if (get_use_acceleration_when_possible()) + bubble_content_mask_->layer()->SetBounds(layer()->bounds()); GetWidget()->GetRootView()->SchedulePaint(); } |