Open whimboo opened 2 months ago
The Browser Testing and Tools Working Group just discussed Support retrieval of content quads for elements with CSS transitions
.
I believe the difference is that quad returns 4 points whereas the rect returns only 2. So rect is always rectangular, while the quad can reflect the actual shape of the element after the transform. I think it can be still important for hit-testing.
Yes, this is actually for https://developer.mozilla.org/en-US/docs/Web/API/DOMQuad and is important (as I already mentioned) when elements are transformed via CSS.
Here an example: https://drafts.fxtf.org/geometry/#example-9bbe24bd
It looks like that we maybe should discuss it again today when we are all present?
The Browser Testing and Tools Working Group just discussed Support retrieval of content quads for elements with CSS transitions
, and agreed to the following:
ACTION: jgraham to speak to Emilio and get advice on what we can do here
while Firefox implements this as Element.getBoxQuads()
Note this is effectively currently unspecified: https://drafts.csswg.org/cssom-view/#dom-geometryutils-getboxquads (though supported in Firefox behind a flag).
https://github.com/w3c/csswg-drafts/issues/10537 is an issue for defining getBoxQuads
, which is a content API implementing this feature. I think this issue is blocked on having some usable definition of what getBoxQuads
does, and if that definition is also tied to a DOM API I think it would make sense for clients to use that content API via script rather than having a special API in WebDriver that does the same thing.
See also https://github.com/w3c/webdriver-bidi/issues/769 / https://github.com/microsoft/playwright/issues/32577:
Add support for getting content quads to ensure accurate clicking inside transformed elements. This is particularly relevant for tests involving transformed elements, as seen in tests/page/page-click.spec.ts.
It would be beneficial to support the retrieval of content quads for elements with CSS transformations applied. Currently, this functionality lacks a uniform W3C specification, leading to inconsistent implementations across browsers, including differences in API naming. Both Chrome and Firefox, however, support content quad retrieval.
The content quad of an element should accurately reflect its current position and size, even during CSS transitions, and should be used instead of
getBoundingClientRect()
to get the actual position and size for performing precise actions on such elements.Integrating this API directly into WebDriver BiDi would enable clients to use a dedicated command that works consistently across all browsers, eliminating the need for browser-specific implementations via
script.evaluate
orscript.callFunction
.For Chrome, the
DOM.getContentQuads()
command is available in the Chrome DevTools Protocol, while Firefox implements this asElement.getBoxQuads()
.