OSDN Git Service

bias towards space in select text
authorCary Clark <cary@android.com>
Thu, 24 Feb 2011 17:20:18 +0000 (12:20 -0500)
committerCary Clark <cary@android.com>
Thu, 24 Feb 2011 17:20:18 +0000 (12:20 -0500)
When computing the presence or absence of a space,
it's usually the case that the absense of a space case
has no error. The presence of a space may have more
error, since the size of the space may be adjusted by
the page.

When the two computed errors are equal, bias towards
the space case. This fixes text selection on Google News.

bug:3470564
Change-Id: I1feadd945e9faaf970bca0702a7cf79429592784

WebKit/android/nav/SelectText.cpp

index 5ed5c21..1524058 100644 (file)
@@ -271,7 +271,7 @@ public:
             SkFixedToScalar(posNoSpace), SkFixedToScalar(diffNoSpace),
             SkFixedToScalar(posWithSpace), SkFixedToScalar(diffWithSpace),
             mLastPaint.getTextSize());
-        return diffWithSpace < diffNoSpace;
+        return diffWithSpace <= diffNoSpace;
     }
 
     SkFixed minSpaceWidth(SkPaint& paint)