Issue #3050 - 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.
This commit is contained in:
Moonchild 2022-01-10 19:51:48 +00:00 committed by roytam1
commit 4bdd388989
2 changed files with 24 additions and 0 deletions

View file

@ -4457,6 +4457,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;
@ -4473,6 +4474,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);
@ -4496,6 +4508,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);