diff options
author | Moonchild <moonchild@palemoon.org> | 2022-01-15 21:31:29 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-08 00:57:11 +0200 |
commit | 44e35f67b43f4c85e9db7e2777bde8d90c2ea7e7 (patch) | |
tree | 5df5281bcabd35a2d5e6bd4f68d4fbcd42200029 /layout | |
parent | 56d9003017a94e7619f98e76b04929115514d08c (diff) | |
download | uxp-44e35f67b43f4c85e9db7e2777bde8d90c2ea7e7.tar.gz |
Issue #1853 - Follow-up: extend attribution mapping to resize and corner
controls to allow themes to respond to scrollbar-width.
Also clean up the comments and whitespace a bit.
Diffstat (limited to 'layout')
-rw-r--r-- | layout/generic/nsGfxScrollFrame.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 8b76dc712d..bbde1d7dc0 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4465,7 +4465,8 @@ 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. + + // Map scrollbar-width to an attribute on horizontal scrollbars for browser themes. if (scrollWidth == StyleScrollbarWidth::None) { mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, NS_LITERAL_STRING("none"), false); @@ -4476,6 +4477,7 @@ ScrollFrameHelper::CreateAnonymousContent( mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, NS_LITERAL_STRING("auto"), false); } + if (mIsRoot) { mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::root_, NS_LITERAL_STRING("true"), false); @@ -4499,7 +4501,8 @@ 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. + + // Map scrollbar-width to an attribute on vertical scrollbars for browser themes. if (scrollWidth == StyleScrollbarWidth::None) { mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, NS_LITERAL_STRING("none"), false); @@ -4510,6 +4513,7 @@ ScrollFrameHelper::CreateAnonymousContent( mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, NS_LITERAL_STRING("auto"), false); } + if (mIsRoot) { mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::root_, NS_LITERAL_STRING("true"), false); @@ -4548,6 +4552,18 @@ ScrollFrameHelper::CreateAnonymousContent( } mResizerContent->SetAttr(kNameSpaceID_None, nsGkAtoms::dir, dir, false); + // Map scrollbar-width to an attribute on resizers for browser themes. + if (scrollWidth == StyleScrollbarWidth::None) { + mResizerContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("none"), false); + } else if (scrollWidth == StyleScrollbarWidth::Thin) { + mResizerContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("thin"), false); + } else { + mResizerContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("auto"), false); + } + if (mIsRoot) { nsIContent* browserRoot = GetBrowserRoot(mOuter->GetContent()); mCollapsedResizer = !(browserRoot && @@ -4570,6 +4586,19 @@ ScrollFrameHelper::CreateAnonymousContent( kNameSpaceID_XUL, nsIDOMNode::ELEMENT_NODE); NS_TrustedNewXULElement(getter_AddRefs(mScrollCornerContent), nodeInfo.forget()); + + // Map scrollbar-width to an attribute on scrollcorners for browser themes. + if (scrollWidth == StyleScrollbarWidth::None) { + mScrollCornerContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("none"), false); + } else if (scrollWidth == StyleScrollbarWidth::Thin) { + mScrollCornerContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("thin"), false); + } else { + mScrollCornerContent->SetAttr(kNameSpaceID_None, nsGkAtoms::scrollbarwidth, + NS_LITERAL_STRING("auto"), false); + } + if (!aElements.AppendElement(mScrollCornerContent)) return NS_ERROR_OUT_OF_MEMORY; } |