From 227036b82bdfa36081554674f004b31a065fbf27 Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Tue, 24 Apr 2012 16:53:41 -0700 Subject: [PATCH] The visiblerect calculation should take view's scaling into consideration webkit change: https://android-git.corp.google.com/g/#/c/183080/ bug:5684832 Change-Id: Icac236cb4ff837ee4ba21cf1613da47b56cc3732 --- core/java/android/webkit/WebViewClassic.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java index 3bd9960a6359a..0f8c2d1292f32 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -3243,14 +3243,14 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc // the scale factor is not 1) private void calcOurContentVisibleRectF(RectF r) { calcOurVisibleRect(mContentVisibleRect); - r.left = viewToContentXf(mContentVisibleRect.left); + r.left = viewToContentXf(mContentVisibleRect.left) / mWebView.getScaleX(); // viewToContentY will remove the total height of the title bar. Add // the visible height back in to account for the fact that if the title // bar is partially visible, the part of the visible rect which is // displaying our content is displaced by that amount. - r.top = viewToContentYf(mContentVisibleRect.top + getVisibleTitleHeightImpl()); - r.right = viewToContentXf(mContentVisibleRect.right); - r.bottom = viewToContentYf(mContentVisibleRect.bottom); + r.top = viewToContentYf(mContentVisibleRect.top + getVisibleTitleHeightImpl()) / mWebView.getScaleY(); + r.right = viewToContentXf(mContentVisibleRect.right) / mWebView.getScaleX(); + r.bottom = viewToContentYf(mContentVisibleRect.bottom) / mWebView.getScaleY(); } static class ViewSizeData {