Five follow-ups to the Chrome APIs plan
Five small experiments that the Chrome APIs plan left open, on one stage. Pick one. Semantic zoom swaps a tile that is too small to read for a one-sentence stand-in. Column pages turns the columns of a multi-column element like pages. Text rectangles compares the selection rectangles of canvas text with those of a DOM range. Float buffer draws a panel into a 16-bit float WebGL buffer with a bloom pass. Effect from CSS picks the shader effect of each card with a custom property. The stage starts on a 2D canvas. The WebGL context is made when one of the last three is first chosen.
This browser can't draw elements into a canvas, so the five experiments aren't shown.
none, wave, split and lines.
Show the code five paint routines on two canvases, one shader
- Semantic zoom. Each tile and its stand-in are drawn at the same place, with the alpha set by the size of the tile's text on screen.
- The Summarizer call that replaces the stand-in text.
- Column pages: the element. Five columns in one element.
- Column pages: the draw. Two quads from one texture while a page turns.
- The fragment shader. Four modes: plain, page turn, raise above 1.0, effect chosen in CSS.
- Text rectangles.
Range.getClientRects()on the drawn element andTextMetrics.getSelectionRects()on canvas text. - Float buffer. The panel goes into a float texture, then the bloom chain.
- The float drawing buffer and extended tone mapping.
- When the float buffer is asked for.
- The bloom passes.
- Effect from CSS: the rules.
- Effect from CSS: the read. A registered
<custom-ident>becomes a number for the shader.
How it works
Semantic zoom. Six tiles and six stand-ins are children of a 2D canvas. The canvas draws each tile at its place in a 3 by 2 grid, scaled by the zoom. Body text is 14 pixels, so under a zoom of about 0.6 it is
below 8.5 pixels on screen. Between 0.5 and 0.72 the tile fades out and its stand-in fades in at the same rectangle. The stand-in holds the first sentence of the tile until "Use the Summarizer API" is pressed,
which asks Summarizer for a headline of each tile. Both are elements, so a tap on either one reaches a click handler at any zoom.
Column pages. The article has columns: 5, a fixed height and no gap, and is 1,250 pixels wide. Its picture is uploaded once as a texture. A page is one fifth of the texture. During a turn the shader maps
the top page onto a cylinder that rolls from right to left and shows the back of the paper where it has come over. After each draw updateElementGeometry() places the element so that the shown page lines up with its picture.
Text rectangles. The top line is a DOM element drawn with drawElementImage(), and the blue boxes are Range.getClientRects() for the chosen characters. The bottom line is the same string drawn with
fillText() in the same font, and the orange boxes are TextMetrics.getSelectionRects(), which is in Chrome 160 and behind the experimental features flag before it. The status line gives both lists and the largest difference.
Float buffer. texElementSubImage2D() gives WebGL an 8-bit picture, so no value above 1.0 arrives. The shader multiplies the badge, the button and the full-white pixels of the strip, and draws into an
RGBA16F texture. A bright pass keeps what is above 1.0, four blur passes at a quarter of the size spread it, and the composite adds it back. The canvas's own buffer is asked to be RGBA16F with
drawingBufferStorage(), in Display P3, with drawingBufferToneMapping({ mode: 'extended' }) where that exists. The page asks for the float buffer at the start only on a screen that matches (dynamic-range: high).
If the stage is empty with the float buffer, choose the 8-bit one: the bloom is the same and nothing passes white.
Effect from CSS. --fx is registered as a <custom-ident>. Once a frame the page reads it from each card with getComputedStyle() and looks the name up in a table of effect numbers, next to the
number and colour uniforms that lib/css-uniforms.js reads. The binding is in this page's own code. lib/shader-fx.js wasn't changed, because it's shared by other pages.
Live checks
These wait for a tap, because two of them use the page's WebGL context and read pixels back from it. The 2D checks run on their own small canvases in the corner of the window. The WebGL checks draw a 40 pixel fixture into the float texture, not the demo.
Findings
- Measured in Chromium 157 (headless, software rendering) on 2026-11-21. The live checks above give the answers for the browser you are using.
- A drawn element keeps its click target at any scale in a 2D canvas. A 200 by 100 element drawn at 60 by 30 is clicked inside the small rectangle and not where its full size would be.
- An element that isn't drawn in a paint keeps the click target of its last draw. When the stage changed experiment, the tiles of the first one were still clicked through the text of the third. The page draws each unused element outside the canvas with an alpha of 0, and on the WebGL canvas moves it with
updateElementGeometry(). - An element with
columns: 5and a fixed height is one picture with all five columns, 2,500 by 660 pixels at a scale of 2. No scroll container is needed to get the columns of a text as separate pages. - The scroll markers of a multi-column scroller (
::column::scroll-markerwithscroll-marker-group: after) aren't in the picture of the drawn scroller: the picture is the size of the element and no marker pixel is in the canvas. SettingscrollLefton the drawn scroller changes its picture to the next column. TextMetrics.getSelectionRects()is absent without the experimental features flag. With the flag, for 20 pixel serif text, its rectangle and the one fromRange.getClientRects()start within 0.01 pixels of each other, differ by 0.03 pixels in width and are both 22 pixels tall. For a selection across Latin and Hebrew text in the demo both give three rectangles of the same widths, and the largest difference at an edge is 0.43 pixels.drawingBufferStorage(gl.RGBA16F, …)is accepted on a drawable WebGL canvas,texElementSubImage2D()still uploads into the context, and a white box multiplied by 4 reads back as 4.00 from the float scene texture and from the drawing buffer.drawingBufferToneMapping()exists only with the experimental features flag.- The test browser, which composites in software, shows nothing for a WebGL canvas with an
RGBA16Fdrawing buffer: the canvas is empty on screen and the console reports an invalidreadPixelsformat for each frame, although the buffer holds the picture. So the page asks for the float buffer at the start only where(dynamic-range: high)matches, and has a control for both. - A registered
<custom-ident>reads back fromgetComputedStyle()as the name. In a 1 second linear transition it readnoneat 0.25 s andwaveat 0.75 s, while a registered number read 0.25 and 0.75. - Seen on my phone (Chrome 159, Android, experimental features flag on) on 2026-11-22: the
RGBA16Fdrawing buffer is shown, with tone mappingextended, and the raised parts are much brighter than white. At a headroom of 4.0 and a bloom of 1.0 the labels were hard to read, so the page now starts at 2.5 and 0.4. With the 8-bit buffer every raised pixel was cut off at white and the labels were lost. The composite now scales such a pixel down with its colour kept. On the float buffer the labels of the button and the badge and the word in the strip were then reported readable, the word "very clear". - Not verified: what
Summarizerreturns. The test browser has no HDR output and reports the model as "downloadable".