diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 01:58:33 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 01:58:33 +0000 |
commit | 5ba9d5f9a061f5fb345ce651908ff67bfef80a71 (patch) | |
tree | 140b74f127492ad5b8299795438598bccd1f6b5a /ui | |
parent | 1b2747da8cf41299c56b60a87fc3200eceb8c002 (diff) | |
download | chromium_src-5ba9d5f9a061f5fb345ce651908ff67bfef80a71.zip chromium_src-5ba9d5f9a061f5fb345ce651908ff67bfef80a71.tar.gz chromium_src-5ba9d5f9a061f5fb345ce651908ff67bfef80a71.tar.bz2 |
Add GetTargetBounds to window/layer.
This is necessary for WindowManager to deterimne the window's layout even when window is animating.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8357023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/window.cc | 4 | ||||
-rw-r--r-- | ui/aura/window.h | 4 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.cc | 6 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.h | 4 |
4 files changed, 18 insertions, 0 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 3d74cb6..4ff40e2 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -144,6 +144,10 @@ void Window::SetBounds(const gfx::Rect& new_bounds) { SetBoundsInternal(new_bounds); } +gfx::Rect Window::GetTargetBounds() const { + return layer_->GetTargetBounds(); +} + const gfx::Rect& Window::bounds() const { return layer_->bounds(); } diff --git a/ui/aura/window.h b/ui/aura/window.h index 668ce80..aa2bd23 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -122,6 +122,10 @@ class AURA_EXPORT Window : public ui::LayerDelegate { // Changes the bounds of the window. void SetBounds(const gfx::Rect& new_bounds); + // Returns the target bounds of the window. If the window's layer is + // not animating, it simply returns the current bounds. + gfx::Rect GetTargetBounds() const; + // Sets the minimum size of the window that a user can resize it to. // A smaller size can still be set using SetBounds(). void set_minimum_size(const gfx::Size& minimum_size) { diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc index 8266bff..34444ec 100644 --- a/ui/gfx/compositor/layer.cc +++ b/ui/gfx/compositor/layer.cc @@ -136,6 +136,12 @@ void Layer::SetBounds(const gfx::Rect& bounds) { SetBoundsImmediately(bounds); } +gfx::Rect Layer::GetTargetBounds() const { + if (animator_.get() && animator_->IsRunning()) + return gfx::Rect(animator_->GetTargetPoint(), bounds_.size()); + return bounds_; +} + void Layer::SetOpacity(float opacity) { StopAnimatingIfNecessary(LayerAnimator::OPACITY); if (animator_.get() && animator_->IsRunning()) { diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h index c449e88..86ae4fd 100644 --- a/ui/gfx/compositor/layer.h +++ b/ui/gfx/compositor/layer.h @@ -97,6 +97,10 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate { void SetBounds(const gfx::Rect& bounds); const gfx::Rect& bounds() const { return bounds_; } + // Return the target bounds if animator is running, or the current bounds + // otherwise. + gfx::Rect GetTargetBounds() const; + // The opacity of the layer. The opacity is applied to each pixel of the // texture (resulting alpha = opacity * alpha). float opacity() const { return opacity_; } |