Skip to content

[css-omview] update description of getBoxQuads API #10537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jogibear9988 opened this issue Jul 8, 2024 · 4 comments · May be fixed by #10538
Open

[css-omview] update description of getBoxQuads API #10537

jogibear9988 opened this issue Jul 8, 2024 · 4 comments · May be fixed by #10538

Comments

@jogibear9988
Copy link

The getBoxQuads API is missing lot of its description.

Issue in Firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=1107559

Description
https://hacks.mozilla.org/2014/03/introducing-the-getboxquads-api/

@jogibear9988
Copy link
Author

I've also created a polyfill for this API https://github.com/jogibear9988/getBoxQuadsPolyfill

But in the polyfill I also added an offset DOMQuad to the getBoxQuads API. I'd like to suggest to add this also. This is usefull in a designer application, if you want to draw something around an element with an offset. For example a selected rectangle, wich should be offset a few pixels

@jogibear9988
Copy link
Author

And the polyfill does not work correctly for SVG and MathML cause of missing offsetLeft/Top, see: #10514

@jgraham
Copy link
Member

jgraham commented May 14, 2025

We need this for WebDriver-BiDi. It's something that Chrome Devtools Protocol offers and which clients depend on and which blocks their migration to the standard (e.g. Playwright). Use case wise, it's because automated testing tools want to be able to dispatch pointer events (e.g. click) inside an element, even when it's transformed.

If there are concerns with landing a DOM API we could have a WebDriver-BiDi specific API to retrieve the bounding content quads for an element given a suitable definition, but if there is a DOM API we'd prefer to expose that directly.

@jogibear9988
Copy link
Author

jogibear9988 commented May 14, 2025

If there are concerns with landing a DOM API we could have a WebDriver-BiDi specific API to retrieve the bounding content quads for an element given a suitable definition, but if there is a DOM API we'd prefer to expose that directly.

I hope we would get this as a DOM API. I think there are many App wich could benefit from such an API. For example WYSIWYG Designers (like https://github.com/node-projects/web-component-designer, https://grapesjs.com/, https://craft.js.org/, ...), VisBug (https://visbug.web.app/), SVG Editors (so many...) could benefit from this.

My Designer is for example now using my polyfill, but it could not work correctly for SVG & MathML cause they don't provide offsetXXXX Properties. And also the performance is so much slower then the native implementation in Firefox. And the Brows does need to calculate these Points anyway to draw the elements.
So hopefully we get this forward to get a native implementation.

As I see, the DevTools API does not support the "fromBox" & "toBox" option. So this a thing wich need to be worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants