summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authorboliu <boliu@chromium.org>2016-01-22 12:52:18 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-22 20:54:39 +0000
commit514375f942b65d8a0bb513f82c96607e64b754d8 (patch)
tree678b693afbb5a04bae53619701bc839769d2c935 /android_webview
parente6834c6873a44c4757ac279eedcd8f63eaa49e08 (diff)
downloadchromium_src-514375f942b65d8a0bb513f82c96607e64b754d8.zip
chromium_src-514375f942b65d8a0bb513f82c96607e64b754d8.tar.gz
chromium_src-514375f942b65d8a0bb513f82c96607e64b754d8.tar.bz2
aw: Update canvas translate after draw
This is a follow up to r370808. After r370808, the result of ComputeScroll will be reflected on UI thread at the end of draw, so is not reflected in the transform in the canvas passed to onDraw. Webview rendering code is designed to handle this case. However anything drawn after webview will be using the incorrect translate. This includes webview's children, and the default scroll bar. The fix for this is to simply update the translate of the canvas with the new scroll offset. BUG=545633 Review URL: https://codereview.chromium.org/1621793002 Cr-Commit-Position: refs/heads/master@{#371030}
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwContents.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 9140cd4..26980b9 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -2903,16 +2903,20 @@ public class AwContents implements SmartClipProvider,
}
mScrollOffsetManager.syncScrollOffsetFromOnDraw();
+ int scrollX = mContainerView.getScrollX();
+ int scrollY = mContainerView.getScrollY();
Rect globalVisibleRect = getGlobalVisibleRect();
- boolean did_draw = nativeOnDraw(
- mNativeAwContents, canvas, canvas.isHardwareAccelerated(),
- mContainerView.getScrollX(), mContainerView.getScrollY(),
- globalVisibleRect.left, globalVisibleRect.top,
- globalVisibleRect.right, globalVisibleRect.bottom);
+ boolean did_draw = nativeOnDraw(mNativeAwContents, canvas,
+ canvas.isHardwareAccelerated(), scrollX, scrollY, globalVisibleRect.left,
+ globalVisibleRect.top, globalVisibleRect.right, globalVisibleRect.bottom);
if (did_draw && canvas.isHardwareAccelerated() && !FORCE_AUXILIARY_BITMAP_RENDERING) {
did_draw = mNativeGLDelegate.requestDrawGL(canvas, false, mContainerView);
}
- if (!did_draw) {
+ if (did_draw) {
+ int scrollXDiff = mContainerView.getScrollX() - scrollX;
+ int scrollYDiff = mContainerView.getScrollY() - scrollY;
+ canvas.translate(-scrollXDiff, -scrollYDiff);
+ } else {
TraceEvent.instant("NativeDrawFailed");
canvas.drawColor(getEffectiveBackgroundColor());
}