From 0e6a9cc60aeb754e00e466ce20052d2fa9ccb7f9 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 6 Jan 2021 16:31:36 +0000 Subject: Issue #1705 - Part 3: Rename ScrollbarStyles to ScrollStyles. ScrollbarStyles contains values of overflow, (over)scroll-behavior, etc. The only one which is marginally related to scroll _bars_ is overflow, which can be used to hide scrollbar (by making an element not scrollable) or enforce the scrollbar to display. It makes more sense to be called ScrollStyles as it's mainly concerning behavior of scrolling, not scrollbars. Also, with the addition of scrollbar width properties, the current name can be confusing. --- layout/generic/TextOverflow.cpp | 4 ++-- layout/generic/nsFrame.cpp | 2 +- layout/generic/nsGfxScrollFrame.cpp | 34 +++++++++++++++++----------------- layout/generic/nsGfxScrollFrame.h | 10 +++++----- layout/generic/nsIScrollableFrame.h | 4 ++-- 5 files changed, 27 insertions(+), 27 deletions(-) (limited to 'layout/generic') diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index f4db27766d..3d78eaf911 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -305,8 +305,8 @@ TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder, mCanHaveInlineAxisScrollbar = false; if (mScrollableFrame) { auto scrollbarStyle = mBlockWM.IsVertical() ? - mScrollableFrame->GetScrollbarStyles().mVertical : - mScrollableFrame->GetScrollbarStyles().mHorizontal; + mScrollableFrame->GetScrollStyles().mVertical : + mScrollableFrame->GetScrollStyles().mHorizontal; mCanHaveInlineAxisScrollbar = scrollbarStyle != NS_STYLE_OVERFLOW_HIDDEN; if (!mAdjustForPixelSnapping) { // Scrolling to the end position can leave some text still overflowing due diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index a9e6354abe..5d05b71037 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -9188,7 +9188,7 @@ nsIFrame::IsFocusable(int32_t *aTabIndex, bool aWithMouse) // will be enough to make them keyboard scrollable. nsIScrollableFrame *scrollFrame = do_QueryFrame(this); if (scrollFrame && - !scrollFrame->GetScrollbarStyles().IsHiddenInBothDirections() && + !scrollFrame->GetScrollStyles().IsHiddenInBothDirections() && !scrollFrame->GetScrollRange().IsEqualEdges(nsRect(0, 0, 0, 0))) { // Scroll bars will be used for overflow isFocusable = true; diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 95e4b9bf4c..8e7b208e42 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -263,7 +263,7 @@ struct MOZ_STACK_CLASS ScrollReflowInput { // worry about the reflow depth here , mBoxState(aState.mFrame->PresContext(), aState.mRenderingContext, 0) { - ScrollbarStyles styles = aFrame->GetScrollbarStyles(); + ScrollStyles styles = aFrame->GetScrollStyles(); mHScrollbar = ShouldShowScrollbar(styles.mHorizontal); mVScrollbar = ShouldShowScrollbar(styles.mVertical); } @@ -808,7 +808,7 @@ nsHTMLScrollFrame::PlaceScrollArea(ScrollReflowInput& aState, nscoord nsHTMLScrollFrame::GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext) { - ScrollbarStyles ss = GetScrollbarStyles(); + ScrollStyles ss = GetScrollStyles(); if (ss.mVertical != NS_STYLE_OVERFLOW_SCROLL || !mHelper.mVScrollbarBox) return 0; @@ -1161,7 +1161,7 @@ nsHTMLScrollFrame::AccessibleType() // Create an accessible regardless of focusable state because the state can be // changed during frame life cycle without any notifications to accessibility. if (mContent->IsRootOfNativeAnonymousSubtree() || - GetScrollbarStyles().IsHiddenInBothDirections()) { + GetScrollStyles().IsHiddenInBothDirections()) { return a11y::eNoType; } @@ -1320,7 +1320,7 @@ ScrollFrameHelper::WantAsyncScroll() const return true; } - ScrollbarStyles styles = GetScrollbarStylesFromFrame(); + ScrollStyles styles = GetScrollStylesFromFrame(); nscoord oneDevPixel = GetScrolledFrame()->PresContext()->AppUnitsPerDevPixel(); nsRect scrollRange = GetScrollRange(); bool isVScrollable = (scrollRange.height >= oneDevPixel) && @@ -1571,7 +1571,7 @@ nsXULScrollFrame::GetXULPrefSize(nsBoxLayoutState& aState) nsSize pref = mHelper.mScrolledFrame->GetXULPrefSize(aState); - ScrollbarStyles styles = GetScrollbarStyles(); + ScrollStyles styles = GetScrollStyles(); // scrolled frames don't have their own margins @@ -1604,7 +1604,7 @@ nsXULScrollFrame::GetXULMinSize(nsBoxLayoutState& aState) nsSize min = mHelper.mScrolledFrame->GetXULMinSizeForScrollArea(aState); - ScrollbarStyles styles = GetScrollbarStyles(); + ScrollStyles styles = GetScrollStyles(); if (mHelper.mVScrollbarBox && styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) { @@ -2490,7 +2490,7 @@ bool ScrollFrameHelper::IsAlwaysActive() const // If we're overflow:hidden, then start as inactive until // we get scrolled manually. - ScrollbarStyles styles = GetScrollbarStylesFromFrame(); + ScrollStyles styles = GetScrollStylesFromFrame(); return (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN && styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN); } @@ -3821,21 +3821,21 @@ static void HandleScrollPref(nsIScrollable *aScrollable, int32_t aOrientation, } } -ScrollbarStyles -ScrollFrameHelper::GetScrollbarStylesFromFrame() const +ScrollStyles +ScrollFrameHelper::GetScrollStylesFromFrame() const { nsPresContext* presContext = mOuter->PresContext(); if (!presContext->IsDynamic() && !(mIsRoot && presContext->HasPaginatedScrolling())) { - return ScrollbarStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN); + return ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN); } if (!mIsRoot) { const nsStyleDisplay* disp = mOuter->StyleDisplay(); - return ScrollbarStyles(disp); + return ScrollStyles(disp); } - ScrollbarStyles result = presContext->GetViewportScrollbarStylesOverride(); + ScrollStyles result = presContext->GetViewportScrollStylesOverride(); nsCOMPtr container = presContext->GetContainerWeak(); nsCOMPtr scrollable = do_QueryInterface(container); if (scrollable) { @@ -4004,7 +4004,7 @@ ScrollFrameHelper::ScrollBy(nsIntPoint aDelta, nsPoint newPos = mDestination + nsPoint(aDelta.x*deltaMultiplier.width, aDelta.y*deltaMultiplier.height); if (aSnap == nsIScrollableFrame::ENABLE_SNAP) { - ScrollbarStyles styles = GetScrollbarStylesFromFrame(); + ScrollStyles styles = GetScrollStylesFromFrame(); if (styles.mScrollSnapTypeY != NS_STYLE_SCROLL_SNAP_TYPE_NONE || styles.mScrollSnapTypeX != NS_STYLE_SCROLL_SNAP_TYPE_NONE) { nscoord appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel(); @@ -4412,7 +4412,7 @@ ScrollFrameHelper::CreateAnonymousContent( bool canHaveHorizontal; bool canHaveVertical; if (!mIsRoot) { - ScrollbarStyles styles = scrollable->GetScrollbarStyles(); + ScrollStyles styles = scrollable->GetScrollStyles(); canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN; canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN; if (!canHaveHorizontal && !canHaveVertical && !isResizable) { @@ -5094,7 +5094,7 @@ nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) (if we're the viewport and we added or removed a scrollbar). **************/ - ScrollbarStyles styles = GetScrollbarStyles(); + ScrollStyles styles = GetScrollStyles(); // Look at our style do we always have vertical or horizontal scrollbars? if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) @@ -5399,7 +5399,7 @@ bool ScrollFrameHelper::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) { nsIScrollableFrame* sf = do_QueryFrame(mOuter); - ScrollbarStyles ss = sf->GetScrollbarStyles(); + ScrollStyles ss = sf->GetScrollStyles(); // Reflow when the change in overflow leads to one of our scrollbars // changing or might require repositioning the scrolled content due to @@ -6121,7 +6121,7 @@ ComputeScrollSnapInfo(const ScrollFrameHelper& aScrollFrame) { ScrollSnapInfo result; - ScrollbarStyles styles = aScrollFrame.GetScrollbarStylesFromFrame(); + ScrollStyles styles = aScrollFrame.GetScrollStylesFromFrame(); if (styles.mScrollSnapTypeY == NS_STYLE_SCROLL_SNAP_TYPE_NONE && styles.mScrollSnapTypeX == NS_STYLE_SCROLL_SNAP_TYPE_NONE) { diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 2968678563..41957d5e55 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -55,7 +55,7 @@ public: ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot); ~ScrollFrameHelper(); - mozilla::ScrollbarStyles GetScrollbarStylesFromFrame() const; + mozilla::ScrollStyles GetScrollStylesFromFrame() const; // If a child frame was added or removed on the scrollframe, // reload our child frame list. @@ -775,8 +775,8 @@ public: virtual nsIFrame* GetScrolledFrame() const override { return mHelper.GetScrolledFrame(); } - virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override { - return mHelper.GetScrollbarStylesFromFrame(); + virtual mozilla::ScrollStyles GetScrollStyles() const override { + return mHelper.GetScrollStylesFromFrame(); } virtual uint32_t GetScrollbarVisibility() const override { return mHelper.GetScrollbarVisibility(); @@ -1199,8 +1199,8 @@ public: virtual nsIFrame* GetScrolledFrame() const override { return mHelper.GetScrolledFrame(); } - virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override { - return mHelper.GetScrollbarStylesFromFrame(); + virtual mozilla::ScrollStyles GetScrollStyles() const override { + return mHelper.GetScrollStylesFromFrame(); } virtual uint32_t GetScrollbarVisibility() const override { return mHelper.GetScrollbarVisibility(); diff --git a/layout/generic/nsIScrollableFrame.h b/layout/generic/nsIScrollableFrame.h index b7e3caf46a..4ad45a528d 100644 --- a/layout/generic/nsIScrollableFrame.h +++ b/layout/generic/nsIScrollableFrame.h @@ -12,7 +12,7 @@ #include "nsCoord.h" #include "DisplayItemClip.h" -#include "ScrollbarStyles.h" +#include "ScrollStyles.h" #include "mozilla/Maybe.h" #include "mozilla/gfx/Point.h" #include "nsIScrollbarMediator.h" @@ -63,7 +63,7 @@ public: * or NS_STYLE_OVERFLOW_AUTO) governing the horizontal and vertical * scrollbars for this frame. */ - virtual mozilla::ScrollbarStyles GetScrollbarStyles() const = 0; + virtual mozilla::ScrollStyles GetScrollStyles() const = 0; enum { HORIZONTAL = 0x01, VERTICAL = 0x02 }; /** -- cgit v1.2.3