2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
1999-12-07 06:36:05 +03:00
|
|
|
|
2006-03-29 22:29:03 +04:00
|
|
|
/*
|
2009-09-01 08:11:11 +04:00
|
|
|
* interface that provides scroll APIs implemented by scrollable frames
|
2006-03-29 22:29:03 +04:00
|
|
|
*/
|
|
|
|
|
1999-12-07 06:36:05 +03:00
|
|
|
#ifndef nsIScrollFrame_h___
|
|
|
|
#define nsIScrollFrame_h___
|
|
|
|
|
|
|
|
#include "nsCoord.h"
|
2015-09-10 02:08:03 +03:00
|
|
|
#include "DisplayItemClip.h"
|
2013-08-24 00:20:07 +04:00
|
|
|
#include "ScrollbarStyles.h"
|
2015-05-26 22:39:29 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
2012-11-23 05:25:23 +04:00
|
|
|
#include "mozilla/gfx/Point.h"
|
2014-02-05 05:33:18 +04:00
|
|
|
#include "nsIScrollbarMediator.h"
|
2013-05-31 05:30:13 +04:00
|
|
|
#include "Units.h"
|
2014-08-31 07:29:24 +04:00
|
|
|
#include "FrameMetrics.h"
|
1999-12-07 06:36:05 +03:00
|
|
|
|
2012-10-29 09:44:31 +04:00
|
|
|
#define NS_DEFAULT_VERTICAL_SCROLL_DISTANCE 3
|
|
|
|
#define NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE 5
|
2012-02-20 20:24:36 +04:00
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
class gfxContext;
|
2004-01-09 22:21:20 +03:00
|
|
|
class nsBoxLayoutState;
|
2009-09-01 08:11:11 +04:00
|
|
|
class nsIScrollPositionListener;
|
2012-08-06 07:00:57 +04:00
|
|
|
class nsIFrame;
|
2013-08-24 00:20:07 +04:00
|
|
|
class nsPresContext;
|
|
|
|
class nsIContent;
|
2017-10-03 01:05:19 +03:00
|
|
|
class nsAtom;
|
2014-10-22 05:54:06 +04:00
|
|
|
class nsDisplayListBuilder;
|
1999-12-07 06:36:05 +03:00
|
|
|
|
2014-08-31 07:29:24 +04:00
|
|
|
namespace mozilla {
|
|
|
|
struct ContainerLayerParameters;
|
|
|
|
namespace layers {
|
|
|
|
class Layer;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
2015-06-21 19:27:31 +03:00
|
|
|
} // namespace mozilla
|
2014-08-31 07:29:24 +04:00
|
|
|
|
2009-09-01 08:11:11 +04:00
|
|
|
/**
|
|
|
|
* Interface for frames that are scrollable. This interface exposes
|
|
|
|
* APIs for examining scroll state, observing changes to scroll state,
|
|
|
|
* and triggering scrolling.
|
|
|
|
*/
|
2014-02-14 10:40:53 +04:00
|
|
|
class nsIScrollableFrame : public nsIScrollbarMediator {
|
1999-12-07 06:36:05 +03:00
|
|
|
public:
|
2013-07-10 13:58:13 +04:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2014-08-31 07:29:24 +04:00
|
|
|
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
|
|
|
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
2016-03-12 06:04:53 +03:00
|
|
|
typedef mozilla::layers::ScrollSnapInfo ScrollSnapInfo;
|
2013-07-10 13:58:13 +04:00
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsIScrollableFrame)
|
1999-12-07 06:36:05 +03:00
|
|
|
|
|
|
|
/**
|
2009-09-01 08:11:11 +04:00
|
|
|
* Get the frame for the content that we are scrolling within
|
|
|
|
* this scrollable frame.
|
1999-12-07 06:36:05 +03:00
|
|
|
*/
|
2004-09-06 06:44:43 +04:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const = 0;
|
1999-12-07 06:36:05 +03:00
|
|
|
|
2009-09-01 08:11:11 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2013-08-24 00:20:07 +04:00
|
|
|
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const = 0;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2010-01-14 16:00:00 +03:00
|
|
|
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.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const = 0;
|
2012-09-24 08:30:33 +04:00
|
|
|
/**
|
|
|
|
* Returns the directions in which scrolling is perceived to be allowed.
|
|
|
|
* A direction is perceived to be allowed if there is a visible scrollbar
|
|
|
|
* for that direction or if the scroll range is at least one device pixel.
|
|
|
|
*/
|
|
|
|
uint32_t GetPerceivedScrollingDirections() const;
|
2004-01-09 22:21:20 +03:00
|
|
|
/**
|
|
|
|
* Return the actual sizes of all possible scrollbars. Returns 0 for scrollbar
|
|
|
|
* positions that don't have a scrollbar or where the scrollbar is not visible.
|
2005-10-18 09:00:24 +04:00
|
|
|
* Do not call this while this frame's descendants are being reflowed, it won't be
|
|
|
|
* accurate.
|
2004-01-09 22:21:20 +03:00
|
|
|
*/
|
|
|
|
virtual nsMargin GetActualScrollbarSizes() const = 0;
|
|
|
|
/**
|
|
|
|
* Return the sizes of all scrollbars assuming that any scrollbars that could
|
2010-01-14 16:00:00 +03:00
|
|
|
* be visible due to overflowing content, are. This can be called during reflow
|
|
|
|
* of the scrolled contents.
|
2004-01-09 22:21:20 +03:00
|
|
|
*/
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) = 0;
|
2009-09-01 08:11:11 +04:00
|
|
|
/**
|
|
|
|
* Return the sizes of all scrollbars assuming that any scrollbars that could
|
2010-01-14 16:00:00 +03:00
|
|
|
* be visible due to overflowing content, are. This can be called during reflow
|
|
|
|
* of the scrolled contents.
|
2009-09-01 08:11:11 +04:00
|
|
|
*/
|
2008-04-10 08:39:41 +04:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext* aRC) = 0;
|
2013-05-27 02:05:10 +04:00
|
|
|
/**
|
|
|
|
* Return the width for non-disappearing scrollbars.
|
|
|
|
*/
|
2015-07-27 18:52:12 +03:00
|
|
|
virtual nscoord
|
|
|
|
GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext* aRC,
|
2015-07-27 18:52:12 +03:00
|
|
|
mozilla::WritingMode aWM) = 0;
|
2013-07-23 17:22:58 +04:00
|
|
|
/**
|
|
|
|
* GetScrolledRect is designed to encapsulate deciding which
|
|
|
|
* directions of overflow should be reachable by scrolling and which
|
|
|
|
* should not. Callers should NOT depend on it having any particular
|
|
|
|
* behavior (although nsXULScrollFrame currently does).
|
|
|
|
*
|
|
|
|
* This should only be called when the scrolled frame has been
|
|
|
|
* reflowed with the scroll port size given in mScrollPort.
|
|
|
|
*
|
|
|
|
* Currently it allows scrolling down and to the right for
|
|
|
|
* nsHTMLScrollFrames with LTR directionality and for all
|
|
|
|
* nsXULScrollFrames, and allows scrolling down and to the left for
|
|
|
|
* nsHTMLScrollFrames with RTL directionality.
|
|
|
|
*/
|
|
|
|
virtual nsRect GetScrolledRect() const = 0;
|
2000-05-15 08:12:31 +04:00
|
|
|
/**
|
2009-09-01 08:11:11 +04:00
|
|
|
* Get the area of the scrollport relative to the origin of this frame's
|
|
|
|
* border-box.
|
|
|
|
* This is the area of this frame minus border and scrollbars.
|
|
|
|
*/
|
|
|
|
virtual nsRect GetScrollPortRect() const = 0;
|
|
|
|
/**
|
|
|
|
* Get the offset of the scrollport origin relative to the scrolled
|
|
|
|
* frame origin. Typically the position will be non-negative.
|
|
|
|
* This will always be a multiple of device pixels.
|
2000-05-15 08:12:31 +04:00
|
|
|
*/
|
2004-09-06 06:44:43 +04:00
|
|
|
virtual nsPoint GetScrollPosition() const = 0;
|
2012-12-12 01:12:43 +04:00
|
|
|
/**
|
2017-07-06 15:00:35 +03:00
|
|
|
* As GetScrollPosition(), but uses the top-right as origin for RTL frames.
|
2012-12-12 01:12:43 +04:00
|
|
|
*/
|
|
|
|
virtual nsPoint GetLogicalScrollPosition() const = 0;
|
2000-05-15 08:12:31 +04:00
|
|
|
/**
|
2009-09-01 08:11:11 +04:00
|
|
|
* Get the area that must contain the scroll position. Typically
|
|
|
|
* (but not always, e.g. for RTL content) x and y will be 0, and
|
|
|
|
* width or height will be nonzero if the content can be scrolled in
|
|
|
|
* that direction. Since scroll positions must be a multiple of
|
|
|
|
* device pixels, the range extrema will also be a multiple of
|
|
|
|
* device pixels.
|
2000-05-15 08:12:31 +04:00
|
|
|
*/
|
2009-09-01 08:11:11 +04:00
|
|
|
virtual nsRect GetScrollRange() const = 0;
|
2012-06-11 03:44:50 +04:00
|
|
|
/**
|
|
|
|
* Get the size of the scroll port to use when clamping the scroll
|
|
|
|
* position.
|
|
|
|
*/
|
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const = 0;
|
2004-09-04 07:17:18 +04:00
|
|
|
/**
|
2009-09-01 08:11:11 +04:00
|
|
|
* Return how much we would try to scroll by in each direction if
|
|
|
|
* asked to scroll by one "line" vertically and horizontally.
|
2004-09-04 07:17:18 +04:00
|
|
|
*/
|
2009-09-01 08:11:11 +04:00
|
|
|
virtual nsSize GetLineScrollAmount() const = 0;
|
|
|
|
/**
|
|
|
|
* Return how much we would try to scroll by in each direction if
|
|
|
|
* asked to scroll by one "page" vertically and horizontally.
|
|
|
|
*/
|
|
|
|
virtual nsSize GetPageScrollAmount() const = 0;
|
2004-07-24 01:39:47 +04:00
|
|
|
|
2009-09-01 08:11:11 +04:00
|
|
|
/**
|
2014-07-09 21:02:31 +04:00
|
|
|
* When a scroll operation is requested, we ask for instant, smooth,
|
|
|
|
* smooth msd, or normal scrolling.
|
|
|
|
*
|
|
|
|
* SMOOTH scrolls have a symmetrical acceleration and deceleration curve
|
2017-07-06 15:00:35 +03:00
|
|
|
* modeled with a set of splines that guarantee that the destination will be
|
2014-07-09 21:02:31 +04:00
|
|
|
* reached over a fixed time interval. SMOOTH will only be smooth if smooth
|
|
|
|
* scrolling is actually enabled. This behavior is utilized by keyboard and
|
|
|
|
* mouse wheel scrolling events.
|
|
|
|
*
|
|
|
|
* SMOOTH_MSD implements a physically based model that approximates the
|
|
|
|
* behavior of a mass-spring-damper system. SMOOTH_MSD scrolls have a
|
|
|
|
* non-symmetrical acceleration and deceleration curve, can potentially
|
|
|
|
* overshoot the destination on intermediate frames, and complete over a
|
|
|
|
* variable time interval. SMOOTH_MSD will only be smooth if cssom-view
|
|
|
|
* smooth-scrolling is enabled.
|
|
|
|
*
|
|
|
|
* INSTANT is always synchronous, NORMAL can be asynchronous.
|
|
|
|
*
|
|
|
|
* If an INSTANT scroll request happens while a SMOOTH or async scroll is
|
|
|
|
* already in progress, the async scroll is interrupted and we instantly
|
|
|
|
* scroll to the destination.
|
|
|
|
*
|
|
|
|
* If an INSTANT or SMOOTH scroll request happens while a SMOOTH_MSD scroll
|
|
|
|
* is already in progress, the SMOOTH_MSD scroll is interrupted without
|
|
|
|
* first scrolling to the destination.
|
2009-09-01 08:11:11 +04:00
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
enum ScrollMode { INSTANT, SMOOTH, SMOOTH_MSD, NORMAL };
|
2014-02-04 05:54:22 +04:00
|
|
|
/**
|
|
|
|
* Some platforms (OSX) may generate additional scrolling events even
|
|
|
|
* after the user has stopped scrolling, simulating a momentum scrolling
|
|
|
|
* effect resulting from fling gestures.
|
|
|
|
* SYNTHESIZED_MOMENTUM_EVENT indicates that the scrolling is being requested
|
|
|
|
* by such a synthesized event and may be ignored if another scroll has
|
|
|
|
* been started since the last actual user input.
|
|
|
|
*/
|
|
|
|
enum ScrollMomentum { NOT_MOMENTUM, SYNTHESIZED_MOMENTUM_EVENT };
|
2009-09-01 08:11:11 +04:00
|
|
|
/**
|
2013-08-09 02:04:59 +04:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2009-09-01 08:11:11 +04:00
|
|
|
* Clamps aScrollPosition to GetScrollRange and sets the scroll position
|
|
|
|
* to that value.
|
2012-02-08 04:53:18 +04:00
|
|
|
* @param aRange If non-null, specifies area which contains aScrollPosition
|
|
|
|
* and can be used for choosing a performance-optimized scroll position.
|
|
|
|
* Any point within this area can be chosen.
|
|
|
|
* The choosen point will be as close as possible to aScrollPosition.
|
2009-09-01 08:11:11 +04:00
|
|
|
*/
|
2012-02-08 04:53:18 +04:00
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
2015-02-20 02:53:30 +03:00
|
|
|
const nsRect* aRange = nullptr,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) = 0;
|
2012-05-15 09:58:09 +04:00
|
|
|
/**
|
2013-08-09 02:04:59 +04:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2012-05-15 09:58:09 +04:00
|
|
|
* Scrolls to a particular position in integer CSS pixels.
|
|
|
|
* Keeps the exact current horizontal or vertical position if the current
|
|
|
|
* position, rounded to CSS pixels, matches aScrollPosition. If
|
|
|
|
* aScrollPosition.x/y is different from the current CSS pixel position,
|
|
|
|
* makes sure we only move in the direction given by the difference.
|
2014-07-09 21:02:31 +04:00
|
|
|
*
|
|
|
|
* When aMode is SMOOTH, INSTANT, or NORMAL, GetScrollPositionCSSPixels (the
|
|
|
|
* scroll position after rounding to CSS pixels) will be exactly
|
|
|
|
* aScrollPosition at the end of the scroll animation.
|
|
|
|
*
|
|
|
|
* When aMode is SMOOTH_MSD, intermediate animation frames may be outside the
|
|
|
|
* range and / or moving in any direction; GetScrollPositionCSSPixels will be
|
|
|
|
* exactly aScrollPosition at the end of the scroll animation unless the
|
|
|
|
* SMOOTH_MSD animation is interrupted.
|
2012-05-15 09:58:09 +04:00
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
virtual void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode
|
|
|
|
= nsIScrollableFrame::INSTANT) = 0;
|
2012-11-23 05:25:23 +04:00
|
|
|
/**
|
2013-08-09 02:04:59 +04:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2012-11-23 05:25:23 +04:00
|
|
|
* Scrolls to a particular position in float CSS pixels.
|
|
|
|
* This does not guarantee that GetScrollPositionCSSPixels equals
|
|
|
|
* aScrollPosition afterward. It tries to scroll as close to
|
|
|
|
* aScrollPosition as possible while scrolling by an integer
|
|
|
|
* number of layer pixels (so the operation is fast and looks clean).
|
|
|
|
*/
|
2013-12-16 21:04:45 +04:00
|
|
|
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom *aOrigin = nullptr) = 0;
|
2013-05-31 05:30:13 +04:00
|
|
|
|
2012-08-10 15:17:06 +04:00
|
|
|
/**
|
|
|
|
* Returns the scroll position in integer CSS pixels, rounded to the nearest
|
|
|
|
* pixel.
|
|
|
|
*/
|
2013-07-10 13:58:13 +04:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() = 0;
|
2009-09-01 08:11:11 +04:00
|
|
|
/**
|
|
|
|
* When scrolling by a relative amount, we can choose various units.
|
|
|
|
*/
|
|
|
|
enum ScrollUnit { DEVICE_PIXELS, LINES, PAGES, WHOLE };
|
|
|
|
/**
|
2013-08-09 02:04:59 +04:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2009-09-01 08:11:11 +04:00
|
|
|
* Modifies the current scroll position by aDelta units given by aUnit,
|
|
|
|
* clamping it to GetScrollRange. If WHOLE is specified as the unit,
|
|
|
|
* content is scrolled all the way in the direction(s) given by aDelta.
|
|
|
|
* @param aOverflow if non-null, returns the amount that scrolling
|
|
|
|
* was clamped by in each direction (how far we moved the scroll position
|
2009-10-08 07:01:15 +04:00
|
|
|
* to bring it back into the legal range). This is never negative. The
|
|
|
|
* values are in device pixels.
|
2009-09-01 08:11:11 +04:00
|
|
|
*/
|
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2014-07-15 18:13:00 +04:00
|
|
|
nsIntPoint* aOverflow = nullptr,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aOrigin = nullptr,
|
2015-02-20 02:53:30 +03:00
|
|
|
ScrollMomentum aMomentum = NOT_MOMENTUM,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) = 0;
|
2015-02-20 02:53:30 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform scroll snapping, possibly resulting in a smooth scroll to
|
|
|
|
* maintain the scroll snap position constraints. Velocity sampled from
|
|
|
|
* main thread scrolling is used to determine best matching snap point
|
|
|
|
* when called after a fling gesture on a trackpad or mouse wheel.
|
|
|
|
*/
|
|
|
|
virtual void ScrollSnap() = 0;
|
|
|
|
|
2004-07-24 01:39:47 +04:00
|
|
|
/**
|
2013-08-09 02:04:59 +04:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2004-07-24 01:39:47 +04:00
|
|
|
* This tells the scroll frame to try scrolling to the scroll
|
|
|
|
* position that was restored from the history. This must be called
|
|
|
|
* at least once after state has been restored. It is called by the
|
|
|
|
* scrolled frame itself during reflow, but sometimes state can be
|
|
|
|
* restored after reflows are done...
|
2009-09-01 08:11:11 +04:00
|
|
|
* XXX should we take an aMode parameter here? Currently it's instant.
|
2004-07-24 01:39:47 +04:00
|
|
|
*/
|
|
|
|
virtual void ScrollToRestoredPosition() = 0;
|
2009-10-25 10:04:18 +03:00
|
|
|
|
2009-09-01 08:11:11 +04:00
|
|
|
/**
|
|
|
|
* Add a scroll position listener. This listener must be removed
|
|
|
|
* before it is destroyed.
|
|
|
|
*/
|
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) = 0;
|
|
|
|
/**
|
|
|
|
* Remove a scroll position listener.
|
|
|
|
*/
|
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal method used by scrollbars to notify their scrolling
|
|
|
|
* container of changes.
|
|
|
|
*/
|
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) = 0;
|
|
|
|
|
2009-10-25 10:04:18 +03:00
|
|
|
/**
|
|
|
|
* Allows the docshell to request that the scroll frame post an event
|
|
|
|
* after being restored from history.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() = 0;
|
2010-07-16 01:08:02 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this scrollframe is being "actively scrolled".
|
|
|
|
* This basically means that we should allocate resources in the
|
|
|
|
* expectation that scrolling is going to happen.
|
|
|
|
*/
|
2014-10-22 05:54:06 +04:00
|
|
|
virtual bool IsScrollingActive(nsDisplayListBuilder* aBuilder) = 0;
|
2017-05-20 01:04:19 +03:00
|
|
|
/**
|
|
|
|
* Same as the above except doesn't take into account will-change budget,
|
|
|
|
* which means that it can be called during display list building.
|
|
|
|
*/
|
|
|
|
virtual bool IsMaybeScrollingActive() const = 0;
|
2014-01-29 02:54:59 +04:00
|
|
|
/**
|
|
|
|
* Returns true if the scrollframe is currently processing an async
|
|
|
|
* or smooth scroll.
|
|
|
|
*/
|
|
|
|
virtual bool IsProcessingAsyncScroll() = 0;
|
2012-08-17 03:40:10 +04:00
|
|
|
/**
|
|
|
|
* Call this when the layer(s) induced by active scrolling are being
|
|
|
|
* completely redrawn.
|
|
|
|
*/
|
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() = 0;
|
2013-03-05 16:26:41 +04:00
|
|
|
/**
|
|
|
|
* Was the current presentation state for this frame restored from history?
|
|
|
|
*/
|
2014-05-06 01:29:20 +04:00
|
|
|
virtual bool DidHistoryRestore() const = 0;
|
2013-03-16 02:32:35 +04:00
|
|
|
/**
|
|
|
|
* Clear the flag so that DidHistoryRestore() returns false until the next
|
|
|
|
* RestoreState call.
|
|
|
|
* @see nsIStatefulFrame::RestoreState
|
|
|
|
*/
|
|
|
|
virtual void ClearDidHistoryRestore() = 0;
|
2013-09-15 04:05:04 +04:00
|
|
|
/**
|
2016-03-26 00:49:43 +03:00
|
|
|
* Determine if the passed in rect is nearly visible according to the frame
|
2013-09-15 04:05:04 +04:00
|
|
|
* visibility heuristics for how close it is to the visible scrollport.
|
|
|
|
*/
|
|
|
|
virtual bool IsRectNearlyVisible(const nsRect& aRect) = 0;
|
2014-06-07 06:23:20 +04:00
|
|
|
/**
|
|
|
|
* Expand the given rect taking into account which directions we can scroll
|
2016-03-26 00:49:43 +03:00
|
|
|
* and how far we want to expand for frame visibility purposes.
|
2014-06-07 06:23:20 +04:00
|
|
|
*/
|
2014-06-07 06:23:22 +04:00
|
|
|
virtual nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const = 0;
|
2013-12-16 21:04:45 +04:00
|
|
|
/**
|
2014-07-10 22:52:40 +04:00
|
|
|
* Returns the origin that triggered the last instant scroll. Will equal
|
|
|
|
* nsGkAtoms::apz when the compositor's replica frame metrics includes the
|
|
|
|
* latest instant scroll.
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* LastScrollOrigin() = 0;
|
2016-10-11 16:36:22 +03:00
|
|
|
/**
|
|
|
|
* Sets a flag on the scrollframe that indicates the current scroll origin
|
|
|
|
* has been sent over in a layers transaction, and subsequent changes to
|
|
|
|
* the scroll position by "weaker" origins are permitted to overwrite the
|
|
|
|
* the scroll origin. Scroll origins that nsLayoutUtils::CanScrollOriginClobberApz
|
|
|
|
* returns false for are considered "weaker" than scroll origins for which
|
|
|
|
* that function returns true.
|
|
|
|
*/
|
|
|
|
virtual void AllowScrollOriginDowngrade() = 0;
|
2014-07-10 22:52:40 +04:00
|
|
|
/**
|
|
|
|
* Returns the origin that triggered the last smooth scroll.
|
|
|
|
* Will equal nsGkAtoms::apz when the compositor's replica frame
|
|
|
|
* metrics includes the latest smooth scroll. The compositor will always
|
|
|
|
* perform an instant scroll prior to instantiating any smooth scrolls
|
|
|
|
* if LastScrollOrigin and LastSmoothScrollOrigin indicate that
|
|
|
|
* an instant scroll and a smooth scroll have occurred since the last
|
|
|
|
* replication of the frame metrics.
|
|
|
|
*
|
|
|
|
* This is set to nullptr to when the compositor thread acknowledges that
|
|
|
|
* the smooth scroll has been started. If the smooth scroll has been stomped
|
|
|
|
* by an instant scroll before the smooth scroll could be started by the
|
|
|
|
* compositor, this is set to nullptr to clear the smooth scroll.
|
2013-12-16 21:04:45 +04:00
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* LastSmoothScrollOrigin() = 0;
|
2013-12-16 21:04:45 +04:00
|
|
|
/**
|
2014-02-06 02:43:20 +04:00
|
|
|
* Returns the current generation counter for the scroll. This counter
|
|
|
|
* increments every time the scroll position is set.
|
2013-12-16 21:04:45 +04:00
|
|
|
*/
|
2014-02-06 02:43:20 +04:00
|
|
|
virtual uint32_t CurrentScrollGeneration() = 0;
|
2014-07-10 22:52:40 +04:00
|
|
|
/**
|
|
|
|
* LastScrollDestination returns the destination of the most recently
|
|
|
|
* requested smooth scroll animation.
|
|
|
|
*/
|
|
|
|
virtual nsPoint LastScrollDestination() = 0;
|
2014-02-06 02:43:20 +04:00
|
|
|
/**
|
|
|
|
* Clears the "origin of last scroll" property stored in this frame, if
|
|
|
|
* the generation counter passed in matches the current scroll generation
|
|
|
|
* counter.
|
|
|
|
*/
|
2014-07-10 22:52:40 +04:00
|
|
|
virtual void ResetScrollInfoIfGeneration(uint32_t aGeneration) = 0;
|
2014-03-13 00:20:26 +04:00
|
|
|
/**
|
|
|
|
* Determine whether it is desirable to be able to asynchronously scroll this
|
|
|
|
* scroll frame.
|
|
|
|
*/
|
|
|
|
virtual bool WantAsyncScroll() const = 0;
|
2014-08-31 07:29:24 +04:00
|
|
|
/**
|
|
|
|
* aLayer's animated geometry root is this frame. If there needs to be a
|
2016-03-29 02:14:52 +03:00
|
|
|
* ScrollMetadata contributed by this frame, append it to aOutput.
|
2014-08-31 07:29:24 +04:00
|
|
|
*/
|
2016-03-29 02:14:52 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
2015-06-21 19:27:31 +03:00
|
|
|
mozilla::layers::Layer* aLayer,
|
2017-07-20 19:33:09 +03:00
|
|
|
const nsIFrame* aContainerReferenceFrame,
|
2015-07-02 20:42:34 +03:00
|
|
|
const ContainerLayerParameters& aParameters,
|
2015-12-22 18:54:19 +03:00
|
|
|
const mozilla::DisplayItemClip* aClip) const = 0;
|
2014-09-23 17:44:00 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If this scroll frame is ignoring viewporting clipping
|
|
|
|
*/
|
|
|
|
virtual bool IsIgnoringViewportClipping() const = 0;
|
2014-10-09 06:56:38 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mark the scrollbar frames for reflow.
|
|
|
|
*/
|
|
|
|
virtual void MarkScrollbarsDirtyForReflow() const = 0;
|
2015-02-25 17:32:09 +03:00
|
|
|
|
|
|
|
virtual void SetTransformingByAPZ(bool aTransforming) = 0;
|
|
|
|
virtual bool IsTransformingByAPZ() const = 0;
|
2015-06-03 02:34:46 +03:00
|
|
|
|
2016-03-10 06:57:14 +03:00
|
|
|
/**
|
|
|
|
* Notify this scroll frame that it can be scrolled by APZ. In particular,
|
|
|
|
* this is called *after* the APZ code has created an APZC for this scroll
|
|
|
|
* frame and verified that it is not a scrollinfo layer. Therefore, setting an
|
|
|
|
* async transform on it is actually user visible.
|
|
|
|
*/
|
|
|
|
virtual void SetScrollableByAPZ(bool aScrollable) = 0;
|
|
|
|
|
2015-09-12 04:58:16 +03:00
|
|
|
/**
|
|
|
|
* Notify this scroll frame that it can be zoomed by APZ.
|
|
|
|
*/
|
|
|
|
virtual void SetZoomableByAPZ(bool aZoomable) = 0;
|
|
|
|
|
2015-06-03 02:34:46 +03:00
|
|
|
/**
|
|
|
|
* Whether or not this frame uses containerful scrolling.
|
|
|
|
*/
|
|
|
|
virtual bool UsesContainerScrolling() const = 0;
|
2015-07-02 23:42:10 +03:00
|
|
|
|
2015-10-12 23:21:49 +03:00
|
|
|
/**
|
|
|
|
* Determine if we should build a scrollable layer for this scroll frame and
|
|
|
|
* return the result. It will also record this result on the scroll frame.
|
|
|
|
* Pass the dirty rect in aDirtyRect. On return it will be set to the
|
|
|
|
* displayport if there is one (ie the dirty rect that should be used).
|
2017-10-03 00:00:16 +03:00
|
|
|
* This function will set the display port base rect if aSetBase is true.
|
|
|
|
* aSetBase is only allowed to be false if there has been a call with it
|
|
|
|
* set to true before on the same paint.
|
2015-10-12 23:21:49 +03:00
|
|
|
*/
|
|
|
|
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsRect* aDirtyRect,
|
2017-10-03 00:00:16 +03:00
|
|
|
bool aSetBase) = 0;
|
2016-01-22 04:09:04 +03:00
|
|
|
|
|
|
|
/**
|
2016-03-26 00:49:43 +03:00
|
|
|
* Notification that this scroll frame is getting its frame visibility updated.
|
2017-04-05 08:18:11 +03:00
|
|
|
* aIgnoreDisplayPort indicates that the display port was ignored (because
|
|
|
|
* there was no suitable base rect)
|
2016-01-22 04:09:04 +03:00
|
|
|
*/
|
2017-04-05 08:18:11 +03:00
|
|
|
virtual void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort) = 0;
|
2016-01-22 09:29:17 +03:00
|
|
|
|
|
|
|
/**
|
2016-03-26 00:49:43 +03:00
|
|
|
* Returns true if this scroll frame had a display port at the last frame
|
2016-01-22 09:29:17 +03:00
|
|
|
* visibility update and fills in aDisplayPort with that displayport. Returns
|
|
|
|
* false otherwise, and doesn't touch aDisplayPort.
|
|
|
|
*/
|
2016-03-26 00:49:43 +03:00
|
|
|
virtual bool GetDisplayPortAtLastApproximateFrameVisibilityUpdate(nsRect* aDisplayPort) = 0;
|
2016-02-04 03:13:35 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when a descendant scrollframe's has its displayport expired.
|
|
|
|
* This function will check to see if this scrollframe may safely expire its
|
|
|
|
* own displayport and schedule a timer to do that if it is safe.
|
|
|
|
*/
|
|
|
|
virtual void TriggerDisplayPortExpiration() = 0;
|
2016-03-12 06:04:53 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns information required to determine where to snap to after a scroll.
|
|
|
|
*/
|
|
|
|
virtual ScrollSnapInfo GetScrollSnapInfo() const = 0;
|
2016-07-13 23:05:53 +03:00
|
|
|
|
2016-12-20 21:39:30 +03:00
|
|
|
/**
|
|
|
|
* Given the drag event aEvent, determine whether the mouse is near the edge
|
|
|
|
* of the scrollable area, and scroll the view in the direction of that edge
|
|
|
|
* if so. If scrolling occurred, true is returned. When false is returned, the
|
|
|
|
* caller should look for an ancestor to scroll.
|
|
|
|
*/
|
|
|
|
virtual bool DragScroll(mozilla::WidgetEvent* aEvent) = 0;
|
2017-01-28 02:02:22 +03:00
|
|
|
|
|
|
|
virtual void AsyncScrollbarDragRejected() = 0;
|
2017-03-11 10:00:46 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether this scroll frame is the root scroll frame of the document
|
|
|
|
* that it is in. Note that some documents don't have root scroll frames at
|
|
|
|
* all (ie XUL documents) even though they may contain other scroll frames.
|
|
|
|
*/
|
|
|
|
virtual bool IsRootScrollFrameOfDocument() const = 0;
|
1999-12-07 06:36:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|