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

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

Issue 173443002: aura: Take transformation into account when computing window bounds in root-window/screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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 | Annotate | Revision Log
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (window->layer_) 376 if (window->layer_)
377 return window->layer_->IsDrawn(); 377 return window->layer_->IsDrawn();
378 } 378 }
379 return false; 379 return false;
380 } 380 }
381 381
382 gfx::Rect Window::GetBoundsInRootWindow() const { 382 gfx::Rect Window::GetBoundsInRootWindow() const {
383 // TODO(beng): There may be a better way to handle this, and the existing code 383 // TODO(beng): There may be a better way to handle this, and the existing code
384 // is likely wrong anyway in a multi-display world, but this will 384 // is likely wrong anyway in a multi-display world, but this will
385 // do for now. 385 // do for now.
386 if (!GetRootWindow()) 386 const Window* root = GetRootWindow();
387 if (!root)
387 return bounds(); 388 return bounds();
388 gfx::Point origin = bounds().origin(); 389 gfx::Transform transform;
389 ConvertPointToTarget(parent_, GetRootWindow(), &origin); 390 if (!layer()->GetTargetTransformRelativeTo(root->layer(), &transform))
390 return gfx::Rect(origin, bounds().size()); 391 return gfx::Rect();
392 gfx::RectF rect(bounds().size());
393 transform.TransformRect(&rect);
oshima 2014/02/20 19:39:35 While I understand the motivation and the current
sadrul 2014/02/20 19:59:59 If there are such cases, perhaps we should find an
oshima 2014/02/20 20:18:51 I think the reason is that such scenario is rare (
sadrul 2014/02/20 21:53:48 Indeed. The motivation from this patch is from her
394 return gfx::ToEnclosingRect(rect);
391 } 395 }
392 396
393 gfx::Rect Window::GetBoundsInScreen() const { 397 gfx::Rect Window::GetBoundsInScreen() const {
394 gfx::Rect bounds(GetBoundsInRootWindow()); 398 gfx::Rect bounds(GetBoundsInRootWindow());
395 const Window* root = GetRootWindow(); 399 const Window* root = GetRootWindow();
396 if (root) { 400 if (root) {
397 aura::client::ScreenPositionClient* screen_position_client = 401 aura::client::ScreenPositionClient* screen_position_client =
398 aura::client::GetScreenPositionClient(root); 402 aura::client::GetScreenPositionClient(root);
399 if (screen_position_client) { 403 if (screen_position_client) {
400 gfx::Point origin = bounds.origin(); 404 gfx::Point origin = bounds.origin();
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 return window; 1442 return window;
1439 if (offset) 1443 if (offset)
1440 *offset += window->bounds().OffsetFromOrigin(); 1444 *offset += window->bounds().OffsetFromOrigin();
1441 } 1445 }
1442 if (offset) 1446 if (offset)
1443 *offset = gfx::Vector2d(); 1447 *offset = gfx::Vector2d();
1444 return NULL; 1448 return NULL;
1445 } 1449 }
1446 1450
1447 } // namespace aura 1451 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698