diff options
author | Moonchild <moonchild@palemoon.org> | 2022-01-10 19:51:48 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-08 00:40:49 +0200 |
commit | e49b80dba7393d5baff831251f7981bc21324d81 (patch) | |
tree | a18c7ae47902a571e403aac04de1ac99a2c486cc /layout/generic/nsGfxScrollFrame.cpp | |
parent | 834ded7d18cf9acbb7d975fe22f2dea4f1f4c57d (diff) | |
download | uxp-e49b80dba7393d5baff831251f7981bc21324d81.tar.gz |
Issue #1853 - Map scrollbar-width to an element attribute.
By mapping this to an attribute, this allows browser themes to respond to
the various available scrollbar width settings in CSS.
Diffstat (limited to 'layout/generic/nsGfxScrollFrame.cpp')
-rw-r--r-- | layout/generic/nsGfxScrollFrame.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 83f5cff2be..8b76dc712d 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4448,6 +4448,7 @@ ScrollFrameHelper::CreateAnonymousContent( kNameSpaceID_XUL, nsIDOMNode::ELEMENT_NODE); NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); + StyleScrollbarWidth scrollWidth = mOuter->StyleUserInterface()->mScrollbarWidth; if (canHaveHorizontal) { RefPtr<NodeInfo> ni = nodeInfo; @@ -4464,6 +4465,17 @@ ScrollFrameHelper::CreateAnonymousContent( NS_LITERAL_STRING("horizontal"), false); mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::clickthrough, NS_LITERAL_STRING("always"), false); + // Map scrollbar-width to an attribute for browser themes. + if (scrollWidth == StyleScrollbarWidth::None) { + mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("none"), false); + } else if (scrollWidth == StyleScrollbarWidth::Thin) { + mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("thin"), false); + } else { + mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("auto"), false); + } if (mIsRoot) { mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::root_, NS_LITERAL_STRING("true"), false); @@ -4487,6 +4499,17 @@ ScrollFrameHelper::CreateAnonymousContent( NS_LITERAL_STRING("vertical"), false); mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::clickthrough, NS_LITERAL_STRING("always"), false); + // Map scrollbar-width to an attribute for browser themes. + if (scrollWidth == StyleScrollbarWidth::None) { + mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("none"), false); + } else if (scrollWidth == StyleScrollbarWidth::Thin) { + mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("thin"), false); + } else { + mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("auto"), false); + } if (mIsRoot) { mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::root_, NS_LITERAL_STRING("true"), false); |