Bug 1856663 - Add more chunks for Android mochitest-plain. r=jmaher,taskgraph-reviewe...
[gecko.git] / layout / xul / nsIScrollbarMediator.h
blobce26289fd907e8ecb1c75b994d0bc0c9b72b7ec7
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 nsGfxScrollFrame, 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 nsHTMLScrollFrame::ThumbMoved in nsGfxScrollFrame.cpp.)
69 * @note This method might destroy the frame, pres shell, and other objects.
71 virtual void ThumbMoved(nsScrollbarFrame* aScrollbar, nscoord aOldPos,
72 nscoord aNewPos) = 0;
73 /**
74 * Called when the scroll bar thumb, slider, or any other component is
75 * released.
77 virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) = 0;
78 virtual void VisibilityChanged(bool aVisible) = 0;
80 /**
81 * Obtain the frame for the horizontal or vertical scrollbar, or null
82 * if there is no such box.
84 virtual nsScrollbarFrame* GetScrollbarBox(bool aVertical) = 0;
85 /**
86 * Show or hide scrollbars on 2 fingers touch.
87 * Subclasses should call their ScrollbarActivity's corresponding methods.
89 virtual void ScrollbarActivityStarted() const = 0;
90 virtual void ScrollbarActivityStopped() const = 0;
92 virtual bool IsScrollbarOnRight() const = 0;
94 /**
95 * Returns true if the mediator is asking the scrollbar to suppress
96 * repainting itself on changes.
98 virtual bool ShouldSuppressScrollbarRepaints() const = 0;
101 #endif