diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index c3d570e5130c..cec8382a0787 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -442,19 +442,6 @@ ScrollReflowInput::ScrollReflowInput(nsHTMLScrollFrame* aFrame, GetScrollbarMetrics(mBoxState, hScrollbarBox, &mHScrollbarMinSize, &mHScrollbarPrefSize); - - // A zero minimum size is a bug with non-overlay scrollbars. That - // means we'll always try to place the scrollbar, even if it will ultimately - // not fit, see bug 1809630. XUL collapsing is the exception because the - // front-end uses it. - MOZ_ASSERT(aFrame->PresContext()->UseOverlayScrollbars() || - hScrollbarBox->IsXULCollapsed() || - (mHScrollbarMinSize.width && mHScrollbarMinSize.height), - "Shouldn't have a zero horizontal min-scrollbar-size"); - MOZ_ASSERT(mHScrollbarPrefSize.width >= mHScrollbarMinSize.width && - mHScrollbarPrefSize.height >= mHScrollbarMinSize.height, - "Scrollbar pref size should be >= min size"); - } else { mHScrollbar = ShowScrollbar::Never; mHScrollbarAllowedForScrollingVVInsideLV = false; @@ -465,15 +452,6 @@ ScrollReflowInput::ScrollReflowInput(nsHTMLScrollFrame* aFrame, GetScrollbarMetrics(mBoxState, vScrollbarBox, &mVScrollbarMinSize, &mVScrollbarPrefSize); - - // See above. - MOZ_ASSERT(aFrame->PresContext()->UseOverlayScrollbars() || - vScrollbarBox->IsXULCollapsed() || - (mVScrollbarMinSize.width && mVScrollbarMinSize.height), - "Shouldn't have a zero vertical min-size"); - MOZ_ASSERT(mVScrollbarPrefSize.width >= mVScrollbarMinSize.width && - mVScrollbarPrefSize.height >= mVScrollbarMinSize.height, - "Scrollbar pref size should be >= min size"); } else { mVScrollbar = ShowScrollbar::Never; mVScrollbarAllowedForScrollingVVInsideLV = false; diff --git a/widget/ScrollbarDrawingWin.cpp b/widget/ScrollbarDrawingWin.cpp index c20735a7109e..97b5e9afe474 100644 --- a/widget/ScrollbarDrawingWin.cpp +++ b/widget/ScrollbarDrawingWin.cpp @@ -33,6 +33,11 @@ LayoutDeviceIntSize ScrollbarDrawingWin::GetMinimumWidgetSize( case StyleAppearance::ScrollbarHorizontal: case StyleAppearance::ScrollbarthumbVertical: case StyleAppearance::ScrollbarthumbHorizontal: { + if ((aAppearance == StyleAppearance::ScrollbarHorizontal || + aAppearance == StyleAppearance::ScrollbarVertical) && + !aPresContext->UseOverlayScrollbars()) { + return LayoutDeviceIntSize{}; + } // TODO: for short scrollbars it could be nice if the thumb could shrink // under this size. auto sizes = GetScrollbarSizes(aPresContext, aFrame); @@ -41,22 +46,8 @@ LayoutDeviceIntSize ScrollbarDrawingWin::GetMinimumWidgetSize( aAppearance == StyleAppearance::ScrollbarthumbHorizontal || aAppearance == StyleAppearance::ScrollbarbuttonLeft || aAppearance == StyleAppearance::ScrollbarbuttonRight; - const auto relevantSize = - isHorizontal ? sizes.mHorizontal : sizes.mVertical; - auto size = LayoutDeviceIntSize{relevantSize, relevantSize}; - if (aAppearance == StyleAppearance::ScrollbarHorizontal || - aAppearance == StyleAppearance::ScrollbarVertical) { - // Always reserve some space in the right direction. Historically we've - // reserved 3 times the size in the other axis (one for the thumb, two - // for the buttons). We do this even when painting thin scrollbars just - // for consistency, though there just one would probably do. - if (isHorizontal) { - size.width *= 3; - } else { - size.height *= 3; - } - } - return size; + const auto size = isHorizontal ? sizes.mHorizontal : sizes.mVertical; + return LayoutDeviceIntSize{size, size}; } default: return LayoutDeviceIntSize{};