--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -6014,17 +6014,17 @@ nsDocShell::GetCurScrollPos(int32_t aScr
nsresult
nsDocShell::SetCurScrollPosEx(int32_t aCurHorizontalPos,
int32_t aCurVerticalPos)
{
nsIScrollableFrame* sf = GetRootScrollFrame();
NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
nsIScrollableFrame::ScrollMode scrollMode = nsIScrollableFrame::INSTANT;
- if (sf->GetScrollbarStyles().mScrollBehavior ==
+ if (sf->GetScrollStyles().mScrollBehavior ==
NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
}
sf->ScrollTo(nsPoint(aCurHorizontalPos, aCurVerticalPos), scrollMode);
return NS_OK;
}
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -1341,17 +1341,17 @@ KeyframeEffect::CanThrottleOverflowChang
// If the nearest scrollable ancestor has overflow:hidden,
// we don't care about overflow.
nsIScrollableFrame* scrollable =
nsLayoutUtils::GetNearestScrollableFrame(&aFrame);
if (!scrollable) {
return true;
}
- ScrollbarStyles ss = scrollable->GetScrollbarStyles();
+ ScrollStyles ss = scrollable->GetScrollStyles();
if (ss.mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
ss.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
scrollable->GetLogicalScrollPosition() == nsPoint(0, 0)) {
return true;
}
return false;
}
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -800,17 +800,17 @@ void
Element::Scroll(const CSSIntPoint& aScroll, const ScrollOptions& aOptions)
{
nsIScrollableFrame* sf = GetScrollFrame();
if (sf) {
nsIScrollableFrame::ScrollMode scrollMode = nsIScrollableFrame::INSTANT;
if (aOptions.mBehavior == ScrollBehavior::Smooth) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
} else if (aOptions.mBehavior == ScrollBehavior::Auto) {
- ScrollbarStyles styles = sf->GetScrollbarStyles();
+ ScrollStyles styles = sf->GetScrollStyles();
if (styles.mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
}
}
sf->ScrollToCSSPixels(aScroll, scrollMode);
}
}
@@ -897,17 +897,17 @@ Element::SetScrollTop(int32_t aScrollTop
// there is one.
//
// If aScrollTop is nonzero, we need to flush layout because we need to figure
// out what our real scrollTopMax is.
FlushType flushType = aScrollTop == 0 ? FlushType::Frames : FlushType::Layout;
nsIScrollableFrame* sf = GetScrollFrame(nullptr, flushType);
if (sf) {
nsIScrollableFrame::ScrollMode scrollMode = nsIScrollableFrame::INSTANT;
- if (sf->GetScrollbarStyles().mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
+ if (sf->GetScrollStyles().mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
}
sf->ScrollToCSSPixels(CSSIntPoint(sf->GetScrollPositionCSSPixels().x,
aScrollTop),
scrollMode);
}
}
@@ -922,17 +922,17 @@ void
Element::SetScrollLeft(int32_t aScrollLeft)
{
// We can't assume things here based on the value of aScrollLeft, because
// depending on our direction and layout 0 may or may not be in our scroll
// range. So we need to flush layout no matter what.
nsIScrollableFrame* sf = GetScrollFrame();
if (sf) {
nsIScrollableFrame::ScrollMode scrollMode = nsIScrollableFrame::INSTANT;
- if (sf->GetScrollbarStyles().mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
+ if (sf->GetScrollStyles().mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
}
sf->ScrollToCSSPixels(CSSIntPoint(aScrollLeft,
sf->GetScrollPositionCSSPixels().y),
scrollMode);
}
}
@@ -1968,17 +1968,17 @@ Element::UnbindFromTree(bool aDeep, bool
#ifdef DEBUG
// If we can get access to the PresContext, then we sanity-check that
// we're not leaving behind a pointer to ourselves as the PresContext's
// cached provider of the viewport's scrollbar styles.
if (document) {
nsPresContext* presContext = document->GetPresContext();
if (presContext) {
MOZ_ASSERT(this !=
- presContext->GetViewportScrollbarStylesOverrideElement(),
+ presContext->GetViewportScrollStylesOverrideElement(),
"Leaving behind a raw pointer to this element (as having "
"propagated scrollbar styles) - that's dangerous...");
}
}
#endif
ClearInDocument();
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -7282,17 +7282,17 @@ nsIDocument::GetViewportInfo(const Scree
void
nsIDocument::UpdateViewportOverflowType(nscoord aScrolledWidth,
nscoord aScrollportWidth)
{
#ifdef DEBUG
MOZ_ASSERT(mPresShell);
nsPresContext* pc = GetPresContext();
- MOZ_ASSERT(pc->GetViewportScrollbarStylesOverride().mHorizontal ==
+ MOZ_ASSERT(pc->GetViewportScrollStylesOverride().mHorizontal ==
NS_STYLE_OVERFLOW_HIDDEN,
"Should only be called when viewport has overflow-x: hidden");
MOZ_ASSERT(aScrolledWidth > aScrollportWidth,
"Should only be called when viewport is overflowed");
MOZ_ASSERT(IsTopLevelContentDocument(),
"Should only be called for top-level content document");
#endif // DEBUG
@@ -10680,17 +10680,17 @@ nsIDocument::DispatchFullscreenError(con
nsContentUtils::eDOM_PROPERTIES,
aMessage);
}
static void
UpdateViewportScrollbarOverrideForFullscreen(nsIDocument* aDoc)
{
if (nsPresContext* presContext = aDoc->GetPresContext()) {
- presContext->UpdateViewportScrollbarStylesOverride();
+ presContext->UpdateViewportScrollStylesOverride();
}
}
static void
ClearFullscreenStateOnElement(Element* aElement)
{
// Remove styles from existing top element.
EventStateManager::SetFullScreenState(aElement, false);
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -3987,17 +3987,17 @@ nsGlobalWindowInner::ScrollTo(const CSSI
if (scroll.x > maxpx) {
scroll.x = maxpx;
}
if (scroll.y > maxpx) {
scroll.y = maxpx;
}
- bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
+ bool smoothScroll = sf->GetScrollStyles().IsSmoothScroll(aOptions.mBehavior);
sf->ScrollToCSSPixels(scroll, smoothScroll
? nsIScrollableFrame::SMOOTH_MSD
: nsIScrollableFrame::INSTANT);
}
}
void
@@ -4041,17 +4041,17 @@ nsGlobalWindowInner::ScrollByLines(int32
const ScrollOptions& aOptions)
{
FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
// It seems like it would make more sense for ScrollByLines to use
// SMOOTH mode, but tests seem to depend on the synchronous behaviour.
// Perhaps Web content does too.
- bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
+ bool smoothScroll = sf->GetScrollStyles().IsSmoothScroll(aOptions.mBehavior);
sf->ScrollBy(nsIntPoint(0, numLines), nsIScrollableFrame::LINES,
smoothScroll
? nsIScrollableFrame::SMOOTH_MSD
: nsIScrollableFrame::INSTANT);
}
}
@@ -4060,17 +4060,17 @@ nsGlobalWindowInner::ScrollByPages(int32
const ScrollOptions& aOptions)
{
FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
// It seems like it would make more sense for ScrollByPages to use
// SMOOTH mode, but tests seem to depend on the synchronous behaviour.
// Perhaps Web content does too.
- bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
+ bool smoothScroll = sf->GetScrollStyles().IsSmoothScroll(aOptions.mBehavior);
sf->ScrollBy(nsIntPoint(0, numPages), nsIScrollableFrame::PAGES,
smoothScroll
? nsIScrollableFrame::SMOOTH_MSD
: nsIScrollableFrame::INSTANT);
}
}
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2678,17 +2678,17 @@ EventStateManager::ComputeScrollTargetAn
case layers::ScrollDirection::eVertical:
if (checkIfScrollableY) {
continue;
}
break;
}
}
- ScrollbarStyles ss = scrollableFrame->GetScrollbarStyles();
+ ScrollStyles ss = scrollableFrame->GetScrollStyles();
bool hiddenForV = (NS_STYLE_OVERFLOW_HIDDEN == ss.mVertical);
bool hiddenForH = (NS_STYLE_OVERFLOW_HIDDEN == ss.mHorizontal);
if ((hiddenForV && hiddenForH) ||
(checkIfScrollableY && !checkIfScrollableX && hiddenForV) ||
(checkIfScrollableX && !checkIfScrollableY && hiddenForH)) {
continue;
}
@@ -2791,17 +2791,17 @@ EventStateManager::DoScrollText(nsIScrol
nsIntSize scrollAmountInDevPixels(
pc->AppUnitsToDevPixels(scrollAmount.width),
pc->AppUnitsToDevPixels(scrollAmount.height));
nsIntPoint actualDevPixelScrollAmount =
DeltaAccumulator::GetInstance()->
ComputeScrollAmountForDefaultAction(aEvent, scrollAmountInDevPixels);
// Don't scroll around the axis whose overflow style is hidden.
- ScrollbarStyles overflowStyle = aScrollableFrame->GetScrollbarStyles();
+ ScrollStyles overflowStyle = aScrollableFrame->GetScrollStyles();
if (overflowStyle.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
actualDevPixelScrollAmount.x = 0;
}
if (overflowStyle.mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
actualDevPixelScrollAmount.y = 0;
}
nsIScrollbarMediator::ScrollSnapMode snapMode = nsIScrollbarMediator::DISABLE_SNAP;
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -122,23 +122,23 @@ ScrollFrameTo(nsIScrollableFrame* aFrame
// scroll event. The overflow property could have changed at some time
// between the two events and so APZ may have computed a scrollable region
// that is larger than what is actually allowed.
//
// Currently, we allow the scroll position to change even though the frame is
// overflow:hidden (that is, we take |targetScrollPosition|). If this turns
// out to be problematic, an alternative solution would be to ignore the
// scroll position change (that is, use |geckoScrollPosition|).
- if (aFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
+ if (aFrame->GetScrollStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
targetScrollPosition.y != geckoScrollPosition.y) {
NS_WARNING(nsPrintfCString(
"APZCCH: targetScrollPosition.y (%f) != geckoScrollPosition.y (%f)",
targetScrollPosition.y, geckoScrollPosition.y).get());
}
- if (aFrame->GetScrollbarStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
+ if (aFrame->GetScrollStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
targetScrollPosition.x != geckoScrollPosition.x) {
NS_WARNING(nsPrintfCString(
"APZCCH: targetScrollPosition.x (%f) != geckoScrollPosition.x (%f)",
targetScrollPosition.x, geckoScrollPosition.x).get());
}
// If the scrollable frame is currently in the middle of an async or smooth
// scroll then we don't want to interrupt it (see bug 961280).
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -3452,17 +3452,17 @@ static void ScrollToShowRect(nsIScrollab
// does this save time, but it's not safe to call GetLineScrollAmount
// during reflow (because it depends on font size inflation and doesn't
// use the in-reflow-safe font-size inflation path). If we did call it,
// it would assert and possible give the wrong result.
if (aVertical.mWhenToScroll == nsIPresShell::SCROLL_IF_NOT_VISIBLE ||
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();
if (((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN) &&
(!aVertical.mOnlyIfPerceivedScrollableDirection ||
(directions & nsIScrollableFrame::VERTICAL))) {
@@ -3509,17 +3509,17 @@ static void ScrollToShowRect(nsIScrollab
needToScroll = true;
}
}
// If we don't need to scroll, then don't try since it might cancel
// 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);
if (gfxPrefs::ScrollBehaviorEnabled() && smoothScroll) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
}
aFrameAsScrollable->ScrollTo(scrollPt, scrollMode, &allowedRange);
}
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1376,19 +1376,19 @@ RestyleManager::ProcessRestyledFrames(ns
nsGkAtoms::html)) {
// If the restyled element provided/provides the scrollbar styles for
// the viewport before and/or after this restyle, AND it's not coopting
// that responsibility from some other element (which would need
// reconstruction to make its own scrollframe now), THEN: we don't need
// to reconstruct - we can just reflow, because no scrollframe is being
// added/removed.
nsIContent* prevOverrideNode =
- presContext->GetViewportScrollbarStylesOverrideElement();
+ presContext->GetViewportScrollStylesOverrideElement();
nsIContent* newOverrideNode =
- presContext->UpdateViewportScrollbarStylesOverride();
+ presContext->UpdateViewportScrollStylesOverride();
if (data.mContent == prevOverrideNode ||
data.mContent == newOverrideNode) {
// If we get here, the restyled element provided the scrollbar styles
// for viewport before this restyle, OR it will provide them after.
if (!prevOverrideNode || !newOverrideNode ||
prevOverrideNode == newOverrideNode) {
// If we get here, the restyled element is NOT replacing (or being
rename from layout/base/ScrollbarStyles.cpp
rename to layout/base/ScrollStyles.cpp
--- a/layout/base/ScrollbarStyles.cpp
+++ b/layout/base/ScrollStyles.cpp
@@ -1,33 +1,33 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "mozilla/ScrollStyles.h"
#include "nsStyleStruct.h" // for nsStyleDisplay and nsStyleBackground::Position
namespace mozilla {
- ScrollbarStyles::ScrollbarStyles(uint8_t aH, uint8_t aV,
- const nsStyleDisplay* aDisplay)
+ ScrollStyles::ScrollStyles(uint8_t aH, uint8_t aV,
+ const nsStyleDisplay* aDisplay)
: mHorizontal(aH), mVertical(aV),
mScrollBehavior(aDisplay->mScrollBehavior),
mOverscrollBehaviorX(aDisplay->mOverscrollBehaviorX),
mOverscrollBehaviorY(aDisplay->mOverscrollBehaviorY),
mScrollSnapTypeX(aDisplay->mScrollSnapTypeX),
mScrollSnapTypeY(aDisplay->mScrollSnapTypeY),
mScrollSnapPointsX(aDisplay->mScrollSnapPointsX),
mScrollSnapPointsY(aDisplay->mScrollSnapPointsY),
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),
mOverscrollBehaviorX(aDisplay->mOverscrollBehaviorX),
mOverscrollBehaviorY(aDisplay->mOverscrollBehaviorY),
mScrollSnapTypeX(aDisplay->mScrollSnapTypeX),
mScrollSnapTypeY(aDisplay->mScrollSnapTypeY),
mScrollSnapPointsX(aDisplay->mScrollSnapPointsX),
mScrollSnapPointsY(aDisplay->mScrollSnapPointsY),
rename from layout/base/ScrollbarStyles.h
rename to layout/base/ScrollStyles.h
--- a/layout/base/ScrollbarStyles.h
+++ b/layout/base/ScrollStyles.h
@@ -1,28 +1,28 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 mozilla_ScrollStyles_h
+#define mozilla_ScrollStyles_h
#include <stdint.h>
#include "nsStyleConsts.h" // for NS_STYLE_SCROLL_SNAP_*
#include "nsStyleCoord.h" // for nsStyleCoord
#include "mozilla/dom/WindowBinding.h"
// Forward declarations
struct nsStyleDisplay;
namespace mozilla {
-struct ScrollbarStyles
+struct ScrollStyles
{
// Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
// or NS_STYLE_OVERFLOW_AUTO.
uint8_t mHorizontal;
uint8_t mVertical;
// Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO or
// NS_STYLE_SCROLL_BEHAVIOR_SMOOTH
uint8_t mScrollBehavior;
@@ -32,17 +32,17 @@ struct ScrollbarStyles
// or NS_STYLE_SCROLL_SNAP_PROXIMITY.
uint8_t mScrollSnapTypeX;
uint8_t mScrollSnapTypeY;
nsStyleCoord mScrollSnapPointsX;
nsStyleCoord mScrollSnapPointsY;
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),
mOverscrollBehaviorX(StyleOverscrollBehavior::Auto),
mOverscrollBehaviorY(StyleOverscrollBehavior::Auto),
mScrollSnapTypeX(NS_STYLE_SCROLL_SNAP_TYPE_NONE),
mScrollSnapTypeY(NS_STYLE_SCROLL_SNAP_TYPE_NONE),
mScrollSnapPointsX(nsStyleCoord(eStyleUnit_None)),
mScrollSnapPointsY(nsStyleCoord(eStyleUnit_None)) {
@@ -50,39 +50,39 @@ struct ScrollbarStyles
mScrollSnapDestinationX.mPercent = 0;
mScrollSnapDestinationX.mLength = nscoord(0.0f);
mScrollSnapDestinationX.mHasPercent = false;
mScrollSnapDestinationY.mPercent = 0;
mScrollSnapDestinationY.mLength = nscoord(0.0f);
mScrollSnapDestinationY.mHasPercent = false;
}
- explicit ScrollbarStyles(const nsStyleDisplay* aDisplay);
- ScrollbarStyles(uint8_t aH, uint8_t aV, const nsStyleDisplay* aDisplay);
- bool operator==(const ScrollbarStyles& aStyles) const {
+ explicit ScrollStyles(const nsStyleDisplay* aDisplay);
+ ScrollStyles(uint8_t aH, uint8_t aV, const nsStyleDisplay* aDisplay);
+ bool operator==(const ScrollStyles& aStyles) const {
return aStyles.mHorizontal == mHorizontal && aStyles.mVertical == mVertical &&
aStyles.mScrollBehavior == mScrollBehavior &&
aStyles.mOverscrollBehaviorX == mOverscrollBehaviorX &&
aStyles.mOverscrollBehaviorY == mOverscrollBehaviorY &&
aStyles.mScrollSnapTypeX == mScrollSnapTypeX &&
aStyles.mScrollSnapTypeY == mScrollSnapTypeY &&
aStyles.mScrollSnapPointsX == mScrollSnapPointsX &&
aStyles.mScrollSnapPointsY == mScrollSnapPointsY &&
aStyles.mScrollSnapDestinationX == mScrollSnapDestinationX &&
aStyles.mScrollSnapDestinationY == mScrollSnapDestinationY;
}
- bool operator!=(const ScrollbarStyles& aStyles) const {
+ bool operator!=(const ScrollStyles& aStyles) const {
return !(*this == aStyles);
}
bool IsHiddenInBothDirections() const {
return mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
mVertical == NS_STYLE_OVERFLOW_HIDDEN;
}
bool IsSmoothScroll(dom::ScrollBehavior aBehavior) const {
return aBehavior == dom::ScrollBehavior::Smooth ||
(aBehavior == dom::ScrollBehavior::Auto &&
mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH);
}
};
} // namespace mozilla
-#endif
+#endif // mozilla_ScrollStyles_h
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -58,33 +58,33 @@ EXPORTS += [
'nsLayoutUtils.h',
'nsPresArena.h',
'nsPresArenaObjectList.h',
'nsPresContext.h',
'nsQuoteList.h',
'nsRefreshDriver.h',
'nsStyleChangeList.h',
'nsStyleSheetService.h',
- 'ScrollbarStyles.h',
'StackArena.h',
'TouchManager.h',
'Units.h',
'UnitTransforms.h',
'WordMovementType.h',
'ZoomConstraintsClient.h',
]
EXPORTS.mozilla += [
'ArenaObjectID.h',
'ArenaRefPtr.h',
'ArenaRefPtrInlines.h',
'GeometryUtils.h',
'OverflowChangedTracker.h',
'PresShell.h',
'RestyleManager.h',
+ 'ScrollStyles.h',
'ShapeUtils.h',
'StaticPresData.h',
'UndisplayedNode.h',
]
UNIFIED_SOURCES += [
'AccessibleCaret.cpp',
'AccessibleCaretEventHub.cpp',
@@ -108,17 +108,17 @@ UNIFIED_SOURCES += [
'nsPresArena.cpp',
'nsPresContext.cpp',
'nsQuoteList.cpp',
'nsStyleChangeList.cpp',
'nsStyleSheetService.cpp',
'PositionedEventTargeting.cpp',
'PresShell.cpp',
'RestyleManager.cpp',
- 'ScrollbarStyles.cpp',
+ 'ScrollStyles.cpp',
'ShapeUtils.cpp',
'StackArena.cpp',
'StaticPresData.cpp',
'TouchManager.cpp',
'ZoomConstraintsClient.cpp',
]
# nsRefreshDriver.cpp needs to be built separately because of name clashes in the OS X headers
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2405,22 +2405,22 @@ nsCSSFrameConstructor::ConstructDocEleme
//
// @see ComputedStyle::ApplyStyleFixups
{
RefPtr<ComputedStyle> sc = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport, nullptr);
GetRootFrame()->SetComputedStyleWithoutNotification(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);
NS_ASSERTION(mDocElementContainingBlock, "Should have parent by now");
nsFrameConstructorState state(mPresShell,
GetAbsoluteContainingBlock(mDocElementContainingBlock, FIXED_POS),
nullptr,
@@ -4525,17 +4525,17 @@ nsCSSFrameConstructor::FindDisplayData(c
// it might have dynamically changed from scrollable to not scrollable,
// and that might need to be propagated.
// XXXbz is this the right place to do this? If this code moves,
// make this function static.
bool propagatedScrollToViewport = false;
if (aElement.IsHTMLElement(nsGkAtoms::body)) {
if (nsPresContext* presContext = mPresShell->GetPresContext()) {
propagatedScrollToViewport =
- presContext->UpdateViewportScrollbarStylesOverride() == &aElement;
+ presContext->UpdateViewportScrollStylesOverride() == &aElement;
}
}
NS_ASSERTION(!propagatedScrollToViewport ||
!mPresShell->GetPresContext()->IsPaginated(),
"Shouldn't propagate scroll in paginated contexts");
if (aDisplay.IsBlockInsideStyle()) {
@@ -4561,17 +4561,17 @@ nsCSSFrameConstructor::FindDisplayData(c
return &sScrollableBlockData[caption];
}
// If the scrollable frame would have propagated its scrolling to the
// viewport, we still want to construct a regular block rather than a
// 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;
}
}
// Handle various non-scrollable blocks.
static const FrameConstructionData sNonScrollableBlockData[2][2] = {
{ FULL_CTOR_FCDATA(0,
&nsCSSFrameConstructor::ConstructNonScrollableBlock),
@@ -7684,29 +7684,29 @@ nsCSSFrameConstructor::ContentRemoved(ns
// We want to detect when the viewport override element stored in the
// prescontext is in the subtree being removed. Except in fullscreen cases
// (which are handled in Element::UnbindFromTree and do not get stored on the
// prescontext), the override element is always either the root element or a
// <body> child of the root element. So we can only be removing the stored
// override element if the thing being removed is either the override element
// itself or the root element (which can be a parent of the override element).
- if (aChild == presContext->GetViewportScrollbarStylesOverrideElement() ||
+ if (aChild == presContext->GetViewportScrollStylesOverrideElement() ||
(aChild->IsElement() && !aChild->GetParent())) {
// We might be removing the element that we propagated viewport scrollbar
// styles from. Recompute those. (This clause covers two of the three
// possible scrollbar-propagation sources: the <body> [as aChild or a
// descendant] and the root node. The other possible scrollbar-propagation
// 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.
// We don't handle the fullscreen case here, because it doesn't change the
// scrollbar styles override element stored on the prescontext.)
Element* newOverrideElement =
- presContext->UpdateViewportScrollbarStylesOverride();
+ presContext->UpdateViewportScrollStylesOverride();
// If aChild is the root, then we don't need to do any reframing of
// newOverrideElement, because we're about to tear down the whole frame tree
// anyway. And we need to make sure we don't do any such reframing, because
// reframing the <body> can trigger a reframe of the <html> and then reenter
// here.
//
// But if aChild is not the root, and if newOverrideElement is not
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -11,24 +11,24 @@
#ifndef nsCSSFrameConstructor_h___
#define nsCSSFrameConstructor_h___
#include "mozilla/ArenaAllocator.h"
#include "mozilla/Attributes.h"
#include "mozilla/LinkedList.h"
#include "mozilla/RestyleManager.h"
+#include "mozilla/ScrollStyles.h"
#include "nsCOMPtr.h"
#include "nsILayoutHistoryState.h"
#include "nsQuoteList.h"
#include "nsCounterManager.h"
#include "nsIAnonymousContentCreator.h"
#include "nsFrameManager.h"
-#include "ScrollbarStyles.h"
struct nsFrameItems;
struct nsStyleDisplay;
struct nsGenConInitializer;
class nsContainerFrame;
class nsFirstLineFrame;
class nsFirstLetterFrame;
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1960,17 +1960,17 @@ nsLayoutUtils::IsFixedPosFrameInDisplayP
nsIScrollableFrame*
nsLayoutUtils::GetNearestScrollableFrameForDirection(nsIFrame* aFrame,
Direction aDirection)
{
NS_ASSERTION(aFrame, "GetNearestScrollableFrameForDirection expects a non-null frame");
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 &&
(directions & nsIScrollableFrame::VERTICAL)) :
(ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN &&
(directions & nsIScrollableFrame::HORIZONTAL)))
return scrollableFrame;
}
@@ -1987,17 +1987,17 @@ nsLayoutUtils::GetNearestScrollableFrame
f->GetParent() : nsLayoutUtils::GetCrossDocParentFrame(f)) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(f);
if (scrollableFrame) {
if (aFlags & SCROLLABLE_ONLY_ASYNC_SCROLLABLE) {
if (scrollableFrame->WantAsyncScroll()) {
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) {
return scrollableFrame;
}
}
if (aFlags & SCROLLABLE_ALWAYS_MATCH_ROOT) {
nsIPresShell* ps = f->PresShell();
@@ -8725,21 +8725,21 @@ nsLayoutUtils::CalculateRootCompositionS
/* static */ nsRect
nsLayoutUtils::CalculateScrollableRectForFrame(nsIScrollableFrame* aScrollableFrame, nsIFrame* aRootFrame)
{
nsRect contentBounds;
if (aScrollableFrame) {
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;
}
contentBounds.width += aScrollableFrame->GetScrollPortRect().width;
contentBounds.height += aScrollableFrame->GetScrollPortRect().height;
} else {
contentBounds = aRootFrame->GetRect();
@@ -9164,20 +9164,20 @@ nsLayoutUtils::ComputeScrollMetadata(nsI
WheelHandlingUtils::GetDisregardedWheelScrollDirection(
aScrollFrame->GetParent()));
}
metadata.SetUsesContainerScrolling(scrollableFrame->UsesContainerScrolling());
metadata.SetSnapInfo(scrollableFrame->GetScrollSnapInfo());
- ScrollbarStyles scrollbarStyles = scrollableFrame->GetScrollbarStyles();
+ ScrollStyles scrollStyles = scrollableFrame->GetScrollStyles();
metadata.SetOverscrollBehavior(OverscrollBehaviorInfo::FromStyleConstants(
- scrollbarStyles.mOverscrollBehaviorX,
- scrollbarStyles.mOverscrollBehaviorY));
+ scrollStyles.mOverscrollBehaviorX,
+ scrollStyles.mOverscrollBehaviorY));
}
// If we have the scrollparent being the same as the scroll id, the
// compositor-side code could get into an infinite loop while building the
// overscroll handoff chain.
MOZ_ASSERT(aScrollParentId == FrameMetrics::NULL_SCROLL_ID || scrollId != aScrollParentId);
metrics.SetScrollId(scrollId);
metrics.SetIsRootContent(aIsRootContent);
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -192,18 +192,18 @@ nsPresContext::nsPresContext(nsIDocument
mDefaultColor(NS_RGBA(0,0,0,0)),
mBackgroundColor(NS_RGB(0xFF, 0xFF, 0xFF)),
mLinkColor(NS_RGB(0x00, 0x00, 0xEE)),
mActiveLinkColor(NS_RGB(0xEE, 0x00, 0x00)),
mVisitedLinkColor(NS_RGB(0x55, 0x1A, 0x8B)),
mFocusBackgroundColor(mBackgroundColor),
mFocusTextColor(mDefaultColor),
mBodyTextColor(mDefaultColor),
- mViewportScrollbarOverrideElement(nullptr),
- mViewportStyleScrollbar(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO),
+ mViewportScrollOverrideElement(nullptr),
+ mViewportScrollStyles(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO),
mFocusRingWidth(1),
mExistThrottledUpdates(false),
// mImageAnimationMode is initialised below, in constructor body
mImageAnimationModePref(imgIContainer::kNormalAnimMode),
mFontGroupCacheDirty(true),
mInterruptChecksToSkip(0),
mElementsRestyled(0),
mFramesConstructed(0),
@@ -1329,43 +1329,43 @@ nsPresContext::ScreenSizeInchesForFontIn
*aChanged = true;
mLastFontInflationScreenSize = deviceSizeInches;
}
return deviceSizeInches;
}
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 &&
aDisplay->mScrollSnapTypeX == NS_STYLE_SCROLL_SNAP_TYPE_NONE &&
aDisplay->mScrollSnapTypeY == NS_STYLE_SCROLL_SNAP_TYPE_NONE &&
aDisplay->mScrollSnapPointsX == nsStyleCoord(eStyleUnit_None) &&
aDisplay->mScrollSnapPointsY == nsStyleCoord(eStyleUnit_None) &&
!aDisplay->mScrollSnapDestination.mXPosition.mHasPercent &&
!aDisplay->mScrollSnapDestination.mYPosition.mHasPercent &&
aDisplay->mScrollSnapDestination.mXPosition.mLength == 0 &&
aDisplay->mScrollSnapDestination.mYPosition.mLength == 0) {
return false;
}
if (aDisplay->mOverflowX == NS_STYLE_OVERFLOW_CLIP) {
- *aStyles = ScrollbarStyles(NS_STYLE_OVERFLOW_HIDDEN,
- NS_STYLE_OVERFLOW_HIDDEN, aDisplay);
+ *aStyles = ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN,
+ NS_STYLE_OVERFLOW_HIDDEN, aDisplay);
} else {
- *aStyles = ScrollbarStyles(aDisplay);
+ *aStyles = ScrollStyles(aDisplay);
}
return true;
}
static Element*
-GetPropagatedScrollbarStylesForViewport(nsPresContext* aPresContext,
- ScrollbarStyles *aStyles)
+GetPropagatedScrollStylesForViewport(nsPresContext* aPresContext,
+ ScrollStyles *aStyles)
{
nsIDocument* document = aPresContext->Document();
Element* docElement = document->GetRootElement();
// docElement might be null if we're doing this after removing it.
if (!docElement) {
return nullptr;
}
@@ -1405,60 +1405,60 @@ GetPropagatedScrollbarStylesForViewport(
// tell caller we stole the overflow style from the body element
return bodyElement;
}
return nullptr;
}
Element*
-nsPresContext::UpdateViewportScrollbarStylesOverride()
+nsPresContext::UpdateViewportScrollStylesOverride()
{
// Start off with our default styles, and then update them as needed.
- mViewportStyleScrollbar = ScrollbarStyles(NS_STYLE_OVERFLOW_AUTO,
- NS_STYLE_OVERFLOW_AUTO);
- mViewportScrollbarOverrideElement = nullptr;
+ mViewportScrollStyles = ScrollStyles(NS_STYLE_OVERFLOW_AUTO,
+ NS_STYLE_OVERFLOW_AUTO);
+ mViewportScrollOverrideElement = nullptr;
// Don't propagate the scrollbar state in printing or print preview.
if (!IsPaginated()) {
- mViewportScrollbarOverrideElement =
- GetPropagatedScrollbarStylesForViewport(this, &mViewportStyleScrollbar);
+ mViewportScrollOverrideElement =
+ GetPropagatedScrollStylesForViewport(this, &mViewportScrollStyles);
}
nsIDocument* document = Document();
if (Element* fullscreenElement = document->GetFullscreenElement()) {
// If the document is in fullscreen, but the fullscreen element is
// not the root element, we should explicitly suppress the scrollbar
// here. Note that, we still need to return the original element
// the styles are from, so that the state of those elements is not
// affected across fullscreen change.
if (fullscreenElement != document->GetRootElement() &&
- fullscreenElement != mViewportScrollbarOverrideElement) {
- mViewportStyleScrollbar = ScrollbarStyles(NS_STYLE_OVERFLOW_HIDDEN,
- NS_STYLE_OVERFLOW_HIDDEN);
+ fullscreenElement != mViewportScrollOverrideElement) {
+ mViewportScrollStyles = ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN,
+ NS_STYLE_OVERFLOW_HIDDEN);
}
}
- return mViewportScrollbarOverrideElement;
+ return mViewportScrollOverrideElement;
}
bool
-nsPresContext::ElementWouldPropagateScrollbarStyles(const Element& aElement)
+nsPresContext::ElementWouldPropagateScrollStyles(const Element& aElement)
{
MOZ_ASSERT(IsPaginated(), "Should only be called on paginated contexts");
if (aElement.GetParent() && !aElement.IsHTMLElement(nsGkAtoms::body)) {
// We certainly won't be propagating from this element.
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
nsPresContext::SetContainer(nsIDocShell* aDocShell)
{
if (aDocShell) {
NS_ASSERTION(!(mContainer && mNeedsPrefUpdate),
"Should only need pref update if mContainer is null.");
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -7,16 +7,17 @@
/* a presentation of a document, part 1 */
#ifndef nsPresContext_h___
#define nsPresContext_h___
#include "mozilla/Attributes.h"
#include "mozilla/MediaFeatureChange.h"
#include "mozilla/NotNull.h"
+#include "mozilla/ScrollStyles.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/WeakPtr.h"
#include "nsColor.h"
#include "nsCoord.h"
#include "nsCOMPtr.h"
#include "nsIPresShell.h"
#include "nsIPresShellInlines.h"
#include "nsRect.h"
@@ -36,17 +37,16 @@
#include "gfxRect.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/AppUnits.h"
#include "prclist.h"
#include "nsThreadUtils.h"
-#include "ScrollbarStyles.h"
#include "nsIMessageManager.h"
#include "Units.h"
#include "prenv.h"
#include "mozilla/StaticPresData.h"
class nsBidi;
class nsIPrintSettings;
class nsDocShell;
@@ -128,17 +128,17 @@ class nsRootPresContext;
// objects that provide an outer context for a presentation shell.
class nsPresContext : public nsISupports,
public mozilla::SupportsWeakPtr<nsPresContext> {
public:
using Encoding = mozilla::Encoding;
template <typename T> using NotNull = mozilla::NotNull<T>;
typedef mozilla::LangGroupFontPrefs LangGroupFontPrefs;
- typedef mozilla::ScrollbarStyles ScrollbarStyles;
+ typedef mozilla::ScrollStyles ScrollStyles;
typedef mozilla::StaticPresData StaticPresData;
using TransactionId = mozilla::layers::TransactionId;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsPresContext)
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsPresContext)
enum nsPresContextType {
@@ -749,38 +749,38 @@ public:
* property that should be applied to the viewport. If one is found then we
* return the element that we took the overflow from (which should then be
* treated as "overflow: visible"), and we store the overflow style here.
* If the document is in fullscreen, and the fullscreen element is not the
* root, the scrollbar of viewport will be suppressed.
* @return if scroll was propagated from some content node, the content node
* it was propagated from.
*/
- mozilla::dom::Element* UpdateViewportScrollbarStylesOverride();
+ mozilla::dom::Element* 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).
*/
- mozilla::dom::Element* GetViewportScrollbarStylesOverrideElement() const {
- return mViewportScrollbarOverrideElement;
+ mozilla::dom::Element* GetViewportScrollStylesOverrideElement() const {
+ return mViewportScrollOverrideElement;
}
- const ScrollbarStyles& GetViewportScrollbarStylesOverride() const
+ const ScrollStyles& GetViewportScrollStylesOverride() const
{
- return mViewportStyleScrollbar;
+ return mViewportScrollStyles;
}
/**
* 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(const mozilla::dom::Element&);
+ bool ElementWouldPropagateScrollStyles(const mozilla::dom::Element&);
/**
* Set and get methods for controlling the background drawing
*/
bool GetBackgroundImageDraw() const { return mDrawImageBackground; }
void SetBackgroundImageDraw(bool aCanDraw)
{
mDrawImageBackground = aCanDraw;
@@ -1348,23 +1348,23 @@ protected:
nscolor mFocusBackgroundColor;
nscolor mFocusTextColor;
nscolor mBodyTextColor;
// This is a non-owning pointer. May be null. If non-null, it's guaranteed to
// be pointing to an element that's still alive, because we'll reset it in
- // UpdateViewportScrollbarStylesOverride() as part of the cleanup code when
+ // UpdateViewportScrollStylesOverride() as part of the cleanup code when
// this element is removed from the document. (For <body> and the root
// element, this call happens in nsCSSFrameConstructor::ContentRemoved(). For
// fullscreen elements, it happens in the fullscreen-specific cleanup invoked
// by Element::UnbindFromTree().)
- mozilla::dom::Element* MOZ_NON_OWNING_REF mViewportScrollbarOverrideElement;
- ScrollbarStyles mViewportStyleScrollbar;
+ mozilla::dom::Element* MOZ_NON_OWNING_REF mViewportScrollOverrideElement;
+ ScrollStyles mViewportScrollStyles;
uint8_t mFocusRingWidth;
bool mExistThrottledUpdates;
uint16_t mImageAnimationMode;
uint16_t mImageAnimationModePref;
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -617,27 +617,27 @@ nsListControlFrame::ReflowAsDropdown(nsP
}
mLastDropdownComputedBSize = state.ComputedBSize();
aStatus.Reset();
nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
}
-ScrollbarStyles
-nsListControlFrame::GetScrollbarStyles() const
+ScrollStyles
+nsListControlFrame::GetScrollStyles() const
{
// We can't express this in the style system yet; when we can, this can go away
- // and GetScrollbarStyles can be devirtualized
+ // and GetScrollStyles can be devirtualized
int32_t style = IsInDropDownMode() ? NS_STYLE_OVERFLOW_AUTO
: NS_STYLE_OVERFLOW_SCROLL;
if (GetWritingMode().IsVertical()) {
- return ScrollbarStyles(style, NS_STYLE_OVERFLOW_HIDDEN);
+ return ScrollStyles(style, NS_STYLE_OVERFLOW_HIDDEN);
} else {
- return ScrollbarStyles(NS_STYLE_OVERFLOW_HIDDEN, style);
+ return ScrollStyles(NS_STYLE_OVERFLOW_HIDDEN, style);
}
}
bool
nsListControlFrame::ShouldPropagateComputedBSizeToScrolledContent() const
{
return !IsInDropDownMode();
}
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -97,17 +97,17 @@ public:
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
// nsIFormControlFrame
virtual nsresult SetFormProperty(nsAtom* aName, const nsAString& aValue) override;
virtual void SetFocus(bool aOn = true, bool aRepaint = false) override;
- virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override;
+ virtual mozilla::ScrollStyles GetScrollStyles() const override;
virtual bool ShouldPropagateComputedBSizeToScrolledContent() const override;
// for accessibility purposes
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
// nsIListControlFrame
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -337,18 +337,18 @@ TextOverflow::TextOverflow(nsDisplayList
// a text-overflow marker in this case.
mAdjustForPixelSnapping = !mBlockWM.IsBidiLTR();
}
}
#endif
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
// to pixel snapping behaviour in our scrolling code.
mAdjustForPixelSnapping = mCanHaveInlineAxisScrollbar;
}
// Use a null containerSize to convert a vector from logical to physical.
const nsSize nullContainerSize;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -9988,17 +9988,17 @@ nsIFrame::IsFocusable(int32_t *aTabIndex
// Otherwise you couldn't scroll them with keyboard, which is
// an accessibility issue (e.g. Section 508 rules)
// However, we don't make them to be focusable with the mouse,
// because the extra focus outlines are considered unnecessarily ugly.
// When clicked on, the selection position within the element
// 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;
tabIndex = 0;
}
}
}
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -211,17 +211,17 @@ nsHTMLScrollFrame::GetSplittableType() c
All other things being equal, we prefer layouts with fewer scrollbars showing.
*/
namespace mozilla {
struct MOZ_STACK_CLASS ScrollReflowInput {
const ReflowInput& mReflowInput;
nsBoxLayoutState mBoxState;
- ScrollbarStyles mStyles;
+ ScrollStyles mStyles;
nsMargin mComputedBorder;
// === Filled in by ReflowScrolledFrame ===
nsOverflowAreas mContentsOverflowAreas;
MOZ_INIT_OUTSIDE_CTOR
bool mReflowedContentsWithHScrollbar;
MOZ_INIT_OUTSIDE_CTOR
bool mReflowedContentsWithVScrollbar;
@@ -237,17 +237,17 @@ struct MOZ_STACK_CLASS ScrollReflowInput
bool mShowVScrollbar;
ScrollReflowInput(nsIScrollableFrame* aFrame,
const ReflowInput& aReflowInput) :
mReflowInput(aReflowInput),
// mBoxState is just used for scrollbars so we don't need to
// worry about the reflow depth here
mBoxState(aReflowInput.mFrame->PresContext(), aReflowInput.mRenderingContext, 0),
- mStyles(aFrame->GetScrollbarStyles()) {
+ mStyles(aFrame->GetScrollStyles()) {
}
};
} // namespace mozilla
// XXXldb Can this go away?
static nsSize ComputeInsideBorderSize(ScrollReflowInput* aState,
const nsSize& aDesiredInsideBorderSize)
@@ -434,17 +434,17 @@ nsHTMLScrollFrame::TryLayout(ScrollReflo
nscoord scrolledWidth = scrolledRect.width + oneDevPixel;
if (scrolledWidth <= scrollPortSize.width) {
break;
}
// Viewport scrollbar style is used below instead of aState->mStyles
// because the latter can be affected by various factors, while we
// only care about what the page itself specifies.
nsPresContext* pc = PresContext();
- ScrollbarStyles styles = pc->GetViewportScrollbarStylesOverride();
+ ScrollStyles styles = pc->GetViewportScrollStylesOverride();
if (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
break;
}
// Only top level content document is considered.
nsIDocument* doc = pc->Document();
if (!doc->IsTopLevelContentDocument()) {
break;
}
@@ -817,17 +817,17 @@ nsHTMLScrollFrame::PlaceScrollArea(Scrol
scrolledFrame->GetView(),
scrolledArea,
0);
}
nscoord
nsHTMLScrollFrame::GetIntrinsicVScrollbarWidth(gfxContext *aRenderingContext)
{
- ScrollbarStyles ss = GetScrollbarStyles();
+ ScrollStyles ss = GetScrollStyles();
if (ss.mVertical != NS_STYLE_OVERFLOW_SCROLL || !mHelper.mVScrollbarBox)
return 0;
// Don't need to worry about reflow depth here since it's
// just for scrollbars
nsBoxLayoutState bls(PresContext(), aRenderingContext, 0);
nsSize vScrollbarPrefSize(0, 0);
GetScrollbarMetrics(bls, mHelper.mVScrollbarBox,
@@ -1169,17 +1169,17 @@ nsHTMLScrollFrame::AccessibleType()
{
if (IsTableCaption()) {
return GetRect().IsEmpty() ? a11y::eNoType : a11y::eHTMLCaptionType;
}
// 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;
}
return a11y::eHyperTextType;
}
#endif
NS_QUERYFRAME_HEAD(nsHTMLScrollFrame)
@@ -1350,17 +1350,17 @@ bool
ScrollFrameHelper::WantAsyncScroll() const
{
// If zooming is allowed, and this is a frame that's allowed to zoom, then
// we want it to be async-scrollable or zooming will not be permitted.
if (mZoomableByAPZ) {
return true;
}
- ScrollbarStyles styles = GetScrollbarStylesFromFrame();
+ ScrollStyles styles = GetScrollStylesFromFrame();
nscoord oneDevPixel = GetScrolledFrame()->PresContext()->AppUnitsPerDevPixel();
nsRect scrollRange = GetScrollRange();
bool isVScrollable = (scrollRange.height >= oneDevPixel) &&
(styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
bool isHScrollable = (scrollRange.width >= oneDevPixel) &&
(styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN);
#if defined(MOZ_WIDGET_ANDROID)
@@ -1595,17 +1595,17 @@ nsXULScrollFrame::GetXULBoxAscent(nsBoxL
return ascent;
}
nsSize
nsXULScrollFrame::GetXULPrefSize(nsBoxLayoutState& aState)
{
nsSize pref = mHelper.mScrolledFrame->GetXULPrefSize(aState);
- ScrollbarStyles styles = GetScrollbarStyles();
+ ScrollStyles styles = GetScrollStyles();
// scrolled frames don't have their own margins
if (mHelper.mVScrollbarBox &&
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
nsSize vSize = mHelper.mVScrollbarBox->GetXULPrefSize(aState);
nsBox::AddMargin(mHelper.mVScrollbarBox, vSize);
pref.width += vSize.width;
@@ -1624,17 +1624,17 @@ nsXULScrollFrame::GetXULPrefSize(nsBoxLa
return pref;
}
nsSize
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) {
nsSize vSize = mHelper.mVScrollbarBox->GetXULMinSize(aState);
AddMargin(mHelper.mVScrollbarBox, vSize);
min.width += vSize.width;
if (min.height < vSize.height)
min.height = vSize.height;
@@ -2534,17 +2534,17 @@ bool ScrollFrameHelper::IsAlwaysActive()
// If we have scrolled before, then we should stay active.
if (mHasBeenScrolled) {
return true;
}
// 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);
}
static void
RemoveDisplayPortCallback(nsITimer* aTimer, void* aClosure)
{
ScrollFrameHelper* helper = static_cast<ScrollFrameHelper*>(aClosure);
@@ -3712,19 +3712,19 @@ ScrollFrameHelper::BuildDisplayList(nsDi
CompositorHitTestInfo info = CompositorHitTestInfo::eVisibleToHitTest
| CompositorHitTestInfo::eDispatchToContent;
// If the scroll frame has non-default overscroll-behavior, instruct
// APZ to require a target confirmation before processing events that
// hit this scroll frame (that is, to drop the events if a confirmation
// does not arrive within the timeout period). Otherwise, APZ's
// fallback behaviour of scrolling the enclosing scroll frame would
// violate the specified overscroll-behavior.
- ScrollbarStyles scrollbarStyles = GetScrollbarStylesFromFrame();
- if (scrollbarStyles.mOverscrollBehaviorX != StyleOverscrollBehavior::Auto ||
- scrollbarStyles.mOverscrollBehaviorY != StyleOverscrollBehavior::Auto) {
+ ScrollStyles scrollStyles = GetScrollStylesFromFrame();
+ if (scrollStyles.mOverscrollBehaviorX != StyleOverscrollBehavior::Auto ||
+ scrollStyles.mOverscrollBehaviorY != StyleOverscrollBehavior::Auto) {
info |= CompositorHitTestInfo::eRequiresTargetConfirmation;
}
nsDisplayCompositorHitTestInfo* hitInfo =
MakeDisplayItem<nsDisplayCompositorHitTestInfo>(aBuilder, mScrolledFrame, info, 1,
Some(mScrollPort + aBuilder->ToReferenceFrame(mOuter)));
AppendInternalItemToTop(scrolledContent, hitInfo, Some(INT32_MAX));
}
}
@@ -3994,31 +3994,31 @@ static void HandleScrollPref(nsIScrollab
aValue = NS_STYLE_OVERFLOW_HIDDEN;
break;
case nsIScrollable::Scrollbar_Always:
aValue = NS_STYLE_OVERFLOW_SCROLL;
break;
}
}
-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);
- }
-
- ScrollbarStyles result = presContext->GetViewportScrollbarStylesOverride();
+ return ScrollStyles(disp);
+ }
+
+ ScrollStyles result = presContext->GetViewportScrollStylesOverride();
nsCOMPtr<nsISupports> container = presContext->GetContainerWeak();
nsCOMPtr<nsIScrollable> scrollable = do_QueryInterface(container);
if (scrollable) {
HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_X,
result.mHorizontal);
HandleScrollPref(scrollable, nsIScrollable::ScrollOrientation_Y,
result.mVertical);
}
@@ -4177,17 +4177,17 @@ ScrollFrameHelper::ScrollBy(nsIntPoint a
default:
NS_ERROR("Invalid scroll mode");
return;
}
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();
deltaMultiplier = nsSize(appUnitsPerDevPixel, appUnitsPerDevPixel);
negativeTolerance = 0.1f;
positiveTolerance = 0;
nsIScrollableFrame::ScrollUnit snapUnit = aUnit;
if (aOrigin == nsGkAtoms::mouseWheel) {
@@ -4619,17 +4619,17 @@ ScrollFrameHelper::CreateAnonymousConten
// If we're the scrollframe for the root, then we want to construct
// our scrollbar frames no matter what. That way later dynamic
// changes to propagated overflow styles will show or hide
// scrollbars on the viewport without requiring frame reconstruction
// of the viewport (good!).
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) {
// Nothing to do.
return NS_OK;
}
} else {
canHaveHorizontal = true;
@@ -5338,17 +5338,17 @@ nsXULScrollFrame::XULLayout(nsBoxLayoutS
the vertical one.
Finally we position and size the scrollbars and scrollcorner (the
square that is needed in the corner of the window when two
scrollbars are visible), and reflow any fixed position views
(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)
mHelper.mHasHorizontalScrollbar = true;
if (styles.mVertical == NS_STYLE_OVERFLOW_SCROLL)
mHelper.mHasVerticalScrollbar = true;
if (mHelper.mHasHorizontalScrollbar)
@@ -5673,17 +5673,17 @@ ScrollFrameHelper::ReflowCallbackCancele
{
mPostedReflowCallback = false;
}
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
// reduced extents.
nsRect scrolledRect = GetScrolledRect();
uint32_t overflowChange = GetOverflowChange(scrolledRect, mPrevScrolledRect);
mPrevScrolledRect = scrolledRect;
@@ -6399,17 +6399,17 @@ CollectScrollSnapCoordinates(nsIFrame* a
}
}
static layers::ScrollSnapInfo
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) {
// We won't be snapping, short-circuit the computation.
return result;
}
result.mScrollSnapTypeX = styles.mScrollSnapTypeX;
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -53,17 +53,17 @@ public:
typedef mozilla::layers::LayerManager LayerManager;
class AsyncScroll;
class AsyncSmoothMSDScroll;
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.
// We need this if a scrollbar frame is recreated.
void ReloadChildFrames();
nsresult CreateAnonymousContent(
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aElements);
@@ -810,18 +810,18 @@ public:
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) override;
// nsIScrollableFrame
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();
}
virtual nsMargin GetActualScrollbarSizes() const override {
return mHelper.GetActualScrollbarSizes();
}
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) override {
@@ -1262,18 +1262,18 @@ public:
static void AdjustReflowInputForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
static void AdjustReflowInputBack(nsBoxLayoutState& aState, bool aSetBack);
// nsIScrollableFrame
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();
}
virtual nsMargin GetActualScrollbarSizes() const override {
return mHelper.GetActualScrollbarSizes();
}
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) override {
--- a/layout/generic/nsIScrollableFrame.h
+++ b/layout/generic/nsIScrollableFrame.h
@@ -8,18 +8,18 @@
* interface that provides scroll APIs implemented by scrollable frames
*/
#ifndef nsIScrollFrame_h___
#define nsIScrollFrame_h___
#include "nsCoord.h"
#include "DisplayItemClip.h"
-#include "ScrollbarStyles.h"
#include "mozilla/Maybe.h"
+#include "mozilla/ScrollStyles.h"
#include "mozilla/gfx/Point.h"
#include "nsIScrollbarMediator.h"
#include "Units.h"
#include "FrameMetrics.h"
#define NS_DEFAULT_VERTICAL_SCROLL_DISTANCE 3
#define NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE 5
@@ -60,17 +60,17 @@ public:
*/
virtual nsIFrame* GetScrolledFrame() const = 0;
/**
* Get the styles (NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
* 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 };
/**
* Return the scrollbars which are visible. It's OK to call this during reflow
* of the scrolled contents, in which case it will reflect the current
* assumptions about scrollbar visibility.
*/
virtual uint32_t GetScrollbarVisibility() const = 0;