OSDN Git Service

adjust right edge of copy bounds if edge is not found
authorCary Clark <cary@android.com>
Tue, 21 Jul 2009 20:42:59 +0000 (16:42 -0400)
committerCary Clark <cary@android.com>
Tue, 21 Jul 2009 20:42:59 +0000 (16:42 -0400)
Sometimes the right edge of the copy rectangle misses the
right-most character to be copied. An earlier change over-
compensated by moving the edge boundary by 2. Now, move
the edge boundary by 1, and if that fails, try 2.

WebKit/android/jni/WebViewCore.cpp

index 40dc56d..f1cb3fa 100644 (file)
@@ -1352,11 +1352,17 @@ WebCore::String WebViewCore::getSelection(SkRegion* selRgn)
             DBG_NAV_LOG("!node");
             return result;
         }
-        WebCore::IntPoint endPt = WebCore::IntPoint(rect.fRight - 2, cy);
+        WebCore::IntPoint endPt = WebCore::IntPoint(rect.fRight - 1, cy);
         hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(endPt, false);
         WebCore::Node* endNode = hitTestResult.innerNode();
         if (!endNode) {
-            DBG_NAV_LOG("!endNode");
+            DBG_NAV_LOG("!endNode (right-1)");
+            endPt = WebCore::IntPoint(rect.fRight - 2, cy);
+            hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(endPt, false);
+            endNode = hitTestResult.innerNode();
+        }
+        if (!endNode) {
+            DBG_NAV_LOG("!endNode (right-2)");
             return result;
         }
         int start = findTextBoxIndex(node, startPt);