diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index e718315731..6197cf94c3 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -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; } diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index 5aab75de26..3250fec5c9 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -1572,7 +1572,9 @@ GetThemeDpiScaleFactor(nsIFrame* aFrame) static bool IsScrollbarWidthThin(nsIFrame* aFrame) { - return aFrame->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::Thin; + nsStyleContext* styleContext = nsLayoutUtils::GetNonAnonymousStyleContext(aFrame); + auto scrollbarWidth = styleContext->StyleUIReset()->mScrollbarWidth; + return scrollbarWidth == StyleScrollbarWidth::Thin; } NS_IMETHODIMP