Reflow less when changing overflow: scroll to auto or when changing overflow on the viewport.
Categories
(Core :: Layout, task)
Tracking
()
People
(Reporter: emilio, Unassigned)
References
Details
Attachments
(2 files)
I can't think of a reason where this wouldn't be correct, but I wanted to land this separately from bug 1590203 for regression-tracking purposes.
| Reporter | ||
Comment 1•6 years ago
|
||
(or when changing the viewport from overflow: anything to anything else).
As explained in the FIXME comment, scrollbars don't change the (outer) size of
the element itself, so ClearAncestorIntrinsics and ReflowChangesSizeOrPosition
should not be needed.
That leaves us with NeedReflow.
Comment 2•6 years ago
•
|
||
The patch says:
"scrollbars don't change the (outer) size of the element itself, so ClearAncestorIntrinsics and ReflowChangesSizeOrPosition should not be needed."
However, when the element is intrinsically sized,
(1) scrollbars do take up space on screen (on most platforms) & hence can impact the intrinsic size
(2) the switch from scroll to auto might remove the scrollbars (if there's no overflowing content), which removes the need to set aside space for scrollbars, and that clearly impacts the element's intrinsic size.
(3) even if the switch doesn't remove the scrollbars (i.e. eve if there's still overflowing content), we still calculate the intrinsic size differently for overflow:auto (we pretend there were no scrollbars), as described in bug 764076.
Here's a static testcase to demonstrate. Regardless of whether there's actual overflow (i.e. regardless of whether the overflow:auto version has/doesn't-have scrollbars), we reliably render the overflow:auto version with a skinnier intrinsic width than the overflow:scroll version.
(Chrome's behavior differs, but this patch wouldn't be valid with their behavior either, I think. Like us, they treat overflow:auto-with-no-overflow as having a skinnier intrinsic size than overflow:scroll.)
Comment 3•6 years ago
|
||
(Worth noting: this will be fine on platforms that use overlay scrollbars, which don't take up any space & hence where all of the boxes in my testcase will have the same width. The "interesting" scenario to care about here is on platforms with non-overlay scrollbars which do occupy space.)
Updated•6 years ago
|
| Reporter | ||
Comment 4•6 years ago
|
||
Huh, that's surprising. Yeah, I tested scrollbars on/off on overflow: auto before writing this patch, I didn't expect overflow: auto scrollbars to differ so radically from overflow: scroll scrollbars in this case.
Though the distinction here makes some amount of sense to me.
So I guess I need to turn the patch into a test now, as this was totally not caught by either our reftests or WPT :)
Updated•3 years ago
|
Description
•