Open Bug 1572508 Opened 4 months ago Updated 4 months ago

Convert the prefs in PositionedEventTargeting.cpp

Categories

(Core :: Preferences: Backend, task)

task
Not set

Tracking

()

People

(Reporter: KrisWright, Unassigned)

References

(Blocks 1 open bug)

Details

There are a bunch of prefs in PositionedEventTargeting.cpp, stored as EventRadiusPrefs[1], that could be converted to static prefs or code constants. These are a bit tricky because they are dynamically generated or selected in a call to GetPrefsFor [2]. Converting these to static prefs will require reworking how they are used a bit - instead of dynamically selecting the prefs as is, the code could use a boolean flag to select which pref from the struct to use.

Another option is to eschew using prefs entirely, and either use the general callback mechanism or just use code constants to set the same values.

[1] https://searchfox.org/mozilla-central/rev/9ae20497229225cb3fa729a787791f424ff8087b/layout/base/PositionedEventTargeting.cpp#79
[2] https://searchfox.org/mozilla-central/rev/9ae20497229225cb3fa729a787791f424ff8087b/layout/base/PositionedEventTargeting.cpp#95

I thought of another option: convert all the relevant prefs to static prefs, and then change EventRadiusPrefs so it holds a bunch of function pointers. sMouseEventRadiusPrefs would hold function pointers to the getters for the mouse prefs, and sTouchEventRadiusPrefs would hold function pointers to the getters for the touch prefs. Both of these structs would be able to be constructed statically.

I still would prefer to replace the prefs in favour of code constants, but if that's not possible, I think the above is the next best option, because it wouldn't require major logic changes that the boolean flags approach would require.

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