Commit b750dac8 authored by antrim@chromium.org's avatar antrim@chromium.org

Use TargetTransform instead of transform in ConvertPointFor/FromAncestor

Shell::SetDisplayWorkAreaInsets (called from ShelfLayoutManager if launcher was set to autohide) applied while some
containers were transform-animated (lock window animation) resulted in incorrect offsets.

BUG=167215


Review URL: https://chromiumcodereview.appspot.com/11682006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175617 0039d316-1c4b-4281-b951-d872f2087c98
parent d3dbe56e
...@@ -581,7 +581,7 @@ void Layer::StackRelativeTo(Layer* child, Layer* other, bool above) { ...@@ -581,7 +581,7 @@ void Layer::StackRelativeTo(Layer* child, Layer* other, bool above) {
bool Layer::ConvertPointForAncestor(const Layer* ancestor, bool Layer::ConvertPointForAncestor(const Layer* ancestor,
gfx::Point* point) const { gfx::Point* point) const {
gfx::Transform transform; gfx::Transform transform;
bool result = GetTransformRelativeTo(ancestor, &transform); bool result = GetTargetTransformRelativeTo(ancestor, &transform);
gfx::Point3F p(*point); gfx::Point3F p(*point);
transform.TransformPoint(p); transform.TransformPoint(p);
*point = gfx::ToFlooredPoint(p.AsPointF()); *point = gfx::ToFlooredPoint(p.AsPointF());
...@@ -591,22 +591,24 @@ bool Layer::ConvertPointForAncestor(const Layer* ancestor, ...@@ -591,22 +591,24 @@ bool Layer::ConvertPointForAncestor(const Layer* ancestor,
bool Layer::ConvertPointFromAncestor(const Layer* ancestor, bool Layer::ConvertPointFromAncestor(const Layer* ancestor,
gfx::Point* point) const { gfx::Point* point) const {
gfx::Transform transform; gfx::Transform transform;
bool result = GetTransformRelativeTo(ancestor, &transform); bool result = GetTargetTransformRelativeTo(ancestor, &transform);
gfx::Point3F p(*point); gfx::Point3F p(*point);
transform.TransformPointReverse(p); transform.TransformPointReverse(p);
*point = gfx::ToFlooredPoint(p.AsPointF()); *point = gfx::ToFlooredPoint(p.AsPointF());
return result; return result;
} }
bool Layer::GetTransformRelativeTo(const Layer* ancestor, bool Layer::GetTargetTransformRelativeTo(const Layer* ancestor,
gfx::Transform* transform) const { gfx::Transform* transform) const {
const Layer* p = this; const Layer* p = this;
for (; p && p != ancestor; p = p->parent()) { for (; p && p != ancestor; p = p->parent()) {
gfx::Transform translation; gfx::Transform translation;
translation.Translate(static_cast<float>(p->bounds().x()), translation.Translate(static_cast<float>(p->bounds().x()),
static_cast<float>(p->bounds().y())); static_cast<float>(p->bounds().y()));
if (!p->transform().IsIdentity()) // Use target transform so that result will be correct once animation is
transform->ConcatTransform(p->transform()); // finished.
if (!p->GetTargetTransform().IsIdentity())
transform->ConcatTransform(p->GetTargetTransform());
transform->ConcatTransform(translation); transform->ConcatTransform(translation);
} }
return p == ancestor; return p == ancestor;
......
...@@ -295,8 +295,8 @@ class COMPOSITOR_EXPORT Layer ...@@ -295,8 +295,8 @@ class COMPOSITOR_EXPORT Layer
bool ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const; bool ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const;
bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const; bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const;
bool GetTransformRelativeTo(const Layer* ancestor, bool GetTargetTransformRelativeTo(const Layer* ancestor,
gfx::Transform* transform) const; gfx::Transform* transform) const;
// The only externally updated layers are ones that get their pixels from // The only externally updated layers are ones that get their pixels from
// WebKit and WebKit does not produce valid alpha values. All other layers // WebKit and WebKit does not produce valid alpha values. All other layers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment