diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h index 1e9d870594..75c031afac 100644 --- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -1134,6 +1134,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 d1053da86d..e1a7215d93 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -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 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);