summaryrefslogtreecommitdiff
path: root/layout/base
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-01-06 16:31:36 +0000
committerMoonchild <moonchild@palemoon.org>2021-01-06 16:31:36 +0000
commitbfefb70b73f7a9023aee40906a90bfd3ce2b22a4 (patch)
treeec4cb347e7cb522e098115abf09e7d2652366148 /layout/base
parent94c09b557608ae3bd8e2cb031ac268a1261346c3 (diff)
downloadaura-central-bfefb70b73f7a9023aee40906a90bfd3ce2b22a4.tar.gz
Issue mcp-graveyard/UXP%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.
Diffstat (limited to 'layout/base')
-rw-r--r--layout/base/RestyleManagerBase.cpp4
-rw-r--r--layout/base/ScrollStyles.cpp (renamed from layout/base/ScrollbarStyles.cpp)6
-rw-r--r--layout/base/ScrollStyles.h (renamed from layout/base/ScrollbarStyles.h)18
-rw-r--r--layout/base/moz.build4
-rw-r--r--layout/base/nsCSSFrameConstructor.cpp10
-rw-r--r--layout/base/nsCSSFrameConstructor.h2
-rw-r--r--layout/base/nsLayoutUtils.cpp8
-rw-r--r--layout/base/nsPresContext.cpp28
-rw-r--r--layout/base/nsPresContext.h18
-rw-r--r--layout/base/nsPresShell.cpp4
10 files changed, 51 insertions, 51 deletions
diff --git a/layout/base/RestyleManagerBase.cpp b/layout/base/RestyleManagerBase.cpp
index 433589dac..192c0df99 100644
--- a/layout/base/RestyleManagerBase.cpp
+++ b/layout/base/RestyleManagerBase.cpp
@@ -1137,9 +1137,9 @@ if (!mDestroyedFrames) {
// to reconstruct - we can just reflow, because no scrollframe is being
// added/removed.
nsIContent* prevOverrideNode =
- presContext->GetViewportScrollbarStylesOverrideNode();
+ presContext->GetViewportScrollStylesOverrideNode();
nsIContent* newOverrideNode =
- presContext->UpdateViewportScrollbarStylesOverride();
+ presContext->UpdateViewportScrollStylesOverride();
if (data.mContent == prevOverrideNode ||
data.mContent == newOverrideNode) {
diff --git a/layout/base/ScrollbarStyles.cpp b/layout/base/ScrollStyles.cpp
index cc9f0c57d..328657d3d 100644
--- a/layout/base/ScrollbarStyles.cpp
+++ b/layout/base/ScrollStyles.cpp
@@ -3,12 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "ScrollbarStyles.h"
+#include "ScrollStyles.h"
#include "nsStyleStruct.h" // for nsStyleDisplay and nsStyleBackground::Position
namespace mozilla {
- ScrollbarStyles::ScrollbarStyles(uint8_t aH, uint8_t aV,
+ ScrollStyles::ScrollStyles(uint8_t aH, uint8_t aV,
const nsStyleDisplay* aDisplay)
: mHorizontal(aH), mVertical(aV),
mScrollBehavior(aDisplay->mScrollBehavior),
@@ -19,7 +19,7 @@ namespace mozilla {
mScrollSnapDestinationX(aDisplay->mScrollSnapDestination.mXPosition),
mScrollSnapDestinationY(aDisplay->mScrollSnapDestination.mYPosition) {}
- ScrollbarStyles::ScrollbarStyles(const nsStyleDisplay* aDisplay)
+ ScrollStyles::ScrollStyles(const nsStyleDisplay* aDisplay)
: mHorizontal(aDisplay->mOverflowX), mVertical(aDisplay->mOverflowY),
mScrollBehavior(aDisplay->mScrollBehavior),
mScrollSnapTypeX(aDisplay->mScrollSnapTypeX),
diff --git a/layout/base/ScrollbarStyles.h b/layout/base/ScrollStyles.h
index e6f0c6dde..c5743ee6b 100644
--- a/layout/base/ScrollbarStyles.h
+++ b/layout/base/ScrollStyles.h
@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef ScrollbarStyles_h
-#define ScrollbarStyles_h
+#ifndef ScrollStyles_h
+#define ScrollStyles_h
#include <stdint.h>
#include "nsStyleConsts.h" // for NS_STYLE_SCROLL_SNAP_*
@@ -16,7 +16,7 @@ struct nsStyleDisplay;
namespace mozilla {
-struct ScrollbarStyles
+struct ScrollStyles
{
// Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
// or NS_STYLE_OVERFLOW_AUTO.
@@ -34,7 +34,7 @@ struct ScrollbarStyles
nsStyleCoord::CalcValue mScrollSnapDestinationX;
nsStyleCoord::CalcValue mScrollSnapDestinationY;
- ScrollbarStyles(uint8_t aH, uint8_t aV)
+ ScrollStyles(uint8_t aH, uint8_t aV)
: mHorizontal(aH), mVertical(aV),
mScrollBehavior(NS_STYLE_SCROLL_BEHAVIOR_AUTO),
mScrollSnapTypeX(NS_STYLE_SCROLL_SNAP_TYPE_NONE),
@@ -50,10 +50,10 @@ struct ScrollbarStyles
mScrollSnapDestinationY.mHasPercent = false;
}
- explicit ScrollbarStyles(const nsStyleDisplay* aDisplay);
- ScrollbarStyles(uint8_t aH, uint8_t aV, const nsStyleDisplay* aDisplay);
- ScrollbarStyles() {}
- bool operator==(const ScrollbarStyles& aStyles) const {
+ explicit ScrollStyles(const nsStyleDisplay* aDisplay);
+ ScrollStyles(uint8_t aH, uint8_t aV, const nsStyleDisplay* aDisplay);
+ ScrollStyles() {}
+ bool operator==(const ScrollStyles& aStyles) const {
return aStyles.mHorizontal == mHorizontal && aStyles.mVertical == mVertical &&
aStyles.mScrollBehavior == mScrollBehavior &&
aStyles.mScrollSnapTypeX == mScrollSnapTypeX &&
@@ -63,7 +63,7 @@ struct ScrollbarStyles
aStyles.mScrollSnapDestinationX == mScrollSnapDestinationX &&
aStyles.mScrollSnapDestinationY == mScrollSnapDestinationY;
}
- bool operator!=(const ScrollbarStyles& aStyles) const {
+ bool operator!=(const ScrollStyles& aStyles) const {
return !(*this == aStyles);
}
bool IsHiddenInBothDirections() const {
diff --git a/layout/base/moz.build b/layout/base/moz.build
index 51cab4c6b..86377e9db 100644
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -95,7 +95,7 @@ EXPORTS += [
'nsRefreshDriver.h',
'nsStyleChangeList.h',
'nsStyleSheetService.h',
- 'ScrollbarStyles.h',
+ 'ScrollStyles.h',
'StackArena.h',
'Units.h',
'UnitTransforms.h',
@@ -162,7 +162,7 @@ SOURCES += [
'RestyleManager.cpp',
'RestyleManagerBase.cpp',
'RestyleTracker.cpp',
- 'ScrollbarStyles.cpp',
+ 'ScrollStyles.cpp',
'ServoRestyleManager.cpp',
'StackArena.cpp',
'StaticPresData.cpp',
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index 45b95826c..2cc5ec818 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2406,12 +2406,12 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
GetRootFrame()->SetStyleContextWithoutNotification(sc);
}
- // Make sure to call UpdateViewportScrollbarStylesOverride before
+ // Make sure to call UpdateViewportScrollStylesOverride before
// SetUpDocElementContainingBlock, since it sets up our scrollbar state
// properly.
DebugOnly<nsIContent*> propagatedScrollFrom;
if (nsPresContext* presContext = mPresShell->GetPresContext()) {
- propagatedScrollFrom = presContext->UpdateViewportScrollbarStylesOverride();
+ propagatedScrollFrom = presContext->UpdateViewportScrollStylesOverride();
}
SetUpDocElementContainingBlock(aDocElement);
@@ -4660,7 +4660,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
if (aElement->IsHTMLElement(nsGkAtoms::body)) {
if (nsPresContext* presContext = mPresShell->GetPresContext()) {
propagatedScrollToViewport =
- presContext->UpdateViewportScrollbarStylesOverride() == aElement;
+ presContext->UpdateViewportScrollStylesOverride() == aElement;
}
}
@@ -4696,7 +4696,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
// scrollframe so that it paginates correctly, but we don't want to set
// the bit on the block that tells it to clip at paint time.
if (mPresShell->GetPresContext()->
- ElementWouldPropagateScrollbarStyles(aElement)) {
+ ElementWouldPropagateScrollStyles(aElement)) {
suppressScrollFrame = false;
}
}
@@ -8133,7 +8133,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
// source is a fullscreen element, and we have code elsewhere to update
// scrollbars after fullscreen elements are removed -- specifically, it's
// part of the fullscreen cleanup code called by Element::UnbindFromTree.)
- presContext->UpdateViewportScrollbarStylesOverride();
+ presContext->UpdateViewportScrollStylesOverride();
}
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h
index 0de00a90c..abdfbf7ce 100644
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -22,7 +22,7 @@
#include "nsCounterManager.h"
#include "nsIAnonymousContentCreator.h"
#include "nsFrameManager.h"
-#include "ScrollbarStyles.h"
+#include "ScrollStyles.h"
struct nsFrameItems;
class nsStyleContext;
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 86a11bce9..ccdc5503f 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2023,7 +2023,7 @@ nsLayoutUtils::GetNearestScrollableFrameForDirection(nsIFrame* aFrame,
for (nsIFrame* f = aFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(f);
if (scrollableFrame) {
- ScrollbarStyles ss = scrollableFrame->GetScrollbarStyles();
+ ScrollStyles ss = scrollableFrame->GetScrollStyles();
uint32_t directions = scrollableFrame->GetPerceivedScrollingDirections();
if (aDirection == eVertical ?
(ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN &&
@@ -2050,7 +2050,7 @@ nsLayoutUtils::GetNearestScrollableFrame(nsIFrame* aFrame, uint32_t aFlags)
return scrollableFrame;
}
} else {
- ScrollbarStyles ss = scrollableFrame->GetScrollbarStyles();
+ ScrollStyles ss = scrollableFrame->GetScrollStyles();
if ((aFlags & SCROLLABLE_INCLUDE_HIDDEN) ||
ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN ||
ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
@@ -8255,11 +8255,11 @@ nsLayoutUtils::CalculateScrollableRectForFrame(nsIScrollableFrame* aScrollableFr
contentBounds = aScrollableFrame->GetScrollRange();
nsPoint scrollPosition = aScrollableFrame->GetScrollPosition();
- if (aScrollableFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
+ if (aScrollableFrame->GetScrollStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
contentBounds.y = scrollPosition.y;
contentBounds.height = 0;
}
- if (aScrollableFrame->GetScrollbarStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
+ if (aScrollableFrame->GetScrollStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
contentBounds.x = scrollPosition.x;
contentBounds.width = 0;
}
diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp
index 1d90b967a..f7be42b5f 100644
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1346,7 +1346,7 @@ nsPresContext::ScreenSizeInchesForFontInflation(bool* aChanged)
}
static bool
-CheckOverflow(const nsStyleDisplay* aDisplay, ScrollbarStyles* aStyles)
+CheckOverflow(const nsStyleDisplay* aDisplay, ScrollStyles* aStyles)
{
if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
aDisplay->mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_AUTO &&
@@ -1362,17 +1362,17 @@ CheckOverflow(const nsStyleDisplay* aDisplay, ScrollbarStyles* aStyles)
}
if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP) {
- *aStyles = ScrollbarStyles(NS_STYLE_OVERFLOW_HIDDEN,
+ *aStyles = ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN,
NS_STYLE_OVERFLOW_HIDDEN, aDisplay);
} else {
- *aStyles = ScrollbarStyles(aDisplay);
+ *aStyles = ScrollStyles(aDisplay);
}
return true;
}
static nsIContent*
-GetPropagatedScrollbarStylesForViewport(nsPresContext* aPresContext,
- ScrollbarStyles *aStyles)
+GetPropagatedScrollStylesForViewport(nsPresContext* aPresContext,
+ ScrollStyles *aStyles)
{
nsIDocument* document = aPresContext->Document();
Element* docElement = document->GetRootElement();
@@ -1424,16 +1424,16 @@ GetPropagatedScrollbarStylesForViewport(nsPresContext* aPresContext,
}
nsIContent*
-nsPresContext::UpdateViewportScrollbarStylesOverride()
+nsPresContext::UpdateViewportScrollStylesOverride()
{
// Start off with our default styles, and then update them as needed.
- mViewportStyleScrollbar = ScrollbarStyles(NS_STYLE_OVERFLOW_AUTO,
+ mViewportStyleScrollbar = ScrollStyles(NS_STYLE_OVERFLOW_AUTO,
NS_STYLE_OVERFLOW_AUTO);
mViewportScrollbarOverrideNode = nullptr;
// Don't propagate the scrollbar state in printing or print preview.
if (!IsPaginated()) {
mViewportScrollbarOverrideNode =
- GetPropagatedScrollbarStylesForViewport(this, &mViewportStyleScrollbar);
+ GetPropagatedScrollStylesForViewport(this, &mViewportStyleScrollbar);
}
nsIDocument* document = Document();
@@ -1445,7 +1445,7 @@ nsPresContext::UpdateViewportScrollbarStylesOverride()
// affected across fullscreen change.
if (fullscreenElement != document->GetRootElement() &&
fullscreenElement != mViewportScrollbarOverrideNode) {
- mViewportStyleScrollbar = ScrollbarStyles(NS_STYLE_OVERFLOW_HIDDEN,
+ mViewportStyleScrollbar = ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN,
NS_STYLE_OVERFLOW_HIDDEN);
}
}
@@ -1454,7 +1454,7 @@ nsPresContext::UpdateViewportScrollbarStylesOverride()
}
bool
-nsPresContext::ElementWouldPropagateScrollbarStyles(Element* aElement)
+nsPresContext::ElementWouldPropagateScrollStyles(Element* aElement)
{
MOZ_ASSERT(IsPaginated(), "Should only be called on paginated contexts");
if (aElement->GetParent() && !aElement->IsHTMLElement(nsGkAtoms::body)) {
@@ -1462,13 +1462,13 @@ nsPresContext::ElementWouldPropagateScrollbarStyles(Element* aElement)
return false;
}
- // Go ahead and just call GetPropagatedScrollbarStylesForViewport, but update
- // a dummy ScrollbarStyles we don't care about. It'll do a bit of extra work,
+ // Go ahead and just call GetPropagatedScrollStylesForViewport, but update
+ // a dummy ScrollStyles we don't care about. It'll do a bit of extra work,
// but saves us having to have more complicated code or more code duplication;
// in practice we will make this call quite rarely, because we checked for all
// the common cases above.
- ScrollbarStyles dummy(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO);
- return GetPropagatedScrollbarStylesForViewport(this, &dummy) == aElement;
+ ScrollStyles dummy(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO);
+ return GetPropagatedScrollStylesForViewport(this, &dummy) == aElement;
}
void
diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h
index a2b9bb533..10908a604 100644
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -35,7 +35,7 @@
#include "mozilla/AppUnits.h"
#include "prclist.h"
#include "nsThreadUtils.h"
-#include "ScrollbarStyles.h"
+#include "ScrollStyles.h"
#include "nsIMessageManager.h"
#include "mozilla/RestyleLogging.h"
#include "Units.h"
@@ -140,7 +140,7 @@ class nsPresContext : public nsIObserver,
public mozilla::SupportsWeakPtr<nsPresContext> {
public:
typedef mozilla::LangGroupFontPrefs LangGroupFontPrefs;
- typedef mozilla::ScrollbarStyles ScrollbarStyles;
+ typedef mozilla::ScrollStyles ScrollStyles;
typedef mozilla::StaticPresData StaticPresData;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@@ -716,19 +716,19 @@ public:
* @return if scroll was propagated from some content node, the content node
* it was propagated from.
*/
- nsIContent* UpdateViewportScrollbarStylesOverride();
+ nsIContent* UpdateViewportScrollStylesOverride();
/**
* Returns the cached result from the last call to
- * UpdateViewportScrollbarStylesOverride() -- i.e. return the node
+ * UpdateViewportScrollStylesOverride() -- i.e. return the node
* whose scrollbar styles we have propagated to the viewport (or nullptr if
* there is no such node).
*/
- nsIContent* GetViewportScrollbarStylesOverrideNode() const {
+ nsIContent* GetViewportScrollStylesOverrideNode() const {
return mViewportScrollbarOverrideNode;
}
- const ScrollbarStyles& GetViewportScrollbarStylesOverride() const
+ const ScrollStyles& GetViewportScrollStylesOverride() const
{
return mViewportStyleScrollbar;
}
@@ -737,7 +737,7 @@ public:
* Check whether the given element would propagate its scrollbar styles to the
* viewport in non-paginated mode. Must only be called if IsPaginated().
*/
- bool ElementWouldPropagateScrollbarStyles(mozilla::dom::Element* aElement);
+ bool ElementWouldPropagateScrollStyles(mozilla::dom::Element* aElement);
/**
* Set and get methods for controlling the background drawing
@@ -1312,13 +1312,13 @@ protected:
// This is a non-owning pointer. May be null. If non-null, it's guaranteed
// to be pointing to a node that's still alive, because we'll reset it in
- // UpdateViewportScrollbarStylesOverride() as part of the cleanup code
+ // UpdateViewportScrollStylesOverride() as part of the cleanup code
// when this node is removed from the document. (For <body> and the root node,
// this call happens in nsCSSFrameConstructor::ContentRemoved(). For
// fullscreen elements, it happens in the fullscreen-specific cleanup
// invoked by Element::UnbindFromTree().)
nsIContent* MOZ_NON_OWNING_REF mViewportScrollbarOverrideNode;
- ScrollbarStyles mViewportStyleScrollbar;
+ ScrollStyles mViewportStyleScrollbar;
uint8_t mFocusRingWidth;
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 1fb223172..9ba4ff462 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -3331,7 +3331,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
aHorizontal.mWhenToScroll == nsIPresShell::SCROLL_IF_NOT_VISIBLE) {
lineSize = aFrameAsScrollable->GetLineScrollAmount();
}
- ScrollbarStyles ss = aFrameAsScrollable->GetScrollbarStyles();
+ ScrollStyles ss = aFrameAsScrollable->GetScrollStyles();
nsRect allowedRange(scrollPt, nsSize(0, 0));
bool needToScroll = false;
uint32_t directions = aFrameAsScrollable->GetPerceivedScrollingDirections();
@@ -3388,7 +3388,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
// a current smooth scroll operation.
if (needToScroll) {
nsIScrollableFrame::ScrollMode scrollMode = nsIScrollableFrame::INSTANT;
- bool autoBehaviorIsSmooth = (aFrameAsScrollable->GetScrollbarStyles().mScrollBehavior
+ bool autoBehaviorIsSmooth = (aFrameAsScrollable->GetScrollStyles().mScrollBehavior
== NS_STYLE_SCROLL_BEHAVIOR_SMOOTH);
bool smoothScroll = (aFlags & nsIPresShell::SCROLL_SMOOTH) ||
((aFlags & nsIPresShell::SCROLL_SMOOTH_AUTO) && autoBehaviorIsSmooth);