| Index: ui/views/view.cc
|
| diff --git a/ui/views/view.cc b/ui/views/view.cc
|
| index d65f4bc25926d324ee7ea48ed5732ec678c93523..f1258cc3e5e15fdce1e0b8907a0dd97d6ac29698 100644
|
| --- a/ui/views/view.cc
|
| +++ b/ui/views/view.cc
|
| @@ -708,6 +708,15 @@ View* View::GetSelectedViewForGroup(int group) {
|
| void View::ConvertPointToTarget(const View* source,
|
| const View* target,
|
| gfx::Point* point) {
|
| + gfx::PointF point_f(*point);
|
| + ConvertPointToTargetF(source, target, &point_f);
|
| + *point = gfx::ToFlooredPoint(point_f);
|
| +}
|
| +
|
| +// static
|
| +void View::ConvertPointToTargetF(const View* source,
|
| + const View* target,
|
| + gfx::PointF* point) {
|
| DCHECK(source);
|
| DCHECK(target);
|
| if (source == target)
|
| @@ -717,10 +726,10 @@ void View::ConvertPointToTarget(const View* source,
|
| CHECK_EQ(GetHierarchyRoot(source), root);
|
|
|
| if (source != root)
|
| - source->ConvertPointForAncestor(root, point);
|
| + source->ConvertPointForAncestorF(root, point);
|
|
|
| if (target != root)
|
| - target->ConvertPointFromAncestor(root, point);
|
| + target->ConvertPointFromAncestorF(root, point);
|
| }
|
|
|
| // static
|
| @@ -2146,22 +2155,38 @@ bool View::GetTransformRelativeTo(const View* ancestor,
|
|
|
| bool View::ConvertPointForAncestor(const View* ancestor,
|
| gfx::Point* point) const {
|
| + gfx::PointF point_f(*point);
|
| + bool result = ConvertPointForAncestorF(ancestor, &point_f);
|
| + *point = gfx::ToFlooredPoint(point_f);
|
| + return result;
|
| +}
|
| +
|
| +bool View::ConvertPointForAncestorF(const View* ancestor,
|
| + gfx::PointF* point) const {
|
| gfx::Transform trans;
|
| // TODO(sad): Have some way of caching the transformation results.
|
| bool result = GetTransformRelativeTo(ancestor, &trans);
|
| - auto p = gfx::Point3F(gfx::PointF(*point));
|
| + auto p = gfx::Point3F(*point);
|
| trans.TransformPoint(&p);
|
| - *point = gfx::ToFlooredPoint(p.AsPointF());
|
| + *point = p.AsPointF();
|
| return result;
|
| }
|
|
|
| bool View::ConvertPointFromAncestor(const View* ancestor,
|
| gfx::Point* point) const {
|
| + gfx::PointF point_f(*point);
|
| + bool result = ConvertPointFromAncestorF(ancestor, &point_f);
|
| + *point = gfx::ToFlooredPoint(point_f);
|
| + return result;
|
| +}
|
| +
|
| +bool View::ConvertPointFromAncestorF(const View* ancestor,
|
| + gfx::PointF* point) const {
|
| gfx::Transform trans;
|
| bool result = GetTransformRelativeTo(ancestor, &trans);
|
| - auto p = gfx::Point3F(gfx::PointF(*point));
|
| + auto p = gfx::Point3F(*point);
|
| trans.TransformPointReverse(&p);
|
| - *point = gfx::ToFlooredPoint(p.AsPointF());
|
| + *point = p.AsPointF();
|
| return result;
|
| }
|
|
|
|
|