Contact emails
jochen....@googlemail.com
Explainer
https://gist.github.com/jogibear9988/8420264d0911ce6c5aab0ac5cda0744e
Specification
https://drafts.csswg.org/cssom-view/#the-geometryutils-interface
Summary
Prototype the CSSOM View GeometryUtils API in Blink behind the existing GeometryUtils runtime flag. The API exposes getBoxQuads(), convertQuadFromNode(), convertRectFromNode(), and convertPointFromNode() on Document, Element, Text, and CSSPseudoElement so authors can obtain and convert precise DOM geometry using standard DOMPoint, DOMRect, and DOMQuad objects.
The underlying DOM geometry value types, including DOMPoint, DOMRect, and DOMQuad, already exist in Chromium; this prototype adds the node-based geometry utility methods.
Blink component
Blink>Geometry
Web Feature ID
dom-geometry
Goals for experimentation
None
Risks
Interoperability and Compatibility
Interoperability risk is relatively low. These APIs are defined in the CSSOM View specification and are not Chromium-specific.
Firefox already implements the GeometryUtils APIs, including getBoxQuads(), convertPointFromNode(), convertRectFromNode(), and convertQuadFromNode(), providing an existing independent implementation.
The main interoperability risk is differences in geometry calculations for edge cases such as CSS transforms, SVG, nested browsing contexts, and fragmented inline elements. Web Platform Tests are used to verify behavior across implementations.
Gecko: Shipped/Shipping (
https://bugzilla.mozilla.org/show_bug.cgi?id=1107559)
WebKit: No signal
https://bugs.webkit.org/show_bug.cgi?id=321597
rdar://problem/185319307
Web developers: Positive (
https://github.com/web-platform-dx/developer-signals/issues/301)
Other signals:
Ergonomics
The APIs are synchronous geometry queries and may require style and layout to be up to date, similar to existing geometry APIs such as getBoundingClientRect(). Authors should avoid excessive geometry queries that cause repeated synchronous layout. No additional ergonomics risks are known.
Activation
The API can be used directly without additional libraries. A polyfill is available for browsers that do not yet implement the GeometryUtils APIs:
https://github.com/node-projects/get-box-quads-polyfill
Security
No new security risks are known.
The APIs expose geometry information that is already available through existing DOM/CSSOM APIs such as getBoundingClientRect() and getClientRects(). They do not expose cross-origin document contents or bypass existing same-origin restrictions.
WebView application risks
Does this intent deprecate or change behavior of existing APIs,
such that it has potentially high risk for Android WebView-based
applications?
Low risk. This feature adds new APIs and does not deprecate or change the behavior of existing APIs. Existing Android WebView applications that do not use these APIs are unaffected.
Debuggability
The APIs are directly callable from JavaScript and the DevTools console. Returned DOMPoint, DOMRect, and DOMQuad objects can be inspected normally.
Will this feature be supported on all six Blink platforms
(Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?
Yes
Yes
https://github.com/web-platform-tests/wpt/pull/61015
DevTrial instructions
https://gist.github.com/jogibear9988/fab3ab3f4529874c91f07d0d3768d0b7
Flag name on about://flags
No information provided
Finch feature name
GeometryUtils
Requires code in //chrome?
False
Tracking bug
https://issues.chromium.org/issues/427918516
Measurement
No dedicated UseCounters have been added yet.
Estimated milestones
No milestones specified
Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/6015941766807552
Links to previous Intent discussions
Intent to Prototype:
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6a4d5bd1.a289f910.4de7f.0524.GAE%40google.com