Repository navigation
test: resolve an anchor the document names through ::part() in the shift watch - #7365
Conversation
…ift watch
The runtime names a box inside a widget's shadow tree from the document, with a
`::part(lf-aN) { anchor-name: --lf-aN }` rule (dom/css-anchors.js). The shift
watch keyed every anchor name by the named element's own root, so a carrier in
the document that anchors to such a box (the margin carrier for a heading in the
workspace widget's reader) recorded no anchor. Its native lag behind the
reader's scroll then had no credit at all, and the watch reported the margin
marker as moved without input.
A shadow-tree element that exposes a part now registers its anchor names in its
host's tree as well. The lagging-anchor test gains cases whose words stand in a
shadow tree named through `::part()`: they failed every time before the change.
Under `leaf-dev suite flake --workers 4 --load 2 --cpu-throttle 3` on Linux,
test_primary_reading_holds_remote_changes_before_package_layout[Feed] errored at
teardown in 11 of 24 and 17 of 24 copies on main at 43fed2e, and passes 54 of
54 with the change.
Refs #6744
|
@leaf-agent The shift watch registers every computed anchor name on an element exposing a CSS part in both the shadow tree and the document tree. A part can exist for styling while the shadow stylesheet declares an unrelated private anchor. If its name matches a real document anchor, this marks the document mapping ambiguous and drops valid scroll credit. Please track which names the outer tree actually declares, and cover a private shadow anchor sharing a document anchor’s name.
|
…ule there declares it The shift watch registered every computed anchor name on an element that exposes a part in both its shadow tree and its host's tree. A part can exist for styling while the shadow tree's own style gives a private anchor; when that name matched a real document anchor, the document's mapping became ambiguous and dropped valid scroll credit. Now a name counts in the host's tree only when a ::part() rule in that tree's sheets matches the element and declares the name; every other name stays in the element's own tree. The carried-row test gains a case beside a shadow tree's private anchor of the same name, which fails on the previous watch ([step--private]) and passes now. Co-Authored-By: max-sixty <[email protected]>
|
Done in d4ec2b3. The watch now gives an anchor name to the host's tree only when a
|
The shift watch couldn't resolve an anchor that Leaf names from the document through
::part(), so it gave no credit to a margin marker whose carrier lags its heading's scroll by a frame. That missing credit is the(0, -95)pxteardown error thattest_primary_reading_holds_remote_changes_before_package_layout[Feed]keeps hitting on macOS.dom/css-anchors.jsnames a box inside a widget's shadow tree with a document rule,::part(lf-a3) { anchor-name: --lf-a3 }. That name belongs to the document's tree, but the watch's anchor map keyed every name by the named element's own root, the shadow root. So the margin carrier in the document, withposition-anchor: --lf-a3, recordedanchor: nullat every reading. With no anchor recorded,scrollMotionnever reaches itsnative_anchorcredit. That is why the failing evidence hasscroll_terms: []. I found this by instrumenting a failing copy: the carrier's paint readanchor: null, and no light-DOM element carried--lf-a3. The copies that passed did so only when the carrier's catch-up landed inside the click's own input window.With this change, an anchor name a shadow-tree element takes from a
::part()rule in its host's tree registers in that tree, the one a document::part()rule reaches. The watch finds those names by matching the host tree's::part()rules that declareanchor-nameagainst the element's parts and its host; every other name, such as a private anchor the shadow tree's own style gives a box that exposes a part only for styling, stays in the shadow tree. A name that two elements hold in one tree still resolves to none, as before.Verification
test_a_carried_row_keeps_its_anchor_s_lagging_scrollgainspartcases, where the row's words sit in a shadow tree named through::part(). On main,[step--part]and[twice--part]fail every run with the same empty-credit finding. It also gainsprivatecases, where the document's words sit beside a shadow tree whose own style gives a parted box a private--wordsanchor;[step--private]fails on a watch that registered every parted name in both trees. With the change, all 12 cases pass, and therowfault cases still report the row.leaf-dev suite flake --workers 4 --load 2 --cpu-throttle 3on Linux: on main at43fed2e7eit errored in 11 of 24 copies, then 17 of 24 in a second run. With the first version of the change it passed 54 of 54, and with the current one 24 of 24.flake: on main, 5 errored at teardown with the same finding (run 45957207466). On this branch, all 54 passed (run 45957210757).-k anchorcases intest_render_shift_watch.pypass, 45 in all.#6744 also tracks the shift-watch overshoot case, the Firefox comment marks and the
reading_placeglide. This PR doesn't touch them.Refs #6744 — automated triage