Merge "Send animation start notification back to webkit from ui thread" into ics-mr1

This commit is contained in:
Chris Craik
2011-11-29 16:55:47 -08:00
committed by Android (Google) Code Review
3 changed files with 23 additions and 8 deletions

View File

@@ -4604,14 +4604,15 @@ public class WebView extends AbsoluteLayout
boolean UIAnimationsRunning = false;
// Currently for each draw we compute the animation values;
// We may in the future decide to do that independently.
if (mNativeClass != 0 && nativeEvaluateLayersAnimations(mNativeClass)) {
if (mNativeClass != 0 && !canvas.isHardwareAccelerated()
&& nativeEvaluateLayersAnimations(mNativeClass)) {
UIAnimationsRunning = true;
// If we have unfinished (or unstarted) animations,
// we ask for a repaint. We only need to do this in software
// rendering (with hardware rendering we already have a different
// method of requesting a repaint)
if (!canvas.isHardwareAccelerated())
invalidate();
mWebViewCore.sendMessage(EventHub.NOTIFY_ANIMATION_STARTED);
invalidate();
}
// decide which adornments to draw
@@ -8796,10 +8797,13 @@ public class WebView extends AbsoluteLayout
/** @hide Called by JNI when pages are swapped (only occurs with hardware
* acceleration) */
protected void pageSwapCallback() {
protected void pageSwapCallback(boolean notifyAnimationStarted) {
if (inEditingMode()) {
didUpdateWebTextViewDimensions(ANYWHERE);
}
if (notifyAnimationStarted) {
mWebViewCore.sendMessage(EventHub.NOTIFY_ANIMATION_STARTED);
}
}
void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {

View File

@@ -519,7 +519,12 @@ public final class WebViewCore {
/**
* Update the layers' content
*/
private native boolean nativeUpdateLayers(int baseLayer);
private native boolean nativeUpdateLayers(int nativeClass, int baseLayer);
/**
* Notify webkit that animations have begun (on the hardware accelerated content)
*/
private native void nativeNotifyAnimationStarted(int nativeClass);
private native boolean nativeFocusBoundsChanged();
@@ -1035,6 +1040,8 @@ public final class WebViewCore {
static final int PLUGIN_SURFACE_READY = 195;
static final int NOTIFY_ANIMATION_STARTED = 196;
// private message ids
private static final int DESTROY = 200;
@@ -1594,6 +1601,10 @@ public final class WebViewCore {
nativePluginSurfaceReady();
break;
case NOTIFY_ANIMATION_STARTED:
nativeNotifyAnimationStarted(mNativeClass);
break;
case ADD_PACKAGE_NAMES:
if (BrowserFrame.sJavaBridge == null) {
throw new IllegalStateException("No WebView " +
@@ -2015,7 +2026,7 @@ public final class WebViewCore {
return;
}
// Directly update the layers we last passed to the UI side
if (nativeUpdateLayers(mLastDrawData.mBaseLayer)) {
if (nativeUpdateLayers(mNativeClass, mLastDrawData.mBaseLayer)) {
// If anything more complex than position has been touched, let's do a full draw
webkitDraw();
}

View File

@@ -110,9 +110,9 @@ public class ProfiledWebView extends WebView {
* been redrawn.
*/
@Override
protected void pageSwapCallback() {
protected void pageSwapCallback(boolean startAnim) {
mContentInvalMillis = System.currentTimeMillis() - mContentInvalMillis;
super.pageSwapCallback();
super.pageSwapCallback(startAnim);
Log.d("ProfiledWebView", "REDRAW TOOK " + mContentInvalMillis
+ "millis");
mIsTesting = true;