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

Unified Diff: content/browser/web_contents/touch_editable_impl_aura.cc

Issue 304883002: Enable touch text selection tests on all Aura platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert point to root window before screen Created 6 years, 7 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: content/browser/web_contents/touch_editable_impl_aura.cc
diff --git a/content/browser/web_contents/touch_editable_impl_aura.cc b/content/browser/web_contents/touch_editable_impl_aura.cc
index 648d888c44f432e7126318eff363facecd9e95ee..08c69971caf236ca6a631365d337c07e9a938a5b 100644
--- a/content/browser/web_contents/touch_editable_impl_aura.cc
+++ b/content/browser/web_contents/touch_editable_impl_aura.cc
@@ -255,20 +255,31 @@ void TouchEditableImplAura::ConvertPointToScreen(gfx::Point* point) {
if (!rwhva_)
return;
aura::Window* window = rwhva_->GetNativeView();
+ aura::Window* root = window->GetRootWindow();
+
+ // First convert the point to root window coordinates, then if there is a
+ // screen position client, convert it to screen coordinates.
+ aura::Window::ConvertPointToTarget(window, root, point);
aura::client::ScreenPositionClient* screen_position_client =
- aura::client::GetScreenPositionClient(window->GetRootWindow());
+ aura::client::GetScreenPositionClient(root);
if (screen_position_client)
- screen_position_client->ConvertPointToScreen(window, point);
+ screen_position_client->ConvertPointToScreen(root, point);
}
void TouchEditableImplAura::ConvertPointFromScreen(gfx::Point* point) {
if (!rwhva_)
return;
aura::Window* window = rwhva_->GetNativeView();
+ aura::Window* root = window->GetRootWindow();
+
+ // If there is a screen position client, convert the point from screen to root
+ // window and then to client coordinates. Otherwise, suppose the point is in
+ // root window coordinates and convert it to client coordinates.
aura::client::ScreenPositionClient* screen_position_client =
- aura::client::GetScreenPositionClient(window->GetRootWindow());
+ aura::client::GetScreenPositionClient(root);
if (screen_position_client)
- screen_position_client->ConvertPointFromScreen(window, point);
+ screen_position_client->ConvertPointFromScreen(root, point);
+ aura::Window::ConvertPointToTarget(root, window, point);
}
bool TouchEditableImplAura::DrawsHandles() {

Powered by Google App Engine
This is Rietveld 408576698