| OLD | NEW |
| 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_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( | 133 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( |
| 134 const gfx::Rect& client_bounds) const { | 134 const gfx::Rect& client_bounds) const { |
| 135 gfx::Size size(GetSizeForClientSize(client_bounds.size())); | 135 gfx::Size size(GetSizeForClientSize(client_bounds.size())); |
| 136 return bubble_border_->GetBounds(gfx::Rect(), size); | 136 return bubble_border_->GetBounds(gfx::Rect(), size); |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool BubbleFrameView::GetClientMask(const gfx::Size& size, | 139 bool BubbleFrameView::GetClientMask(const gfx::Size& size, |
| 140 gfx::Path* path) const { | 140 gfx::Path* path) const { |
| 141 const int radius = bubble_border_->GetBorderCornerRadius(); | 141 const int radius = bubble_border_->GetBorderCornerRadius(); |
| 142 gfx::Insets content_insets = GetInsets(); |
| 143 // If the client bounds don't touch the edges, no need to mask. |
| 144 if (std::min({content_insets.top(), content_insets.left(), |
| 145 content_insets.bottom(), content_insets.right()}) > radius) { |
| 146 return false; |
| 147 } |
| 142 gfx::RectF rect((gfx::Rect(size))); | 148 gfx::RectF rect((gfx::Rect(size))); |
| 143 rect.Inset(gfx::InsetsF(0.5f)); | |
| 144 path->addRoundRect(gfx::RectFToSkRect(rect), radius, radius); | 149 path->addRoundRect(gfx::RectFToSkRect(rect), radius, radius); |
| 145 return true; | 150 return true; |
| 146 } | 151 } |
| 147 | 152 |
| 148 int BubbleFrameView::NonClientHitTest(const gfx::Point& point) { | 153 int BubbleFrameView::NonClientHitTest(const gfx::Point& point) { |
| 149 if (!bounds().Contains(point)) | 154 if (!bounds().Contains(point)) |
| 150 return HTNOWHERE; | 155 return HTNOWHERE; |
| 151 if (close_->visible() && close_->GetMirroredBounds().Contains(point)) | 156 if (close_->visible() && close_->GetMirroredBounds().Contains(point)) |
| 152 return HTCLOSE; | 157 return HTCLOSE; |
| 153 | 158 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 size.Enlarge(client_insets.width(), client_insets.height()); | 518 size.Enlarge(client_insets.width(), client_insets.height()); |
| 514 size.SetToMax(gfx::Size(title_bar_width, 0)); | 519 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 515 | 520 |
| 516 if (footnote_container_) | 521 if (footnote_container_) |
| 517 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 522 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 518 | 523 |
| 519 return size; | 524 return size; |
| 520 } | 525 } |
| 521 | 526 |
| 522 } // namespace views | 527 } // namespace views |
| OLD | NEW |