diff options
author | George Mount <mount@google.com> | 2012-06-05 09:19:21 -0700 |
---|---|---|
committer | George Mount <mount@google.com> | 2012-06-07 16:03:49 -0700 |
commit | 40369ea6114f406fef50d4241335dd8613372748 (patch) | |
tree | ab9cfafa46aa94c92f638b010d3cd264768cfb18 /Source/WebKit/android | |
parent | 523a7935e27e963c733375675e8f29d64008cac3 (diff) | |
download | external_webkit-40369ea6114f406fef50d4241335dd8613372748.zip external_webkit-40369ea6114f406fef50d4241335dd8613372748.tar.gz external_webkit-40369ea6114f406fef50d4241335dd8613372748.tar.bz2 |
Add layer clip check to hide handles when not visible.
Bug 6590742
Change-Id: Idd1ad305989ab8137597f86b4a6463e052c08a9e
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 5e2354b..9cbdca5 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -740,6 +740,20 @@ bool isHandleLeft(SelectText::HandleId handleId) return (selectText->getHandleType(handleId) == SelectText::LeftHandle); } +bool isPointVisible(int layerId, int contentX, int contentY) +{ + bool isVisible = true; + const TransformationMatrix* transform = getLayerTransform(layerId); + if (transform) { + // layer is guaranteed to be non-NULL because of getLayerTransform + LayerAndroid* layer = m_baseLayer->findById(layerId); + IntRect rect = layer->visibleContentArea(); + rect = transform->mapRect(rect); + isVisible = rect.contains(contentX, contentY); + } + return isVisible; +} + private: // local state for WebView bool m_isDrawingPaused; // private to getFrameCache(); other functions operate in a different thread @@ -1303,6 +1317,13 @@ static bool nativeIsHandleLeft(JNIEnv *env, jobject obj, jint nativeView, return webview->isHandleLeft(static_cast<SelectText::HandleId>(handleId)); } +static bool nativeIsPointVisible(JNIEnv *env, jobject obj, jint nativeView, + jint layerId, jint contentX, jint contentY) +{ + WebView* webview = reinterpret_cast<WebView*>(nativeView); + return webview->isPointVisible(layerId, contentX, contentY); +} + /* * JNI registration */ @@ -1383,6 +1404,8 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeFindMaxVisibleRect }, { "nativeIsHandleLeft", "(II)Z", (void*) nativeIsHandleLeft }, + { "nativeIsPointVisible", "(IIII)Z", + (void*) nativeIsPointVisible }, }; int registerWebView(JNIEnv* env) |