Issue #2765 - Part 3: Make scrollbar width checks use the originating non-NAC style context

This commit is contained in:
Francis Dominic Fajardo 2025-06-26 21:15:50 +08:00 committed by roytam1
commit 3ba0b10bb4
2 changed files with 6 additions and 2 deletions

View file

@ -1058,7 +1058,9 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
// This is only needed for root element because scrollbars of non-
// root elements with "scrollbar-width: none" is already suppressed
// in ScrollFrameHelper::CreateAnonymousContent.
if (this->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::None) {
nsStyleContext* scrollbarStyle = nsLayoutUtils::GetNonAnonymousStyleContext(this);
auto scrollbarWidth = scrollbarStyle->StyleUIReset()->mScrollbarWidth;
if (scrollbarWidth == StyleScrollbarWidth::None) {
state.mVScrollbar = ShowScrollbar::Never;
state.mHScrollbar = ShowScrollbar::Never;
}