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

Unified Diff: components/exo/display.cc

Issue 2396883003: exo: Fix dragging edge cases (Closed)
Patch Set: Fix unit tests Created 4 years, 2 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
Index: components/exo/display.cc
diff --git a/components/exo/display.cc b/components/exo/display.cc
index df470b28122ce118cf389e2f6aa29f09d28e9c3c..3dffade70acf5dadc5ae5b45e90093de6f4e4534 100644
--- a/components/exo/display.cc
+++ b/components/exo/display.cc
@@ -19,6 +19,7 @@
#include "components/exo/sub_surface.h"
#include "components/exo/surface.h"
#include "ui/views/widget/widget.h"
+#include "ui/wm/core/coordinate_conversion.h"
#if defined(USE_OZONE)
#include <GLES2/gl2extchromium.h>
@@ -112,7 +113,7 @@ std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) {
return nullptr;
}
- return base::MakeUnique<ShellSurface>(surface, nullptr, gfx::Rect(),
+ return base::MakeUnique<ShellSurface>(*this, surface, nullptr, gfx::Rect(),
true /* activatable */,
ash::kShellWindowId_DefaultContainer);
}
@@ -135,15 +136,16 @@ std::unique_ptr<ShellSurface> Display::CreatePopupShellSurface(
}
// Determine the initial bounds for popup. |position| is relative to the
- // parent's main surface origin and initial bounds are relative to the
- // container origin.
- gfx::Rect initial_bounds(position, gfx::Size(1, 1));
- aura::Window::ConvertRectToTarget(
+ // parent's main surface origin and initial bounds are in virtual coordinates.
+ gfx::Point origin = position;
+ wm::ConvertPointToScreen(
ShellSurface::GetMainSurface(parent->GetWidget()->GetNativeWindow())
->window(),
- parent->GetWidget()->GetNativeWindow()->parent(), &initial_bounds);
+ &origin);
+ ConvertFromScreenToVirtual(&origin);
+ gfx::Rect initial_bounds(origin, gfx::Size(1, 1));
- return base::MakeUnique<ShellSurface>(surface, parent, initial_bounds,
+ return base::MakeUnique<ShellSurface>(*this, surface, parent, initial_bounds,
false /* activatable */,
ash::kShellWindowId_DefaultContainer);
}
@@ -159,8 +161,9 @@ std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface(
return nullptr;
}
- return base::MakeUnique<ShellSurface>(surface, nullptr, gfx::Rect(1, 1),
- true /* activatable */, container);
+ return base::MakeUnique<ShellSurface>(*this, surface, nullptr,
+ gfx::Rect(1, 1), true /* activatable */,
+ container);
}
std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface,

Powered by Google App Engine
This is Rietveld 408576698