Commit f7bf4534 authored by jdduke's avatar jdduke Committed by Commit bot

[Android] Round instead if truncate for selection coordinates

Composited selection coordinates are in floating pointer DIPs. However,
current APIs for manipulating the selection are all in integral
coordinates. This leads to cases where an adjusted selection can
chaotically hop across selection region boundaries.

Until all platforms adopt unified selection and we transition the APIs
to use floating point coordinates, use rounded coordinates when
manipulating the selection from the browser.

BUG=489852

Review URL: https://codereview.chromium.org/1139043004

Cr-Commit-Position: refs/heads/master@{#330640}
parent 07371986
......@@ -53,6 +53,7 @@
#include "ui/android/view_android.h"
#include "ui/android/window_android.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/screen.h"
......@@ -799,7 +800,7 @@ void ContentViewCoreImpl::MoveRangeSelectionExtent(const gfx::PointF& extent) {
if (!web_contents_)
return;
web_contents_->MoveRangeSelectionExtent(gfx::Point(extent.x(), extent.y()));
web_contents_->MoveRangeSelectionExtent(gfx::ToRoundedPoint(extent));
}
void ContentViewCoreImpl::SelectBetweenCoordinates(const gfx::PointF& base,
......@@ -807,8 +808,8 @@ void ContentViewCoreImpl::SelectBetweenCoordinates(const gfx::PointF& base,
if (!web_contents_)
return;
gfx::Point base_point = gfx::Point(base.x(), base.y());
gfx::Point extent_point = gfx::Point(extent.x(), extent.y());
gfx::Point base_point = gfx::ToRoundedPoint(base);
gfx::Point extent_point = gfx::ToRoundedPoint(extent);
if (base_point == extent_point)
return;
......
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