"rectToScreenRect()" in LayoutUtils.sys.mjs has to return pixels in CSS units
Categories
(Toolkit :: General, defect)
Tracking
()
People
(Reporter: whimboo, Unassigned)
Details
While the getElementBoundingScreenRect()
method in this module returns already CSS pixels, the rectToScreenRect
method doesn't. This means that based on the device's pixel ratio different results are returned.
Filing this because it's needed for our work on dispatch async events through the parent process in Remote Agent (bug 1773393).
Comment 1•1 year ago
|
||
The severity field is not set for this bug.
:mossop, could you have a look please?
For more information, please visit BugBot documentation.
Comment 2•1 year ago
|
||
It's not terribly clear why this would block bug 1773393
Reporter | ||
Comment 3•1 year ago
|
||
(In reply to Dave Townsend [:mossop] from comment #2)
It's not terribly clear why this would block bug 1773393
Event specific methods in DOMWindowUtils like for mouse, touch and wheel expect all CSS pixels as input for the coordinates of the event. As such we would need a way to get the CSS pixels from a given rect or point similar to the getElementBoundingScreenRect()
method which already returns that.
Are there any reasons why rectToScreenRect
actually returns device pixels instead of CSS pixels?
Comment 4•1 year ago
|
||
(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #3)
(In reply to Dave Townsend [:mossop] from comment #2)
It's not terribly clear why this would block bug 1773393
Event specific methods in DOMWindowUtils like for mouse, touch and wheel expect all CSS pixels as input for the coordinates of the event. As such we would need a way to get the CSS pixels from a given rect or point similar to the
getElementBoundingScreenRect()
method which already returns that.Are there any reasons why
rectToScreenRect
actually returns device pixels instead of CSS pixels?
Makoto wrote it so maybe they know but I suspect it is just what was needed at the time. There are very few consumers so you could possibly change the method and all the callers or just add another method there.
Reporter | ||
Comment 5•1 year ago
|
||
Interesting that all the existing references for rectToScreenRect
are only used under /mobile
.
I wonder how changing the result to CSS pixel would affect real Firefox builds on Android. For all the wpt tests we force the layout.css.devPixelsPerPx
preference to 1
so we might not see a difference.
Makoto, do you think that we can just change it or do we have to take care of other code as well? Thanks.
Comment 6•1 year ago
|
||
This converts the rectangle to device's pixel scale. Since GeckoView will use mobile viewport.
getElementBoundingScreenRect uses ToScreenRectInCSSUnits, but rectToScreenRect uses ToScreenRect. See both code what different.
Updated•11 months ago
|
Description
•