Convert the prefs in PositionedEventTargeting.cpp
Categories
(Core :: Preferences: Backend, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox79 | --- | fixed |
People
(Reporter: KrisWright, Assigned: n.nethercote)
References
Details
Attachments
(1 file, 1 obsolete file)
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
| Assignee | ||
Comment 1•6 years ago
|
||
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.
| Reporter | ||
Comment 2•6 years ago
|
||
These prefs should eventually be converted to static prefs or just use code constants, but rather than gut the tests that use these pref values I decided to go for the least invasive route and set callbacks for the two structs.
| Assignee | ||
Comment 3•6 years ago
|
||
This is a weird conversion because the existing VarCache mirror prefs are in a
two static structs, one for touch prefs and one for the equivalent mouse prefs,
and we dynamically select the appropriate struct in GetPrefsFor().
(But note that ui.mouse.radius.reposition and
ui.mouse.radius.inputSource.touchonly do not have corresponding touch
prefs! For touch events they are always considered to be false.)
The commit make the following changes.
- It makes the prefs into static prefs.
- It changes
GetPrefsFor()so it copies the values of the static prefs into a
temporary struct, which is then read from. - It renames some fields in
EventRadiusPrefsto make them more closely match
the pref names.
Updated•6 years ago
|
| Assignee | ||
Comment 4•6 years ago
•
|
||
Kris: here's my attempt, which is more invasive but avoids callbacks. I ended up just making copies of the static pref values instead of using function pointers like I suggested in comment 1.
Comment 6•6 years ago
|
||
| bugherder | ||
Updated•5 years ago
|
Description
•