зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1656802. Add flags that let us differentiate not showing scrollbars because something is overflow hidden from not showing scrollbars for other reasons. r=emilio
For the former we are still allowed to show scrollbars if we need to scroll the visual viewport inside the layout viewport (as long as they take up no layout space). For the latter we still do not want to show scrollbars. The ShowScrollbar enum is now only from layouts perspective and doesn't take into account anything about the visual viewport. Differential Revision: https://phabricator.services.mozilla.com/D85700
This commit is contained in:
Родитель
9e2292aea1
Коммит
519c4bdc9e
|
@ -273,6 +273,10 @@ namespace mozilla {
|
|||
enum class ShowScrollbar : uint8_t {
|
||||
Auto,
|
||||
Always,
|
||||
// Never is a misnomer. We can still get a scrollbar if we need to scroll the
|
||||
// visual viewport inside the layout viewport. Thus this enum is best thought
|
||||
// of as value used by layout, which does not know about the visual viewport.
|
||||
// The visual viewport does not affect any layout sizes, so this is sound.
|
||||
Never,
|
||||
};
|
||||
|
||||
|
@ -292,7 +296,15 @@ struct MOZ_STACK_CLASS ScrollReflowInput {
|
|||
const ReflowInput& mReflowInput;
|
||||
nsBoxLayoutState mBoxState;
|
||||
ShowScrollbar mHScrollbar;
|
||||
// If the horizontal scrollbar is allowed (even if mHScrollbar ==
|
||||
// ShowScrollbar::Never) provided that it is for scrolling the visual viewport
|
||||
// inside the layout viewport only.
|
||||
bool mHScrollbarAllowedForScrollingVVInsideLV = true;
|
||||
ShowScrollbar mVScrollbar;
|
||||
// If the vertical scrollbar is allowed (even if mVScrollbar ==
|
||||
// ShowScrollbar::Never) provided that it is for scrolling the visual viewport
|
||||
// inside the layout viewport only.
|
||||
bool mVScrollbarAllowedForScrollingVVInsideLV = true;
|
||||
nsMargin mComputedBorder;
|
||||
|
||||
// === Filled in by ReflowScrolledFrame ===
|
||||
|
@ -1156,9 +1168,11 @@ void nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
// sanity check: ensure that if we have no scrollbar, we treat it
|
||||
// as hidden.
|
||||
if (!mHelper.mVScrollbarBox || mHelper.mNeverHasVerticalScrollbar) {
|
||||
state.mVScrollbarAllowedForScrollingVVInsideLV = false;
|
||||
state.mVScrollbar = ShowScrollbar::Never;
|
||||
}
|
||||
if (!mHelper.mHScrollbarBox || mHelper.mNeverHasHorizontalScrollbar) {
|
||||
state.mHScrollbarAllowedForScrollingVVInsideLV = false;
|
||||
state.mHScrollbar = ShowScrollbar::Never;
|
||||
}
|
||||
|
||||
|
@ -1188,6 +1202,8 @@ void nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
ComputedStyle* scrollbarStyle = nsLayoutUtils::StyleForScrollbar(this);
|
||||
auto scrollbarWidth = scrollbarStyle->StyleUIReset()->mScrollbarWidth;
|
||||
if (scrollbarWidth == StyleScrollbarWidth::None) {
|
||||
state.mVScrollbarAllowedForScrollingVVInsideLV = false;
|
||||
state.mHScrollbarAllowedForScrollingVVInsideLV = false;
|
||||
state.mVScrollbar = ShowScrollbar::Never;
|
||||
state.mHScrollbar = ShowScrollbar::Never;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче