You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seem to be at least two different models for hit testing at (x, y):
Treat the hit test location as a pixel, namely, a 1x1 rectangle with top-left corner at (x, y), and then return elements whose boxes have non-zero intersection with the pixel
Treat the hit test location as a zero-sized point at (x, y), and return elements whose boxes contain the point. Note that boxes are considered as left-closed-right-open and top-closed-bottom-open; In other words, a point on the bottom or right edge of a box doesn't hit the box.
The two models have different behaviors when taking subpixels into account. See fiddle https://jsfiddle.net/bgec7tzo/4/, where the behavior in Chrome is different from Firefox/Safari. Chrome uses model 1, while Firefox and Safari seem closer to model 2.
So I think we should make it clear how hit testing works with subpixels.
Btw, neither of the models seems fully natural to me:
In model 1, using a 1x1 pixel coordinated at a non-integer location seems weird
In model 2, the left-closed-right-open requirement seems artificial, but all browsers follow it so I guess we can't really remove it; This requirement also creates some difficulties when we need to flip the coordinate space for direction and writing-mode
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
There seem to be at least two different models for hit testing at
(x, y)
:(x, y)
, and then return elements whose boxes have non-zero intersection with the pixel(x, y)
, and return elements whose boxes contain the point. Note that boxes are considered as left-closed-right-open and top-closed-bottom-open; In other words, a point on the bottom or right edge of a box doesn't hit the box.The two models have different behaviors when taking subpixels into account. See fiddle https://jsfiddle.net/bgec7tzo/4/, where the behavior in Chrome is different from Firefox/Safari. Chrome uses model 1, while Firefox and Safari seem closer to model 2.
Also note that in some other cases Safari and Firefox behave differently.
So I think we should make it clear how hit testing works with subpixels.
Btw, neither of the models seems fully natural to me:
direction
andwriting-mode
The text was updated successfully, but these errors were encountered: