Repository navigation
Fail a row that an occupant taking its seat stands taller - #3764
Conversation
Twice a place changed size as one occupant gave way to another: page search stood the floating panel's row taller than the comment field it replaced (#3710), and a margin card's Reopen grew its controls row. The shift watch passed both, because a row standing on its foot rises at its top while every word and control in it stays put. `tests/swap_watch.js` joins the browser fixture's watches and runs on every test in every engine. A swap is a frame in which a box keeps its place while one child stops drawing a box and another starts, by removal and insertion or hiding and showing. The watch fails a flex row whose height changes in a swap the way its tallest occupant's did, where the change reaches the box holding the row and the taller occupant isn't taller for its content (typed words, or growth while it stood). A trusted key or press first judges what changed since the last painted frame, so a swap a test opens and closes between two frames is still judged. Measured on 1,086 browser tests, every third and second-of-three test across margin, threads, controls, widgets, drafts, navigation, projection, the floating panel, options, reactions and commands: - Judging every place in every axis fired 678 times in 336 tests, nearly all views, lists and cards growing with what they show. - Flex lines in their cross axis, with the occupant and container readings, fired 19 times: 8 were columns, cards and lists taking the width of their words; 3 were drafts whose words sized the panel's field; 8 were the defect below. - The rule as landed fires 9 times in 8 tests, all one defect: under a finger, the Threads list's filter tabs stood at the 44px floor, so the panel's controls row was 47px in the list and 40px in a thread. Recall: with #3710's CSS reverted, it fails `test_whatever_the_field_holds_the_row_keeps_its_line` under a mouse and a finger, naming page search's field and its search surface. On main, Reopen is as tall as Resolve, so the margin card's case only shows on the control-line branch. The filter tabs now stand 26px tall and reach the floor through the panel's unpainted reach, with the strip keeping the reach's room inside its scroll box, so the controls row is 40px in both views. The watch costs a median 11ms of script per test (p90 27ms) in the sampled pages. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… one task's events - A document that `document.open()` empties holds no place; the watch threw on it and, with its reset skipped, on every frame after. - A moved occupant keeps its last size, and an element read before a frame is watched again, unobserved first, since observing twice reports nothing. - Only keydown and pointerdown judge before a frame: the mouse and touch events a press brings run in its task, so a swap one of them undoes was never painted. - Judging before a frame reads everything inside an element whose attributes changed, as a panel's mode attribute swaps occupants several levels down, and reads an inline box as empty, as the observer does. - Only a field that grows with its words exempts its occupant; a one-line input's words never size it. - Resize, presentation and hidden-tab exemptions last until the second frame after their cause, as the shift watch counts them. - The filter tabs' 26px face is one token. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A child a keyed renderer takes out and puts back in the same row took no one's seat, so a row that lost its tallest item while one moved within it no longer reads as a swap. Judging before a frame no longer reads the whole page when the runtime sets a class on the root or the body as the pointer moves, which cost a press 22-36ms on an 8,000-element page; it now costs about 1ms. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The row swap watch can fail a valid content-driven resize. The inline case reproduces a false finding from the browser fixture.
A row whose field took more lines in the same press as a short occupant gave way to a taller one grew for the field, not the swap. The occupant that grows or shrinks a row must now stand taller than every child that stood through the swap, on its side of it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The new sibling scan still attributes a shadow-root row's growth to the swapped occupant; see the inline reproduction.
…h a swap A flex host lays out its shadow tree, and a slot its assigned elements, so a field that grows beside the swap inside a shadow tree now vetoes the finding as one in light DOM does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
laidOut reads a shadow tree only when attachShadow populated roots. A declarative <template shadowrootmode="open"> creates a root without calling that hook, and the watch also never observes its children. I reproduced a flex row with a declarative shadow root whose 24px button gives way to a 40px button: the row grew, but judge_watches() reported no place-resized finding. The repository uses declarative shadow roots in test_render_export.py, so this leaves a supported page shape outside the new check. Discover and observe roots already present when a host enters the document, and let laidOut read those roots too.
An open declarative shadow root never reaches the patched attachShadow, so its host's arrival now adopts it: its children are observed and laid out as the host's. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Declarative shadow roots: fixed in 3172c8e. A host's arrival now adopts an open shadow root the parser built, so its children are observed and laid out as the host's;
|
|
Confirmed: the declarative shadow root now participates in the swap watch, and the focused regression test passes at |
) The swap watch added in #3764 disturbed several browser fixtures on main. It waited for animation frames in offscreen frames where Chrome does not paint, observed unrelated descendants deeply enough to trigger a ResizeObserver loop, and measured new nodes in a concealed tab before a press. This change drains swaps after the existing shift-watch paint checkpoint, observes only flex rows and the boxes needed to judge them, and measures arrivals only when they belong to a tracked row. It also treats an SVG drawing's intrinsic height as content growth, so replacing a diagram's source with its drawing does not fail the row rule. The failing cases from [main CI run 39975651411](https://github.com/max-sixty/leaf/actions/runs/39975651411) for hidden and offscreen frames, revision layout, diagram rendering, and hidden-tab log scrolling now pass. A focused selection of 19 browser cases passed, including the swap watch's positive and negative examples; Prettier and ESLint passed on the changed file. The run's press-handling and quote failures were repaired on main by #3767 and #3766. Co-authored-by: leaf-agent <[email protected]>
The browser fixture now fails a test when a flex row's height changes as one occupant gives way to another. That was the pattern of #3710, where page search stood the floating panel's row taller than the comment field it replaced, and of the margin card's Reopen growing its controls row. The shift watch passed both: a row standing on its foot rises at its top while every word and control in it stays put. On a sample of 1,086 browser tests the check fired 9 times in 8 tests, all on one real defect, which this PR fixes.
The watch
tests/swap_watch.jsruns on every page the fixture opens, in every engine, beside the words watch.keydownorpointerdownfirst judges what changed since the last frame, as the page then lays it out. Without this, page search opened and closed between two frames, and the Keep the floating panel's row one line tall whatever its field holds #3710 regression passed.Measurements
The sample was two-thirds of the 1,629 tests in
margin/,threads/,controls/,widgets/,drafts/,navigation/,projection/and the floating panel, options, reactions and commands modules, run before merging #3738:test_whatever_the_field_holds_the_row_keeps_its_lineunder a mouse and a finger when page search's WebAwesome box gets its vendor height back. That is Keep the floating panel's row one line tall whatever its field holds #3710's cause, re-created on the merged tree by dropping--wa-form-control-height. Onmainbefore Make every one-line control its place's line, and meet the touch floor with a reach #3738, Reopen and Resolve were both 28px, so the Reopen case had no height change to catch. A swap a renderer spreads over two frames is missed.The defect it found
Under a finger, the Threads list's filter tabs stood at the 44px floor. The panel's controls row was therefore 52px in the list and 42px in a thread (47px and 40px before #3738). The tabs now stand 26px tall, as under a mouse, and reach the floor through the panel's unpainted reach. The strip keeps the reach's room inside its scroll box, so nothing clips it, and takes none in the row. Both views now show a 42px controls row, and the aim sweep finds no short aim in the Threads list under a finger.
Known limits
rendering.js), and none of the roughly 1,400 test runs in this work hit one.--lf-line. A sweep asserting that per control, in each mode, would catch control-height cases without a test having to swap them. It would not catch a composite occupant such as page search's surface, which this watch does.Checks
tests/browser/test_render_swap_watch.py: a growing occupant fails when replaced, moved in, shown, swapped across two tasks in one frame, or swapped inside a declarative shadow tree. These pass: a filling occupant, one its own words grew, a swap the same press undoes before any frame, a row that loses its tallest item while a sibling moves within it, and a row a neighbouring field grows in the same press, in light DOM or a shadow tree. Each passing case was checked to fail with its mechanism removed.document.open(), missed moved-in occupants, a false firing on reorders and on a press's own mouse events, and a 22-36ms cost per press when the runtime set a body class; all are fixed and re-reviewed. The auto-reviewer's findings (a neighbour sizing the row, a shadow host's children, declarative shadow roots) are fixed too.test_every_control_the_layer_offers_is_a_box_the_user_can_hit(both pointers), the shift watch's document-replacement test andtests/modelpass.test_composer_return_edits_or_sends_according_to_its_keyboard[android],test_align_current_item_from_the_menu_on_touch_reserves_z,test_shot_controls_have_disjoint_targets_and_labels_stay_passive[True].