зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1748181 - Provide a pref to make scrollbar-width: thin behave as auto. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D137898
This commit is contained in:
Родитель
3a0f75795e
Коммит
70d562520d
|
@ -461,7 +461,7 @@ ScrollReflowInput::ScrollReflowInput(nsHTMLScrollFrame* aFrame,
|
|||
// makes us suppress scrollbars in CreateAnonymousContent. But if this frame
|
||||
// initially had a non-'none' scrollbar-width and dynamically changed to
|
||||
// 'none', then we'll need to handle it here.
|
||||
if (scrollbarStyle->StyleUIReset()->mScrollbarWidth ==
|
||||
if (scrollbarStyle->StyleUIReset()->ScrollbarWidth() ==
|
||||
StyleScrollbarWidth::None) {
|
||||
mHScrollbar = ShowScrollbar::Never;
|
||||
mHScrollbarAllowedForScrollingVVInsideLV = false;
|
||||
|
@ -1111,7 +1111,7 @@ nscoord nsHTMLScrollFrame::IntrinsicScrollbarGutterSizeAtInlineEdges(
|
|||
}
|
||||
|
||||
const auto* styleForScrollbar = nsLayoutUtils::StyleForScrollbar(this);
|
||||
if (styleForScrollbar->StyleUIReset()->mScrollbarWidth ==
|
||||
if (styleForScrollbar->StyleUIReset()->ScrollbarWidth() ==
|
||||
StyleScrollbarWidth::None) {
|
||||
// Scrollbar shouldn't appear at all with "scrollbar-width: none".
|
||||
return 0;
|
||||
|
@ -5465,7 +5465,7 @@ auto ScrollFrameHelper::GetNeededAnonymousContent() const
|
|||
result += AnonymousContentType::HorizontalScrollbar;
|
||||
result += AnonymousContentType::VerticalScrollbar;
|
||||
// If scrollbar-width is none, don't generate scrollbars.
|
||||
} else if (mOuter->StyleUIReset()->mScrollbarWidth !=
|
||||
} else if (mOuter->StyleUIReset()->ScrollbarWidth() !=
|
||||
StyleScrollbarWidth::None) {
|
||||
nsIScrollableFrame* scrollable = do_QueryFrame(mOuter);
|
||||
ScrollStyles styles = scrollable->GetScrollStyles();
|
||||
|
@ -6941,7 +6941,7 @@ void ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
|||
nsPresContext* pc = aState.PresContext();
|
||||
auto scrollbarWidth = nsLayoutUtils::StyleForScrollbar(mOuter)
|
||||
->StyleUIReset()
|
||||
->mScrollbarWidth;
|
||||
->ScrollbarWidth();
|
||||
auto sizes = pc->Theme()->GetScrollbarSizes(pc, scrollbarWidth,
|
||||
nsITheme::Overlay::No);
|
||||
nsSize resizerMinSize = mResizerBox->GetXULMinSize(aState);
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
== viewport-scrollbar-color-change.html viewport-scrollbar-color-change-ref.html
|
||||
== scrollbar-thin-overflow-change.html scrollbar-thin-overflow-change-ref.html
|
||||
test-pref(layout.css.scrollbar-width-thin.disabled,true) == scrollbar-width-thin.html scrollbar-width-auto.html
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<!doctype html>
|
||||
<style>
|
||||
:root {
|
||||
overflow: scroll;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<style>
|
||||
:root {
|
||||
scrollbar-width: thin;
|
||||
overflow: scroll;
|
||||
}
|
||||
</style>
|
|
@ -1723,11 +1723,21 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset {
|
|||
|
||||
private:
|
||||
mozilla::StyleUserSelect mUserSelect; // Use ComputedStyle::UserSelect()
|
||||
mozilla::StyleScrollbarWidth mScrollbarWidth; // Use ScrollbarWidth()
|
||||
|
||||
public:
|
||||
mozilla::StyleUserSelect ComputedUserSelect() const { return mUserSelect; }
|
||||
|
||||
mozilla::StyleScrollbarWidth mScrollbarWidth;
|
||||
mozilla::StyleScrollbarWidth ScrollbarWidth() const {
|
||||
if (MOZ_UNLIKELY(
|
||||
mozilla::StaticPrefs::layout_css_scrollbar_width_thin_disabled())) {
|
||||
if (mScrollbarWidth == mozilla::StyleScrollbarWidth::Thin) {
|
||||
return mozilla::StyleScrollbarWidth::Auto;
|
||||
}
|
||||
}
|
||||
return mScrollbarWidth;
|
||||
}
|
||||
|
||||
uint8_t mMozForceBrokenImageIcon; // (0 if not forcing, otherwise forcing)
|
||||
mozilla::StyleImeMode mIMEMode;
|
||||
mozilla::StyleWindowDragging mWindowDragging;
|
||||
|
|
|
@ -404,7 +404,7 @@ bool nsIFrame::AddXULMinSize(nsIFrame* aBox, nsSize& aSize, bool& aWidthSet,
|
|||
case StyleAppearance::ScrollbarHorizontal: {
|
||||
ComputedStyle* style = nsLayoutUtils::StyleForScrollbar(aBox);
|
||||
auto sizes = theme->GetScrollbarSizes(
|
||||
pc, style->StyleUIReset()->mScrollbarWidth,
|
||||
pc, style->StyleUIReset()->ScrollbarWidth(),
|
||||
nsITheme::Overlay::No);
|
||||
if (appearance == StyleAppearance::ScrollbarVertical) {
|
||||
aSize.width = pc->DevPixelsToAppUnits(sizes.mVertical);
|
||||
|
|
|
@ -8104,6 +8104,12 @@
|
|||
mirror: always
|
||||
rust: true
|
||||
|
||||
# Whether we want scrollbar-width: thin to behave as scrollbar-width: auto.
|
||||
- name: layout.css.scrollbar-width-thin.disabled
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Whether the `scrollbar-gutter` CSS property is enabled.
|
||||
- name: layout.css.scrollbar-gutter.enabled
|
||||
type: RelaxedAtomicBool
|
||||
|
|
|
@ -71,7 +71,7 @@ bool ScrollbarDrawing::IsParentScrollbarHoveredOrActive(nsIFrame* aFrame) {
|
|||
|
||||
/*static*/
|
||||
bool ScrollbarDrawing::IsScrollbarWidthThin(const ComputedStyle& aStyle) {
|
||||
auto scrollbarWidth = aStyle.StyleUIReset()->mScrollbarWidth;
|
||||
auto scrollbarWidth = aStyle.StyleUIReset()->ScrollbarWidth();
|
||||
return scrollbarWidth == StyleScrollbarWidth::Thin;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ auto ScrollbarDrawing::GetScrollbarSizes(nsPresContext* aPresContext,
|
|||
auto ScrollbarDrawing::GetScrollbarSizes(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame) -> ScrollbarSizes {
|
||||
auto* style = nsLayoutUtils::StyleForScrollbar(aFrame);
|
||||
auto width = style->StyleUIReset()->mScrollbarWidth;
|
||||
auto width = style->StyleUIReset()->ScrollbarWidth();
|
||||
auto overlay =
|
||||
aPresContext->UseOverlayScrollbars() ? Overlay::Yes : Overlay::No;
|
||||
return GetScrollbarSizes(aPresContext, width, overlay);
|
||||
|
@ -203,7 +203,7 @@ ScrollbarParams ScrollbarDrawing::ComputeScrollbarParams(
|
|||
nsLookAndFeel::GetInt(LookAndFeel::IntID::UseOverlayScrollbars) != 0;
|
||||
params.isRolledOver = IsParentScrollbarRolledOver(aFrame);
|
||||
params.isSmall =
|
||||
aStyle.StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::Thin;
|
||||
aStyle.StyleUIReset()->ScrollbarWidth() == StyleScrollbarWidth::Thin;
|
||||
params.isRtl = nsNativeTheme::IsFrameRTL(aFrame);
|
||||
params.isHorizontal = aIsHorizontal;
|
||||
params.isOnDarkBackground = !StaticPrefs::widget_disable_dark_scrollbar() &&
|
||||
|
|
|
@ -35,7 +35,7 @@ LayoutDeviceIntSize ScrollbarDrawingCocoa::GetMinimumWidgetSize(
|
|||
case StyleAppearance::ScrollbartrackVertical:
|
||||
case StyleAppearance::ScrollbartrackHorizontal: {
|
||||
ComputedStyle* style = nsLayoutUtils::StyleForScrollbar(aFrame);
|
||||
auto scrollbarWidth = style->StyleUIReset()->mScrollbarWidth;
|
||||
auto scrollbarWidth = style->StyleUIReset()->ScrollbarWidth();
|
||||
auto size = GetScrollbarSize(
|
||||
scrollbarWidth,
|
||||
LookAndFeel::GetInt(LookAndFeel::IntID::UseOverlayScrollbars));
|
||||
|
|
Загрузка…
Ссылка в новой задаче