From 4e65c3ef3ab34e815d6464636a52d5250ebb50ab Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Wed, 12 Jan 2011 13:14:29 -0500 Subject: [PATCH] always compute cx, cy in select text The cx, cy locals are later stored as part of the best character found. They must always be computed so that the best state can compare with the test state. bug:3339016 Change-Id: I4cbb791dc8d3836b027c6a9088dc3a59031c40b9 --- WebKit/android/nav/SelectText.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp index f2d75214b..ff69ddd6c 100644 --- a/WebKit/android/nav/SelectText.cpp +++ b/WebKit/android/nav/SelectText.cpp @@ -608,11 +608,11 @@ public: } // cx and cy are the distances from the tested center // The center distance is used when the test point is over the text - int cx = INT_MAX; - int cy = INT_MAX; - if (ignoreColumn && dy == 0 && mDy == 0) { - cy = std::abs(((testBounds.fTop + testBounds.fBottom) >> 1) + int cx = std::abs(((testBounds.fLeft + testBounds.fRight) >> 1) + - mFocusX); + int cy = std::abs(((testBounds.fTop + testBounds.fBottom) >> 1) - mFocusY); + if (ignoreColumn && dy == 0 && mDy == 0) { if (mCy < cy) { #ifdef EXTRA_NOISY_LOGGING DBG_NAV_LOGD("FirstCheck reject cy=%d mCy=%d", cy, mCy); @@ -621,8 +621,6 @@ public: } if (mCy == cy) { if (dx == 0 && mDx == 0) { - cx = std::abs(((testBounds.fLeft + testBounds.fRight) >> 1) - - mFocusX); if (mCx < cx) { #ifdef EXTRA_NOISY_LOGGING DBG_NAV_LOGD("FirstCheck reject cx=%d mCx=%d", cx, mCx); -- 2.11.0