summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-11-17 11:00:36 -0500
committerCary Clark <cary@android.com>2010-11-17 11:00:36 -0500
commit07cc18eacd49c7df279f0759f23c63dab37c04a1 (patch)
tree3bea792b85e4c225116fdc83f51a74759317210b
parent283cbf40ef1279a6c444458b69a653410b82ca7a (diff)
downloadexternal_webkit-07cc18eacd49c7df279f0759f23c63dab37c04a1.zip
external_webkit-07cc18eacd49c7df279f0759f23c63dab37c04a1.tar.gz
external_webkit-07cc18eacd49c7df279f0759f23c63dab37c04a1.tar.bz2
improve select text anchor tracking
The initial point for the touch relative to the anchor was erroneously calculated, causing the select anchor to jump to the left or right each time a drag was initiated. With this fix, the anchor no longer jumps. bug:3089212 Change-Id: I995afa97ef9851fc5f15d642d7975797d8eb2022
-rw-r--r--WebKit/android/nav/SelectText.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index 2a1ca34..352ec7e 100644
--- a/WebKit/android/nav/SelectText.cpp
+++ b/WebKit/android/nav/SelectText.cpp
@@ -1379,6 +1379,8 @@ void SelectText::extendSelection(const IntRect& vis, int x, int y)
setVisibleRect(vis);
SkIRect clipRect = m_visibleRect;
int base;
+ DBG_NAV_LOGD("extend x/y=%d,%d m_startOffset=%d,%d", x, y,
+ m_startOffset.fX, m_startOffset.fY);
x -= m_startOffset.fX;
y -= m_startOffset.fY;
if (m_startSelection) {
@@ -1397,6 +1399,8 @@ void SelectText::extendSelection(const IntRect& vis, int x, int y)
m_extendSelection = true;
m_original.fX = m_original.fY = 0;
}
+ DBG_NAV_LOGD("extend x/y=%d,%d m_original=%d,%d", x, y,
+ m_original.fX, m_original.fY);
x -= m_original.fX;
y -= m_original.fY;
if (!clipRect.contains(x, y) || !clipRect.contains(m_selStart)) {
@@ -1588,11 +1592,11 @@ bool SelectText::startSelection(const CachedRoot* root, const IntRect& vis,
m_picture->width(), m_picture->height(),left, top, right, bottom, x, y);
if (m_hitTopLeft && (!hitBottomRight || y - top < bottom - y)) {
DBG_NAV_LOG("hit top left");
- m_original.fX -= left;
+ m_original.fX -= m_selStart.fLeft;
m_original.fY -= (m_selStart.fTop + m_selStart.fBottom) >> 1;
} else if (hitBottomRight) {
DBG_NAV_LOG("hit bottom right");
- m_original.fX -= right;
+ m_original.fX -= m_selEnd.fRight;
m_original.fY -= (m_selEnd.fTop + m_selEnd.fBottom) >> 1;
}
return m_hitTopLeft || hitBottomRight;