0
Commit Graph

94 Commits

Author SHA1 Message Date
William Liu
6f13c2ba06 [DNT] Reorder tests
Put all the BackForwardTransitionAnimationManagerBrowserTest together.

Bug: 331710055
Change-Id: I968ec7b564345b0a00559a6b10c9fd4235db11a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5846069
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1352915}
2024-09-09 19:32:36 +00:00
Baran Erfani
09614c197b Added a metric to record animation abort reasons
This metric is recorded in an enum histogram once per gesture.
The enum values correspond to reason/state of the current navigation and
any other existing navigation in the background.

Bug: 349815498
Change-Id: I7f06609dd574492b997a1f572a844c3f6b7f91d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5833108
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: Baran Erfani <baranerf@google.com>
Cr-Commit-Position: refs/heads/main@{#1352095}
2024-09-06 16:36:39 +00:00
Avi Drissman
f72e86b427 Use an opaque type for FrameTreeNode IDs, part 12
content_browser_client

Bug: 361344235
Change-Id: Ib65d872e91d3ee8db24f2ba0f1768d348540e44e
Include-Ci-Only-Tests: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5836564
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Charlie Reis <creis@chromium.org>
Owners-Override: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1351740}
2024-09-05 22:10:28 +00:00
Baran Erfani
ffb8f4c35d Added IgnoreInputCount UMA metric - Implementation
This metric counts the number of times that an input with type
WebInputEvent::Type::kTouchStart is ignored while the animator is
processing/animating (in animation invoked and canceled cases).

Implementation logic diagram: https://drive.google.com/file/d/1Wsyqv0hg64wJBPJgoUlesrmEGSCygyFL/view?usp=sharing

Note: This CL includes the implementation of `MaybeRecordIgnoredInput` in addition to histogram definition.

Bug: 331778097
Change-Id: I70118978006f24f4b02c39adbb53a5dc6b032dee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5807671
Commit-Queue: Baran Erfani <baranerf@google.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Luc Nguyen <lucnguyen@google.com>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1350294}
2024-09-03 18:20:53 +00:00
Baran Erfani
de163bd84c Added IgnoreInputCount UMA metric - Plumbing
This metric counts the number of times that an input with type
WebInputEvent::Type::kTouchStart is ignored while the animator is
processing/animating (in animation invoked and canceled cases).

Note: This CL only has the plumbing part to get the input event.
The subsequent CL will include the implementation of `MaybeRecordIgnoredInput`.

Bug: 331778097
Change-Id: Ieffeae77422c0add24a4f3a1a8738d26acd3db7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5783845
Commit-Queue: Baran Erfani <baranerf@google.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1347017}
2024-08-26 22:26:27 +00:00
William Liu
efd118031e [DNT] Use the favicon for fallback UX
Fixed: 40260440
Change-Id: I040c68c8a5d550c5463da7c9f4e3be75384723a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5786956
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1346962}
2024-08-26 21:10:01 +00:00
Khushal Sagar
9a64b45458 content: Fix layer tree for navigations from native pages
We were not removing the embedder live content when the invoke animation
is done. Fix that.

Fixed: 361824219
Change-Id: Ic54af1a0b61c87be39261ca73b82e410a1e98bde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5806611
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1346922}
2024-08-26 19:58:37 +00:00
Khushal Sagar
90ee3332a6 content: Fix has ua visual transition api for navigation transitions
We currently miss plumbing this bit to the renderer since it's set on
the navigation request after the commit message is already sent. Fix
that timing and update the browser test to include the complete flow.

Bug: 331671779
Change-Id: I857dbe903e746945e5e5c06146bc0c83c8ade0f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5804907
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1345671}
2024-08-22 21:41:26 +00:00
William Liu
e56dd5637e [DNT] Add a timer to dismiss the stale screenshot
We might have a screenshot stay on top of the live page, after the
navigation commits, if the new renderer does not produce a frame (e.g.,
a very busy renderer main thread).

While this should be very rare, we still need a grace failsafe. In this
CL we simply remove the screenshot and terminate the animator (skipping
the crossfade) if the new renderer fails to produce a new frame after
four seconds

Fixed: 360844863
Change-Id: I404e8adefc3899d5cc21f8a514815744b6f0a68e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5797899
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1345579}
2024-08-22 19:06:22 +00:00
William Liu
521264c920 [DNT] Disable paint holding for transition
In order to implement a timer for navigation transition, we should
disable the paint holding timer. We don't want to let the navigation
transition timer fire so we crossfade from the screenshot of the
current page to the fallback surface of the previous page, and then let
the paint holding timer fire to dismiss the fallback surface, if the
new renderer doesn't produce a frame in time.

In other words we "upgrade" from the paint holding timer to the
navigation transition timer, if a history navigation is being animated.

Another alternative is to purposefully give the navigation transition
timer a longer duration, so it always fires after paint holding. Didn't
implement that approach because I didn't want this feature to be
dependent on paint holding.

Bug: 360844863
Change-Id: Ieaa95359dd3cd3418e7d739f9b747a22b2bc5082
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5797563
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1344896}
2024-08-21 17:25:03 +00:00
William Liu
9732ef0660 [DNT] Reorder APIs
The definitions should be in the same ordering as their declarations

Change-Id: Id68e178138ef129924ccbb26c84331b733515062
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5797948
Reviewed-by: Adithya Srinivasan <adithyas@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1344174}
2024-08-20 15:57:31 +00:00
Lijin Shen
c8213df694 [dnt] Animate native view bitmap when swiping away from NTP
This CL adds a embedder_live_content_clone_ to show the native view
bitmap when swiping away from NTP. It will also replace
old_surface_clone_ when necessary.

Screenrecord: http://screencast/cast/NTY3MjQyNzkxMTY0MzEzNnwwZjQ5Y2QyZS1iNA

Bug: 331780926
Change-Id: I28aafc87993b6c5602673d16a11ec0700f96b54a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5774588
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Jinsuk Kim <jinsukkim@chromium.org>
Commit-Queue: Lijin Shen <lazzzis@google.com>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1343766}
2024-08-19 21:26:15 +00:00
David Bokan
425b95dd4c dnt: Implement forward transitions
Adds animation for forward transitions in 3-button mode behind a
feature flag.

Bug: 331778101
Change-Id: Ib01b57686e4c66c11df41dd5109e84d7c1fe200a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5774162
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1342346}
2024-08-15 17:39:10 +00:00
Peter Boström
01ab59ae08 Migrate NOTREACHED_NORETURN -> NOTREACHED
NOTREACHED() has turned [[noreturn]] so the former macro isn't needed
anymore.

This does not attempt to do a rewrite of any surrounding code, like:

if (!foo) {
  NOTREACHED();
}

to CHECK(foo);

Those transforms take a non-trivial amount of time (and there are
thousands of instances). Cleanup can be left as an exercise for the
reader.

NO_IFTTT=No-op-rename migration.

Bug: 40580068
Change-Id: I068c5fdce9dc4c352d8bdd62bb3cd2c0a2d59659
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5782602
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1342096}
2024-08-15 02:39:49 +00:00
David Bokan
e8ff29ad90 Reapply "dnt: DAMPen BackForwardTransitionAnimationManager tests"
This relands commit 2931e7e8b0 which
was reverted in commit 4822abbbc7

Original CL in first uploaded patchset, diff from PS1 for changes.

The test would fail if the RFH is reused so the last render frame
metadata has a valid sequence number but not the one that's being
waited on.

Bug: 331778101
Change-Id: Ib57b8f07aa0063c334169cb3da4dd54ec995378b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5784917
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1341704}
2024-08-14 16:07:46 +00:00
luci-bisection@appspot.gserviceaccount.com
4822abbbc7 Revert "dnt: DAMPen BackForwardTransitionAnimationManager tests"
This reverts commit 2931e7e8b0.

Reason for revert:
LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5665833071149056

Sample build with failed test: https://ci.chromium.org/b/8739653698726948305
Affected test(s):
[ninja://content/test:content_browsertests/BackForwardTransitionAnimationManagerBrowserTest.NavigatingFromACrashedPage](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FBackForwardTransitionAnimationManagerBrowserTest.NavigatingFromACrashedPage?q=VHash%3A25e0d04bad413a2d)

If this is a false positive, please report it at http://b.corp.google.com/createIssue?component=1199205&description=Analysis%3A+https%3A%2F%2Fci.chromium.org%2Fui%2Fp%2Fchromium%2Fbisection%2Ftest-analysis%2Fb%2F5665833071149056&format=PLAIN&priority=P3&title=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F5780030&type=BUG

Original change's description:
> dnt: DAMPen BackForwardTransitionAnimationManager tests
>
> These tests currently perform most assertions/expectations within the
> test harness rather than in the test body. Failing assertions outside
> the test body don't cause the test to stop and require looking at the
> stacktrace to understand where in a test the failure is coming from.
> Android stacks are often incomplete on bots which makes tests difficult
> to debug.
>
> This mega CL (sorry) removes almost all of the harness asserting logic
> and places the checks in test bodies. New tests are added to
> preserve coverage where needed. High level changes:
>
>  * Replaced all the transform checks (ExpectedLayerTransforms) with
>    explicit checks in tests.
>  * Exposed layers to tests explicitly, rather than relying on indexes.
>  * Exposed animator state to tests and check it inline in test body.
>  * Replaced most uses of callback with TestFuture and other minor
>    cleanups.
>
>  The aim is for tests to be Descriptive And Meaningful Phrases
>  (DAMP[1]), even at the cost of some repetition. Having checks inside
>  the harness is:
>
>  * Difficult to tell what each individual test is actually checking for.
>  * Each test effectively tests _everything_ so a single defect can cause
>    many test failures and extremely verbose logs.
>  * Adding new functionality (e.g. RTL, Forward nav) means logic inside
>    the harness gets more complex and stateful. Risk losing coverage if
>    there's logic bugs.
>  * To understand what a test is doing requires learning the entire
>    harness.
>
> [1] https://abseil.io/resources/swe-book/html/ch12.html#:~:text=and%20Code%20Sharing%3A-,DAMP%2C%20Not%20DRY,-One%20final%C2%A0
>
> Change-Id: I9fb78b3c80adf537a3f168b6ae54e426c956315a
> Bug: 331778101
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5780030
> Commit-Queue: David Bokan <bokan@chromium.org>
> Reviewed-by: William Liu <liuwilliam@chromium.org>
> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1341464}
>

Bug: 331778101
Change-Id: I3dce5575a7845b98ba276af0333185fe0776b1d0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5787729
Reviewed-by: Osama Fathy <osamafathy@google.com>
Owners-Override: Osama Fathy <osamafathy@google.com>
Commit-Queue: Osama Fathy <osamafathy@google.com>
Cr-Commit-Position: refs/heads/main@{#1341550}
2024-08-14 10:26:44 +00:00
David Bokan
2931e7e8b0 dnt: DAMPen BackForwardTransitionAnimationManager tests
These tests currently perform most assertions/expectations within the
test harness rather than in the test body. Failing assertions outside
the test body don't cause the test to stop and require looking at the
stacktrace to understand where in a test the failure is coming from.
Android stacks are often incomplete on bots which makes tests difficult
to debug.

This mega CL (sorry) removes almost all of the harness asserting logic
and places the checks in test bodies. New tests are added to
preserve coverage where needed. High level changes:

 * Replaced all the transform checks (ExpectedLayerTransforms) with
   explicit checks in tests.
 * Exposed layers to tests explicitly, rather than relying on indexes.
 * Exposed animator state to tests and check it inline in test body.
 * Replaced most uses of callback with TestFuture and other minor
   cleanups.

 The aim is for tests to be Descriptive And Meaningful Phrases
 (DAMP[1]), even at the cost of some repetition. Having checks inside
 the harness is:

 * Difficult to tell what each individual test is actually checking for.
 * Each test effectively tests _everything_ so a single defect can cause
   many test failures and extremely verbose logs.
 * Adding new functionality (e.g. RTL, Forward nav) means logic inside
   the harness gets more complex and stateful. Risk losing coverage if
   there's logic bugs.
 * To understand what a test is doing requires learning the entire
   harness.

[1] https://abseil.io/resources/swe-book/html/ch12.html#:~:text=and%20Code%20Sharing%3A-,DAMP%2C%20Not%20DRY,-One%20final%C2%A0

Change-Id: I9fb78b3c80adf537a3f168b6ae54e426c956315a
Bug: 331778101
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5780030
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1341464}
2024-08-14 05:24:06 +00:00
William Liu
730fbf6aae [DNT] Set favicon from Clank to //content
The favicon is initially sent from //component to Clank via
https://crsrc.org/c/components/favicon/content/content_favicon_driver.cc;drc=2db1d3ab427d32c7978ac06b34187ccb1dc7a337;l=133

In this CL we also set the favicon for the last committed entry of the
current active WebContents. The favicon must belong to the last
committed entry because the //content fetching is done in the same
stack as
https://crsrc.org/c/components/favicon/content/content_favicon_driver.cc;drc=2db1d3ab427d32c7978ac06b34187ccb1dc7a337;l=133

The favicon is explicitly scaled to the size required by the navigation
transitions UI. So we set it on NavigationTransitionData instead of the
generic favicon on content::FaviconStatus.

Low-Coverage-Reason: TESTS_IN_SEPARATE_CL
Bug: 40260440
Change-Id: If80bd84f5d2da3e684b64bacfc41b019b75bd97b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5783856
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1341290}
2024-08-13 21:52:10 +00:00
Baran Erfani
cf4ec71ff6 Handle screenshotting rotated screens
This is to use fallback screenshot when the screenshot was taken
in a different orientation compared to the current screen
(horizontal vs. vertical).

Bug: 346979589
Change-Id: I88d6323b518c8c70cbae609d098bbfde3b3ba66c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5770276
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: Baran Erfani <baranerf@google.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1341128}
2024-08-13 18:27:38 +00:00
Khushal Sagar
bb7c9e8470 content: Re-enable input suppression for back forward transition.
This change enables input suppression during a back forward transition
with the following changes from the previous attempt:

1. Input suppression starts when the swipe gesture ends, i.e., we have a
touch up which either starts a navigation or cancels the gesture. This
ensures the suppression doesn't start mid-gesture, which is the case
in 3-button navigation mode where the navigation gesture is driven by
overscroll events from the renderer.

2. Fix the order of resetting gesture detection in RWHVAndroid. Resetting the gesture detector involves generating synthetic touch
cancel events if the user started a drag during the input suppression
period. This can create the following situation:

  a) We get touch start/move events during input suppression.
     GestureDetector maps these to scroll start/update events which are
     not propagated further due to input suppression.

  b) When ending input suppression, resetting the gesture detector sends
     a synthetic cancel event which maps to a gesture scroll end event.
     Since suppression is now over, the scroll end event is propagated
     while it's corresponding scroll start event was suppressed.

Avoid the above by resetting the gesture detector right before
unsuppressing input.

Fixed: 344620149
Change-Id: I09103843e026fb32af670b99ecee6552bd1ff055
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5777543
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1341073}
2024-08-13 17:24:00 +00:00
David Bokan
7ff8d2e489 dnt: Remove unused return in TrackRequest
Change-Id: Ib17035babdcd955b031e85ca04d623531b5efdb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5781569
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Auto-Submit: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1340367}
2024-08-12 14:08:35 +00:00
David Bokan
f86505e301 refactor: remove unused x,y from BackGestureEvent
These values are unused as the progress field is what drives all
effects. Tests aren't bothering to set these correctly so lets remove
this and all the associated plumbing.

Change-Id: I93bcad6a3932be222689243e2a9413e80bf78572
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5777482
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Auto-Submit: David Bokan <bokan@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1339810}
2024-08-09 19:41:43 +00:00
Khushal Sagar
81c3e888d6 content: Fix erroneous CHECK for back forward visual transitions.
The code assumes that a new navigation can not commit while we're
playing the cancel animation or waiting for before unload response. This
is incorrect since a same-document navigation can commit during this
phase.

R=liuwilliam@chromium.org

Fixed: 353960892
Change-Id: I4c7c922fab15f37e46613993180ce5289f2d305a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5770081
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1339801}
2024-08-09 19:21:20 +00:00
William Liu
c0748df037 [DNT] Redo scrim according to the UX spec
Change the scrim behavior. Before, the scrim animation is 0.8->0.3
during the invoke animation then 0.3->0 during the crossfade; in this CL
the scrim is only applied during the invoke animation, and is from
0.2->0 for light mode and 0.1->0 in light mode.

The Surface0 color will be used for the final fallback UX impl, which
isn't finch blocking.

Bug: 40260440
Change-Id: I6f840193b6e01daa63e7ede962fd537cbb530324
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5769672
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1339666}
2024-08-09 15:42:36 +00:00
William Liu
f58ab3dcb9 [DNT] Use theme color for fallback UX
We can remove all the reference to the page's background color.

Bug: 40260440
Change-Id: Ib7d1ef9a016b7cc4051c6745622b551f61b93814
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5769938
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1339187}
2024-08-08 18:10:30 +00:00
Khushal Sagar
cf6bdc1182 content: Disable back/fwd UX for prefers reduced motion.
If the user has opted into reduced motion, disable the UX for back/fwd
swipe gestures. Also disable screenshotting since the screenshots would
be redundant.

Fixed: 353501690
Change-Id: If5e52cc654f5c55f3dd37ff305a96fc9c2bda092
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5765481
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1339052}
2024-08-08 14:29:15 +00:00
William Liu
62ae26ceab Reland "[DNT] Track subframe navigation requests"
This is a reland of commit 1ea3357521

Revert reason: in some subframe tests, in order to create one main
frame request and one subframe request in one GoToIndex(), we are
navigating the mainframe same-doc while navigating the subframe
cross-doc. For the mainframe same-doc navigation, the LSID increment
experiment flag is required to capture the screenshot.

The fix is diff PS1..onward, where we enable the LSID flag for all
tests.

Tested with the exact android-arm-test build.

Original change's description:
> [DNT] Track subframe navigation requests
>
> For any navigation:
> - If there is a main frame navigation request, we track the main frame
> request regardless of any subframe navigation requests.
> - If there is no main frame request, we only track the navigation with
> exactly one subframe request. The navigation with >1 subframe requests
> won't be animated.
>
> Since no subframe navigation screenshots are captured, we will show the
> fallback UX during the subframe transitions.
>
> Note: when a primary main frame request commits, we cancel the ongoing
> subframe transition. The stack is:
> - DidFinishNav() called for the subframe request. Since the nav_handle
> has not committed, we play the cancel animation.
> - If by the time the main frame request commits, the cancel animation
> is still playing, OnDidNavigatePrimaryMainFramePreCommit() will be
> called for the main frame request. We then transit from
> kDisplayingCancelAnimation to kAnimationAborted.
>
> Bug: 41490714, 357060513
> Change-Id: Idb6135b3ba272d4b3f15a1b9f48a9cbf699ddb70
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5738894
> Reviewed-by: David Bokan <bokan@chromium.org>
> Commit-Queue: William Liu <liuwilliam@chromium.org>
> Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1337863}

Bug: 41490714, 357060513
Change-Id: I0a05dbbd690efeb4c433c95ecea9ea272a57cc73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5769855
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1339051}
2024-08-08 14:28:16 +00:00
Michael van Ouwerkerk
cd2f19be9b Revert "[DNT] Track subframe navigation requests"
This reverts commit 1ea3357521.

Reason for revert: 
OneMainFrameRequest_OneSubframeRequest is failing

Original change's description:
> [DNT] Track subframe navigation requests
>
> For any navigation:
> - If there is a main frame navigation request, we track the main frame
> request regardless of any subframe navigation requests.
> - If there is no main frame request, we only track the navigation with
> exactly one subframe request. The navigation with >1 subframe requests
> won't be animated.
>
> Since no subframe navigation screenshots are captured, we will show the
> fallback UX during the subframe transitions.
>
> Note: when a primary main frame request commits, we cancel the ongoing
> subframe transition. The stack is:
> - DidFinishNav() called for the subframe request. Since the nav_handle
> has not committed, we play the cancel animation.
> - If by the time the main frame request commits, the cancel animation
> is still playing, OnDidNavigatePrimaryMainFramePreCommit() will be
> called for the main frame request. We then transit from
> kDisplayingCancelAnimation to kAnimationAborted.
>
> Bug: 41490714, 357060513
> Change-Id: Idb6135b3ba272d4b3f15a1b9f48a9cbf699ddb70
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5738894
> Reviewed-by: David Bokan <bokan@chromium.org>
> Commit-Queue: William Liu <liuwilliam@chromium.org>
> Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1337863}

Bug: 41490714, 357060513, 358033372
Change-Id: If8dd8d2db1bb9ff13db2937c6dd0b596901f44fb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5767295
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Reviewed-by: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Owners-Override: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1338414}
2024-08-07 12:37:26 +00:00
William Liu
1ea3357521 [DNT] Track subframe navigation requests
For any navigation:
- If there is a main frame navigation request, we track the main frame
request regardless of any subframe navigation requests.
- If there is no main frame request, we only track the navigation with
exactly one subframe request. The navigation with >1 subframe requests
won't be animated.

Since no subframe navigation screenshots are captured, we will show the
fallback UX during the subframe transitions.

Note: when a primary main frame request commits, we cancel the ongoing
subframe transition. The stack is:
- DidFinishNav() called for the subframe request. Since the nav_handle
has not committed, we play the cancel animation.
- If by the time the main frame request commits, the cancel animation
is still playing, OnDidNavigatePrimaryMainFramePreCommit() will be
called for the main frame request. We then transit from
kDisplayingCancelAnimation to kAnimationAborted.

Bug: 41490714, 357060513
Change-Id: Idb6135b3ba272d4b3f15a1b9f48a9cbf699ddb70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5738894
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1337863}
2024-08-06 15:03:30 +00:00
Vladimir Levin
b85f6dae95 DNT: Don't crash on chained back.
This patch fixes the way we get rid of the animator in cases of chained
back. The destructor of the animator CHECKs that we're in a terminal
state, so just resetting the animator can trigger that. Instead, abort
the animation and destroy via the destruction calls. This also cleans
up the observers appropriately.

R=khushalsagar@chromium.org, liuwilliam@chromium.org

Change-Id: Ia18c08de6ad6078933f6721919d6696b67fd9855
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5758278
Commit-Queue: Vladimir Levin <vmpstr@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1336203}
2024-08-01 19:46:34 +00:00
Khushal Sagar
5194321551 content: Re-enable compression for navigation entry screenshots.
crrev.com/5744060 added screenshot compression but the size of the
encoded bitmap was computed incorrectly. This resulted in an error when
uploading the compressed bitmap to GPU memory during the transition.

Fix this and also pull out the compression code to a common helper
method so it can be shared with compression for tab switcher
screenshots.

TBR=rbyers@chromium.org

Bug: 40256003
Change-Id: I639eedfdd11111b403d81c3787da3720cbaefaed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5750244
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1335782}
2024-07-31 23:50:30 +00:00
William Liu
cf65f01001 [DNT] Force the browser top control to show before the transition.
Say we capture a screenshot of page A with the top control shown. If the
top control is hidden on page B, when we transit back to A we will be
showing the canvas at the bottom for the screenshot preview.

One way to go around this is to always force the browser top control to
be fully visible at the start of the transition.

The change in cc/input/browser_controls_offset_manager.cc is required
for three-button mode because the gesture in three button mode is
considered as a scroll. When the gesture is dispatched from the OS:
- BrowserControlsOffsetManager::ScrollBegin
- BrowserControlsOffsetManager::ScrollBy
- Clank gets the gesture, and starts to animate down the TC.
- BrowserControlsOffsetManager::UpdateBrowserControlsState
  - Set show_controls_when_scroll_completes_ to true.
- BrowserControlsOffsetManager::ScrollEnd
  - Because show_controls_when_scroll_completes_ is true, we try to
    reanimate the TC to show, failing a DCHECK[0].

show_controls_when_scroll_completes_ was added in
https://crrev.com/c/4136461 and was used to defer the scroll-initiated
TC animation after browser-driven TC animation.

[0]: https://crsrc.org/c/cc/input/browser_controls_offset_manager.cc;drc=34ad7f3844f882baf3d31a6bc6e300acaa0e3fc8;l=617

Bug: 340292683
Low-Coverage-Reason: TESTS_IN_SEPARATE_CL
Change-Id: I8d42edafb288057d656ad33d91139f5555506c71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5678714
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1332347}
2024-07-24 15:37:57 +00:00
William Liu
b76c185a2a [DNT] New API shouldAnimateNavigationTransition
Returns if a gesture navigation will be animated or not. We use this API
in https://crrev.com/c/5678714 so we don't bring down the top control
for navigations that won't be animated.

Bug: 340292683
Low-Coverage-Reason: TRIVIAL_CHANGE
Change-Id: Iea0086ab31b6ede305312ba37e5ae63bafece7e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5731083
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1332346}
2024-07-24 15:37:44 +00:00
David Bokan
bbd0cba613 dnt: Mirror directions of navigation transitions in RTL
This CL plumbs the edge parameter into BackForwardTransitionAnimator so
that it can be used to mirror the back gesture animation. The caller
(manager) is responsible for determining the direction so the animator
is agnostic of RTL - only that it needs to perform an animation from a
given edge.

Also fix the progress computation in 3-button mode to run from 0 to 1
irrespective of the direction, allowing the animator to fully implement
the animation as well as matching the semantics of BackEventCompat (used
by gestural mode).

Bug: 331778964
Change-Id: Iab5ab3a0422ac8c6450f93804f39299df20a64b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5690915
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: Jungshik Shin <jshin@chromium.org>
Reviewed-by: Lijin Shen <lazzzis@google.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1331282}
2024-07-22 20:17:36 +00:00
Khushal Sagar
ba53f42942 content: Add logging for back forward animation.
Bug: 353960892
Change-Id: Ic70855cd712d4ca48d7ed60d6a517fe7b7406416
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5722526
Reviewed-by: William Liu <liuwilliam@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1329867}
2024-07-18 22:47:35 +00:00
Khushal Sagar
931bd7de56 content: Add indeterminate progress bar for invoke animation.
This change adds the content internal progress bar shown while the
navigation is pending commit. The next change hooks it up to the chrome
code to get the correct parameters for the bar and ensures only one
progress bar is drawn at a time.

R=liuwilliam@chromium.org, bokan@chromium.org

Bug: 342419747
Change-Id: Id19b12fa2a6a99ceb3155923a4f21daa2e242afe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5715168
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1329823}
2024-07-18 21:25:23 +00:00
Baran Erfani
384b3293af Added UMA Metrics For Cache Hit Or Miss Reasons
The following metrics are added:
- Cache hit
- Cache miss - caused by subframe
- Cache miss - not captured because of opting out of BFCache; related to crbug.com/40268228
- Cache miss - others

Bug: 40259040
Change-Id: I46d464bfca128539b042ddcad09c579231fcbc88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5689055
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Baran Erfani <baranerf@google.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1329781}
2024-07-18 20:30:04 +00:00
William Liu
fd44484d21 Reland "[DNT] Clone old surface for same-doc navs"
This is a reland of commit f56c7d2306

The cause: when kIncrementLocalSurfaceIdForMainframeSameDocNavigation
is init'ed in SetUp(), the value is _somehow_ not overridden in //blink
when `is_chrome_branded = true` is set in the args.gn.

The fix: ScopedFeatureList should be init'ed in the test harness's ctor.
See diff of PS1..2.

Tested: with `is_chrome_branded = true` in my local dev build dir, and
the android-official bot.

Original change's description:
> [DNT] Clone old surface for same-doc navs
>
> Since we are subscribing to the widget host immediately after the nav
> starts, we might as well clone the old surface at the same spot. This
> way we don't have to add a ReadyToCommitSameDocNav on the
> NavigatorDelegate or RFHDelegate.
>
> Bug: 352526258
> Change-Id: Ic1ea3aa561c47ab0efcc314903369ae6d35f5be3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5695986
> Commit-Queue: William Liu <liuwilliam@chromium.org>
> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1326326}

Bug: 352526258
Change-Id: I5e1827cb91d3d4ee72ff03e315ca29956cfa3e8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5708049
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1328313}
2024-07-16 18:13:44 +00:00
David Bokan
e888b3c3f5 dnt: Add flag to mirror gestures when in RTL
When this flag is enabled and if Chrome's UI is in an RTL layout (i.e.
using a right-to-left language like Arabic), navigation gestures will
flip the meaning of the edges, i.e. treat the right edge as "back" and
the left edge as "forward". (Note: only 3-button mode currently
navigates forward from the forward edge. Gestural navigation navigates
back from both edges but doesn't show a transition animation from the
"forward" edge).

Note: this CL implements the flag and passes the right value to the
handler but animations and UI are still broken for the right edge.
Followup CLs will fix these issues.

Bug: 331778964
Change-Id: I7ca92da85a58f66f8cfea0adccafdca5dfe7bdd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5692438
Reviewed-by: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: Lijin Shen <lazzzis@google.com>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: Jungshik Shin <jshin@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1328281}
2024-07-16 17:28:45 +00:00
Hailey Wang
b82545c1da Revert "[DNT] Clone old surface for same-doc navs"
This reverts commit f56c7d2306.

Reason for revert: Suspected failing on bots, see b/352766243.

Original change's description:
> [DNT] Clone old surface for same-doc navs
>
> Since we are subscribing to the widget host immediately after the nav
> starts, we might as well clone the old surface at the same spot. This
> way we don't have to add a ReadyToCommitSameDocNav on the
> NavigatorDelegate or RFHDelegate.
>
> Bug: 352526258
> Change-Id: Ic1ea3aa561c47ab0efcc314903369ae6d35f5be3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5695986
> Commit-Queue: William Liu <liuwilliam@chromium.org>
> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1326326}

Bug: 352526258
Change-Id: I7a4b7e08e9eee241b84ba700d227d784d6574b43
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5703542
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Hailey Wang <haileywang@google.com>
Commit-Queue: Hailey Wang <haileywang@google.com>
Auto-Submit: Hailey Wang <haileywang@google.com>
Cr-Commit-Position: refs/heads/main@{#1326886}
2024-07-12 18:03:39 +00:00
William Liu
1ecbbb7c25 [DNT] Fix SynchronouslyDestroyAnimator refactor
https://crrev.com/c/5637535 missed three spots: For
OnDetachedFromWindow, OnRootWindowVisibilityChanged and
OnDetachCompositor we must also advance the animator to
kAnimationAborted, then destroy the animator.

Also reordered some of the definitions in
back_forward_transition_animation_manager_android.cc, such that the
definitions and declarations are in the same order.

Bug: 345518193
Change-Id: I509358eb55de3f079ed4f81d00aaebd314e84965
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5698065
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1326446}
2024-07-11 22:59:06 +00:00
William Liu
f56c7d2306 [DNT] Clone old surface for same-doc navs
Since we are subscribing to the widget host immediately after the nav
starts, we might as well clone the old surface at the same spot. This
way we don't have to add a ReadyToCommitSameDocNav on the
NavigatorDelegate or RFHDelegate.

Bug: 352526258
Change-Id: Ic1ea3aa561c47ab0efcc314903369ae6d35f5be3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5695986
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1326326}
2024-07-11 19:53:16 +00:00
William Liu
b295fb4b22 [DNT] Reorder the APIs in the hdr and cc
It hurts my eyes that the declarations and definitions are out of order.
Also since the animator's APIs are mirroring the manager, the mirrored
ones should be in the same order of the manager.

Change-Id: I52faab5c37a08cc4ea1f29e809f8ce9c522ae229
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5695546
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1326168}
2024-07-11 15:35:48 +00:00
Khushal Sagar
45006b418e dnt: Disable input suppression
Disable input suppression while crbug.com/344620149 is being
investigated.

R=bokan@chromium.org

Bug: 344620149
Change-Id: I6ca9798236171e05209964b769e06794386fd3dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5691036
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1325763}
2024-07-10 21:39:26 +00:00
Khushal Sagar
7717094484 content: Fix back forward transition test in same-RFH mode
The tests were incorrectly assuming we always have a speculative RFH.
Switch to using the API which returns the RFH the navigation will commit
to for all cases.

R=liuwilliam@chromium.org

Bug: 41491612
Change-Id: I982d659550e1e7efd3ec600aa29ccb312c725c92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5684104
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1324423}
2024-07-08 19:31:53 +00:00
Khushal Sagar
bbdf93d718 content: Add fixes for back forward transitions with same-RFH navs
This change fixes the following issues for same-RFH navigations and back
forward visual transitions:

1. The navigation screenshot cache assumes we never persist a screenshot
for the currently committed navigation entry. This assumption is broken
for same-RFH navigations where the screenshot request is sent at the
same time as the commit IPC is sent to the renderer. If the GPU responds
with the screenshot before the renderer responds with DidCommit, the
screenshot is persisted before the navigation has been committed.

Fix this by restructuring the code such that we defer caching the
screenshot until the NavigationRequest is being destroyed.

2. The SurfaceLayer for the outgoing page is cloned during DidCommit
only for cross-RFH navs. This is currently not done for same-RFH navs
and it would be too late in the navigation lifecycle for these navs. This
is because the SurfaceID of the RFH is updated when sending the commit
message for these navs.

Fix the above by cloning the SurfaceLayer in ReadyToCommit.
Note: The current code misses this for same-document navs which should
be fixed separately.

The browser test still forces RenderDocument on all frames, this is
removed in the follow up patch.

R=liuwilliam@chromium.org, rakina@chromium.org

Cq-Include-Trybots: luci.chromium.try:android-10-arm64-rel,android-11-x86-rel,android-12-x64-dbg,android-12l-x64-dbg,android-12-x64-rel,android-13-x64-rel,android-14-x64-rel,android-15-x64-fyi-rel,android-15-x64-rel,android-arm-compile-dbg,android-arm64-all-targets-dbg,android-arm64-rel,android-bfcache-rel,android-cronet-arm64-rel,android-fieldtrial-rel,android-oreo-x86-rel,android-official,android-mte-arm64-rel,android-oreo-arm64-dbg,android-pie-arm64-dbg,android-pie-x86-rel,android-perfetto-rel,android-x64-rel,android-x86-rel,android_blink_rel

Bug: 41491612
Change-Id: I3d12457ba49e6fd6cbc073ebc360986e13bd3d50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5680502
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1324372}
2024-07-08 18:20:43 +00:00
luci-bisection@appspot.gserviceaccount.com
a81afd82da Revert "content: Fix navigation screenshot caching for same-RFH navigations"
This reverts commit 5321a7ef77.

Reason for revert:
LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5635805469999104

Sample build with failed test: https://ci.chromium.org/b/8743381859705749217
Affected test(s):
[ninja://content/test:content_browsertests/All/BackForwardTransitionAnimationManagerBrowserTest.BeforeUnload_Proceed_WithPrompt/LeftEdge_BackwardNav](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FAll%2FBackForwardTransitionAnimationManagerBrowserTest.BeforeUnload_Proceed_WithPrompt%2FLeftEdge_BackwardNav?q=VHash%3A25e0d04bad413a2d)
[ninja://content/test:content_browsertests/All/BackForwardTransitionAnimationManagerBrowserTest.OnAnimateIsCalled/LeftEdge_BackwardNav](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FAll%2FBackForwardTransitionAnimationManagerBrowserTest.OnAnimateIsCalled%2FLeftEdge_BackwardNav?q=VHash%3A25e0d04bad413a2d)
[ninja://content/test:content_browsertests/All/BackForwardTransitionAnimationManagerBrowserTest.RenderFrameActivatedDuringInvokeAnimation/LeftEdge_BackwardNav](https://ci.chromium.org/ui/test/chromium/ninja:%2F%2Fcontent%2Ftest:content_browsertests%2FAll%2FBackForwardTransitionAnimationManagerBrowserTest.RenderFrameActivatedDuringInvokeAnimation%2FLeftEdge_BackwardNav?q=VHash%3A25e0d04bad413a2d)

If this is a false positive, please report it at http://b.corp.google.com/createIssue?component=1199205&description=Analysis%3A+https%3A%2F%2Fci.chromium.org%2Fui%2Fp%2Fchromium%2Fbisection%2Ftest-analysis%2Fb%2F5635805469999104&format=PLAIN&priority=P3&title=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F5665181&type=BUG

Original change's description:
> content: Fix navigation screenshot caching for same-RFH navigations
>
> The navigation screenshot cache assumes we never persist a screenshot
> for the currently committed navigation entry. This assumption is broken
> for same-RFH navigations where the screenshot request is sent at the
> same time as the commit IPC is sent to the renderer. If the GPU responds
> with the screenshot before the renderer responds with DidCommit, the
> screenshot is persisted before the navigation has been committed.
>
> Fix this by restructuring the code such that we defer caching the
> screenshot until the NavigationRequest is being destroyed.
>
> Cq-Include-Trybots: luci.chromium.try:android-oreo-x86-rel
> R=liuwilliam@chromium.org, rakina@chromium.org
>
> Fixed: 41491612
> Change-Id: I003e7defdc4ffe9033e335081f5ea41db572a524
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5665181
> Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
> Reviewed-by: William Liu <liuwilliam@chromium.org>
> Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
> Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1323131}
>

Bug: 351100976
Change-Id: I0dabbd38a38b94c64a5c10cf2fae14941214716c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5678264
Reviewed-by: Alan Cutter <alancutter@chromium.org>
Owners-Override: Alan Cutter <alancutter@google.com>
Commit-Queue: Samar Chehade-Lepleux <samarchehade@google.com>
Cr-Commit-Position: refs/heads/main@{#1323225}
2024-07-04 08:02:50 +00:00
Khushal Sagar
5321a7ef77 content: Fix navigation screenshot caching for same-RFH navigations
The navigation screenshot cache assumes we never persist a screenshot
for the currently committed navigation entry. This assumption is broken
for same-RFH navigations where the screenshot request is sent at the
same time as the commit IPC is sent to the renderer. If the GPU responds
with the screenshot before the renderer responds with DidCommit, the
screenshot is persisted before the navigation has been committed.

Fix this by restructuring the code such that we defer caching the
screenshot until the NavigationRequest is being destroyed.

Cq-Include-Trybots: luci.chromium.try:android-oreo-x86-rel
R=liuwilliam@chromium.org, rakina@chromium.org

Fixed: 41491612
Change-Id: I003e7defdc4ffe9033e335081f5ea41db572a524
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5665181
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1323131}
2024-07-04 01:26:14 +00:00
Baran Erfani
5a67b86a51 Refactor SynchronouslyDestroyAnimator Continued
- Moved observer definitions to the animation manager
- Added a new State to the animator: kAnimationAborted
- Added a function to the manager to check for the animator state and if it is in a terminal state asynchronously destroy it to avoid calling
SynchronouslyDestroyAnimator from the animator.

Bug: 345518193
Change-Id: I37a95d1a4f28e19221de6321b235897eadc37290
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5637535
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: William Liu <liuwilliam@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: William Liu <liuwilliam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1321123}
2024-06-28 19:21:09 +00:00
William Liu
e96cce556d [dnt] Fallback screenshot
If the destination entry doesn't have a screenshot, we on-the-fly
compose a screenshot using the destination page's background color. The
background color was computed by the CSS and stored on the
NavigationEntry.

Bug: 40260440
Change-Id: I338dc0b6b61a475282876ff6705cde62d903fbac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5622891
Commit-Queue: William Liu <liuwilliam@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1318744}
2024-06-24 19:53:26 +00:00