summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-11-16 09:52:37 -0500
committerCary Clark <cary@android.com>2010-11-16 10:10:25 -0500
commit283cbf40ef1279a6c444458b69a653410b82ca7a (patch)
treeb239f717642ddf02c1992a33379d7dcb4c7867c2 /WebKit/android/nav
parentc171aa015a0cbeab69fa359835f7c82f269d6111 (diff)
downloadexternal_webkit-283cbf40ef1279a6c444458b69a653410b82ca7a.zip
external_webkit-283cbf40ef1279a6c444458b69a653410b82ca7a.tar.gz
external_webkit-283cbf40ef1279a6c444458b69a653410b82ca7a.tar.bz2
improve left edge tap detection
Sites like Gizmodo.com layout paragraphs with extra space between lines. Increase the slop allowed when looking for the left edge of a paragraph to accommodate this. Add #define to disable sideways scrolling if the line is already entirely visible. Make various slop consts more clearly named and commented. A companion fix in frameworks/base is not required, but makes scrolling as a result of taps more reliable. bug:1331125 bug:3099569 Change-Id: I0ed89c1f53de99831e835e417b5409c1176fc841
Diffstat (limited to 'WebKit/android/nav')
-rw-r--r--WebKit/android/nav/CachedRoot.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 4ae66de..a41cfdc 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -44,6 +44,8 @@
#include "wtf/text/CString.h"
#endif
+#define DONT_CENTER_IF_ALREADY_VISIBLE
+
using std::min;
using std::max;
@@ -388,9 +390,9 @@ public:
the text into a rectangle before considering it. */
if (rect.fTop < mPartial.fBottom
&& rect.fBottom > mPartial.fTop
- && mPartial.fRight + SLOP >= rect.fLeft
+ && mPartial.fRight + JOIN_SLOP_X >= rect.fLeft
&& (mPartialType != kDrawBitmap_Type
- || mPartial.height() <= rect.height() + HIT_SLOP)) {
+ || mPartial.height() <= rect.height() + JOIN_SLOP_Y)) {
DBG_NAV_LOGD("LeftCheck join mPartial=(%d, %d, %d, %d)"
" rect=(%d, %d, %d, %d)",
mPartial.fLeft, mPartial.fTop, mPartial.fRight, mPartial.fBottom,
@@ -422,8 +424,8 @@ public:
} else if (mHitLeft == INT_MAX)
return; // wait for intersect success
/* If text is too far away vertically, don't consider it */
- if (!mBounds.isEmpty() && (mPartial.fTop > mBounds.fBottom + SLOP
- || mPartial.fBottom < mBounds.fTop - SLOP)) {
+ if (!mBounds.isEmpty() && (mPartial.fTop > mBounds.fBottom + HIT_SLOP
+ || mPartial.fBottom < mBounds.fTop - HIT_SLOP)) {
DBG_NAV_LOGD("LeftCheck stop mPartial=(%d, %d, %d, %d)"
" mBounds=(%d, %d, %d, %d)",
mPartial.fLeft, mPartial.fTop, mPartial.fRight, mPartial.fBottom,
@@ -454,8 +456,9 @@ public:
}
}
- static const int HIT_SLOP = 5; // space between text parts and lines
- static const int SLOP = 30; // space between text parts and lines
+ static const int JOIN_SLOP_X = 30; // horizontal space between text parts
+ static const int JOIN_SLOP_Y = 5; // vertical space between text lines
+ static const int HIT_SLOP = 30; // diameter allowing for tap size
/* const */ SkIRect mHit; // sloppy hit rectangle
SkIRect mBounds; // reference bounds
SkIRect mPartial; // accumulated text bounds, per line