- From: Xiaocheng Hu via GitHub <sysbot+gh@w3.org>
- Date: Wed, 15 Apr 2020 22:59:19 +0000
- To: public-css-archive@w3.org
xiaochengh has just created a new issue for https://github.com/w3c/csswg-drafts: == [cssom-view] Specify subpixel hit testing for Document.elementFromPoint() etc. == There seem to be at least three different models for hit testing at `(x, y)`: 1. 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 2. 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. Also note that [in some other cases](https://wpt.fyi/results/css/cssom-view/elementFromPoint-subpixel.html?label=experimental&label=master&aligned) 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: - 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` Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4955 using your GitHub account
Received on Wednesday, 15 April 2020 22:59:25 UTC