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

Unified Diff: components/exo/shell_surface.cc

Issue 2467173002: exo: Fix widget positioning for pop-ups (Closed)
Patch Set: Created 4 years, 1 month 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/exo/display.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shell_surface.cc
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index 592c5bf51808e765bc3e51f13bb9f99e9e5b494e..2357913be92c87461ad83f910e615d7a62e9e922 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -1227,8 +1227,11 @@ gfx::Point ShellSurface::GetSurfaceOrigin() const {
// If initial bounds were specified then surface origin is always relative
// to those bounds.
- if (!initial_bounds_.IsEmpty())
- return initial_bounds_.origin() - window_bounds.OffsetFromOrigin();
+ if (!initial_bounds_.IsEmpty()) {
+ gfx::Point origin = window_bounds.origin();
+ wm::ConvertPointToScreen(widget_->GetNativeWindow()->parent(), &origin);
+ return initial_bounds_.origin() - origin.OffsetFromOrigin();
+ }
gfx::Rect visible_bounds = GetVisibleBounds();
switch (resize_component_) {
@@ -1286,6 +1289,11 @@ void ShellSurface::UpdateWidgetBounds() {
if (initial_bounds_.IsEmpty())
new_widget_bounds.set_origin(widget_->GetWindowBoundsInScreen().origin());
+ else {
reveman 2016/11/02 14:24:19 nit: {} for the if-scope above too if needed for e
Dominik Laskowski 2016/11/03 19:56:53 Done.
+ new_widget_bounds.set_origin(initial_bounds_.origin() +
+ visible_bounds.OffsetFromOrigin());
+ }
+
// Update widget origin using the surface origin if the current location of
// surface is being anchored to one side of the widget as a result of a
// resize operation.
« no previous file with comments | « components/exo/display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698