From 1d70e97f3d54028c07d71411bbba2fce5bccf812 Mon Sep 17 00:00:00 2001 From: Jinsuk Kim Date: Mon, 12 Jun 2023 22:48:34 +0000 Subject: [PATCH] [Pcct-SideSheet] Get rid of flashing glitch in maximization A regression due to the content visibility control using View.GONE caused flashing glitch at the beginning/end of maximization. This CL mitigates that. The content becomes hidden with View.INVISIBLE but View.GONE is inserted during the animation. This can both prevent the sluggish resizing and hide the flash. (cherry picked from commit 420ef910e760bcc62b0e713ff88f5130b854ea88) Bug: 1451233 Change-Id: I076230554f598396ffa7cde90594f0e99c3b33a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4598627 Reviewed-by: Kevin Grosu Code-Coverage: Findit Commit-Queue: Jinsuk Kim Cr-Original-Commit-Position: refs/heads/main@{#1154468} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4608523 Cr-Commit-Position: refs/branch-heads/5790@{#656} Cr-Branched-From: 1d71a337b1f6e707a13ae074dca1e2c34905eb9f-refs/heads/main@{#1148114} --- .../PartialCustomTabSideSheetStrategy.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 04fee5d52e851..f5cbcaa64db9c 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);