drawSnapshot ignores fragments from DOMRect values
Categories
(Core :: Web Painting, defect, P3)
Tracking
()
People
(Reporter: whimboo, Unassigned)
References
Details
Attachments
(2 files)
Using an instance of a DOMRect with values containing fragments, drawSnapshot
ignores those and as such has an offset for recording the content by 1px. Instead the values have to be rounded up or down to the next largest whole number. And that is what Chrome is using:
DOMRect(100.2, 100.6, 100.3, 100.7)
DOMRect(101, 101, 100, 100)
Specifically it uses Math.ceil()
for left and top, and Math.floor()
for width, and height.
I noticed that problem when implementing screenshot tests for the remote agent, and comparing screenshots pixel by pixel. For now I will do the workaround in our code.
Matt, could you please check that? Thanks.
Reporter | ||
Comment 1•5 years ago
|
||
This is the HTML testcase which places the element at 100.5px/100.5px.
Reporter | ||
Comment 2•5 years ago
|
||
Actually by using the above example, which is better to compare differences, the output is exactly the same between Firefox and Chrome.
I assume that the is no way to ensure that the element can exactly be captured for fractional values?
Updated•5 years ago
|
Comment 3•5 years ago
|
||
I don't think we can easily capture fractional pixels.
The current code is rounding the provided rect outwards to make it include the fractional area. It sounds like chrome might be rounding in, to only include whole pixels within the fractional area.
Changing the behaviour there is pretty easy, we just need to decide what is the most useful.
Comment 4•5 years ago
|
||
The priority flag is not set for this bug.
:mattwoodrow, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•5 years ago
|
Updated•2 years ago
|
Description
•