Issue #2765 - Part 1: Scrollbar width should be treated as a non-inherited property

Note: non-inherited properties are stored in "reset" style structs.

Previous implementation treats it as an inherited property, which
doesn't match the spec.

This also fixes the incorrect behavior when using the `unset` value
for this property by specifying SETVAL_UNSET_INITIAL in the mask.
This commit is contained in:
Francis Dominic Fajardo 2025-06-25 15:42:59 +08:00 committed by roytam1
commit 8236eec152
7 changed files with 24 additions and 24 deletions

View file

@ -1058,7 +1058,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
// This is only needed for root element because scrollbars of non-
// root elements with "scrollbar-width: none" is already suppressed
// in ScrollFrameHelper::CreateAnonymousContent.
if (this->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) {
if (this->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::None) {
state.mVScrollbar = ShowScrollbar::Never;
state.mHScrollbar = ShowScrollbar::Never;
}
@ -4415,7 +4415,7 @@ ScrollFrameHelper::CreateAnonymousContent(
canHaveHorizontal = true;
canHaveVertical = true;
} else {
if (mOuter->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) {
if (mOuter->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::None) {
// If scrollbar-width is none, don't generate scrollbars.
canHaveHorizontal = false;
canHaveVertical = false;
@ -4448,7 +4448,7 @@ ScrollFrameHelper::CreateAnonymousContent(
kNameSpaceID_XUL,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
StyleScrollbarWidth scrollWidth = mOuter->StyleUserInterface()->mScrollbarWidth;
StyleScrollbarWidth scrollWidth = mOuter->StyleUIReset()->mScrollbarWidth;
if (canHaveHorizontal) {
RefPtr<NodeInfo> ni = nodeInfo;