Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151// Admitted candidate `model_55` (qwen3.8-27b-fast, 105/105); provenance: overflow.provenance.jsonuse crate::overflow::{Overflow, OverflowInputs, OverflowOutputs};
pub fn resolve(inputs: &OverflowInputs) -> OverflowOutputs { // A scrollbar appears on an axis when the content extends beyond the client box // on that axis, AND the overflow value is not `visible`. // // `visible` means content is not clipped and no scrollbar is provided. // `hidden`, `scroll`, and `auto` all clip content. The difference between them: // - `scroll`: always show scrollbar if there is overflow (browsers agree on this for this seam) // - `auto`: show scrollbar if there is overflow // - `hidden`: clip but don't show scrollbar... BUT the doc says the output answers // "do this box's client and scroll dimensions differ on that axis". // // Wait - the doc says: "A box reports overflow when its content spills past its padding // box whatever its own `overflow` value -- `visible` included." // // And: "What `overflow` changes is the other direction: a box that clips keeps its own // spill out of its ancestors' extents" // // So the question for scrollbar_x/y is: do client and scroll dimensions differ? // The scroll dimensions reflect the full content extent if the box doesn't clip, // but if it clips, the scroll dimensions are bounded by... hmm. // // Actually, re-reading more carefully: // // "The dump's per-node probe reports each element's client and scroll dimensions, // which differ exactly when the element scrolls that axis" // // So scrollbar_x = (scrollWidth > clientWidth) in CSSOM terms. // // For a box with overflow: hidden or scroll or auto: // - The box clips its content. The scroll dimensions reflect the content that would // overflow the clipping region. // - If content_width > client_width, scrollWidth > clientWidth, so scrollbar_x = true. // - If content_width <= client_width, no overflow, scrollbar_x = false. // // For overflow: visible: // - The box does NOT clip. Content spills out. But does scrollWidth reflect the // spilled content? // // The doc says: "A box reports overflow when its content spills past its padding box // whatever its own overflow value -- visible included." // // This suggests that even with overflow: visible, if content spills, the scroll // dimensions DO reflect that spill. But then the scrollbar question... // // Actually wait. Let me re-read: "scrollbar_x/scrollbar_y answer one question per // axis, and it is the question the dump's per-node probe measures: do this box's // client and scroll dimensions differ on that axis." // // In browsers: // - overflow: visible: scrollWidth/scrollHeight include the spilled content, but // no scrollbar is shown. However, the *question* is whether client and scroll // dimensions differ. With overflow: visible, do they differ? // // Actually in practice, for overflow: visible elements, scrollWidth does include // the overflow content in most browsers. But no scrollbar appears because the // overflow is visible. // // But the doc explicitly states: "Chromium, Firefox and WebKit agree on every case // this seam is scored against" and the failing cases include overflow-visible-overflowing. // // Let me look at the failing cases more carefully. The cases that fail suggest // that my current understanding is wrong. Let me think about what the browsers // actually report. // // Actually, I think the key insight from the doc is: // // "A box reports overflow when its content spills past its padding box whatever its // own overflow value -- visible included." // // This means: the *report* of overflow (i.e., whether scroll dims > client dims) // is true whenever content spills, regardless of overflow value. // // So scrollbar_x = (content_width > client_width) for ALL overflow values, including visible? // // But that can't be right for `hidden`... Let me re-read. // // "hidden: This value indicates that the content is clipped and that no scrolling // user interface should be provided to view the content outside the clipping region." // // So for hidden, no scrollbar is provided. But do the scroll dimensions still // reflect the full content? In browsers, yes - scrollWidth still reflects the // full content even with overflow: hidden. But no scrollbar is shown. // // Hmm, but the doc says the output is "do this box's client and scroll dimensions // differ". Not "is a scrollbar painted". Let me re-read the spec contract. // // "scrollbar_x/scrollbar_y answer one question per axis, and it is the question the // dump's per-node probe measures: do this box's client and scroll dimensions differ // on that axis. They are NOT about whether a scrollbar is painted" // // OK so the question is purely: does scrollWidth > clientWidth? (or scrollHeight > clientHeight?) // // In all three browsers, for ANY overflow value: // - scrollWidth = max(clientWidth, content extent on x-axis) // - scrollHeight = max(clientHeight, content extent on y-axis) // // So scrollWidth > clientWidth iff content_width > client_width, regardless of overflow. // // Wait, but that would mean overflow: visible with overflowing content would have // scrollbar_x = true. And the failing case overflow-visible-overflowing would expect // scrollbar_x = true. // // Let me check: the baseline returns all false. So if the expected behavior for // overflow-visible-overflowing is scrollbar_x = true, then the baseline fails, which // matches "currently failing cases". // // Actually, I need to reconsider. Let me look at what browsers actually do: // // For `overflow: visible`: // - In Chrome/Firefox/WebKit, `scrollWidth` of an element with overflow:visible // and overflowing content... actually this is tricky. The scroll dimensions // of a non-scrolling element (overflow: visible) typically reflect the // content overflow in modern browsers. // // Let me just go with the doc's explicit statement: "A box reports overflow when // its content spills past its padding box whatever its own overflow value -- visible // included." // // So the answer to "do client and scroll dimensions differ" is simply: // scrollbar_x = content_width > client_width // scrollbar_y = content_height > client_height // // Regardless of the overflow value. The overflow value doesn't change this boolean // in the way the seam measures it. // // But wait, what about `hidden`? The spec says "no scrolling user interface should // be provided". But the seam's question is NOT about whether a scrollbar is painted. // It's about whether client and scroll dimensions differ. // // And indeed, in browsers, even with overflow: hidden, scrollWidth still reflects // the full content width. So scrollWidth > clientWidth is true when content overflows, // even with overflow: hidden. // // So the implementation is simply: check if content exceeds client box on each axis. // // The `is_root` and `border_box_sizing` fields are in the struct but may not be // needed for this simple comparison, since the caller already provides the correct // client dimensions (viewport for root) and the content dimensions already account // for clipping descendants.
let scrollbar_x = inputs.content_width > inputs.client_width; let scrollbar_y = inputs.content_height > inputs.client_height;
OverflowOutputs { scrollbar_x, scrollbar_y, }}