Closed Bug 1666340 Opened 5 years ago Closed 5 years ago

Fold KeyboardScrollAnimation into SmoothScrollAnimation

Categories

(Core :: Panning and Zooming, task, P3)

task

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: kats, Assigned: sunitacool41, Mentored)

References

Details

(Whiteboard: [lang=c++])

Attachments

(1 file, 1 obsolete file)

The KeyboardScrollAnimation class doesn't really need to exist any more. It is a subclass of the GenericScrollAnimation class which does the actual scrolling animation; the extra work that KeyboardScrollAnimation does is basically in the SettingsForType helper function, where it maps a keyboard scroll action into animation settings.

This entire class is largely redundant with the more general SmoothScrollAnimation class, which uses a similar helper, ComputeBezierAnimationSettingsForOrigin. This helper does the same sort of thing as SettingsForType but is more generic and uses a scroll origin as an input.

We should be able to remove KeyboardScrollAnimation completely, and just add a small helper to convert from a keyboard scroll action to an origin, and then use SmoothScrollAnimation at the one use site, here

Mentor: botond
Whiteboard: [apz-outreachy]
Mentor: kats
Whiteboard: [apz-outreachy] → [apz-outreachy][lang=c++]
Whiteboard: [apz-outreachy][lang=c++] → [lang=c++]

Hello,
I am new to contributing here. Can I work on this one?
Thanks.

Yes, absolutely. The first step here is to ensure you are set up to build Firefox on your local machine, which you can do by following the instructions at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions

Once you have done that let us and we can guide you further.

Thanks. :)
I have the Firefox setup done on my local machine.
Can you please guide me here a bit?

I am not able to figure out how to convert a KeyboardScrollAction parameter to a ScrollOrigin parameter.

The conversion will be based on the functionality that currently resides in the SettingsForType function. So in this function, you can see that the eScrollCharacter and eScrollLline variants use the general_smoothScroll_lines_duration* prefs, which is the same as what ScrollOrigin::Lines does. Similarly eScrollPage is equivalent to ScrollOrigin::Pages and eScrollComplete is equivalent to ScrollOrigin::Other. So with this you should be able to write a function that takes a KeyboardScrollAction parameter as input and returns a ScrollOrigin, and then use it here to replace the usage of KeyboardScrollAnimation with SmoothScrollAnimation. Does that make sense?

Assignee: nobody → sunitacool41
Status: NEW → ASSIGNED

I am extremely sorry, I wanted to merge the second commit into the first one and by mistake, a new patch got submitted.
I have updated the original one as well.

No problem! I'll drop the second patch and just look at the updated first one.

Attachment #9187412 - Attachment is obsolete: true
Attachment #9187344 - Attachment description: Bug 1666340 - Fold KeyboardScrollAnimation into SmoothScrollAnimation r = Kartikaya Gupta → Bug 1666340 - Fold KeyboardScrollAnimation into SmoothScrollAnimation r=kats
Pushed by kgupta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/876d78db241c Fold KeyboardScrollAnimation into SmoothScrollAnimation r=kats

Hello,
sorry for the mistake.
I have made changes as suggested in the patch.
Do I need to do anything else?

Flags: needinfo?(sunitacool41)

Thanks! No need to do anything else; I've triggered the re-landing with the updated patch. Sorry for not catching the error during review; we build the code with multiple compiler versions on our CI infrastructure and the error only manifested in an older version of the compiler.

Pushed by kgupta@mozilla.staktrace.com: https://hg.mozilla.org/integration/autoland/rev/deeb82c5b8b8 Fold KeyboardScrollAnimation into SmoothScrollAnimation r=kats
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch

Thank you Sunita! This bug is all done now, feel free to pick out another bug you'd like to work on. I'll be filing a bug shortly to remove KeyboardScrollAnimation since it's no longer used and I'll cc you on that in case you feel like working on that - but feel free to find something more challenging if that's what you'd prefer!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: