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

Unified Diff: components/constrained_window/constrained_window_views.cc

Issue 2934883003: Snap non toplevel dialog windows to pixel boundary. (Closed)
Patch Set: addressed comment Created 3 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/constrained_window/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..18398d6db6029a12e25c7983aef9f6460a1ed125 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.
+ gfx::NativeView window = widget->GetNativeView();
+ views::Widget* toplevel =
+ views::Widget::GetTopLevelWidgetForNativeView(window->parent());
+ ui::SnapLayerToPhysicalPixelBoundary(toplevel->GetLayer(),
+ widget->GetLayer());
+ }
+#endif
}
} // namespace
« no previous file with comments | « components/constrained_window/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698