Commit Graph
2 Commits
Author SHA1 Message Date
shinyobjectz 0ee51a1c64 Inline text in a scrolled element is scrolled once, as Chrome scrolls it, not twice (closes #46). blitz-paint's render_element drew a scroller's contents scrolled two ways: it subtracted the scroll offset from content_position, and (since #18) pre-translated the transform by it. Inline text and a text input's text are placed by both, so a box with scrollTop 60 showed its text 120 px up: "Three" over "Four" where Chrome 148 shows "Two" over "Three". Block children are drawn through the transform alone, which is why sdk/ui's overflow-scroll case (block rows) never caught it. content_position now stays put and the transform scrolls everything. #37's text mask is unchanged: Chrome masks a scroller's background with its text unscrolled (scrollTop read back 60, and a forced repaint kept the mask at "One" over "Two"), and raea's mask already ignored the scroll. Its doc comment now says so instead of calling the offset a gap.
bench/background-clip-text/check.sh adds scrolled.tsx: a plain scroller and a text-clipped one, each scrolled down a line. Only "Three" reaches past x 112, so a strip at x 112-140 tells the lines apart. The raea before this fails both of the plain scroller's strips, and the raea with it passes all of them.

fps, the same 120-frame scrolled.tsx back to back, three runs each: 4.7, 4.0, 4.5 ms a frame before, 4.5, 4.4, 4.0 after (about 230 fps both; the change removes a subtraction).
2026-11-07 22:41:07 -08:00
shinyobjectz 3892ac4367 background-clip: text clips a background to the element's text, as Chrome does (closes #37). Gradient text, a common headline style, came out as a gradient box with the text invisible. Two gaps: the vendored stylo knew the text value only for Gecko, so in Servo mode the declaration didn't parse (and #34's note didn't list it: stylo doesn't report a drop of a property the block already set, here through its background shorthand), and blitz-paint had no text clip. Now stylo takes text for Servo too, and blitz-paint draws a background with a text clip in a group that the text then masks (Compose::DestIn). The mask is the element's own inline layout plus the text of every element inside it, at its place (draw_text_mask: glyphs opaque, without their shadows). A scroller's offset isn't applied inside the mask.
Test: bench/background-clip-text/check.sh draws "Gradient" three ways: with background-clip, with -webkit-background-clip alone, and through a block inside the clipped one. The G's stem must be the gradient's pink, and the box beside and above each word must be the page's #111, as Chrome 148 gives them. Before: 6 of 10 pixels failed (the gradient box). After: PASS. TSX's backgroundClip and WebkitBackgroundClip, and an inline <span> inside, also match Chrome by eye.

fps, the same 300-frame page with three clipped lines, before (17:54 build) and after, back to back in three rounds: 493/542/533 vs 518/599/489 fps incl. encode, no cost beyond the noise.
2026-11-07 18:28:19 -08:00