File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed
Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -643,10 +643,10 @@ public boolean getLoadWithOverviewMode() {
643643
644644 /**
645645 * Set whether the WebView will enable smooth transition while panning or
646- * zooming. If it is true, WebView will choose a solution to maximize the
647- * performance. e.g. the WebView's content may not be updated during the
648- * transition. If it is false, WebView will keep its fidelity. The default
649- * value is false.
646+ * zooming or while the window hosting the WebView does not have focus.
647+ * If it is true, WebView will choose a solution to maximize the performance.
648+ * e.g. the WebView's content may not be updated during the transition.
649+ * If it is false, WebView will keep its fidelity. The default value is false.
650650 */
651651 public void setEnableSmoothTransition (boolean enable ) {
652652 mEnableSmoothTransition = enable ;
Original file line number Diff line number Diff line change @@ -908,6 +908,9 @@ public void onTrimMemory(int level) {
908908 // used for serializing asynchronously handled touch events.
909909 private final TouchEventQueue mTouchEventQueue = new TouchEventQueue ();
910910
911+ // Used to track whether picture updating was paused due to a window focus change.
912+ private boolean mPictureUpdatePausedForFocusChange = false ;
913+
911914 // Used to notify listeners of a new picture.
912915 private PictureListener mPictureListener ;
913916 /**
@@ -5570,8 +5573,20 @@ public void onWindowFocusChanged(boolean hasWindowFocus) {
55705573 setActive (hasWindowFocus );
55715574 if (hasWindowFocus ) {
55725575 JWebCoreJavaBridge .setActiveWebView (this );
5576+ if (mPictureUpdatePausedForFocusChange ) {
5577+ WebViewCore .resumeUpdatePicture (mWebViewCore );
5578+ nativeSetIsScrolling (false );
5579+ mPictureUpdatePausedForFocusChange = false ;
5580+ }
55735581 } else {
55745582 JWebCoreJavaBridge .removeActiveWebView (this );
5583+ final WebSettings settings = getSettings ();
5584+ if (settings != null && settings .enableSmoothTransition () &&
5585+ mWebViewCore != null && !WebViewCore .isUpdatePicturePaused (mWebViewCore )) {
5586+ WebViewCore .pauseUpdatePicture (mWebViewCore );
5587+ nativeSetIsScrolling (true );
5588+ mPictureUpdatePausedForFocusChange = true ;
5589+ }
55755590 }
55765591 super .onWindowFocusChanged (hasWindowFocus );
55775592 }
Original file line number Diff line number Diff line change @@ -2107,6 +2107,10 @@ static void resumeUpdatePicture(WebViewCore core) {
21072107 }
21082108 }
21092109
2110+ static boolean isUpdatePicturePaused (WebViewCore core ) {
2111+ return core != null ? core .mDrawIsPaused : false ;
2112+ }
2113+
21102114 //////////////////////////////////////////////////////////////////////////
21112115
21122116 private void restoreState (int index ) {
You can’t perform that action at this time.
0 commit comments