Repository navigation
layout: style attributes are remembered per source tree, background no longer adds background-image:none - #3682
Conversation
…only background no longer carries background-image:none A second page built in the same run read the first page's remembered style entries because they were keyed by node id alone, which lost the Persian header padding and repeated its background. Entries now carry the id of their source tree. The image reset is dropped from an element's rules when nothing on that element sets an image.
… rules without the image reset
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
sha=4865b26ad78cf0f07cbd2052720d6358f83974d3
🤖 Salam AI reviewVerdict: 🛠️ Changes needed before merging commit SummaryThis pull request scopes remembered layout style attributes to a unique AST uid to prevent cross-page collisions in one process and strips redundant What changed
Review
TestsThe new parity fixtures and expectation updates align with the described bugs and fixes. The PR notes page/style results of 591 passed / 99 failed versus 589 / 101 on main, with the remaining failures described as pre-existing; I did not run tests. No harness coverage is added for the multi-page-in-one-process collision because the runner builds one file at a time, as noted. RisksRemembered style entries remain in process-global vectors for the lifetime of the process (now keyed by AST uid), so long-lived sessions such as LSP/serve/repl may continue accumulating entries. The reported unfixed issues (
|
Two bugs in the page style output.
The page and its Persian twin gave different CSS when built in one process (salam page build en.salam fa.salam, and probably the LSP, serve, repl and editor): the semantic pass remembered each validated style attribute in global vectors keyed by AST node id alone, never cleared, and looked up the first entry with a matching id. A second page has different attributes at the same node ids, so its padding (فاصله داخلی) found the first page's background entry: the background came out twice and the padding never appeared. Each at.Ast now has a unique uid assigned in NewAst, stored with every remembered entry, and the lookups take the AST and match on it. Clearing the vectors at the start of Run would not work because the layout generator runs Run again on a second AST during codegen.
background = "blue" emitted background-image:none next to background-color. The std style writer does that on purpose so a state rule can reset a gradient from the base rule, but with a plain color nothing sets an image and the global :where reset already gives background-image:none. The compiler now strips it from an element's rules unless a rule of that element sets a real image or gradient, or the element has a user class or dynamic class/style.
Before (Persian, English page built first): .a { background-color:#0000ff;background-image:none;background-color:#0000ff;background-image:none;color:#ffffff; } .b { padding:20px; }
After: .a { background-color:#0000ff;color:#ffffff;padding:24px; } .b { padding:20px; }
Tests: en/fa twins parity_header_box and parity_pairs (margin, border, font size, width, height, text align, padding) under page/style, and the fixtures that expected the image reset are updated. page/style with the fixed compiler: 591 passed, 99 failed, against 589 and 101 on main; the 99 are the same pre-existing list (old fixtures that expect the spaced prop: value format). The multi page collision has no harness test because the runner builds one file at a time.
Found, not fixed: فاصله بیرونی gives E112 on a page element (page margin knows فضا and حاشیه), and display with a Persian enum word fails E018 with an English only suggestion list.