summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/WebView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/nav/WebView.cpp')
-rw-r--r--WebKit/android/nav/WebView.cpp59
1 files changed, 30 insertions, 29 deletions
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 38d0ccb..4031439 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -148,7 +148,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl) :
m_javaGlue.m_overrideLoading = GetJMethod(env, clazz, "overrideLoading", "(Ljava/lang/String;)V");
m_javaGlue.m_sendMoveFocus = GetJMethod(env, clazz, "sendMoveFocus", "(II)V");
m_javaGlue.m_sendMoveMouse = GetJMethod(env, clazz, "sendMoveMouse", "(IIII)V");
- m_javaGlue.m_sendMoveMouseIfLatest = GetJMethod(env, clazz, "sendMoveMouseIfLatest", "(Z)V");
+ m_javaGlue.m_sendMoveMouseIfLatest = GetJMethod(env, clazz, "sendMoveMouseIfLatest", "(ZZ)V");
m_javaGlue.m_sendMotionUp = GetJMethod(env, clazz, "sendMotionUp", "(IIIII)V");
m_javaGlue.m_domChangedFocus = GetJMethod(env, clazz, "domChangedFocus", "()V");
m_javaGlue.m_getScaledMaxXScroll = GetJMethod(env, clazz, "getScaledMaxXScroll", "()I");
@@ -210,7 +210,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl) :
#endif
delete m_frameCacheUI;
delete m_navPictureUI;
- m_baseLayer->safeUnref();
+ SkSafeUnref(m_baseLayer);
delete m_glDrawFunctor;
}
@@ -303,10 +303,8 @@ void nativeRecordButtons(bool hasFocus, bool pressed, bool invalidate)
if (hasFocus) {
if (pressed || m_ring.m_isPressed)
state = RenderSkinAndroid::kPressed;
- else if (SkTime::GetMSecs() < m_ringAnimationEnd
- && m_ringAnimationEnd != UINT_MAX) {
+ else if (SkTime::GetMSecs() < m_ringAnimationEnd)
state = RenderSkinAndroid::kFocused;
- }
}
}
ptr->updateFocusState(state);
@@ -390,6 +388,7 @@ bool drawCursorPreamble(CachedRoot* root)
resetCursorRing();
return false;
}
+ m_ring.setIsButton(node);
if (node->isHidden()) {
DBG_NAV_LOG("node->isHidden()");
m_viewImpl->m_hasCursorBounds = false;
@@ -439,7 +438,7 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
m_glWebViewState = new GLWebViewState(&m_viewImpl->gButtonMutex);
if (m_baseLayer->content()) {
IntRect rect(0, 0, m_baseLayer->content()->width(), m_baseLayer->content()->height());
- m_glWebViewState->setBaseLayer(m_baseLayer, rect);
+ m_glWebViewState->setBaseLayer(m_baseLayer, rect, false);
}
}
@@ -473,6 +472,7 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
SkPicture picture;
IntRect rect(0, 0, 0, 0);
+ bool allowSame = false;
if (extra) {
LayerAndroid mainPicture(m_navPictureUI);
PictureSet* content = m_baseLayer->content();
@@ -480,8 +480,15 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
content->height());
extra->draw(canvas, &mainPicture, &rect);
picture.endRecording();
+ } else if (extras == DrawExtrasCursorRing && m_ring.m_isButton) {
+ const CachedFrame* cachedFrame;
+ const CachedNode* cachedCursor = root->currentCursor(&cachedFrame);
+ if (cachedCursor) {
+ rect = cachedCursor->bounds(cachedFrame);
+ allowSame = true;
+ }
}
- m_glWebViewState->setExtra(m_baseLayer, picture, rect);
+ m_glWebViewState->setExtra(m_baseLayer, picture, rect, allowSame);
LayerAndroid* compositeLayer = compositeRoot();
if (compositeLayer)
@@ -489,12 +496,7 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
SkRect visibleRect;
calcOurContentVisibleRect(&visibleRect);
-
- m_viewImpl->setVisibleScreenWidth(visibleRect.width());
- m_viewImpl->setVisibleScreenHeight(visibleRect.height());
-
bool ret = m_glWebViewState->drawGL(viewRect, visibleRect, scale);
-
if (ret || m_glWebViewState->currentPictureCounter() != pic)
return true;
#endif
@@ -556,8 +558,6 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, int extras, bool split)
compositeLayer->setExtra(extra);
SkRect visible;
calcOurContentVisibleRect(&visible);
- m_viewImpl->setVisibleScreenWidth(visible.width());
- m_viewImpl->setVisibleScreenHeight(visible.height());
// call this to be sure we've adjusted for any scrolling or animations
// before we actually draw
compositeLayer->updateFixedLayersPositions(visible);
@@ -686,7 +686,7 @@ CachedRoot* getFrameCache(FrameCachePermission allowNewer)
}
m_viewImpl->gFrameCacheMutex.lock();
delete m_frameCacheUI;
- m_navPictureUI->safeUnref();
+ SkSafeUnref(m_navPictureUI);
m_viewImpl->m_updatedFrameCache = false;
m_frameCacheUI = m_viewImpl->m_frameCacheKit;
m_navPictureUI = m_viewImpl->m_navPictureKit;
@@ -866,7 +866,9 @@ bool moveCursor(int keyCode, int count, bool ignoreScroll)
const CachedNode* focus = root->currentFocus();
bool clearTextEntry = cachedNode != focus && focus
&& cachedNode->nodePointer() != focus->nodePointer() && focus->isTextInput();
- sendMoveMouseIfLatest(clearTextEntry);
+ // Stop painting the caret if the old focus was a text input and so is the new cursor.
+ bool stopPaintingCaret = clearTextEntry && cachedNode->wantsKeyEvents();
+ sendMoveMouseIfLatest(clearTextEntry, stopPaintingCaret);
} else {
int docHeight = root->documentHeight();
int docWidth = root->documentWidth();
@@ -936,13 +938,13 @@ void selectBestAt(const WebCore::IntRect& rect)
} else {
DBG_NAV_LOGD("CachedNode:%p (%d)", node, node->index());
WebCore::IntRect bounds = node->bounds(frame);
- root->rootHistory()->setMouseBounds(frame->unadjustBounds(node, bounds));
+ root->rootHistory()->setMouseBounds(bounds);
m_viewImpl->updateCursorBounds(root, frame, node);
showCursorTimed();
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(node));
}
- sendMoveMouseIfLatest(false);
+ sendMoveMouseIfLatest(false, false);
if (!node)
return;
}
@@ -988,8 +990,6 @@ bool motionUp(int x, int y, int slop)
}
DBG_NAV_LOGD("CachedNode:%p (%d) x=%d y=%d rx=%d ry=%d", result,
result->index(), x, y, rx, ry);
- // No need to call unadjustBounds below. rx and ry are already adjusted to
- // the absolute position of the node.
WebCore::IntRect navBounds = WebCore::IntRect(rx, ry, 1, 1);
history->setNavBounds(navBounds);
history->setMouseBounds(navBounds);
@@ -1210,12 +1210,12 @@ void sendMoveMouse(WebCore::Frame* framePtr, WebCore::Node* nodePtr, int x, int
checkException(env);
}
-void sendMoveMouseIfLatest(bool clearTextEntry)
+void sendMoveMouseIfLatest(bool clearTextEntry, bool stopPaintingCaret)
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(),
- m_javaGlue.m_sendMoveMouseIfLatest, clearTextEntry);
+ m_javaGlue.m_sendMoveMouseIfLatest, clearTextEntry, stopPaintingCaret);
checkException(env);
}
@@ -1383,11 +1383,11 @@ static void copyScrollPositionRecursive(const LayerAndroid* from,
}
#endif
-void setBaseLayer(BaseLayerAndroid* layer, WebCore::IntRect& rect)
+void setBaseLayer(BaseLayerAndroid* layer, WebCore::IntRect& rect, bool showVisualIndicator)
{
#if USE(ACCELERATED_COMPOSITING)
if (m_glWebViewState)
- m_glWebViewState->setBaseLayer(layer, rect);
+ m_glWebViewState->setBaseLayer(layer, rect, showVisualIndicator);
#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
@@ -1396,7 +1396,7 @@ void setBaseLayer(BaseLayerAndroid* layer, WebCore::IntRect& rect)
copyScrollPositionRecursive(compositeRoot(), newCompositeRoot);
}
#endif
- m_baseLayer->safeUnref();
+ SkSafeUnref(m_baseLayer);
m_baseLayer = layer;
CachedRoot* root = getFrameCache(DontAllowNewer);
if (!root)
@@ -1770,11 +1770,12 @@ static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj)
return false;
}
-static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject jrect)
+static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject jrect,
+ jboolean showVisualIndicator)
{
BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(layer);
WebCore::IntRect rect = jrect_to_webrect(env, jrect);
- GET_NATIVE_VIEW(env, obj)->setBaseLayer(layerImpl, rect);
+ GET_NATIVE_VIEW(env, obj)->setBaseLayer(layerImpl, rect, showVisualIndicator);
}
static void nativeReplaceBaseContent(JNIEnv *env, jobject obj, jint content)
@@ -2239,7 +2240,7 @@ static bool nativeMoveCursorToNextTextInput(JNIEnv *env, jobject obj)
if (!next)
return false;
const WebCore::IntRect& bounds = next->bounds(frame);
- root->rootHistory()->setMouseBounds(frame->unadjustBounds(next, bounds));
+ root->rootHistory()->setMouseBounds(bounds);
view->getWebViewCore()->updateCursorBounds(root, frame, next);
view->showCursorUntimed();
root->setCursor(const_cast<CachedFrame*>(frame),
@@ -2566,7 +2567,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetFindIsUp },
{ "nativeSetHeightCanMeasure", "(Z)V",
(void*) nativeSetHeightCanMeasure },
- { "nativeSetBaseLayer", "(ILandroid/graphics/Rect;)V",
+ { "nativeSetBaseLayer", "(ILandroid/graphics/Rect;Z)V",
(void*) nativeSetBaseLayer },
{ "nativeReplaceBaseContent", "(I)V",
(void*) nativeReplaceBaseContent },