Closed Bug 1748574 Opened 1 year ago Closed 1 year ago

Add scrollbar size to scroll frame's intrinsic size if it has non-auto "scrollbar-gutter"

Categories

(Core :: Layout: Scrolling and Overflow, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(2 files)

Per my conversation with Daniel, we should include the scrollbar-gutter's size to scroll frame's intrinsic size as a workaround of bug 764076 (promised in bug 764076 comment 24).

The code that handles this is in nsHTMLScrollFrame::GetIntrinsicVScrollbarWidth [1].

[1] https://searchfox.org/mozilla-central/rev/253ae246f642fe9619597f44de3b087f94e45a2d/layout/generic/nsGfxScrollFrame.cpp#1104-1117

(In reply to Ting-Yu Lin [:TYLin] (UTC-8) from comment #0)

Per my conversation with Daniel, we should include the scrollbar-gutter's size to scroll frame's intrinsic size as a workaround of bug 764076 (promised in bug 764076 comment 24).

To clarify: I do also think this is the correct thing to do, per spec.

It also conveniently provides a workaround for bug 764076, which is nice :) but it's worth doing regardless of that.

The idea here is that, with scrollbar-gutter:stable, we know that we should set aside some space for the scrollbar (just as we do for overflow:scroll), and that should be included as part of the element's intrinsic inline size.

Attached file testcase 1

Here's a testcase, where we differ from Chrome due to this bug.

Chrome renders this testcase's 3 boxes as skinny, wide, wide.

Firefox Nightly disagrees on the second one and renders it as skinny (i.e. we don't request any space for the scrollbar, even though it has scrollbar-gutter:stable and is requesting to always have space for a scrollbar, just like the 3rd box does via overflow-y:scroll).

This patch fixed the following:

  1. Make the helper support the vertical writing modes since its callers
    GetMinISize() and GetPrefISize() are fully aware of the vertical writing modes.
    This fixed a testcase with "writing-mode: vertical-lr" in flexbox's
    cross-axis-scrollbar.html. Yay!

  2. Treat scrollbar's intrinsic size "zero" if we have "scrollbar-width: none"
    since no scrollbar is showing at all. The test 002.html verifies this scenario.

  3. Return the scrollbar size if we have "scrollbar-gutter: stable", or twice the
    size if we have "scrollbar-gutter: stable both-edges". The test 001.html
    verifies this scenario.

Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/28dbb5e40628
Rewrite the helper that computes scrollbar's intrinsic size. r=dholbert
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/32284 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.