[Gecko Bug 1931692] Make MouseEvent::DuplicatePrivateData()
keep storing `mPresContext
#49822
+156
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently,
offsetX
andoffsetY
are defined by CSSOM spec [1]. The specdefines that when the event is not being dispatched, these values should be
same as
pageX
andpageY
. However, we started computing the values withthe latest data since bug 1203404 for compatibility with the other browsers.
However, the test does not check the trusted event behavior. When the event
is a trusted event,
Event::DuplicatePrivateData()
clearsEvent::mPresContext
. Then, callingEvent::GetOffsetCoords
with specifyingmPresContext
aborts to compute it [2]. Therefore, our mouse events return0
foroffsetX
andoffsetY
after propagation.Blink and WebKit caches
offsetX
andoffsetY
values when they are referredfirst time [3][4]. Therefore, their values depend on when they are
referred. I don't think we should follow their tricky behavior immediately.
However, at least, we should return same computed result until the layout and
scroll position are not changed. Therefore, this patch makes
MouseEvent
keeps storing
mPresContext
even after callingUIEvent::DuplicatePrivateData()
and use it when callingEvent::GetOffsetCoords
.Finally, this adds a WPT under
uievents
to check current behavior in thesimplest case (i.e., neither scroll position nor layout is not changed after
starting the propagation).
Differential Revision: https://phabricator.services.mozilla.com/D232589
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1931692
gecko-commit: 42de37e6c1b427a7a0b66aeaa2084dd4a1d8a408
gecko-reviewers: smaug