Chromium Code Reviews| Index: ui/views/mus/native_widget_mus.cc |
| diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc |
| index 45d09e9f5be8b093785a8ce2b8b472b5438baca0..eb897f2effaa96e7e39a1a4da6d3e102dae39dff 100644 |
| --- a/ui/views/mus/native_widget_mus.cc |
| +++ b/ui/views/mus/native_widget_mus.cc |
| @@ -28,6 +28,7 @@ |
| #include "ui/base/hit_test.h" |
| #include "ui/events/event.h" |
| #include "ui/gfx/canvas.h" |
| +#include "ui/gfx/path.h" |
| #include "ui/native_theme/native_theme_aura.h" |
| #include "ui/platform_window/platform_window_delegate.h" |
| #include "ui/views/mus/platform_window_mus.h" |
| @@ -493,6 +494,7 @@ void NativeWidgetMus::NotifyFrameChanged( |
| native_widget->GetWidget()->non_client_view()->Layout(); |
| native_widget->GetWidget()->non_client_view()->SchedulePaint(); |
| native_widget->UpdateClientArea(); |
| + native_widget->UpdateHitTestMask(); |
| } |
| } |
| } |
| @@ -674,6 +676,7 @@ void NativeWidgetMus::OnWidgetInitDone() { |
| // function is called the NonClientView has been created, so that we can |
| // correctly calculate the client area and push it to the mus::Window. |
| UpdateClientArea(); |
| + UpdateHitTestMask(); |
| } |
| bool NativeWidgetMus::ShouldUseNativeFrame() const { |
| @@ -1156,6 +1159,7 @@ void NativeWidgetMus::OnBoundsChanged(const gfx::Rect& old_bounds, |
| if (old_bounds.size() != new_bounds.size()) { |
| native_widget_delegate_->OnNativeWidgetSizeChanged(new_bounds.size()); |
| UpdateClientArea(); |
| + UpdateHitTestMask(); |
| } |
| } |
| @@ -1301,4 +1305,16 @@ void NativeWidgetMus::OnMusWindowVisibilityChanged(mus::Window* window) { |
| native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); |
| } |
| +void NativeWidgetMus::UpdateHitTestMask() { |
| + if (!native_widget_delegate_->HasHitTestMask()) |
|
sky
2016/05/19 18:13:17
This case should set the hit test mask to null.
James Cook
2016/05/19 21:47:46
Done.
|
| + return; |
| + |
| + gfx::Path mask_path; |
| + native_widget_delegate_->GetHitTestMask(&mask_path); |
| + // TODO(jamescook): Use the full path for the mask. |
| + gfx::Rect mask_rect = |
| + gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
| + window_->SetHitTestMask(mask_rect); |
| +} |
| + |
| } // namespace views |