Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i82973 scroll mouse wheel support #44724

Merged
merged 29 commits into from
Aug 22, 2023

Conversation

reidbaker
Copy link
Contributor

@reidbaker reidbaker commented Aug 15, 2023

Fixes flutter/flutter#82973

Mouse scroll wheel support for android.

I chose to not cache the vertical and horizontal scale factors that come from view configuration. The primary reason is that in the current code path context is only used when the user scrolls which was the unimplemented feature. This smaller blast radius I decided was worth the additional calls. A secondary reason is that when the scale factors are changed is not a well documented path nor is there a lifecycle callback to listen to. Scroll factor is cached on api 25 and below because that more closely mirrors the behavior I see in pre 25 versions of android scroll view.

Note flutter takes longer to "see" a mouse that then scrolls than android

Fixes #flutter/flutter/82973

Todo list prior to merge

Links

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

@reidbaker reidbaker requested review from Piinks and a team August 16, 2023 15:08
@reidbaker
Copy link
Contributor Author

@LoveJello When merging in #43949 my code causes your tests to fail. Any ideas what broke? One of the changes I made was to the mock where I made isFromSource more closely match the actual implementation,

@LoveJello
Copy link
Contributor

@LoveJello When merging in #43949 my code causes your tests to fail. Any ideas what broke? One of the changes I made was to the mock where I made isFromSource more closely match the actual implementation,

Sorry for late response.I added some comment in the code.
And you'd better to ask @moffatman to do the code review.
Thanks.

@@ -192,7 +195,9 @@ public boolean onGenericMotionEvent(@NonNull MotionEvent event) {
boolean isMovementEvent =
(event.getActionMasked() == MotionEvent.ACTION_HOVER_MOVE
|| event.getActionMasked() == MotionEvent.ACTION_SCROLL);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change below was made for readability since @camsim99 and I both thought the implementation was confusing. It should be functionally identical and easier to follow. If a reviewer disagree please comment here and let me know.

@reidbaker reidbaker marked this pull request as ready for review August 18, 2023 16:20
@reidbaker
Copy link
Contributor Author

John offered to test horizontal scroll with a mouse with a second scroll wheel after this lands.

@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter_LGTM

@@ -8,11 +8,16 @@
import static org.mockito.Mockito.when;
Copy link
Contributor

@Piinks Piinks Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests! 🤌 Thanks for shaving this down and adding all this coverage.

Copy link
Contributor

@moffatman moffatman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks 😄

@reidbaker reidbaker added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Aug 21, 2023
@auto-submit auto-submit bot merged commit 28b8bd5 into flutter:main Aug 22, 2023
@reidbaker
Copy link
Contributor Author

Pre api 26, horizontal scroll wheel testing will happen post merge given my difficulty finding hardware and not being able to test against an emulator.

@reidbaker reidbaker deleted the i82973-scroll-mouse-wheel-support branch August 22, 2023 18:23
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 22, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 22, 2023
…133075)

flutter/engine@21437d3...28b8bd5

2023-08-22 reidbaker@google.com i82973 scroll mouse wheel support (flutter/engine#44724)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jimgraham@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
Fixes flutter/flutter#82973

Mouse scroll wheel support for android. 

I chose to not cache the vertical and horizontal scale factors that come from view configuration. The primary reason is that in the current code path context is only used when the user scrolls which was the unimplemented feature. This smaller blast radius I decided was worth the additional calls. A secondary reason is that when the scale factors are changed is not a well documented path nor is there a lifecycle callback to listen to. Scroll factor is cached on api 25 and below because that more closely mirrors the behavior I see in pre 25 versions of android scroll view. 

Note flutter takes longer to "see" a mouse that then scrolls than android

Fixes #flutter/flutter/82973

Todo list prior to merge

## Links 
* Some pre api 26 scroll factor code 
    - https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/view/View.java?q=function:getVerticalScrollFactor%20filepath:android%2Fview%2FView.java&ss=android%2Fplatform%2Fsuperproject%2Fmain 
    - https://cs.android.com/android/_/android/platform/frameworks/base/+/main:core/java/android/widget/ScrollView.java;l=930;drc=2fe301db7555bccf53e465436d4cb7442c803df3;bpv=0;bpt=0
* Post api 26 scroll factor code 
    - https://cs.android.com/android/_/android/platform/frameworks/base/+/main:core/java/android/widget/ScrollView.java;l=361;drc=406e0f655387f27dda874c2b975fb0ddbd61aa13;bpv=0;bpt=0 
    - https://developer.android.com/reference/android/view/ViewConfiguration#getScaledVerticalScrollFactor()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scrolling with physical mouse is super slow on Android
5 participants