Skip to content

Commit 9cffd0b

Browse files
committed
TL13a: raea-page-host restyles finely by default. Each attribute set or cleared restyles what Stylo's snapshot invalidation finds and each ancestor itself, not the element's parent's whole subtree; RAEA_FINE_RESTYLE=0 brings back Blitz's own way, and other binaries keep it off unless set. Proven before it was made the default: ui-parity full with it on is 269/271, the same two cases failing as with it off (p15-media canvas-text and img-downscale); the app's timeline suite in a headless raea window with it on passes 53 of 54 (TL10d skips itself there); the 400-clip drag in that window ran at 48-50 fps against 38-41 without, the window's still rate 52-55. The page host sets it in main before any thread starts, as --root's RAEA_PAGE_ROOT is. docs/timeline.feature TL13a has the numbers
1 parent d190585 commit 9cffd0b

3 files changed

Lines changed: 32 additions & 16 deletions

File tree

‎docs/timeline.feature‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,22 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
314314
drawn smaller than they ship and laid out as they ship (raea's <Composition edit={{ scale }}>, the
315315
long side at 960 px; docs/lightspeed.feature PF4): a ray-traced 1080p shot's draft 2.75 s at full
316316
size, 1.7 s scaled
317-
not built TL13a's drag at the window's rate with 400 clips (measured below: Chrome keeps it, raea's window
318-
draws 35 frames a second, bound by the page host's frame after a step: Stylo's restyle, which Blitz
319-
widens to the changed element's parent's whole subtree, paint, and every element's rect taken each
320-
frame. RAEA_FINE_RESTYLE=1 (a trial in vendor/blitz-dom mutator.rs, off by default) measured 11-14 in
321-
a headless window, three rounds alternating: the drag 37, 47 and 49 fps (median frame 25.0, 19.2,
322-
18.9 ms) against 31, 34 and 38 off (34.6, 30.4, 27.9 ms), the window's still rate 51-57; not yet
323-
the window's rate, and not the default until ui-parity passes with it on (its build waits on disk:
324-
1 GB free). In one drag profiled with it on (the run timed out under the profiler, so a weak
325-
read), the page host's busiest frames were the rect walk (get_client_bounding_rect,
326-
transformed_rect); drawing only the clips in view would
327-
draw none fewer, since at its opening fit all 12 tracks and all 400 clips are on screen at once).
317+
not built TL13a's drag at the window's rate with 400 clips, though close (measured below: Chrome keeps it;
318+
raea's window drew 35 frames a second, bound by the page host's frame after a step: Stylo's restyle,
319+
which Blitz widened to the changed element's parent's whole subtree, paint, and every element's rect
320+
taken each frame). raea-page-host now restyles finely by default (vendor/blitz-dom mutator.rs: what
321+
the snapshot's invalidation finds, the changed attribute named in the snapshot even when it was
322+
added, and each ancestor itself for `:has()`; RAEA_FINE_RESTYLE=0 for Blitz's own way), and a rect
323+
with no transform above it is answered without matrix math. ui-parity with it: 269/271, the same
324+
two cases failing as without (p15-media canvas-text, img-downscale); before the snapshot and :has()
325+
fixes it was 266. The app's timeline suite in a headless window with it: 53 of 54 pass, TL10d
326+
skipping itself there. Measured 11-14 in a headless window, three rounds alternating: the drag 38-41
327+
fps without, 48-50 with, against the window's still rate of 52-55, so about 90% of it; a pick
328+
42-62 ms and a split 46-63 ms. A sync of the twins that keeps their boxes on each pointer move
329+
(RAEA_TWIN_SYNC_LIGHT=1, a trial, off) gained nothing. Under another session's load the drag held
330+
the same share of the still rate with the :has() fix as without (0.66-0.72 each, four rounds).
331+
Drawing only the clips in view would draw none fewer: at its opening fit all 12 tracks and all 400
332+
clips are on screen at once.
328333
TL13a's stage clause is met (an edit on the scene's stage by 88 ms, median, TL13b). The
329334
skills guide's note on an item's `timeline` field waits for PR #19 to merge
330335

‎engine/page/host/src/main.rs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
//! it, bevy_ui's kinds. --root: where the page's own-origin fetches are read from (RAEA_PAGE_ROOT). --size: the
77
//! window, default 1440x900. RAEA_PAGE_BRP_PORT (default: a free one), RAEA_PAGE_MCP_PORT (default 7477; 0: none),
88
//! RAEA_PAGE_PICK=0: the page's pointers and keys dispatched by the host (page::input) instead of through raea-page's
9-
//! picking route, the default. The page's `<img data-raea-stage>` plays a composition live (raea-page-stage).
9+
//! picking route, the default. RAEA_FINE_RESTYLE=0: an attribute change restyles its element's parent's whole subtree
10+
//! (Blitz's own way; the host's default is the fine restyle, docs/timeline.feature TL13a). The page's
11+
//! `<img data-raea-stage>` plays a composition live (raea-page-stage).
1012
//! --chrome inset: the page under a transparent title bar, its title area moving the window (raea-page-window).
1113
//! --window (built with the `window` feature): on screen, a window of its own that closes the app (raea's desktop app;
1214
//! RAEA_PAGE_HOST sends the page's /host/* to the feed's host: raea-page-net).
@@ -63,6 +65,14 @@ fn main() {
6365
eprintln!("raea-page-host: {e}");
6466
std::process::exit(2);
6567
});
68+
// a page's attribute set or cleared restyles what Stylo's invalidation finds, and each ancestor itself, not the
69+
// element's parent's whole subtree (vendor/blitz-dom mutator.rs): ui-parity's 271 cases come out the same case by
70+
// case, and a 400-clip timeline drag in raea feed's window went from 38-41 to 48-50 frames a second
71+
// (docs/timeline.feature TL13a). RAEA_FINE_RESTYLE=0 restyles the parent's whole subtree, as before. Set here,
72+
// before any thread starts, as --root's RAEA_PAGE_ROOT is.
73+
if std::env::var_os("RAEA_FINE_RESTYLE").is_none() {
74+
unsafe { std::env::set_var("RAEA_FINE_RESTYLE", "1") }
75+
}
6676
// headless (the benches, raea app check): the system's clipboard, files, dialogs and browser stay untouched (T2d)
6777
if !a.window {
6878
raea_io_os::set_headless();

‎vendor/blitz-dom/src/mutator.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ enum SpecialOp {
4343
UnloadCustomWidget(NodeId),
4444
}
4545

46-
/// raea (RAEA_FINE_RESTYLE=1, a trial, off by default): an attribute set or cleared restyles only what its snapshot's
47-
/// invalidation finds (the selectors that read it, siblings' and ancestors' included) and, for `style`, the element's
48-
/// own declarations (RESTYLE_STYLE_ATTRIBUTE, below), as Servo does, instead of the element's and its parent's whole
49-
/// subtrees. A clip dragged along a timeline track restyled every clip on the track each step (raea feed's TL13a).
46+
/// raea (RAEA_FINE_RESTYLE=1; off unless set, and raea-page-host sets it unless it's set already): an attribute set or
47+
/// cleared restyles only what its snapshot's invalidation finds (the selectors that read it, siblings' and ancestors'
48+
/// included), each ancestor itself (for `:has()`), and, for `style`, the element's own declarations
49+
/// (RESTYLE_STYLE_ATTRIBUTE, below), as Servo does, instead of the element's and its parent's whole subtrees. A clip
50+
/// dragged along a timeline track restyled every clip on the track each step (raea feed's TL13a).
5051
fn fine_restyle() -> bool {
5152
static ON: std::sync::LazyLock<bool> = std::sync::LazyLock::new(|| std::env::var_os("RAEA_FINE_RESTYLE").is_some_and(|v| v == "1"));
5253
*ON

0 commit comments

Comments
 (0)