diff options
author | Moonchild <moonchild@palemoon.org> | 2021-01-08 14:15:50 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-01-08 14:15:50 +0000 |
commit | c05bca316875ca90c56468e70b54a355bd4ca3c6 (patch) | |
tree | 9ab73c0dbab8cbcf7a7ff7a06c602ca694fbf41f /layout/generic | |
parent | 65da2431f9ee9711e971002ae17043c1a3d36a3f (diff) | |
download | uxp-c05bca316875ca90c56468e70b54a355bd4ca3c6.tar.gz |
Issue #1705 - Part 5: Implement scrollbar-width:none for all target platforms.
Diffstat (limited to 'layout/generic')
-rw-r--r-- | layout/generic/nsGfxScrollFrame.cpp | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 8e7b208e42..d1053da86d 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1054,6 +1054,15 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, reflowScrollCorner = showResizer == mHelper.mCollapsedResizer; mHelper.mCollapsedResizer = !showResizer; } + + // Hide the scrollbar when the scrollbar-width is set to none. + // 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->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) { + state.mVScrollbar = ShowScrollbar::Never; + state.mHScrollbar = ShowScrollbar::Never; + } } nsRect oldScrollAreaBounds = mHelper.mScrollPort; @@ -4404,24 +4413,30 @@ ScrollFrameHelper::CreateAnonymousContent( nsIScrollableFrame *scrollable = do_QueryFrame(mOuter); - // If we're the scrollframe for the root, then we want to construct - // our scrollbar frames no matter what. That way later dynamic - // changes to propagated overflow styles will show or hide - // scrollbars on the viewport without requiring frame reconstruction - // of the viewport (good!). bool canHaveHorizontal; bool canHaveVertical; - if (!mIsRoot) { - ScrollStyles styles = scrollable->GetScrollStyles(); - canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN; - canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN; + if (mIsRoot) { + // If we're the scrollframe for the root, then we want to construct + // our scrollbar frames no matter what. That way, later dynamic + // changes to propagated overflow styles will show or hide + // scrollbars on the viewport without requiring frame reconstruction + // of the viewport (which is a Good Thing(tm)!). + canHaveHorizontal = true; + canHaveVertical = true; + } else { + if (mOuter->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) { + // If scrollbar-width is none, don't generate scrollbars. + canHaveHorizontal = false; + canHaveVertical = false; + } else { + ScrollStyles styles = scrollable->GetScrollStyles(); + canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN; + canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN; + } if (!canHaveHorizontal && !canHaveVertical && !isResizable) { // Nothing to do. return NS_OK; } - } else { - canHaveHorizontal = true; - canHaveVertical = true; } // The anonymous <div> used by <inputs> never gets scrollbars. |