diff options
Diffstat (limited to 'Source/WebKit/android/nav/WebView.cpp')
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 0876db6..10f679d 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -420,7 +420,7 @@ void scrollRectOnScreen(const IntRect& rect) { if (rect.isEmpty()) return; - SkRect visible; + SkRect visible = SkRect::MakeEmpty(); calcOurContentVisibleRect(&visible); int dx = 0; int left = rect.x(); @@ -572,10 +572,6 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In unsigned int pic = m_glWebViewState->currentPictureCounter(); m_glWebViewState->glExtras()->setDrawExtra(extra); - LayerAndroid* compositeLayer = compositeRoot(); - if (compositeLayer) - compositeLayer->setExtra(0); - SkRect visibleRect; calcOurContentVisibleRect(&visibleRect); // Make sure we have valid coordinates. We might not have valid coords @@ -650,28 +646,27 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, int extras, bool split) default: ; } +#if USE(ACCELERATED_COMPOSITING) + LayerAndroid* compositeLayer = compositeRoot(); + if (compositeLayer) { + SkRect visible; + calcOurContentVisibleRect(&visible); + // call this to be sure we've adjusted for any scrolling or animations + // before we actually draw + compositeLayer->updateFixedLayersPositions(visible); + compositeLayer->updatePositions(); + // We have to set the canvas' matrix on the base layer + // (to have fixed layers work as intended) + SkAutoCanvasRestore restore(canvas, true); + m_baseLayer->setMatrix(canvas->getTotalMatrix()); + canvas->resetMatrix(); + m_baseLayer->draw(canvas); + } +#endif if (extra) { IntRect dummy; // inval area, unused for now extra->draw(canvas, &mainPicture, &dummy); } -#if USE(ACCELERATED_COMPOSITING) - LayerAndroid* compositeLayer = compositeRoot(); - if (!compositeLayer) - return ret; - compositeLayer->setExtra(extra); - SkRect visible; - calcOurContentVisibleRect(&visible); - // call this to be sure we've adjusted for any scrolling or animations - // before we actually draw - compositeLayer->updateFixedLayersPositions(visible); - compositeLayer->updatePositions(); - // We have to set the canvas' matrix on the base layer - // (to have fixed layers work as intended) - SkAutoCanvasRestore restore(canvas, true); - m_baseLayer->setMatrix(canvas->getTotalMatrix()); - canvas->resetMatrix(); - m_baseLayer->draw(canvas); -#endif return ret; } @@ -1557,7 +1552,12 @@ void setBaseLayer(BaseLayerAndroid* layer, SkRegion& inval, bool showVisualIndic void getTextSelectionRegion(SkRegion *region) { - m_selectText.getSelectionRegion(getVisibleRect(), region); + m_selectText.getSelectionRegion(getVisibleRect(), region, compositeRoot()); +} + +void getTextSelectionHandles(int* handles) +{ + m_selectText.getSelectionHandles(handles); } void replaceBaseContent(PictureSet* set) @@ -1989,12 +1989,22 @@ static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject inv registerPageSwapCallback); } -static void nativeGetTextSelectionRegion(JNIEnv *env, jobject obj, jobject region) +static void nativeGetTextSelectionRegion(JNIEnv *env, jobject obj, jint view, + jobject region) { if (!region) return; SkRegion* nregion = GraphicsJNI::getNativeRegion(env, region); - GET_NATIVE_VIEW(env, obj)->getTextSelectionRegion(nregion); + ((WebView*)view)->getTextSelectionRegion(nregion); +} + +static void nativeGetSelectionHandles(JNIEnv *env, jobject obj, jint view, + jintArray arr) +{ + int handles[4]; + ((WebView*)view)->getTextSelectionHandles(handles); + env->SetIntArrayRegion(arr, 0, 4, handles); + checkException(env); } static BaseLayerAndroid* nativeGetBaseLayer(JNIEnv *env, jobject obj) @@ -2902,8 +2912,10 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeSetHeightCanMeasure }, { "nativeSetBaseLayer", "(ILandroid/graphics/Region;ZZZ)V", (void*) nativeSetBaseLayer }, - { "nativeGetTextSelectionRegion", "(Landroid/graphics/Region;)V", + { "nativeGetTextSelectionRegion", "(ILandroid/graphics/Region;)V", (void*) nativeGetTextSelectionRegion }, + { "nativeGetSelectionHandles", "(I[I)V", + (void*) nativeGetSelectionHandles }, { "nativeGetBaseLayer", "()I", (void*) nativeGetBaseLayer }, { "nativeReplaceBaseContent", "(I)V", |