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

@ -3924,7 +3924,6 @@ nsStyleUserInterface::nsStyleUserInterface(nsPresContext* aContext)
, mPointerEvents(NS_STYLE_POINTER_EVENTS_AUTO)
, mCursor(NS_STYLE_CURSOR_AUTO)
, mCaretColor(StyleComplexColor::Auto())
, mScrollbarWidth(StyleScrollbarWidth::Auto)
{
MOZ_COUNT_CTOR(nsStyleUserInterface);
}
@ -3937,7 +3936,6 @@ nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource)
, mCursor(aSource.mCursor)
, mCursorImages(aSource.mCursorImages)
, mCaretColor(aSource.mCaretColor)
, mScrollbarWidth(aSource.mScrollbarWidth)
{
MOZ_COUNT_CTOR(nsStyleUserInterface);
}
@ -3989,13 +3987,6 @@ nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const
if (mCaretColor != aNewData.mCaretColor) {
hint |= nsChangeHint_RepaintFrame;
}
if (mScrollbarWidth != aNewData.mScrollbarWidth) {
// For scrollbar-width change, we need some special handling similar
// to overflow properties. Specifically, we may need to reconstruct
// the scrollbar or force reflow of the viewport scrollbar.
hint |= nsChangeHint_ScrollbarChange;
}
return hint;
}
@ -4010,6 +4001,7 @@ nsStyleUIReset::nsStyleUIReset(nsPresContext* aContext)
, mIMEMode(NS_STYLE_IME_MODE_AUTO)
, mWindowDragging(StyleWindowDragging::Default)
, mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT)
, mScrollbarWidth(StyleScrollbarWidth::Auto)
{
MOZ_COUNT_CTOR(nsStyleUIReset);
}
@ -4020,6 +4012,7 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource)
, mIMEMode(aSource.mIMEMode)
, mWindowDragging(aSource.mWindowDragging)
, mWindowShadow(aSource.mWindowShadow)
, mScrollbarWidth(aSource.mScrollbarWidth)
{
MOZ_COUNT_CTOR(nsStyleUIReset);
}
@ -4050,6 +4043,13 @@ nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
return nsChangeHint_SchedulePaint;
}
if (mScrollbarWidth != aNewData.mScrollbarWidth) {
// For scrollbar-width change, we need some special handling similar
// to overflow properties. Specifically, we may need to reconstruct
// the scrollbar or force reflow of the viewport scrollbar.
return nsChangeHint_ScrollbarChange;
}
return nsChangeHint(0);
}