summaryrefslogtreecommitdiff
path: root/layout/generic
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-01-08 14:15:50 +0000
committerMoonchild <moonchild@palemoon.org>2021-01-08 14:15:50 +0000
commit7fcc8395f0303d93ac23b9bac5b2f2369b64717c (patch)
tree9ab73c0dbab8cbcf7a7ff7a06c602ca694fbf41f /layout/generic
parentc82f3db99de093cb636cb51f8273d80d1a634bf6 (diff)
downloadaura-central-7fcc8395f0303d93ac23b9bac5b2f2369b64717c.tar.gz
Issue mcp-graveyard/UXP%1705 - Part 5: Implement scrollbar-width:none for all target platforms.
Diffstat (limited to 'layout/generic')
-rw-r--r--layout/generic/nsGfxScrollFrame.cpp39
1 files changed, 27 insertions, 12 deletions
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp
index 8e7b208e4..d1053da86 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.