Repository navigation
fix: credit an anchored box whose inset adds a multi-term offset to its anchor's edge - #7390
Merged
Merged
Conversation
…ts anchor's edge The shift watch credited a box for following its CSS anchor through a scroll only where the inset read `anchor(side)` alone or plus one length or var(). A heading's link stands at `calc(anchor(top) + var(...) + (var(...) - var(...)) / 2 + var(...))`, so the watch gave it no credit, and a scroll no input owned, such as a script's fragment navigation, reported the link moving with its heading. On an idle machine the earlier click's rendering still owned that scroll; on a slow CPU it had closed, so the test failed. The watch now credits an inset whose calc() sum holds the anchor's edge as one added term and no other term reading an anchor. A new case in the watch's anchor-scroll test covers that form and fails without the change. Closes #7389
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shift watch credits a box that follows its CSS anchor through a scroll only when it can read the anchoring from the box's inset. Until now it accepted
anchor(side)alone or with one length orvar()added. The heading link'stop(browser/styles/components/integration.css,.lf-heading-link) iscalc(anchor(top, -9999px) + var(--lf-heading-link-top, 0px) + (var(...) - var(...)) / 2 + var(--lf-block-control-dy, 0px)), so the watch couldn't credit it. Intest_a_heading_copies_the_link_to_the_section_it_opens, the script'slocation.hrefnavigation to#rates%252Flimitsscrolls the page 50 px, and the link moves with its heading, which is correct. The watch reported that move as residual, with no scroll terms. On an idle machine the earlier click's rendering still owns the scroll, so nothing gets reported. On a slow CPU that rendering has closed before the navigation, and the test errors at teardown.The watch now credits an inset whose
calc()sum has the anchor's edge as one added term, as long as no other term reads an anchor. That remaining part is an offset the anchor's travel doesn't change. Forms where the edge is subtracted, scaled or nested still get no credit, and the header says so. The code block's Copy control uses the same multi-term form, so it is covered too.Verification:
test_a_heading_copies_the_link_to_the_section_it_openserrored every time at--cpu-throttle 4before the change. After it, the file passes at throttles 4 and 8, andleaf-dev suite flake --copies 6 --cpu-throttle 6passed 6 of 6.offset_sumdeclaration intest_native_anchor_scroll_retains_local_motion_proofcovers the clean case, which fails without the change, and a case where the anchor moves independently, which still fails. The other anchor, portal and popover cases intest_render_shift_watch.pyandmargin/test_pins.pypass.The watch changes; no product code does.
Closes #7389 — automated triage