rebuild the nav cache on mouse clicks during page load
On the first tap down, send a message to rebuild the nav cache so that double taps have a better chance of having some alignment information to work with. Also, pass scale information to getBlockLeftEdge to restrict the alignment search
This commit is contained in:
@@ -3814,6 +3814,8 @@ public class WebView extends AbsoluteLayout
|
||||
} else {
|
||||
mTouchMode = TOUCH_INIT_MODE;
|
||||
mPreventDrag = mForwardTouchEvents;
|
||||
mWebViewCore.sendMessage(
|
||||
EventHub.UPDATE_FRAME_CACHE_IF_LOADING);
|
||||
if (mLogEvent && eventTime - mLastTouchUpTime < 1000) {
|
||||
EventLog.writeEvent(EVENT_LOG_DOUBLE_TAP_DURATION,
|
||||
(eventTime - mLastTouchUpTime), eventTime);
|
||||
@@ -4681,7 +4683,7 @@ public class WebView extends AbsoluteLayout
|
||||
// mLastTouchX and mLastTouchY are the point in the current viewport
|
||||
int contentX = viewToContent((int) mLastTouchX + mScrollX);
|
||||
int contentY = viewToContent((int) mLastTouchY + mScrollY);
|
||||
int left = nativeGetBlockLeftEdge(contentX, contentY);
|
||||
int left = nativeGetBlockLeftEdge(contentX, contentY, mActualScale);
|
||||
if (left != NO_LEFTEDGE) {
|
||||
// add a 5pt padding to the left edge. Re-calculate the zoom
|
||||
// center so that the new scroll x will be on the left edge.
|
||||
@@ -5656,5 +5658,5 @@ public class WebView extends AbsoluteLayout
|
||||
private native void nativeUpdatePluginReceivesEvents();
|
||||
// return NO_LEFTEDGE means failure.
|
||||
private static final int NO_LEFTEDGE = -1;
|
||||
private native int nativeGetBlockLeftEdge(int x, int y);
|
||||
private native int nativeGetBlockLeftEdge(int x, int y, float scale);
|
||||
}
|
||||
|
||||
@@ -648,6 +648,7 @@ final class WebViewCore {
|
||||
}
|
||||
|
||||
static final String[] HandlerDebugString = {
|
||||
"UPDATE_FRAME_CACHE_IF_LOADING", // = 98
|
||||
"SCROLL_TEXT_INPUT", // = 99
|
||||
"LOAD_URL", // = 100;
|
||||
"STOP_LOADING", // = 101;
|
||||
@@ -699,6 +700,7 @@ final class WebViewCore {
|
||||
|
||||
class EventHub {
|
||||
// Message Ids
|
||||
static final int UPDATE_FRAME_CACHE_IF_LOADING = 98;
|
||||
static final int SCROLL_TEXT_INPUT = 99;
|
||||
static final int LOAD_URL = 100;
|
||||
static final int STOP_LOADING = 101;
|
||||
@@ -805,10 +807,11 @@ final class WebViewCore {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
if (DebugFlags.WEB_VIEW_CORE) {
|
||||
Log.v(LOGTAG, (msg.what < SCROLL_TEXT_INPUT || msg.what
|
||||
Log.v(LOGTAG, (msg.what < UPDATE_FRAME_CACHE_IF_LOADING
|
||||
|| msg.what
|
||||
> FREE_MEMORY ? Integer.toString(msg.what)
|
||||
: HandlerDebugString[msg.what
|
||||
- SCROLL_TEXT_INPUT])
|
||||
- UPDATE_FRAME_CACHE_IF_LOADING])
|
||||
+ " arg1=" + msg.arg1 + " arg2=" + msg.arg2
|
||||
+ " obj=" + msg.obj);
|
||||
}
|
||||
@@ -825,6 +828,10 @@ final class WebViewCore {
|
||||
mNativeClass = 0;
|
||||
break;
|
||||
|
||||
case UPDATE_FRAME_CACHE_IF_LOADING:
|
||||
nativeUpdateFrameCacheIfLoading();
|
||||
break;
|
||||
|
||||
case SCROLL_TEXT_INPUT:
|
||||
nativeScrollFocusedTextInput(msg.arg1, msg.arg2);
|
||||
break;
|
||||
@@ -1938,6 +1945,8 @@ final class WebViewCore {
|
||||
WebView.CLEAR_TEXT_ENTRY).sendToTarget();
|
||||
}
|
||||
|
||||
private native void nativeUpdateFrameCacheIfLoading();
|
||||
|
||||
/**
|
||||
* Scroll the focused textfield to (x, y) in document space
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user