Chromium Code Reviews| Index: components/constrained_window/constrained_window_views.cc |
| diff --git a/components/constrained_window/constrained_window_views.cc b/components/constrained_window/constrained_window_views.cc |
| index 37de79c84e03281a1e200c195a8ea42fe8bc9850..f0c3f804ffb29744e6fb856b813790eb28e45f0d 100644 |
| --- a/components/constrained_window/constrained_window_views.cc |
| +++ b/components/constrained_window/constrained_window_views.cc |
| @@ -24,6 +24,11 @@ |
| #import "components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.h" |
| #endif |
| +#if defined(USE_AURA) |
| +#include "ui/aura/window.h" |
| +#include "ui/compositor/dip_util.h" |
| +#endif |
| + |
| using web_modal::ModalDialogHost; |
| using web_modal::ModalDialogHostObserver; |
| @@ -126,6 +131,19 @@ void UpdateModalDialogPosition(views::Widget* widget, |
| } |
| widget->SetBounds(gfx::Rect(position, size)); |
| + |
| +#if defined(USE_AURA) |
| + if (!widget->is_top_level()) { |
| + // Toplevel windows are automatiacally snapped, but CHILD windows |
| + // may not. If it's not toplevel, snap the widget's layer to pixel |
| + // based on the parent toplevel window, which should be snapped. |
| + aura::Window* window = widget->GetNativeWindow(); |
|
msw
2017/07/05 20:16:42
nit: use gfx::NativeView and GetNativeView or inli
oshima
2017/07/07 18:11:30
Done
|
| + views::Widget* toplevel = |
| + views::Widget::GetTopLevelWidgetForNativeView(window->parent()); |
| + ui::SnapLayerToPhysicalPixelBoundary(toplevel->GetLayer(), |
| + widget->GetLayer()); |
| + } |
| +#endif |
| } |
| } // namespace |