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

Side by Side Diff: ui/aura/window.cc

Issue 2648583003: Handle floating point coordinates from ozone to exosphere (Closed)
Patch Set: added F variant to screen position client. fixed exo tests. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if (result) 425 if (result)
426 return result; 426 return result;
427 } 427 }
428 return NULL; 428 return NULL;
429 } 429 }
430 430
431 // static 431 // static
432 void Window::ConvertPointToTarget(const Window* source, 432 void Window::ConvertPointToTarget(const Window* source,
433 const Window* target, 433 const Window* target,
434 gfx::Point* point) { 434 gfx::Point* point) {
435 gfx::PointF point_f(*point);
436 ConvertPointToTargetF(source, target, &point_f);
437 *point = gfx::ToFlooredPoint(point_f);
438 }
439
440 // static
441 void Window::ConvertPointToTargetF(const Window* source,
442 const Window* target,
443 gfx::PointF* point) {
435 if (!source) 444 if (!source)
436 return; 445 return;
437 if (source->GetRootWindow() != target->GetRootWindow()) { 446 if (source->GetRootWindow() != target->GetRootWindow()) {
438 client::ScreenPositionClient* source_client = 447 client::ScreenPositionClient* source_client =
439 client::GetScreenPositionClient(source->GetRootWindow()); 448 client::GetScreenPositionClient(source->GetRootWindow());
440 // |source_client| can be NULL in tests. 449 // |source_client| can be NULL in tests.
441 if (source_client) 450 if (source_client)
442 source_client->ConvertPointToScreen(source, point); 451 source_client->ConvertPointToScreenF(source, point);
443 452
444 client::ScreenPositionClient* target_client = 453 client::ScreenPositionClient* target_client =
445 client::GetScreenPositionClient(target->GetRootWindow()); 454 client::GetScreenPositionClient(target->GetRootWindow());
446 // |target_client| can be NULL in tests. 455 // |target_client| can be NULL in tests.
447 if (target_client) 456 if (target_client)
448 target_client->ConvertPointFromScreen(target, point); 457 target_client->ConvertPointFromScreenF(target, point);
449 } else { 458 } else {
450 ui::Layer::ConvertPointToLayer(source->layer(), target->layer(), point); 459 ui::Layer::ConvertPointToLayerF(source->layer(), target->layer(), point);
451 } 460 }
452 } 461 }
453 462
454 // static 463 // static
455 void Window::ConvertRectToTarget(const Window* source, 464 void Window::ConvertRectToTarget(const Window* source,
456 const Window* target, 465 const Window* target,
457 gfx::Rect* rect) { 466 gfx::Rect* rect) {
458 DCHECK(rect); 467 DCHECK(rect);
459 gfx::Point origin = rect->origin(); 468 gfx::Point origin = rect->origin();
460 ConvertPointToTarget(source, target, &origin); 469 ConvertPointToTarget(source, target, &origin);
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 layer_name = "Unnamed Window"; 1127 layer_name = "Unnamed Window";
1119 1128
1120 if (id_ != -1) 1129 if (id_ != -1)
1121 layer_name += " " + base::IntToString(id_); 1130 layer_name += " " + base::IntToString(id_);
1122 1131
1123 layer()->set_name(layer_name); 1132 layer()->set_name(layer_name);
1124 #endif 1133 #endif
1125 } 1134 }
1126 1135
1127 } // namespace aura 1136 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698