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

Unified Diff: components/exo/shell_surface.cc

Issue 2467173002: exo: Fix widget positioning for pop-ups (Closed)
Patch Set: Add unit test 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') | components/exo/shell_surface_unittest.cc » ('j') | 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..92fb6e0772851f374ec0a5ad6072b55a8248ba85 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_) {
@@ -1283,8 +1286,12 @@ void ShellSurface::UpdateWidgetBounds() {
// Avoid changing widget origin unless initial bounds were specified and
// widget origin is always relative to it.
- if (initial_bounds_.IsEmpty())
+ if (initial_bounds_.IsEmpty()) {
new_widget_bounds.set_origin(widget_->GetWindowBoundsInScreen().origin());
+ } else {
+ 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
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698