Bug 1902759 - When a new tab is opened, TalkBack focus is shifted to the new tab...
[gecko.git] / layout / xul / nsIScrollbarMediator.h
bloba49e5dc39d25e800897fafcebed6d5d5bb6f4476
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsIScrollbarMediator_h___
8 #define nsIScrollbarMediator_h___
10 #include "mozilla/ScrollTypes.h"
11 #include "nsQueryFrame.h"
12 #include "nsCoord.h"
14 class nsScrollbarFrame;
15 class nsIFrame;
17 class nsIScrollbarMediator : public nsQueryFrame {
18 public:
19 NS_DECL_QUERYFRAME_TARGET(nsIScrollbarMediator)
21 /**
22 * The aScrollbar argument denotes the scrollbar that's firing the
23 * notification. aScrollbar is never null. aDirection is either -1, 0, or 1.
26 /**
27 * When set to ENABLE_SNAP, additional scrolling will be performed after the
28 * scroll operation to maintain the constraints set by CSS Scroll snapping.
29 * The additional scrolling may include asynchronous smooth scrolls that
30 * continue to animate after the initial scroll position has been set.
31 * In case of DEFAULT, it means ENABLE_SNAP for CSS scroll snap v1,
32 * DISABLE_SNAP for the old scroll snap.
35 /**
36 * One of the following three methods is called when the scrollbar's button is
37 * clicked.
38 * @note These methods might destroy the frame, pres shell, and other objects.
40 virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
41 mozilla::ScrollSnapFlags aSnapFlags =
42 mozilla::ScrollSnapFlags::Disabled) = 0;
43 virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
44 mozilla::ScrollSnapFlags aSnapFlags =
45 mozilla::ScrollSnapFlags::Disabled) = 0;
46 virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
47 mozilla::ScrollSnapFlags aSnapFlags =
48 mozilla::ScrollSnapFlags::Disabled) = 0;
50 // Only implemented for ScrollContainerFrame, not nsTreeBodyFrame.
51 virtual void ScrollByUnit(nsScrollbarFrame* aScrollbar,
52 mozilla::ScrollMode aMode, int32_t aDirection,
53 mozilla::ScrollUnit aUnit,
54 mozilla::ScrollSnapFlags aSnapFlags =
55 mozilla::ScrollSnapFlags::Disabled) = 0;
57 /**
58 * RepeatButtonScroll is called when the scrollbar's button is held down. When
59 * the button is first clicked the increment is set; RepeatButtonScroll adds
60 * this increment to the current position.
61 * @note This method might destroy the frame, pres shell, and other objects.
63 virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) = 0;
64 /**
65 * aOldPos and aNewPos are scroll positions.
66 * The scroll positions start with zero at the left edge; implementors that
67 * want zero at the right edge for RTL content will need to adjust
68 * accordingly. (See ScrollContainerFrame::ThumbMoved in
69 * ScrollContainerFrame.cpp.)
70 * @note This method might destroy the frame, pres shell, and other objects.
72 virtual void ThumbMoved(nsScrollbarFrame* aScrollbar, nscoord aOldPos,
73 nscoord aNewPos) = 0;
74 /**
75 * Called when the scroll bar thumb, slider, or any other component is
76 * released.
78 virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) = 0;
79 virtual void VisibilityChanged(bool aVisible) = 0;
81 /**
82 * Obtain the frame for the horizontal or vertical scrollbar, or null
83 * if there is no such box.
85 virtual nsScrollbarFrame* GetScrollbarBox(bool aVertical) = 0;
86 /**
87 * Show or hide scrollbars on 2 fingers touch.
88 * Subclasses should call their ScrollbarActivity's corresponding methods.
90 virtual void ScrollbarActivityStarted() const = 0;
91 virtual void ScrollbarActivityStopped() const = 0;
93 virtual bool IsScrollbarOnRight() const = 0;
95 /**
96 * Returns true if the mediator is asking the scrollbar to suppress
97 * repainting itself on changes.
99 virtual bool ShouldSuppressScrollbarRepaints() const = 0;
102 #endif