diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java index 04fee5d52e851a..f5cbcaa64db9c2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java @@ -181,7 +181,12 @@ boolean toggleMaximize(boolean animate) { } else { start = windowLayout.width; end = mIsMaximized ? displayWidth : clampedInitialWidth; - updateListener = (anim) -> setWindowWidth((int) anim.getAnimatedValue()); + View content = (ViewGroup) mActivity.findViewById(R.id.compositor_view_holder); + updateListener = (anim) -> { + // Switch the invisibility type to GONE to prevent sluggish resizing artifacts. + if (content.getVisibility() != View.GONE) content.setVisibility(View.GONE); + setWindowWidth((int) anim.getAnimatedValue()); + }; } // Keep the WebContents invisible during the animation to hide the jerky visual artifacts // of the contents due to resizing. @@ -203,6 +208,7 @@ private void setContentVisible(boolean visible) { } private void onMaximizeEnd() { + setContentVisible(false); if (isMaximized()) { if (mSheetOnRight) { configureLayoutBeyondScreen(false);