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.
pull/24/head
Moonchild 2 years ago committed by roytam1
parent 3765010635
commit 21f707390d
  1. 10
      accessible/tests/mochitest/treeupdate/test_cssoverflow.html
  2. 2
      dom/animation/KeyframeEffectReadOnly.cpp
  3. 20
      dom/base/Element.cpp
  4. 2
      dom/base/nsDocument.cpp
  5. 6
      dom/base/nsGlobalWindow.cpp
  6. 4
      dom/events/EventStateManager.cpp
  7. 4
      gfx/layers/apz/util/APZCCallbackHelper.cpp
  8. 4
      layout/base/RestyleManagerBase.cpp
  9. 6
      layout/base/ScrollStyles.cpp
  10. 18
      layout/base/ScrollStyles.h
  11. 4
      layout/base/moz.build
  12. 10
      layout/base/nsCSSFrameConstructor.cpp
  13. 2
      layout/base/nsCSSFrameConstructor.h
  14. 8
      layout/base/nsLayoutUtils.cpp
  15. 28
      layout/base/nsPresContext.cpp
  16. 18
      layout/base/nsPresContext.h
  17. 4
      layout/base/nsPresShell.cpp
  18. 10
      layout/forms/nsListControlFrame.cpp
  19. 2
      layout/forms/nsListControlFrame.h
  20. 4
      layout/generic/TextOverflow.cpp
  21. 2
      layout/generic/nsFrame.cpp
  22. 34
      layout/generic/nsGfxScrollFrame.cpp
  23. 10
      layout/generic/nsGfxScrollFrame.h
  24. 4
      layout/generic/nsIScrollableFrame.h
  25. 2
      layout/style/nsRuleNode.cpp
  26. 4
      layout/xul/nsListBoxBodyFrame.cpp

@ -67,7 +67,7 @@
* Change scrollbar styles from hidden to auto. That makes us to create an
* accessible for scroll area.
*/
function changeScrollbarStyles(aContainerID, aScrollAreaID)
function changeScrollStyles(aContainerID, aScrollAreaID)
{
this.container = getAccessible(aContainerID);
this.scrollAreaNode = getNode(aScrollAreaID);
@ -77,7 +77,7 @@
new invokerChecker(EVENT_REORDER, this.container)
];
this.invoke = function changeScrollbarStyles_invoke()
this.invoke = function changeScrollStyles_invoke()
{
var accTree =
{ SECTION: [] };
@ -86,7 +86,7 @@
this.scrollAreaNode.style.overflow = "auto";
}
this.finalCheck = function changeScrollbarStyles_finalCheck()
this.finalCheck = function changeScrollStyles_finalCheck()
{
var accTree =
{ SECTION: [ // container
@ -95,7 +95,7 @@
testAccessibleTree(this.container, accTree);
}
this.getID = function changeScrollbarStyles_getID()
this.getID = function changeScrollStyles_getID()
{
return "change scrollbar styles " + prettyName(aScrollAreaID);
}
@ -114,7 +114,7 @@
gQueue = new eventQueue();
gQueue.push(new changeScrollRange("container", "scrollarea"));
gQueue.push(new changeScrollbarStyles("container2", "scrollarea2"));
gQueue.push(new changeScrollStyles("container2", "scrollarea2"));
gQueue.invoke(); // Will call SimpleTest.finish();
}

@ -1089,7 +1089,7 @@ KeyframeEffectReadOnly::CanThrottleTransformChanges(nsIFrame& aFrame) const
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)) {

@ -745,7 +745,7 @@ Element::Scroll(const CSSIntPoint& aScroll, const ScrollOptions& aOptions)
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;
}
@ -834,7 +834,7 @@ Element::SetScrollTop(int32_t aScrollTop)
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(sf->GetScrollPositionCSSPixels().x,
@ -856,7 +856,7 @@ Element::SetScrollLeft(int32_t aScrollLeft)
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;
}
@ -1069,7 +1069,7 @@ ShadowRoot*
Element::GetShadowRootByMode() const
{
/**
* 1. Let shadow be context objects shadow root.
* 1. Let shadow be context object???s shadow root.
* 2. If shadow is null or its mode is "closed", then return null.
*/
ShadowRoot* shadowRoot = GetShadowRoot();
@ -1088,7 +1088,7 @@ already_AddRefed<ShadowRoot>
Element::AttachShadow(const ShadowRootInit& aInit, ErrorResult& aError)
{
/**
* 1. If context objects namespace is not the HTML namespace,
* 1. If context object???s namespace is not the HTML namespace,
* then throw a "NotSupportedError" DOMException.
*/
if (!IsHTMLElement()) {
@ -1097,7 +1097,7 @@ Element::AttachShadow(const ShadowRootInit& aInit, ErrorResult& aError)
}
/**
* 2. If context objects local name is not
* 2. If context object???s local name is not
* a valid custom element name, "article", "aside", "blockquote",
* "body", "div", "footer", "h1", "h2", "h3", "h4", "h5", "h6",
* "header", "main" "nav", "p", "section", or "span",
@ -1181,8 +1181,8 @@ Element::AttachShadowInternal(bool aClosed, ErrorResult& aError)
/**
* 4. Let shadow be a new shadow root whose node document is
* context objects node document, host is context object,
* and mode is inits mode.
* context object???s node document, host is context object,
* and mode is init???s mode.
*/
RefPtr<ShadowRoot> shadowRoot =
new ShadowRoot(this, aClosed, nodeInfo.forget(), protoBinding);
@ -1190,7 +1190,7 @@ Element::AttachShadowInternal(bool aClosed, ErrorResult& aError)
shadowRoot->SetIsComposedDocParticipant(IsInComposedDoc());
/**
* 5. Set context objects shadow root to shadow.
* 5. Set context object???s shadow root to shadow.
*/
SetShadowRoot(shadowRoot);
@ -1890,7 +1890,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
nsPresContext* presContext = presShell->GetPresContext();
if (presContext) {
MOZ_ASSERT(this !=
presContext->GetViewportScrollbarStylesOverrideNode(),
presContext->GetViewportScrollStylesOverrideNode(),
"Leaving behind a raw pointer to this node (as having "
"propagated scrollbar styles) - that's dangerous...");
}

@ -10568,7 +10568,7 @@ UpdateViewportScrollbarOverrideForFullscreen(nsIDocument* aDoc)
{
if (nsIPresShell* presShell = aDoc->GetShell()) {
if (nsPresContext* presContext = presShell->GetPresContext()) {
presContext->UpdateViewportScrollbarStylesOverride();
presContext->UpdateViewportScrollStylesOverride();
}
}
}

@ -8264,7 +8264,7 @@ nsGlobalWindow::ScrollTo(const CSSIntPoint& aScroll,
scroll.y = maxpx;
}
bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
bool smoothScroll = sf->GetScrollStyles().IsSmoothScroll(aOptions.mBehavior);
sf->ScrollToCSSPixels(scroll, smoothScroll
? nsIScrollableFrame::SMOOTH_MSD
@ -8320,7 +8320,7 @@ nsGlobalWindow::ScrollByLines(int32_t numLines,
// 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
@ -8341,7 +8341,7 @@ nsGlobalWindow::ScrollByPages(int32_t numPages,
// 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

@ -2516,7 +2516,7 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
return frameToScroll;
}
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) ||
@ -2609,7 +2609,7 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
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;
}

@ -92,10 +92,10 @@ ScrollFrameTo(nsIScrollableFrame* aFrame, const FrameMetrics& aMetrics, bool& aS
// (by design). Note also that when we run into this case, even if both axes
// have overflow:hidden, we want to set aSuccessOut to true, so that the displayport
// follows the async scroll position rather than the gecko scroll position.
if (aFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
if (aFrame->GetScrollStyles().mVertical == NS_STYLE_OVERFLOW_HIDDEN) {
targetScrollPosition.y = geckoScrollPosition.y;
}
if (aFrame->GetScrollbarStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
if (aFrame->GetScrollStyles().mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
targetScrollPosition.x = geckoScrollPosition.x;
}

@ -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) {

@ -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),

@ -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 {

@ -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',

@ -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

@ -22,7 +22,7 @@
#include "nsCounterManager.h"
#include "nsIAnonymousContentCreator.h"
#include "nsFrameManager.h"
#include "ScrollbarStyles.h"
#include "ScrollStyles.h"
struct nsFrameItems;
class nsStyleContext;

@ -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;
}

@ -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

@ -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;

@ -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);

@ -614,17 +614,17 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
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);
}
}

@ -106,7 +106,7 @@ public:
virtual nsresult SetFormProperty(nsIAtom* 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

@ -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

@ -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;

@ -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<nsISupports> container = presContext->GetContainerWeak();
nsCOMPtr<nsIScrollable> 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) {

@ -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();

@ -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 };
/**

@ -424,7 +424,7 @@ static nsSize CalcViewportUnitsScale(nsPresContext* aPresContext)
nsIScrollableFrame* scrollFrame =
aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
if (scrollFrame) {
ScrollbarStyles styles(scrollFrame->GetScrollbarStyles());
ScrollStyles styles(scrollFrame->GetScrollStyles());
if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL ||
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {

@ -296,7 +296,7 @@ nsListBoxBodyFrame::GetXULMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState
result.height = 0;
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
if (scrollFrame &&
scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
scrollFrame->GetScrollStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
nsMargin scrollbars =
scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
result.width += scrollbars.left + scrollbars.right;
@ -316,7 +316,7 @@ nsListBoxBodyFrame::GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState)
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
if (scrollFrame &&
scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
scrollFrame->GetScrollStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
pref.width += scrollbars.left + scrollbars.right;
}

Loading…
Cancel
Save