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 | |
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.
-rw-r--r-- | dom/base/nsGkAtomList.h | 1 | ||||
-rw-r--r-- | layout/generic/nsGfxScrollFrame.cpp | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h index e5008c420b..ad2eda2116 100644 --- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -1133,6 +1133,7 @@ GK_ATOM(scrollbarDownBottom, "scrollbar-down-bottom") GK_ATOM(scrollbarDownTop, "scrollbar-down-top") GK_ATOM(scrollbarUpBottom, "scrollbar-up-bottom") GK_ATOM(scrollbarUpTop, "scrollbar-up-top") +GK_ATOM(scrollbarwidth, "scrollbarwidth") GK_ATOM(scrollbox, "scrollbox") GK_ATOM(scrollcorner, "scrollcorner") GK_ATOM(scrolling, "scrolling") 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); |