2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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/. */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* rendering object to wrap rendering objects that should be scrollable */
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
#ifndef nsGfxScrollFrame_h___
|
|
|
|
#define nsGfxScrollFrame_h___
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
1999-08-20 02:16:23 +04:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
2000-03-31 11:02:06 +04:00
|
|
|
#include "nsBoxFrame.h"
|
1999-12-07 06:36:05 +03:00
|
|
|
#include "nsIScrollableFrame.h"
|
2014-02-05 05:33:18 +04:00
|
|
|
#include "nsIScrollbarMediator.h"
|
2004-09-13 06:10:29 +04:00
|
|
|
#include "nsIStatefulFrame.h"
|
2006-05-10 21:30:15 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2007-03-05 04:39:53 +03:00
|
|
|
#include "nsIReflowCallback.h"
|
2008-04-10 08:39:41 +04:00
|
|
|
#include "nsBoxLayoutState.h"
|
2009-10-25 10:04:18 +03:00
|
|
|
#include "nsQueryFrame.h"
|
2015-12-18 01:19:30 +03:00
|
|
|
#include "nsRefreshDriver.h"
|
2010-07-16 01:08:05 +04:00
|
|
|
#include "nsExpirationTracker.h"
|
2015-02-25 17:33:00 +03:00
|
|
|
#include "TextOverflow.h"
|
2015-02-20 02:53:30 +03:00
|
|
|
#include "ScrollVelocityQueue.h"
|
2018-03-02 21:18:35 +03:00
|
|
|
#include "mozilla/PresState.h"
|
2018-11-28 00:18:03 +03:00
|
|
|
#include "mozilla/layout/ScrollAnchorContainer.h"
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
class nsPresContext;
|
2004-05-05 06:32:27 +04:00
|
|
|
class nsIPresShell;
|
|
|
|
class nsIContent;
|
2017-10-03 01:05:19 +03:00
|
|
|
class nsAtom;
|
2013-08-22 22:32:52 +04:00
|
|
|
class nsIScrollPositionListener;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2012-08-03 14:35:14 +04:00
|
|
|
namespace mozilla {
|
2016-07-21 13:36:37 +03:00
|
|
|
struct ScrollReflowInput;
|
2014-08-31 07:29:24 +04:00
|
|
|
namespace layers {
|
|
|
|
class Layer;
|
2017-10-25 20:22:04 +03:00
|
|
|
class LayerManager;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
2013-05-02 18:58:00 +04:00
|
|
|
namespace layout {
|
2012-08-03 14:35:14 +04:00
|
|
|
class ScrollbarActivity;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layout
|
2013-10-29 06:27:50 +04:00
|
|
|
|
|
|
|
class ScrollFrameHelper : public nsIReflowCallback {
|
2004-05-05 06:32:27 +04:00
|
|
|
public:
|
2014-06-28 14:13:13 +04:00
|
|
|
typedef nsIFrame::Sides Sides;
|
2013-07-10 13:58:13 +04:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2013-05-02 18:58:00 +04:00
|
|
|
typedef mozilla::layout::ScrollbarActivity ScrollbarActivity;
|
2014-08-31 07:29:24 +04:00
|
|
|
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
2018-11-01 23:15:46 +03:00
|
|
|
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
2016-03-19 03:07:27 +03:00
|
|
|
typedef mozilla::layers::ScrollSnapInfo ScrollSnapInfo;
|
2014-08-31 07:29:24 +04:00
|
|
|
typedef mozilla::layers::Layer Layer;
|
2017-10-25 20:22:04 +03:00
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
2018-11-28 00:18:03 +03:00
|
|
|
typedef mozilla::layout::ScrollAnchorContainer ScrollAnchorContainer;
|
2012-11-23 05:25:23 +04:00
|
|
|
|
2009-10-08 07:01:15 +04:00
|
|
|
class AsyncScroll;
|
2014-07-09 21:02:31 +04:00
|
|
|
class AsyncSmoothMSDScroll;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2013-10-29 06:27:50 +04:00
|
|
|
ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot);
|
|
|
|
~ScrollFrameHelper();
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2018-08-01 09:14:26 +03:00
|
|
|
mozilla::ScrollStyles GetScrollStylesFromFrame() const;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
2011-05-07 00:04:44 +04:00
|
|
|
nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aElements);
|
2014-07-16 22:41:57 +04:00
|
|
|
void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
|
|
|
uint32_t aFilter);
|
2007-01-28 01:50:18 +03:00
|
|
|
nsresult FireScrollPortEvent();
|
2017-11-28 21:09:56 +03:00
|
|
|
void PostScrollEndEvent();
|
2017-10-10 21:54:49 +03:00
|
|
|
void FireScrollEndEvent();
|
2007-01-28 01:50:18 +03:00
|
|
|
void PostOverflowEvent();
|
2017-11-07 03:20:33 +03:00
|
|
|
using PostDestroyData = nsIFrame::PostDestroyData;
|
|
|
|
void Destroy(PostDestroyData& aPostDestroyData);
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2011-12-20 16:30:14 +04:00
|
|
|
void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists, bool aCreateLayer,
|
|
|
|
bool aPositioned);
|
2010-10-21 16:07:55 +04:00
|
|
|
|
2014-05-05 21:55:54 +04:00
|
|
|
bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
|
2014-06-28 14:13:13 +04:00
|
|
|
Sides aSkipSides, nscoord aRadii[8]) const;
|
2010-09-08 02:20:35 +04:00
|
|
|
|
2007-03-05 04:39:53 +03:00
|
|
|
// nsIReflowCallback
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ReflowFinished() override;
|
|
|
|
virtual void ReflowCallbackCanceled() override;
|
2007-03-05 04:39:53 +03:00
|
|
|
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
* Called when the 'curpos' attribute on one of the scrollbars changes.
|
|
|
|
*/
|
2017-10-04 20:19:13 +03:00
|
|
|
void CurPosAttributeChanged(nsIContent* aChild, bool aDoScroll = true);
|
2013-08-09 02:04:59 +04:00
|
|
|
|
2018-12-19 04:38:45 +03:00
|
|
|
void PostScrollEvent(bool aDelayed = false);
|
2005-08-22 03:37:13 +04:00
|
|
|
void FireScrollEvent();
|
2010-01-12 00:45:19 +03:00
|
|
|
void PostScrolledAreaEvent();
|
|
|
|
void FireScrolledAreaEvent();
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2014-09-15 23:30:03 +04:00
|
|
|
bool IsSmoothScrollingEnabled();
|
|
|
|
|
2016-02-25 02:20:40 +03:00
|
|
|
/**
|
|
|
|
* This class handles the dispatching of scroll events to content.
|
|
|
|
*
|
2017-08-10 04:08:38 +03:00
|
|
|
* Scroll events are posted to the refresh driver via
|
|
|
|
* nsRefreshDriver::PostScrollEvent(), and they are fired during a refresh
|
|
|
|
* driver tick, after running requestAnimationFrame callbacks but before
|
|
|
|
* the style flush. This allows rAF callbacks to perform scrolling and have
|
|
|
|
* that scrolling be reflected on the same refresh driver tick, while at
|
|
|
|
* the same time allowing scroll event listeners to make style changes and
|
|
|
|
* have those style changes be reflected on the same refresh driver tick.
|
2016-02-25 02:20:40 +03:00
|
|
|
*
|
2017-08-10 04:08:38 +03:00
|
|
|
* ScrollEvents cannot be refresh observers, because none of the existing
|
|
|
|
* categories of refresh observers (FlushType::Style, FlushType::Layout,
|
|
|
|
* and FlushType::Display) are run at the desired time in a refresh driver
|
|
|
|
* tick. They behave similarly to refresh observers in that their presence
|
|
|
|
* causes the refresh driver to tick.
|
2016-02-25 02:20:40 +03:00
|
|
|
*
|
2017-08-10 04:08:38 +03:00
|
|
|
* ScrollEvents are one-shot runnables; the refresh driver drops them after
|
|
|
|
* running them.
|
2016-02-25 02:20:40 +03:00
|
|
|
*/
|
2017-08-10 04:08:38 +03:00
|
|
|
class ScrollEvent : public Runnable {
|
2006-05-10 21:30:15 +04:00
|
|
|
public:
|
2017-08-10 04:08:38 +03:00
|
|
|
NS_DECL_NSIRUNNABLE
|
2018-12-19 04:38:45 +03:00
|
|
|
explicit ScrollEvent(ScrollFrameHelper* aHelper, bool aDelayed);
|
2017-08-10 04:08:38 +03:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
private:
|
2017-08-10 04:08:38 +03:00
|
|
|
ScrollFrameHelper* mHelper;
|
2006-05-10 21:30:15 +04:00
|
|
|
};
|
|
|
|
|
2017-11-28 21:09:56 +03:00
|
|
|
class ScrollEndEvent : public Runnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
explicit ScrollEndEvent(ScrollFrameHelper* aHelper);
|
|
|
|
void Revoke() { mHelper = nullptr; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-11-28 21:09:56 +03:00
|
|
|
private:
|
|
|
|
ScrollFrameHelper* mHelper;
|
|
|
|
};
|
|
|
|
|
2016-04-26 03:23:21 +03:00
|
|
|
class AsyncScrollPortEvent : public Runnable {
|
2007-01-28 01:50:18 +03:00
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2017-06-12 22:34:10 +03:00
|
|
|
explicit AsyncScrollPortEvent(ScrollFrameHelper* helper)
|
|
|
|
: Runnable("ScrollFrameHelper::AsyncScrollPortEvent"),
|
|
|
|
mHelper(helper) {}
|
2013-10-29 06:27:50 +04:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2007-01-28 01:50:18 +03:00
|
|
|
private:
|
2013-10-29 06:27:50 +04:00
|
|
|
ScrollFrameHelper* mHelper;
|
2007-01-28 01:50:18 +03:00
|
|
|
};
|
|
|
|
|
2016-04-26 03:23:21 +03:00
|
|
|
class ScrolledAreaEvent : public Runnable {
|
2010-01-12 00:45:19 +03:00
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2017-06-12 22:34:10 +03:00
|
|
|
explicit ScrolledAreaEvent(ScrollFrameHelper* helper)
|
|
|
|
: Runnable("ScrollFrameHelper::ScrolledAreaEvent"), mHelper(helper) {}
|
2013-10-29 06:27:50 +04:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2010-01-12 00:45:19 +03:00
|
|
|
private:
|
2013-10-29 06:27:50 +04:00
|
|
|
ScrollFrameHelper* mHelper;
|
2010-01-12 00:45:19 +03:00
|
|
|
};
|
|
|
|
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2017-12-05 20:05:51 +03:00
|
|
|
void FinishReflowForScrollbar(mozilla::dom::Element* aElement, nscoord aMinXY,
|
|
|
|
nscoord aMaxXY, nscoord aCurPosXY,
|
|
|
|
nscoord aPageIncrement, nscoord aIncrement);
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2017-12-05 20:05:51 +03:00
|
|
|
void SetScrollbarEnabled(mozilla::dom::Element* aElement, nscoord aMaxPos);
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2017-12-05 20:05:51 +03:00
|
|
|
void SetCoordAttribute(mozilla::dom::Element* aElement, nsAtom* aAtom,
|
|
|
|
nscoord aSize);
|
2013-08-09 02:04:59 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
nscoord GetCoordAttribute(nsIFrame* aFrame, nsAtom* aAtom,
|
|
|
|
nscoord aDefaultValue, nscoord* aRangeStart,
|
2012-05-10 09:24:19 +04:00
|
|
|
nscoord* aRangeLength);
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
* Update scrollbar curpos attributes to reflect current scroll position
|
|
|
|
*/
|
2009-10-08 07:01:15 +04:00
|
|
|
void UpdateScrollbarPosition();
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2009-10-08 07:01:15 +04:00
|
|
|
nsRect GetScrollPortRect() const { return mScrollPort; }
|
2009-09-01 08:11:11 +04:00
|
|
|
nsPoint GetScrollPosition() const {
|
2009-10-08 07:01:15 +04:00
|
|
|
return mScrollPort.TopLeft() - mScrolledFrame->GetPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2011-02-07 10:59:20 +03:00
|
|
|
/**
|
|
|
|
* For LTR frames, the logical scroll position is the offset of the top left
|
|
|
|
* corner of the frame from the top left corner of the scroll port (same as
|
|
|
|
* GetScrollPosition).
|
|
|
|
* For RTL frames, it is the offset of the top right corner of the frame from
|
|
|
|
* the top right corner of the scroll port
|
|
|
|
*/
|
|
|
|
nsPoint GetLogicalScrollPosition() const {
|
|
|
|
nsPoint pt;
|
2016-09-15 12:41:28 +03:00
|
|
|
pt.x = IsPhysicalLTR()
|
2011-02-07 10:59:20 +03:00
|
|
|
? mScrollPort.x - mScrolledFrame->GetPosition().x
|
|
|
|
: mScrollPort.XMost() - mScrolledFrame->GetRect().XMost();
|
|
|
|
pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
|
|
|
|
return pt;
|
|
|
|
}
|
Bug 1453425 - Add relative scroll offset updates using nsGkAtoms::relative. r=botond
This commit adds a scroll origin, nsGkAtoms::relative, which can be used to
mark main thread scrolling that can be combined with a concurrent APZ scroll.
The behavior of this is controlled by a pref, apz.relative-update. This pref
is initially activated and is intended as an aid to narrowing down causes
of regressions for users in bug reports.
Relative scroll updates work by tracking the last sent or accepted APZ
scroll offset. This is sent along with every FrameMetrics. Additionally,
a flag is added to FrameMetrics, mIsRelative, indicating whether the
scroll offset can be combined with a potential APZ scroll. When this
flag is set, AsyncPanZoomController will apply the delta between the sent
base scroll offset, and sent new scroll offset.
This flag is controlled by the last scroll origin on nsGfxScrollFrame. The
new origin, `relative`, is marked as being able to clobber APZ updates,
but can only be set if all scrolls since the last repaint request or
layers transaction have been relative.
Differential Revision: https://phabricator.services.mozilla.com/D8234
--HG--
extra : rebase_source : 51351a84c9cda228a0975e22eda3fd3bd8d261c4
extra : histedit_source : 4b564c19b16fe2bd26adc671b62b7cb6106e8163
2018-10-10 07:24:28 +03:00
|
|
|
nsPoint GetApzScrollPosition() const { return mApzScrollPos; }
|
2009-09-01 08:11:11 +04:00
|
|
|
nsRect GetScrollRange() const;
|
2018-07-22 22:49:38 +03:00
|
|
|
// Get the scroll range assuming the viewport has size (aWidth, aHeight).
|
2012-04-24 22:52:35 +04:00
|
|
|
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
|
2018-07-22 22:49:38 +03:00
|
|
|
nsSize GetVisualViewportSize() const;
|
2018-09-21 22:01:13 +03:00
|
|
|
nsPoint GetVisualViewportOffset() const;
|
2015-03-25 21:40:31 +03:00
|
|
|
void ScrollSnap(
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
|
|
|
void ScrollSnap(
|
|
|
|
const nsPoint& aDestination,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
2014-04-07 15:43:58 +04:00
|
|
|
|
2012-04-24 22:52:35 +04:00
|
|
|
protected:
|
|
|
|
nsRect GetScrollRangeForClamping() const;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2012-04-24 22:52:35 +04:00
|
|
|
public:
|
2014-07-09 21:02:31 +04:00
|
|
|
static void AsyncScrollCallback(ScrollFrameHelper* aInstance,
|
|
|
|
mozilla::TimeStamp aTime);
|
|
|
|
static void AsyncSmoothMSDScrollCallback(ScrollFrameHelper* aInstance,
|
|
|
|
mozilla::TimeDuration aDeltaTime);
|
2012-02-08 04:53:18 +04:00
|
|
|
/**
|
2013-08-09 02:04:59 +04:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2012-02-08 04:53:18 +04:00
|
|
|
* aRange is the range of allowable scroll positions around the desired
|
|
|
|
* aScrollPosition. Null means only aScrollPosition is allowed.
|
|
|
|
* This is a closed-ended range --- aRange.XMost()/aRange.YMost() are allowed.
|
|
|
|
*/
|
|
|
|
void ScrollTo(nsPoint aScrollPosition, nsIScrollableFrame::ScrollMode aMode,
|
2015-02-20 02:53:30 +03:00
|
|
|
nsAtom* aOrigin = nullptr, const nsRect* aRange = nullptr,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
2018-10-06 03:06:40 +03:00
|
|
|
nsIScrollbarMediator::DISABLE_SNAP);
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
void ScrollToCSSPixels(
|
|
|
|
const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::INSTANT,
|
2018-10-06 03:06:40 +03:00
|
|
|
nsAtom* aOrigin = nullptr);
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-12-16 21:04:45 +04:00
|
|
|
void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aOrigin = nullptr);
|
2013-08-09 02:04:59 +04:00
|
|
|
|
2013-07-10 13:58:13 +04:00
|
|
|
CSSIntPoint GetScrollPositionCSSPixels();
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
void ScrollToImpl(nsPoint aScrollPosition, const nsRect& aRange,
|
|
|
|
nsAtom* aOrigin = nullptr);
|
2015-08-07 22:37:56 +03:00
|
|
|
void ScrollVisual();
|
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
|
|
|
void ScrollBy(nsIntPoint aDelta, nsIScrollableFrame::ScrollUnit aUnit,
|
2014-07-15 18:13:00 +04:00
|
|
|
nsIScrollableFrame::ScrollMode aMode, nsIntPoint* aOverflow,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aOrigin = nullptr,
|
2015-02-20 02:53:30 +03:00
|
|
|
nsIScrollableFrame::ScrollMomentum aMomentum =
|
|
|
|
nsIScrollableFrame::NOT_MOMENTUM,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP);
|
2018-10-06 03:06:40 +03:00
|
|
|
void ScrollByCSSPixels(
|
|
|
|
const CSSIntPoint& aDelta,
|
2015-02-20 02:53:30 +03:00
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::INSTANT,
|
2018-10-06 03:06:40 +03:00
|
|
|
nsAtom* aOrigin = nullptr);
|
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
|
|
|
void ScrollToRestoredPosition();
|
2016-04-30 06:06:18 +03:00
|
|
|
|
2017-02-15 00:58:34 +03:00
|
|
|
enum class LoadingState { Loading, Stopped, Loaded };
|
|
|
|
|
|
|
|
LoadingState GetPageLoadingState();
|
2016-04-30 06:06:18 +03:00
|
|
|
|
2015-02-20 02:53:30 +03:00
|
|
|
/**
|
|
|
|
* GetSnapPointForDestination determines which point to snap to after
|
|
|
|
* scrolling. aStartPos gives the position before scrolling and aDestination
|
|
|
|
* gives the position after scrolling, with no snapping. Behaviour is
|
|
|
|
* dependent on the value of aUnit.
|
|
|
|
* Returns true if a suitable snap point could be found and aDestination has
|
|
|
|
* been updated to a valid snapping position.
|
|
|
|
*/
|
|
|
|
bool GetSnapPointForDestination(nsIScrollableFrame::ScrollUnit aUnit,
|
|
|
|
nsPoint aStartPos, nsPoint& aDestination);
|
2013-08-09 02:04:59 +04:00
|
|
|
|
2009-09-01 08:11:11 +04:00
|
|
|
nsSize GetLineScrollAmount() const;
|
|
|
|
nsSize GetPageScrollAmount() const;
|
2004-07-24 01:39:47 +04:00
|
|
|
|
2018-03-02 21:18:35 +03:00
|
|
|
mozilla::UniquePtr<mozilla::PresState> SaveState() const;
|
|
|
|
void RestoreState(mozilla::PresState* aState);
|
2004-09-13 06:10:29 +04:00
|
|
|
|
2005-04-04 01:00:41 +04:00
|
|
|
nsIFrame* GetScrolledFrame() const { return mScrolledFrame; }
|
2012-08-06 07:00:57 +04:00
|
|
|
nsIFrame* GetScrollbarBox(bool aVertical) const {
|
2009-09-01 08:11:11 +04:00
|
|
|
return aVertical ? mVScrollbarBox : mHScrollbarBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-29 03:03:42 +03:00
|
|
|
mListeners.AppendElement(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
|
|
|
void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-29 03:03:42 +03:00
|
|
|
mListeners.RemoveElement(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2004-07-18 16:02:53 +04:00
|
|
|
|
2012-08-06 07:00:57 +04:00
|
|
|
static void SetScrollbarVisibility(nsIFrame* aScrollbar, bool aVisible);
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2006-03-15 19:55:19 +03: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).
|
2017-07-06 15:00:35 +03:00
|
|
|
*
|
2009-10-08 07:01:15 +04:00
|
|
|
* This should only be called when the scrolled frame has been
|
|
|
|
* reflowed with the scroll port size given in mScrollPort.
|
2006-03-15 19:55:19 +03:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2009-10-08 07:01:15 +04:00
|
|
|
nsRect GetScrolledRect() const;
|
|
|
|
|
|
|
|
/**
|
Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel
We want the maximum scroll position to be aligned with layer pixels. That way
we don't have to re-rasterize the scrolled contents once scrolling hits the
edge of the scrollable area.
Here's how we determine the maximum scroll position: We get the scroll port
rect, snapped to layer pixels. Then we get the scrolled rect and also snap
that to layer pixels. The maximum scroll position is set to the difference
between right/bottom edges of these rectangles.
Now the scrollable area is computed by adding this maximum scroll position
to the unsnapped scroll port size.
The underlying idea here is: Pretend we have overflow:visible so that the
scrolled contents start at (0, 0) relative to the scroll port and spill over
the scroll port edges. When these contents are rendered, their rendering is
snapped to layer pixels. We want those exact pixels to be accessible by
scrolling.
This way of computing the snapped scrollable area ensures that, if you scroll
to the maximum scroll position, the right/bottom edges of the rendered
scrolled contents line up exactly with the right/bottom edges of the scroll
port. The scrolled contents are neither cut off nor are they moved too far.
(This is something that no other browser engine gets completely right, see the
testcase in bug 1012752.)
There are also a few disadvantages to this solution. We snap to layer pixels,
and the size of a layer pixel can depend on the zoom level, the document
resolution, the current screen's scale factor, and CSS transforms. The snap
origin is the position of the reference frame. So a change to any of these
things can influence the scrollable area and the maximum scroll position.
This patch does not make us adjust the current scroll position in the event
that the maximum scroll position changes such that the current scroll position
would be out of range, unless there's a reflow of the scrolled contents. This
means that we can sometimes render a slightly inconsistent state where the
current scroll position exceeds the maximum scroll position. We can fix this
once it turns out to be a problem; I doubt that it will be a problem because
none of the other browsers seems to prevent this problem either.
The size of the scrollable area is exposed through the DOM properties
scrollWidth and scrollHeight. At the moment, these are integer properties, so
their value is rounded to the nearest CSS pixel. Before this patch, the
returned value would always be within 0.5 CSS pixels of the value that layout
computed for the content's scrollable overflow based on the CSS styles of the
contents.
Now that scrollWidth and scrollHeight also depend on pixel snapping, their
values can deviate by up to one layer pixel from what the page might expect
based on the styles of the contents. This change requires a few changes to
existing tests.
The fact that scrollWidth and scrollHeight can change based on the position of
the scrollable element and the zoom level / resolution may surprise some web
pages. However, this also seems to happen in Edge. Edge seems to always round
scrollWidth and scrollHeight upwards, possibly to their equivalent of layout
device pixels.
MozReview-Commit-ID: 3LFV7Lio4tG
--HG--
extra : rebase_source : 3e4e0b60493397e61283aa1d7fd93d7c197dec29
extra : source : d43c2d5e87f31ff47d7f3ada66c3f5f27cef84a9
2016-08-05 06:51:58 +03:00
|
|
|
* GetUnsnappedScrolledRectInternal is designed to encapsulate deciding which
|
2009-10-08 07:01:15 +04:00
|
|
|
* 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).
|
2017-07-06 15:00:35 +03:00
|
|
|
*
|
2009-10-08 07:01:15 +04:00
|
|
|
* 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.
|
|
|
|
*/
|
Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel
We want the maximum scroll position to be aligned with layer pixels. That way
we don't have to re-rasterize the scrolled contents once scrolling hits the
edge of the scrollable area.
Here's how we determine the maximum scroll position: We get the scroll port
rect, snapped to layer pixels. Then we get the scrolled rect and also snap
that to layer pixels. The maximum scroll position is set to the difference
between right/bottom edges of these rectangles.
Now the scrollable area is computed by adding this maximum scroll position
to the unsnapped scroll port size.
The underlying idea here is: Pretend we have overflow:visible so that the
scrolled contents start at (0, 0) relative to the scroll port and spill over
the scroll port edges. When these contents are rendered, their rendering is
snapped to layer pixels. We want those exact pixels to be accessible by
scrolling.
This way of computing the snapped scrollable area ensures that, if you scroll
to the maximum scroll position, the right/bottom edges of the rendered
scrolled contents line up exactly with the right/bottom edges of the scroll
port. The scrolled contents are neither cut off nor are they moved too far.
(This is something that no other browser engine gets completely right, see the
testcase in bug 1012752.)
There are also a few disadvantages to this solution. We snap to layer pixels,
and the size of a layer pixel can depend on the zoom level, the document
resolution, the current screen's scale factor, and CSS transforms. The snap
origin is the position of the reference frame. So a change to any of these
things can influence the scrollable area and the maximum scroll position.
This patch does not make us adjust the current scroll position in the event
that the maximum scroll position changes such that the current scroll position
would be out of range, unless there's a reflow of the scrolled contents. This
means that we can sometimes render a slightly inconsistent state where the
current scroll position exceeds the maximum scroll position. We can fix this
once it turns out to be a problem; I doubt that it will be a problem because
none of the other browsers seems to prevent this problem either.
The size of the scrollable area is exposed through the DOM properties
scrollWidth and scrollHeight. At the moment, these are integer properties, so
their value is rounded to the nearest CSS pixel. Before this patch, the
returned value would always be within 0.5 CSS pixels of the value that layout
computed for the content's scrollable overflow based on the CSS styles of the
contents.
Now that scrollWidth and scrollHeight also depend on pixel snapping, their
values can deviate by up to one layer pixel from what the page might expect
based on the styles of the contents. This change requires a few changes to
existing tests.
The fact that scrollWidth and scrollHeight can change based on the position of
the scrollable element and the zoom level / resolution may surprise some web
pages. However, this also seems to happen in Edge. Edge seems to always round
scrollWidth and scrollHeight upwards, possibly to their equivalent of layout
device pixels.
MozReview-Commit-ID: 3LFV7Lio4tG
--HG--
extra : rebase_source : 3e4e0b60493397e61283aa1d7fd93d7c197dec29
extra : source : d43c2d5e87f31ff47d7f3ada66c3f5f27cef84a9
2016-08-05 06:51:58 +03:00
|
|
|
nsRect GetUnsnappedScrolledRectInternal(const nsRect& aScrolledOverflowArea,
|
|
|
|
const nsSize& aScrollPortSize) const;
|
2006-03-15 19:55:19 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetScrollbarVisibility() const {
|
2010-01-14 16:00:00 +03:00
|
|
|
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
|
|
|
|
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
|
|
|
|
}
|
2004-09-29 06:19:06 +04:00
|
|
|
nsMargin GetActualScrollbarSizes() const;
|
2005-04-29 01:57:22 +04:00
|
|
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
2015-07-27 18:52:12 +03:00
|
|
|
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState,
|
|
|
|
mozilla::WritingMode aVerticalWM);
|
2016-09-15 12:41:36 +03:00
|
|
|
bool IsPhysicalLTR() const {
|
|
|
|
WritingMode wm = GetFrameForDir()->GetWritingMode();
|
|
|
|
return wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR();
|
|
|
|
}
|
|
|
|
bool IsBidiLTR() const {
|
|
|
|
nsIFrame* frame = GetFrameForDir();
|
|
|
|
return frame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR;
|
|
|
|
}
|
|
|
|
|
2018-11-30 13:46:48 +03:00
|
|
|
private:
|
2016-09-15 12:41:36 +03:00
|
|
|
nsIFrame* GetFrameForDir() const; // helper for Is{Physical,Bidi}LTR to find
|
|
|
|
// the frame whose directionality we use
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-09-15 12:41:36 +03:00
|
|
|
public:
|
2015-04-21 23:09:48 +03:00
|
|
|
bool IsScrollbarOnRight() const;
|
2014-10-22 05:54:32 +04:00
|
|
|
bool IsScrollingActive(nsDisplayListBuilder* aBuilder) const;
|
2018-01-29 15:24:04 +03:00
|
|
|
bool IsMaybeAsynchronouslyScrolled() const {
|
2017-09-27 02:24:42 +03:00
|
|
|
// If this is true, then we'll build an ASR, and that's what we want
|
|
|
|
// to know I think.
|
|
|
|
return mWillBuildScrollableLayer;
|
|
|
|
}
|
2014-10-22 05:55:55 +04:00
|
|
|
bool IsMaybeScrollingActive() const;
|
2014-07-09 21:02:31 +04:00
|
|
|
bool IsProcessingAsyncScroll() const {
|
|
|
|
return mAsyncScroll != nullptr || mAsyncSmoothMSDScroll != nullptr;
|
|
|
|
}
|
2012-08-17 03:40:10 +04:00
|
|
|
void ResetScrollPositionForLayerPixelAlignment() {
|
|
|
|
mScrollPosForLayerPixelAlignment = GetScrollPosition();
|
|
|
|
}
|
2011-06-16 01:03:49 +04:00
|
|
|
|
2016-05-04 03:27:43 +03:00
|
|
|
bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas);
|
2011-06-16 01:03:49 +04:00
|
|
|
|
2013-09-06 17:35:16 +04:00
|
|
|
void UpdateSticky();
|
|
|
|
|
2015-02-08 20:57:00 +03:00
|
|
|
void UpdatePrevScrolledRect();
|
|
|
|
|
2013-09-15 04:05:04 +04:00
|
|
|
bool IsRectNearlyVisible(const nsRect& aRect) const;
|
2014-06-07 06:23:22 +04:00
|
|
|
nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const;
|
2013-09-15 04:05:04 +04:00
|
|
|
|
2010-03-19 14:49:34 +03:00
|
|
|
// adjust the scrollbar rectangle aRect to account for any visible resizer.
|
|
|
|
// aHasResizer specifies if there is a content resizer, however this method
|
|
|
|
// will also check if a widget resizer is present as well.
|
2018-12-18 00:54:11 +03:00
|
|
|
void AdjustScrollbarRectForResizer(
|
|
|
|
nsIFrame* aFrame, nsPresContext* aPresContext, nsRect& aRect,
|
|
|
|
bool aHasResizer, mozilla::layers::ScrollDirection aDirection);
|
2010-03-19 14:49:34 +03:00
|
|
|
// returns true if a resizer should be visible
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasResizer() { return mResizerBox && !mCollapsedResizer; }
|
2005-04-29 01:57:22 +04:00
|
|
|
void LayoutScrollbars(nsBoxLayoutState& aState, const nsRect& aContentArea,
|
2009-10-08 07:01:15 +04:00
|
|
|
const nsRect& aOldScrollArea);
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2014-10-09 06:56:38 +04:00
|
|
|
void MarkScrollbarsDirtyForReflow() const;
|
|
|
|
|
2012-02-18 03:41:13 +04:00
|
|
|
bool ShouldClampScrollPosition() const;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsAlwaysActive() const;
|
2014-10-22 05:53:38 +04:00
|
|
|
void MarkRecentlyScrolled();
|
|
|
|
void MarkNotRecentlyScrolled();
|
2010-07-16 01:08:05 +04:00
|
|
|
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
|
|
|
|
|
2015-02-25 17:32:09 +03:00
|
|
|
void SetTransformingByAPZ(bool aTransforming) {
|
2017-10-10 21:54:49 +03:00
|
|
|
if (mTransformingByAPZ && !aTransforming) {
|
2017-11-28 21:09:56 +03:00
|
|
|
PostScrollEndEvent();
|
2017-10-10 21:54:49 +03:00
|
|
|
}
|
2015-02-25 17:32:09 +03:00
|
|
|
mTransformingByAPZ = aTransforming;
|
2015-02-25 17:33:00 +03:00
|
|
|
if (!mozilla::css::TextOverflow::HasClippedOverflow(mOuter)) {
|
|
|
|
// If the block has some text-overflow stuff we should kick off a paint
|
|
|
|
// because we have special behaviour for it when APZ scrolling is active.
|
|
|
|
mOuter->SchedulePaint();
|
|
|
|
}
|
2015-02-25 17:32:09 +03:00
|
|
|
}
|
|
|
|
bool IsTransformingByAPZ() const { return mTransformingByAPZ; }
|
2016-03-10 06:57:14 +03:00
|
|
|
void SetScrollableByAPZ(bool aScrollable);
|
2015-09-12 04:58:16 +03:00
|
|
|
void SetZoomableByAPZ(bool aZoomable);
|
2017-11-28 00:45:29 +03:00
|
|
|
void SetHasOutOfFlowContentInsideFilter();
|
2015-09-12 04:58:16 +03:00
|
|
|
|
2015-06-03 02:34:46 +03:00
|
|
|
bool UsesContainerScrolling() const;
|
2015-02-25 17:32:09 +03:00
|
|
|
|
2016-03-19 03:07:27 +03:00
|
|
|
ScrollSnapInfo GetScrollSnapInfo() const;
|
|
|
|
|
2015-10-12 23:21:49 +03:00
|
|
|
bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
2017-10-04 04:28:38 +03:00
|
|
|
nsRect* aVisibleRect, nsRect* aDirtyRect,
|
2017-09-28 04:23:03 +03:00
|
|
|
bool aSetBase,
|
|
|
|
bool* aDirtyRectHasBeenOverriden = nullptr);
|
Bug 1453425 - Add relative scroll offset updates using nsGkAtoms::relative. r=botond
This commit adds a scroll origin, nsGkAtoms::relative, which can be used to
mark main thread scrolling that can be combined with a concurrent APZ scroll.
The behavior of this is controlled by a pref, apz.relative-update. This pref
is initially activated and is intended as an aid to narrowing down causes
of regressions for users in bug reports.
Relative scroll updates work by tracking the last sent or accepted APZ
scroll offset. This is sent along with every FrameMetrics. Additionally,
a flag is added to FrameMetrics, mIsRelative, indicating whether the
scroll offset can be combined with a potential APZ scroll. When this
flag is set, AsyncPanZoomController will apply the delta between the sent
base scroll offset, and sent new scroll offset.
This flag is controlled by the last scroll origin on nsGfxScrollFrame. The
new origin, `relative`, is marked as being able to clobber APZ updates,
but can only be set if all scrolls since the last repaint request or
layers transaction have been relative.
Differential Revision: https://phabricator.services.mozilla.com/D8234
--HG--
extra : rebase_source : 51351a84c9cda228a0975e22eda3fd3bd8d261c4
extra : histedit_source : 4b564c19b16fe2bd26adc671b62b7cb6106e8163
2018-10-10 07:24:28 +03:00
|
|
|
void NotifyApzTransaction() {
|
|
|
|
mAllowScrollOriginDowngrade = true;
|
|
|
|
mApzScrollPos = GetScrollPosition();
|
|
|
|
}
|
2017-04-05 08:18:11 +03:00
|
|
|
void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort);
|
2016-03-26 00:49:43 +03:00
|
|
|
bool GetDisplayPortAtLastApproximateFrameVisibilityUpdate(
|
|
|
|
nsRect* aDisplayPort);
|
2015-10-12 23:21:49 +03:00
|
|
|
|
2016-02-11 01:11:28 +03:00
|
|
|
bool AllowDisplayPortExpiration();
|
2016-02-04 03:13:35 +03:00
|
|
|
void TriggerDisplayPortExpiration();
|
|
|
|
void ResetDisplayPortExpiryTimer();
|
|
|
|
|
2012-01-19 08:13:02 +04:00
|
|
|
void ScheduleSyntheticMouseMove();
|
|
|
|
static void ScrollActivityCallback(nsITimer* aTimer, void* anInstance);
|
|
|
|
|
2013-07-16 16:58:44 +04:00
|
|
|
void HandleScrollbarStyleSwitching();
|
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* LastScrollOrigin() const { return mLastScrollOrigin; }
|
|
|
|
nsAtom* LastSmoothScrollOrigin() const { return mLastSmoothScrollOrigin; }
|
2014-02-06 02:43:20 +04:00
|
|
|
uint32_t CurrentScrollGeneration() const { return mScrollGeneration; }
|
2014-07-10 22:52:40 +04:00
|
|
|
nsPoint LastScrollDestination() const { return mDestination; }
|
|
|
|
void ResetScrollInfoIfGeneration(uint32_t aGeneration) {
|
2014-02-06 02:43:20 +04:00
|
|
|
if (aGeneration == mScrollGeneration) {
|
2014-07-10 22:52:40 +04:00
|
|
|
mLastScrollOrigin = nullptr;
|
|
|
|
mLastSmoothScrollOrigin = nullptr;
|
2014-02-06 02:43:20 +04:00
|
|
|
}
|
|
|
|
}
|
2014-03-13 00:20:26 +04:00
|
|
|
bool WantAsyncScroll() const;
|
2016-03-29 02:14:52 +03:00
|
|
|
Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
2017-07-20 19:33:09 +03:00
|
|
|
LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,
|
2018-10-19 17:24:50 +03:00
|
|
|
const Maybe<ContainerLayerParameters>& aParameters,
|
2015-12-22 18:54:19 +03:00
|
|
|
const mozilla::DisplayItemClip* aClip) const;
|
2018-04-19 16:48:04 +03:00
|
|
|
void ClipLayerToDisplayPort(
|
|
|
|
Layer* aLayer, const mozilla::DisplayItemClip* aClip,
|
|
|
|
const ContainerLayerParameters& aParameters) const;
|
2013-12-16 21:04:45 +04:00
|
|
|
|
2014-02-05 05:33:18 +04:00
|
|
|
// nsIScrollbarMediator
|
2015-03-25 21:40:31 +03:00
|
|
|
void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP);
|
|
|
|
void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP);
|
|
|
|
void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP);
|
2014-02-05 05:33:18 +04:00
|
|
|
void RepeatButtonScroll(nsScrollbarFrame* aScrollbar);
|
|
|
|
void ThumbMoved(nsScrollbarFrame* aScrollbar, nscoord aOldPos,
|
|
|
|
nscoord aNewPos);
|
2015-03-25 21:40:31 +03:00
|
|
|
void ScrollbarReleased(nsScrollbarFrame* aScrollbar);
|
2014-02-05 05:33:18 +04:00
|
|
|
void ScrollByUnit(nsScrollbarFrame* aScrollbar,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode, int32_t aDirection,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollableFrame::ScrollUnit aUnit,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP);
|
2016-03-10 06:57:15 +03:00
|
|
|
bool ShouldSuppressScrollbarRepaints() const {
|
|
|
|
return mSuppressScrollbarRepaints;
|
|
|
|
}
|
2014-02-05 05:33:18 +04:00
|
|
|
|
2016-12-20 21:39:30 +03:00
|
|
|
bool DragScroll(WidgetEvent* aEvent);
|
|
|
|
|
2018-11-22 21:00:49 +03:00
|
|
|
void AsyncScrollbarDragInitiated(uint64_t aDragBlockId,
|
|
|
|
mozilla::layers::ScrollDirection aDirection);
|
2017-01-28 02:02:22 +03:00
|
|
|
void AsyncScrollbarDragRejected();
|
|
|
|
|
2017-03-11 10:00:46 +03:00
|
|
|
bool IsRootScrollFrameOfDocument() const { return mIsRoot; }
|
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
// owning references to the nsIAnonymousContentCreator-built content
|
2017-12-05 20:05:51 +03:00
|
|
|
nsCOMPtr<mozilla::dom::Element> mHScrollbarContent;
|
|
|
|
nsCOMPtr<mozilla::dom::Element> mVScrollbarContent;
|
|
|
|
nsCOMPtr<mozilla::dom::Element> mScrollCornerContent;
|
|
|
|
nsCOMPtr<mozilla::dom::Element> mResizerContent;
|
2007-02-18 20:34:09 +03:00
|
|
|
|
2015-12-18 01:19:30 +03:00
|
|
|
RefPtr<ScrollEvent> mScrollEvent;
|
2017-11-28 21:09:56 +03:00
|
|
|
RefPtr<ScrollEndEvent> mScrollEndEvent;
|
2007-01-28 01:50:18 +03:00
|
|
|
nsRevocableEventPtr<AsyncScrollPortEvent> mAsyncScrollPortEvent;
|
2010-01-12 00:45:19 +03:00
|
|
|
nsRevocableEventPtr<ScrolledAreaEvent> mScrolledAreaEvent;
|
2012-08-06 07:00:57 +04:00
|
|
|
nsIFrame* mHScrollbarBox;
|
|
|
|
nsIFrame* mVScrollbarBox;
|
2005-04-04 01:00:41 +04:00
|
|
|
nsIFrame* mScrolledFrame;
|
2012-08-06 07:00:57 +04:00
|
|
|
nsIFrame* mScrollCornerBox;
|
|
|
|
nsIFrame* mResizerBox;
|
2005-04-29 01:57:22 +04:00
|
|
|
nsContainerFrame* mOuter;
|
2017-08-17 16:45:30 +03:00
|
|
|
const nsIFrame* mReferenceFrameDuringPainting;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<AsyncScroll> mAsyncScroll;
|
|
|
|
RefPtr<AsyncSmoothMSDScroll> mAsyncSmoothMSDScroll;
|
|
|
|
RefPtr<ScrollbarActivity> mScrollbarActivity;
|
2010-01-29 03:03:42 +03:00
|
|
|
nsTArray<nsIScrollPositionListener*> mListeners;
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* mLastScrollOrigin;
|
|
|
|
nsAtom* mLastSmoothScrollOrigin;
|
2015-12-16 18:42:49 +03:00
|
|
|
Maybe<nsPoint> mApzSmoothScrollDestination;
|
2014-02-06 02:43:20 +04:00
|
|
|
uint32_t mScrollGeneration;
|
2009-10-08 07:01:15 +04:00
|
|
|
nsRect mScrollPort;
|
|
|
|
// Where we're currently scrolling to, if we're scrolling asynchronously.
|
|
|
|
// If we're not in the middle of an asynchronous scroll then this is
|
|
|
|
// just the current scroll position. ScrollBy will choose its
|
|
|
|
// destination based on this value.
|
|
|
|
nsPoint mDestination;
|
|
|
|
|
2013-03-21 06:44:37 +04:00
|
|
|
// A goal position to try to scroll to as content loads. As long as mLastPos
|
|
|
|
// matches the current logical scroll position, we try to scroll to
|
|
|
|
// mRestorePos after every reflow --- because after each time content is
|
|
|
|
// loaded/added to the scrollable element, there will be a reflow.
|
2009-10-08 07:01:15 +04:00
|
|
|
nsPoint mRestorePos;
|
2013-03-21 06:44:37 +04:00
|
|
|
// The last logical position we scrolled to while trying to restore
|
|
|
|
// mRestorePos, or 0,0 when this is a new frame. Set to -1,-1 once we've
|
|
|
|
// scrolled for any reason other than trying to restore mRestorePos.
|
2004-09-13 06:10:29 +04:00
|
|
|
nsPoint mLastPos;
|
|
|
|
|
Bug 1453425 - Add relative scroll offset updates using nsGkAtoms::relative. r=botond
This commit adds a scroll origin, nsGkAtoms::relative, which can be used to
mark main thread scrolling that can be combined with a concurrent APZ scroll.
The behavior of this is controlled by a pref, apz.relative-update. This pref
is initially activated and is intended as an aid to narrowing down causes
of regressions for users in bug reports.
Relative scroll updates work by tracking the last sent or accepted APZ
scroll offset. This is sent along with every FrameMetrics. Additionally,
a flag is added to FrameMetrics, mIsRelative, indicating whether the
scroll offset can be combined with a potential APZ scroll. When this
flag is set, AsyncPanZoomController will apply the delta between the sent
base scroll offset, and sent new scroll offset.
This flag is controlled by the last scroll origin on nsGfxScrollFrame. The
new origin, `relative`, is marked as being able to clobber APZ updates,
but can only be set if all scrolls since the last repaint request or
layers transaction have been relative.
Differential Revision: https://phabricator.services.mozilla.com/D8234
--HG--
extra : rebase_source : 51351a84c9cda228a0975e22eda3fd3bd8d261c4
extra : histedit_source : 4b564c19b16fe2bd26adc671b62b7cb6106e8163
2018-10-10 07:24:28 +03:00
|
|
|
// The latest scroll position we've sent or received from APZ. This
|
|
|
|
// represents the main thread's best knowledge of the APZ scroll position,
|
|
|
|
// and is used to calculate relative scroll offset updates.
|
|
|
|
nsPoint mApzScrollPos;
|
|
|
|
|
2010-07-16 01:08:05 +04:00
|
|
|
nsExpirationState mActivityExpirationState;
|
|
|
|
|
2012-01-19 08:13:02 +04:00
|
|
|
nsCOMPtr<nsITimer> mScrollActivityTimer;
|
2012-08-17 03:40:10 +04:00
|
|
|
nsPoint mScrollPosForLayerPixelAlignment;
|
2012-01-19 08:13:02 +04:00
|
|
|
|
2016-03-26 00:49:43 +03:00
|
|
|
// The scroll position where we last updated frame visibility.
|
|
|
|
nsPoint mLastUpdateFramesPos;
|
|
|
|
nsRect mDisplayPortAtLastFrameUpdate;
|
2013-02-25 04:59:21 +04:00
|
|
|
|
2015-02-08 20:57:00 +03:00
|
|
|
nsRect mPrevScrolledRect;
|
|
|
|
|
2018-11-01 23:15:46 +03:00
|
|
|
ScrollableLayerGuid::ViewID mScrollParentID;
|
2014-08-31 07:29:24 +04:00
|
|
|
|
2016-02-04 03:13:35 +03:00
|
|
|
// Timer to remove the displayport some time after scrolling has stopped
|
|
|
|
nsCOMPtr<nsITimer> mDisplayPortExpiryTimer;
|
|
|
|
|
2018-11-28 00:18:03 +03:00
|
|
|
ScrollAnchorContainer mAnchor;
|
|
|
|
|
2018-12-30 05:16:12 +03:00
|
|
|
bool mAllowScrollOriginDowngrade : 1;
|
|
|
|
bool mHadDisplayPortAtLastFrameUpdate : 1;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mNeverHasVerticalScrollbar : 1;
|
|
|
|
bool mNeverHasHorizontalScrollbar : 1;
|
|
|
|
bool mHasVerticalScrollbar : 1;
|
|
|
|
bool mHasHorizontalScrollbar : 1;
|
|
|
|
bool mFrameIsUpdatingScrollbar : 1;
|
|
|
|
bool mDidHistoryRestore : 1;
|
2005-04-04 02:40:25 +04:00
|
|
|
// Is this the scrollframe for the document's viewport?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsRoot : 1;
|
2013-06-17 09:16:27 +04:00
|
|
|
// True if we should clip all descendants, false if we should only clip
|
|
|
|
// descendants for which we are the containing block.
|
|
|
|
bool mClipAllDescendants : 1;
|
2007-01-19 21:01:10 +03:00
|
|
|
// If true, don't try to layout the scrollbars in Reflow(). This can be
|
|
|
|
// useful if multiple passes are involved, because we don't want to place the
|
|
|
|
// scrollbars at the wrong size.
|
2017-07-13 05:37:11 +03:00
|
|
|
bool mSuppressScrollbarUpdate : 1;
|
|
|
|
// If true, we skipped a scrollbar layout due to mSuppressScrollbarUpdate
|
2007-01-19 21:01:10 +03:00
|
|
|
// being set at some point. That means we should lay out scrollbars even if
|
2017-07-13 05:37:11 +03:00
|
|
|
// it might not strictly be needed next time mSuppressScrollbarUpdate is
|
2007-01-19 21:01:10 +03:00
|
|
|
// false.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSkippedScrollbarLayout : 1;
|
2010-05-30 20:38:42 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHadNonInitialReflow : 1;
|
2005-08-31 04:57:27 +04:00
|
|
|
// State used only by PostScrollEvents so we know
|
|
|
|
// which overflow states have changed.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHorizontalOverflow : 1;
|
|
|
|
bool mVerticalOverflow : 1;
|
|
|
|
bool mPostedReflowCallback : 1;
|
|
|
|
bool mMayHaveDirtyFixedChildren : 1;
|
2009-06-24 05:35:00 +04:00
|
|
|
// If true, need to actually update our scrollbar attributes in the
|
|
|
|
// reflow callback.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mUpdateScrollbarAttributes : 1;
|
2010-07-16 01:08:02 +04:00
|
|
|
// If true, we should be prepared to scroll using this scrollframe
|
|
|
|
// by placing descendant content into its own layer(s)
|
2014-10-22 05:53:38 +04:00
|
|
|
bool mHasBeenScrolledRecently : 1;
|
2011-01-17 17:35:32 +03:00
|
|
|
// If true, the resizer is collapsed and not displayed
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCollapsedResizer : 1;
|
2011-03-10 00:35:27 +03:00
|
|
|
|
2015-10-12 23:21:49 +03:00
|
|
|
// If true, the scroll frame should always be active because we always build
|
|
|
|
// a scrollable layer. Used for asynchronous scrolling.
|
|
|
|
bool mWillBuildScrollableLayer : 1;
|
2014-12-18 02:37:28 +03:00
|
|
|
|
2016-02-04 03:13:35 +03:00
|
|
|
// If true, the scroll frame is an ancestor of other scrolling frames, so
|
|
|
|
// we shouldn't expire the displayport on this scrollframe unless those
|
|
|
|
// descendant scrollframes also have their displayports removed.
|
|
|
|
bool mIsScrollParent : 1;
|
|
|
|
|
2015-04-02 21:28:42 +03:00
|
|
|
// Whether we are the root scroll frame that is used for containerful
|
|
|
|
// scrolling with a display port. If true, the scrollable frame
|
|
|
|
// shouldn't attach frame metrics to its layers because the container
|
|
|
|
// will already have the necessary frame metrics.
|
|
|
|
bool mIsScrollableLayerInRootContainer : 1;
|
|
|
|
|
2018-04-19 16:48:04 +03:00
|
|
|
// If true, add clipping in ScrollFrameHelper::ClipLayerToDisplayPort.
|
2014-10-28 07:34:58 +03:00
|
|
|
bool mAddClipRectToLayer : 1;
|
2012-03-12 00:55:00 +04:00
|
|
|
|
2012-11-14 10:26:33 +04:00
|
|
|
// True if this frame has been scrolled at least once
|
|
|
|
bool mHasBeenScrolled : 1;
|
|
|
|
|
2014-02-04 05:54:22 +04:00
|
|
|
// True if the events synthesized by OSX to produce momentum scrolling should
|
|
|
|
// be ignored. Reset when the next real, non-synthesized scroll event occurs.
|
|
|
|
bool mIgnoreMomentumScroll : 1;
|
|
|
|
|
2015-02-25 17:32:09 +03:00
|
|
|
// True if the APZ is in the process of async-transforming this scrollframe,
|
|
|
|
// (as best as we can tell on the main thread, anyway).
|
|
|
|
bool mTransformingByAPZ : 1;
|
|
|
|
|
2016-03-10 06:57:14 +03:00
|
|
|
// True if APZ can scroll this frame asynchronously (i.e. it has an APZC
|
|
|
|
// set up for this frame and it's not a scrollinfo layer).
|
|
|
|
bool mScrollableByAPZ : 1;
|
|
|
|
|
2015-09-12 04:58:16 +03:00
|
|
|
// True if the APZ is allowed to zoom this scrollframe.
|
|
|
|
bool mZoomableByAPZ : 1;
|
|
|
|
|
2017-11-28 00:45:29 +03:00
|
|
|
// True if the scroll frame contains out-of-flow content and is inside
|
|
|
|
// a CSS filter.
|
|
|
|
bool mHasOutOfFlowContentInsideFilter : 1;
|
|
|
|
|
2016-03-10 06:57:15 +03:00
|
|
|
// True if we don't want the scrollbar to repaint itself right now.
|
|
|
|
bool mSuppressScrollbarRepaints : 1;
|
|
|
|
|
2015-02-20 02:53:30 +03:00
|
|
|
mozilla::layout::ScrollVelocityQueue mVelocityQueue;
|
|
|
|
|
2012-03-12 00:55:00 +04:00
|
|
|
protected:
|
2016-03-10 06:57:15 +03:00
|
|
|
class AutoScrollbarRepaintSuppression;
|
|
|
|
friend class AutoScrollbarRepaintSuppression;
|
|
|
|
class AutoScrollbarRepaintSuppression {
|
|
|
|
public:
|
|
|
|
AutoScrollbarRepaintSuppression(ScrollFrameHelper* aHelper, bool aSuppress)
|
|
|
|
: mHelper(aHelper),
|
|
|
|
mOldSuppressValue(aHelper->mSuppressScrollbarRepaints) {
|
|
|
|
mHelper->mSuppressScrollbarRepaints = aSuppress;
|
|
|
|
}
|
|
|
|
|
|
|
|
~AutoScrollbarRepaintSuppression() {
|
|
|
|
mHelper->mSuppressScrollbarRepaints = mOldSuppressValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ScrollFrameHelper* mHelper;
|
|
|
|
bool mOldSuppressValue;
|
|
|
|
};
|
|
|
|
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-03-26 13:53:45 +04:00
|
|
|
void ScrollToWithOrigin(nsPoint aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aOrigin, // nullptr indicates "other" origin
|
2015-02-20 02:53:30 +03:00
|
|
|
const nsRect* aRange,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP);
|
2013-09-15 04:05:04 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
void CompleteAsyncScroll(const nsRect& aRange, nsAtom* aOrigin = nullptr);
|
2014-07-09 21:02:31 +04:00
|
|
|
|
2016-03-15 22:12:11 +03:00
|
|
|
bool HasPluginFrames();
|
2018-05-23 01:41:19 +03:00
|
|
|
bool HasPerspective() const { return mOuter->ChildrenHavePerspective(); }
|
2016-07-15 22:56:39 +03:00
|
|
|
bool HasBgAttachmentLocal() const;
|
Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel
We want the maximum scroll position to be aligned with layer pixels. That way
we don't have to re-rasterize the scrolled contents once scrolling hits the
edge of the scrollable area.
Here's how we determine the maximum scroll position: We get the scroll port
rect, snapped to layer pixels. Then we get the scrolled rect and also snap
that to layer pixels. The maximum scroll position is set to the difference
between right/bottom edges of these rectangles.
Now the scrollable area is computed by adding this maximum scroll position
to the unsnapped scroll port size.
The underlying idea here is: Pretend we have overflow:visible so that the
scrolled contents start at (0, 0) relative to the scroll port and spill over
the scroll port edges. When these contents are rendered, their rendering is
snapped to layer pixels. We want those exact pixels to be accessible by
scrolling.
This way of computing the snapped scrollable area ensures that, if you scroll
to the maximum scroll position, the right/bottom edges of the rendered
scrolled contents line up exactly with the right/bottom edges of the scroll
port. The scrolled contents are neither cut off nor are they moved too far.
(This is something that no other browser engine gets completely right, see the
testcase in bug 1012752.)
There are also a few disadvantages to this solution. We snap to layer pixels,
and the size of a layer pixel can depend on the zoom level, the document
resolution, the current screen's scale factor, and CSS transforms. The snap
origin is the position of the reference frame. So a change to any of these
things can influence the scrollable area and the maximum scroll position.
This patch does not make us adjust the current scroll position in the event
that the maximum scroll position changes such that the current scroll position
would be out of range, unless there's a reflow of the scrolled contents. This
means that we can sometimes render a slightly inconsistent state where the
current scroll position exceeds the maximum scroll position. We can fix this
once it turns out to be a problem; I doubt that it will be a problem because
none of the other browsers seems to prevent this problem either.
The size of the scrollable area is exposed through the DOM properties
scrollWidth and scrollHeight. At the moment, these are integer properties, so
their value is rounded to the nearest CSS pixel. Before this patch, the
returned value would always be within 0.5 CSS pixels of the value that layout
computed for the content's scrollable overflow based on the CSS styles of the
contents.
Now that scrollWidth and scrollHeight also depend on pixel snapping, their
values can deviate by up to one layer pixel from what the page might expect
based on the styles of the contents. This change requires a few changes to
existing tests.
The fact that scrollWidth and scrollHeight can change based on the position of
the scrollable element and the zoom level / resolution may surprise some web
pages. However, this also seems to happen in Edge. Edge seems to always round
scrollWidth and scrollHeight upwards, possibly to their equivalent of layout
device pixels.
MozReview-Commit-ID: 3LFV7Lio4tG
--HG--
extra : rebase_source : 3e4e0b60493397e61283aa1d7fd93d7c197dec29
extra : source : d43c2d5e87f31ff47d7f3ada66c3f5f27cef84a9
2016-08-05 06:51:58 +03:00
|
|
|
uint8_t GetScrolledFrameDir() const;
|
2015-10-06 22:23:24 +03:00
|
|
|
|
2018-09-07 03:35:45 +03:00
|
|
|
bool IsForTextControlWithNoScrollbars() const;
|
|
|
|
|
2018-10-01 08:59:25 +03:00
|
|
|
// Removes any RefreshDriver observers we might have registered.
|
|
|
|
void RemoveObservers();
|
|
|
|
|
2016-03-26 00:49:43 +03:00
|
|
|
static void EnsureFrameVisPrefsCached();
|
|
|
|
static bool sFrameVisPrefsCached;
|
|
|
|
// The number of scrollports wide/high to expand when tracking frame
|
|
|
|
// visibility.
|
2013-09-15 04:05:04 +04:00
|
|
|
static uint32_t sHorzExpandScrollPort;
|
|
|
|
static uint32_t sVertExpandScrollPort;
|
|
|
|
// The fraction of the scrollport we allow to scroll by before we schedule
|
2016-03-26 00:49:43 +03:00
|
|
|
// an update of frame visibility.
|
2013-09-15 04:05:04 +04:00
|
|
|
static int32_t sHorzScrollFraction;
|
|
|
|
static int32_t sVertScrollFraction;
|
2004-05-05 06:32:27 +04:00
|
|
|
};
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2013-10-29 06:27:50 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
/**
|
|
|
|
* The scroll frame creates and manages the scrolling view
|
|
|
|
*
|
|
|
|
* It only supports having a single child frame that typically is an area
|
|
|
|
* frame, but doesn't have to be. The child frame must have a view, though
|
|
|
|
*
|
|
|
|
* Scroll frames don't support incremental changes, i.e. you can't replace
|
|
|
|
* or remove the scrolled frame
|
|
|
|
*/
|
2011-12-28 00:18:48 +04:00
|
|
|
class nsHTMLScrollFrame : public nsContainerFrame,
|
2004-06-18 06:08:19 +04:00
|
|
|
public nsIScrollableFrame,
|
2004-09-13 06:10:29 +04:00
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
2004-06-18 06:08:19 +04:00
|
|
|
public:
|
2013-10-29 06:27:50 +04:00
|
|
|
typedef mozilla::ScrollFrameHelper ScrollFrameHelper;
|
2013-07-10 13:58:13 +04:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2016-07-21 13:36:37 +03:00
|
|
|
typedef mozilla::ScrollReflowInput ScrollReflowInput;
|
2018-11-28 00:18:03 +03:00
|
|
|
typedef mozilla::layout::ScrollAnchorContainer ScrollAnchorContainer;
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsHTMLScrollFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle,
|
2014-05-25 02:20:40 +04:00
|
|
|
bool aIsRoot);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsHTMLScrollFrame)
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2017-08-07 05:23:35 +03:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override {
|
2017-08-07 05:23:35 +03:00
|
|
|
mHelper.BuildDisplayList(aBuilder, aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
}
|
|
|
|
|
2016-07-21 13:36:37 +03:00
|
|
|
bool TryLayout(ScrollReflowInput* aState, ReflowOutput* aKidMetrics,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aAssumeVScroll, bool aAssumeHScroll, bool aForce);
|
2016-07-21 13:36:37 +03:00
|
|
|
bool ScrolledContentDependsOnHeight(ScrollReflowInput* aState);
|
|
|
|
void ReflowScrolledFrame(ScrollReflowInput* aState, bool aAssumeHScroll,
|
2018-12-18 00:54:41 +03:00
|
|
|
bool aAssumeVScroll, ReflowOutput* aMetrics);
|
2016-07-21 13:36:37 +03:00
|
|
|
void ReflowContents(ScrollReflowInput* aState,
|
2016-07-21 13:36:38 +03:00
|
|
|
const ReflowOutput& aDesiredSize);
|
2016-08-25 02:15:46 +03:00
|
|
|
void PlaceScrollArea(ScrollReflowInput& aState,
|
2009-10-08 07:01:15 +04:00
|
|
|
const nsPoint& aScrollPosition);
|
2017-06-09 22:14:53 +03:00
|
|
|
nscoord GetIntrinsicVScrollbarWidth(gfxContext* aRenderingContext);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2014-05-05 21:55:54 +04:00
|
|
|
virtual bool GetBorderRadii(const nsSize& aFrameSize,
|
|
|
|
const nsSize& aBorderArea, Sides aSkipSides,
|
2015-03-21 19:28:04 +03:00
|
|
|
nscoord aRadii[8]) const override {
|
2014-05-05 21:55:54 +04:00
|
|
|
return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii);
|
2010-09-08 02:20:35 +04:00
|
|
|
}
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
2016-04-21 07:28:33 +03:00
|
|
|
virtual nsresult GetXULPadding(nsMargin& aPadding) override;
|
2016-04-21 07:28:32 +03:00
|
|
|
virtual bool IsXULCollapsed() override;
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2016-05-04 03:27:43 +03:00
|
|
|
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
|
|
|
|
return mHelper.ComputeCustomOverflow(aOverflowAreas);
|
2013-03-05 16:26:41 +04:00
|
|
|
}
|
|
|
|
|
2016-12-21 01:56:35 +03:00
|
|
|
bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
|
|
|
|
nscoord* aBaseline) const override {
|
|
|
|
*aBaseline = GetLogicalBaseline(aWM);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-08-25 02:15:46 +03:00
|
|
|
// Recomputes the scrollable overflow area we store in the helper to take
|
|
|
|
// children that are affected by perpsective set on the outer frame and scroll
|
|
|
|
// at different rates.
|
|
|
|
void AdjustForPerspective(nsRect& aScrollableOverflow);
|
|
|
|
|
2014-05-28 23:36:58 +04:00
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aChildList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2017-11-07 03:20:33 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() override { return this; }
|
2009-09-01 15:22:31 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
|
2004-07-18 16:02:53 +04:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DoesClipChildren() override { return true; }
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2018-04-27 00:53:05 +03:00
|
|
|
nsPoint GetPositionOfChildIgnoringScrolling(const nsIFrame* aChild) override {
|
2006-06-16 06:40:29 +04:00
|
|
|
nsPoint pt = aChild->GetPosition();
|
2013-10-29 06:27:50 +04:00
|
|
|
if (aChild == mHelper.GetScrolledFrame()) pt += GetScrollPosition();
|
2006-06-16 06:40:29 +04:00
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 22:41:57 +04:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFilter) override;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2018-08-01 09:14:26 +03:00
|
|
|
virtual mozilla::ScrollStyles GetScrollStyles() const override {
|
|
|
|
return mHelper.GetScrollStylesFromFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarVisibility();
|
2010-01-14 16:00:00 +03:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetActualScrollbarSizes();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetDesiredScrollbarSizes(aState);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext* aRC) override {
|
2009-09-01 08:11:11 +04:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
2013-05-27 02:05:10 +04:00
|
|
|
virtual nscoord GetNondisappearingScrollbarWidth(
|
|
|
|
nsPresContext* aPresContext, gfxContext* aRC,
|
2017-06-09 22:14:53 +03:00
|
|
|
mozilla::WritingMode aWM) override {
|
2013-05-27 02:05:10 +04:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
2015-07-27 18:52:12 +03:00
|
|
|
return mHelper.GetNondisappearingScrollbarWidth(&bls, aWM);
|
2013-05-27 02:05:10 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect GetScrolledRect() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledRect();
|
2013-07-23 17:22:58 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect GetScrollPortRect() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPortRect();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint GetScrollPosition() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLogicalScrollPosition();
|
2012-12-12 01:12:43 +04:00
|
|
|
}
|
Bug 1453425 - Add relative scroll offset updates using nsGkAtoms::relative. r=botond
This commit adds a scroll origin, nsGkAtoms::relative, which can be used to
mark main thread scrolling that can be combined with a concurrent APZ scroll.
The behavior of this is controlled by a pref, apz.relative-update. This pref
is initially activated and is intended as an aid to narrowing down causes
of regressions for users in bug reports.
Relative scroll updates work by tracking the last sent or accepted APZ
scroll offset. This is sent along with every FrameMetrics. Additionally,
a flag is added to FrameMetrics, mIsRelative, indicating whether the
scroll offset can be combined with a potential APZ scroll. When this
flag is set, AsyncPanZoomController will apply the delta between the sent
base scroll offset, and sent new scroll offset.
This flag is controlled by the last scroll origin on nsGfxScrollFrame. The
new origin, `relative`, is marked as being able to clobber APZ updates,
but can only be set if all scrolls since the last repaint request or
layers transaction have been relative.
Differential Revision: https://phabricator.services.mozilla.com/D8234
--HG--
extra : rebase_source : 51351a84c9cda228a0975e22eda3fd3bd8d261c4
extra : histedit_source : 4b564c19b16fe2bd26adc671b62b7cb6106e8163
2018-10-10 07:24:28 +03:00
|
|
|
virtual nsPoint GetApzScrollPosition() const override {
|
|
|
|
return mHelper.GetApzScrollPosition();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect GetScrollRange() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollRange();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2018-07-22 22:49:38 +03:00
|
|
|
virtual nsSize GetVisualViewportSize() const override {
|
|
|
|
return mHelper.GetVisualViewportSize();
|
2012-06-11 03:44:50 +04:00
|
|
|
}
|
2018-09-21 22:01:13 +03:00
|
|
|
virtual nsPoint GetVisualViewportOffset() const override {
|
|
|
|
return mHelper.GetVisualViewportOffset();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsSize GetLineScrollAmount() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLineScrollAmount();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsSize GetPageScrollAmount() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetPageScrollAmount();
|
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.
|
|
|
|
*/
|
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) override {
|
2018-10-06 03:06:40 +03:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, nsGkAtoms::other, aRange, aSnap);
|
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.
|
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
virtual void ScrollToCSSPixels(
|
|
|
|
const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::INSTANT,
|
2018-10-06 03:06:40 +03:00
|
|
|
nsAtom* aOrigin = nullptr) override {
|
|
|
|
mHelper.ScrollToCSSPixels(aScrollPosition, aMode, aOrigin);
|
2012-05-15 09:58:09 +04:00
|
|
|
}
|
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) override {
|
2013-12-16 21:04:45 +04:00
|
|
|
mHelper.ScrollToCSSPixelsApproximate(aScrollPosition, aOrigin);
|
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.
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPositionCSSPixels();
|
2012-08-10 15:17:06 +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
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsIntPoint* aOverflow, nsAtom* aOrigin = nullptr,
|
2015-02-20 02:53:30 +03:00
|
|
|
nsIScrollableFrame::ScrollMomentum aMomentum =
|
|
|
|
nsIScrollableFrame::NOT_MOMENTUM,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum,
|
|
|
|
aSnap);
|
|
|
|
}
|
2018-10-06 03:06:40 +03:00
|
|
|
virtual void ScrollByCSSPixels(
|
|
|
|
const CSSIntPoint& aDelta,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::INSTANT,
|
|
|
|
nsAtom* aOrigin = nullptr) override {
|
|
|
|
mHelper.ScrollByCSSPixels(aDelta, aMode, aOrigin);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollSnap() override { mHelper.ScrollSnap(); }
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollToRestoredPosition() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ScrollToRestoredPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void AddScrollPositionListener(
|
|
|
|
nsIScrollPositionListener* aListener) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.AddScrollPositionListener(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RemoveScrollPositionListener(
|
|
|
|
nsIScrollPositionListener* aListener) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.RemoveScrollPositionListener(aListener);
|
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.
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.CurPosAttributeChanged(aChild);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.PostScrolledAreaEvent();
|
2010-01-12 00:45:19 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsScrollingActive(nsDisplayListBuilder* aBuilder) override {
|
2014-10-22 05:54:06 +04:00
|
|
|
return mHelper.IsScrollingActive(aBuilder);
|
2010-07-16 01:08:02 +04:00
|
|
|
}
|
2017-05-20 01:04:19 +03:00
|
|
|
virtual bool IsMaybeScrollingActive() const override {
|
|
|
|
return mHelper.IsMaybeScrollingActive();
|
|
|
|
}
|
2018-01-29 15:24:04 +03:00
|
|
|
virtual bool IsMaybeAsynchronouslyScrolled() override {
|
|
|
|
return mHelper.IsMaybeAsynchronouslyScrolled();
|
2017-09-27 02:24:42 +03:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsProcessingAsyncScroll() override {
|
2014-01-29 02:54:59 +04:00
|
|
|
return mHelper.IsProcessingAsyncScroll();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ResetScrollPositionForLayerPixelAlignment();
|
2012-08-17 03:40:10 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DidHistoryRestore() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.mDidHistoryRestore;
|
2011-06-16 01:03:49 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ClearDidHistoryRestore() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.mDidHistoryRestore = false;
|
2013-03-16 02:32:35 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsRectNearlyVisible(const nsRect& aRect) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.IsRectNearlyVisible(aRect);
|
2013-09-15 04:05:04 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const override {
|
2014-06-07 06:23:22 +04:00
|
|
|
return mHelper.ExpandRectToNearlyVisible(aRect);
|
2014-06-07 06:23:20 +04:00
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* LastScrollOrigin() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastScrollOrigin();
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* LastSmoothScrollOrigin() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastSmoothScrollOrigin();
|
2013-12-16 21:04:45 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t CurrentScrollGeneration() override {
|
2014-02-06 02:43:20 +04:00
|
|
|
return mHelper.CurrentScrollGeneration();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint LastScrollDestination() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastScrollDestination();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ResetScrollInfoIfGeneration(uint32_t aGeneration) override {
|
2014-07-10 22:52:40 +04:00
|
|
|
mHelper.ResetScrollInfoIfGeneration(aGeneration);
|
2013-12-16 21:04:45 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool WantAsyncScroll() const override {
|
2014-03-13 00:20:26 +04:00
|
|
|
return mHelper.WantAsyncScroll();
|
|
|
|
}
|
2016-03-29 02:14:52 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
2017-07-20 19:33:09 +03:00
|
|
|
LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,
|
2018-10-19 17:24:50 +03:00
|
|
|
const Maybe<ContainerLayerParameters>& aParameters,
|
2015-12-22 18:54:19 +03:00
|
|
|
const mozilla::DisplayItemClip* aClip) const override {
|
2018-04-19 16:48:04 +03:00
|
|
|
return mHelper.ComputeScrollMetadata(
|
|
|
|
aLayerManager, aContainerReferenceFrame, aParameters, aClip);
|
|
|
|
}
|
|
|
|
virtual void ClipLayerToDisplayPort(
|
|
|
|
Layer* aLayer, const mozilla::DisplayItemClip* aClip,
|
|
|
|
const ContainerLayerParameters& aParameters) const override {
|
|
|
|
mHelper.ClipLayerToDisplayPort(aLayer, aClip, aParameters);
|
2015-07-02 23:42:10 +03:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void MarkScrollbarsDirtyForReflow() const override {
|
2014-10-09 06:56:38 +04:00
|
|
|
mHelper.MarkScrollbarsDirtyForReflow();
|
|
|
|
}
|
2015-06-03 02:34:46 +03:00
|
|
|
virtual bool UsesContainerScrolling() const override {
|
|
|
|
return mHelper.UsesContainerScrolling();
|
|
|
|
}
|
2015-10-12 23:21:49 +03:00
|
|
|
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
2017-10-04 04:28:38 +03:00
|
|
|
nsRect* aVisibleRect, nsRect* aDirtyRect,
|
2017-10-03 00:00:16 +03:00
|
|
|
bool aSetBase) override {
|
2017-10-04 04:28:38 +03:00
|
|
|
return mHelper.DecideScrollableLayer(aBuilder, aVisibleRect, aDirtyRect,
|
|
|
|
aSetBase);
|
2015-10-12 23:21:49 +03:00
|
|
|
}
|
Bug 1453425 - Add relative scroll offset updates using nsGkAtoms::relative. r=botond
This commit adds a scroll origin, nsGkAtoms::relative, which can be used to
mark main thread scrolling that can be combined with a concurrent APZ scroll.
The behavior of this is controlled by a pref, apz.relative-update. This pref
is initially activated and is intended as an aid to narrowing down causes
of regressions for users in bug reports.
Relative scroll updates work by tracking the last sent or accepted APZ
scroll offset. This is sent along with every FrameMetrics. Additionally,
a flag is added to FrameMetrics, mIsRelative, indicating whether the
scroll offset can be combined with a potential APZ scroll. When this
flag is set, AsyncPanZoomController will apply the delta between the sent
base scroll offset, and sent new scroll offset.
This flag is controlled by the last scroll origin on nsGfxScrollFrame. The
new origin, `relative`, is marked as being able to clobber APZ updates,
but can only be set if all scrolls since the last repaint request or
layers transaction have been relative.
Differential Revision: https://phabricator.services.mozilla.com/D8234
--HG--
extra : rebase_source : 51351a84c9cda228a0975e22eda3fd3bd8d261c4
extra : histedit_source : 4b564c19b16fe2bd26adc671b62b7cb6106e8163
2018-10-10 07:24:28 +03:00
|
|
|
virtual void NotifyApzTransaction() override {
|
|
|
|
mHelper.NotifyApzTransaction();
|
|
|
|
}
|
2017-04-05 08:18:11 +03:00
|
|
|
virtual void NotifyApproximateFrameVisibilityUpdate(
|
|
|
|
bool aIgnoreDisplayPort) override {
|
|
|
|
mHelper.NotifyApproximateFrameVisibilityUpdate(aIgnoreDisplayPort);
|
2016-01-22 04:09:04 +03:00
|
|
|
}
|
2016-03-26 00:49:43 +03:00
|
|
|
virtual bool GetDisplayPortAtLastApproximateFrameVisibilityUpdate(
|
|
|
|
nsRect* aDisplayPort) override {
|
|
|
|
return mHelper.GetDisplayPortAtLastApproximateFrameVisibilityUpdate(
|
|
|
|
aDisplayPort);
|
2016-01-22 09:29:17 +03:00
|
|
|
}
|
2016-02-04 03:13:35 +03:00
|
|
|
void TriggerDisplayPortExpiration() override {
|
|
|
|
mHelper.TriggerDisplayPortExpiration();
|
|
|
|
}
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2004-09-13 06:10:29 +04:00
|
|
|
// nsIStatefulFrame
|
2018-03-02 21:18:35 +03:00
|
|
|
mozilla::UniquePtr<mozilla::PresState> SaveState() override {
|
|
|
|
return mHelper.SaveState();
|
2004-09-13 06:10:29 +04:00
|
|
|
}
|
2018-03-02 21:18:35 +03:00
|
|
|
NS_IMETHOD RestoreState(mozilla::PresState* aState) override {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.RestoreState(aState);
|
2004-09-13 06:10:29 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-02-05 05:33:18 +04:00
|
|
|
// nsIScrollbarMediator
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByPage(aScrollbar, aDirection, aSnap);
|
2014-02-05 05:33:18 +04:00
|
|
|
}
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByWhole(aScrollbar, aDirection, aSnap);
|
2014-02-05 05:33:18 +04:00
|
|
|
}
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByLine(aScrollbar, aDirection, aSnap);
|
2014-02-05 05:33:18 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) override {
|
2014-02-05 05:33:18 +04:00
|
|
|
mHelper.RepeatButtonScroll(aScrollbar);
|
|
|
|
}
|
|
|
|
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar, nscoord aOldPos,
|
2015-03-21 19:28:04 +03:00
|
|
|
nscoord aNewPos) override {
|
2014-02-05 05:33:18 +04:00
|
|
|
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
|
|
|
}
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) override {
|
|
|
|
mHelper.ScrollbarReleased(aScrollbar);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void VisibilityChanged(bool aVisible) override {}
|
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) override {
|
2014-02-14 10:40:53 +04:00
|
|
|
return mHelper.GetScrollbarBox(aVertical);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollbarActivityStarted() const override;
|
|
|
|
virtual void ScrollbarActivityStopped() const override;
|
2015-02-25 17:32:09 +03:00
|
|
|
|
2015-05-12 11:49:25 +03:00
|
|
|
virtual bool IsScrollbarOnRight() const override {
|
|
|
|
return mHelper.IsScrollbarOnRight();
|
|
|
|
}
|
|
|
|
|
2016-03-10 06:57:15 +03:00
|
|
|
virtual bool ShouldSuppressScrollbarRepaints() const override {
|
|
|
|
return mHelper.ShouldSuppressScrollbarRepaints();
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetTransformingByAPZ(bool aTransforming) override {
|
2015-02-25 17:32:09 +03:00
|
|
|
mHelper.SetTransformingByAPZ(aTransforming);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
bool IsTransformingByAPZ() const override {
|
2015-02-25 17:32:09 +03:00
|
|
|
return mHelper.IsTransformingByAPZ();
|
|
|
|
}
|
2016-03-10 06:57:14 +03:00
|
|
|
void SetScrollableByAPZ(bool aScrollable) override {
|
|
|
|
mHelper.SetScrollableByAPZ(aScrollable);
|
|
|
|
}
|
2015-09-12 04:58:16 +03:00
|
|
|
void SetZoomableByAPZ(bool aZoomable) override {
|
|
|
|
mHelper.SetZoomableByAPZ(aZoomable);
|
|
|
|
}
|
2017-11-28 00:45:29 +03:00
|
|
|
void SetHasOutOfFlowContentInsideFilter() override {
|
|
|
|
mHelper.SetHasOutOfFlowContentInsideFilter();
|
|
|
|
}
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2016-03-12 06:04:53 +03:00
|
|
|
ScrollSnapInfo GetScrollSnapInfo() const override {
|
|
|
|
return mHelper.GetScrollSnapInfo();
|
|
|
|
}
|
|
|
|
|
2016-12-20 21:39:30 +03:00
|
|
|
virtual bool DragScroll(mozilla::WidgetEvent* aEvent) override {
|
|
|
|
return mHelper.DragScroll(aEvent);
|
|
|
|
}
|
|
|
|
|
2018-11-22 21:00:49 +03:00
|
|
|
virtual void AsyncScrollbarDragInitiated(
|
|
|
|
uint64_t aDragBlockId,
|
|
|
|
mozilla::layers::ScrollDirection aDirection) override {
|
|
|
|
return mHelper.AsyncScrollbarDragInitiated(aDragBlockId, aDirection);
|
|
|
|
}
|
|
|
|
|
2017-01-28 02:02:22 +03:00
|
|
|
virtual void AsyncScrollbarDragRejected() override {
|
|
|
|
return mHelper.AsyncScrollbarDragRejected();
|
|
|
|
}
|
|
|
|
|
2017-03-11 10:00:46 +03:00
|
|
|
virtual bool IsRootScrollFrameOfDocument() const override {
|
|
|
|
return mHelper.IsRootScrollFrameOfDocument();
|
|
|
|
}
|
|
|
|
|
2018-11-28 00:18:03 +03:00
|
|
|
virtual const ScrollAnchorContainer* GetAnchor() const override {
|
|
|
|
return &mHelper.mAnchor;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ScrollAnchorContainer* GetAnchor() override {
|
|
|
|
return &mHelper.mAnchor;
|
|
|
|
}
|
|
|
|
|
2017-06-16 12:22:33 +03:00
|
|
|
// Return the scrolled frame.
|
|
|
|
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override {
|
|
|
|
aResult.AppendElement(OwnedAnonBox(mHelper.GetScrolledFrame()));
|
2017-03-04 00:16:11 +03:00
|
|
|
}
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2004-06-18 06:08:19 +04:00
|
|
|
#endif
|
|
|
|
|
2004-09-01 18:58:34 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2004-09-01 18:58:34 +04:00
|
|
|
#endif
|
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
protected:
|
2018-03-22 21:20:41 +03:00
|
|
|
nsHTMLScrollFrame(ComputedStyle* aStyle, bool aIsRoot)
|
|
|
|
: nsHTMLScrollFrame(aStyle, kClassID, aIsRoot) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
nsHTMLScrollFrame(ComputedStyle* aStyle, nsIFrame::ClassID aID, bool aIsRoot);
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetSuppressScrollbarUpdate(bool aSuppress) {
|
2017-07-13 05:37:11 +03:00
|
|
|
mHelper.mSuppressScrollbarUpdate = aSuppress;
|
2005-07-26 03:23:53 +04:00
|
|
|
}
|
2016-07-21 13:36:37 +03:00
|
|
|
bool GuessHScrollbarNeeded(const ScrollReflowInput& aState);
|
|
|
|
bool GuessVScrollbarNeeded(const ScrollReflowInput& aState);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsScrollbarUpdateSuppressed() const {
|
2017-07-13 05:37:11 +03:00
|
|
|
return mHelper.mSuppressScrollbarUpdate;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
}
|
2007-04-26 06:29:21 +04:00
|
|
|
|
|
|
|
// Return whether we're in an "initial" reflow. Some reflows with
|
|
|
|
// NS_FRAME_FIRST_REFLOW set are NOT "initial" as far as we're concerned.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool InInitialReflow() const;
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2007-12-07 03:10:31 +03:00
|
|
|
/**
|
2015-02-08 18:31:14 +03:00
|
|
|
* Override this to return false if computed bsize/min-bsize/max-bsize
|
2007-12-07 03:10:31 +03:00
|
|
|
* should NOT be propagated to child content.
|
|
|
|
* nsListControlFrame uses this.
|
|
|
|
*/
|
2015-02-08 18:31:14 +03:00
|
|
|
virtual bool ShouldPropagateComputedBSizeToScrolledContent() const {
|
|
|
|
return true;
|
|
|
|
}
|
2007-12-07 03:10:31 +03:00
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
private:
|
2013-10-29 06:27:50 +04:00
|
|
|
friend class mozilla::ScrollFrameHelper;
|
|
|
|
ScrollFrameHelper mHelper;
|
2004-06-18 06:08:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The scroll frame creates and manages the scrolling view
|
|
|
|
*
|
|
|
|
* It only supports having a single child frame that typically is an area
|
|
|
|
* frame, but doesn't have to be. The child frame must have a view, though
|
|
|
|
*
|
|
|
|
* Scroll frames don't support incremental changes, i.e. you can't replace
|
|
|
|
* or remove the scrolled frame
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsXULScrollFrame final : public nsBoxFrame,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIScrollableFrame,
|
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
1999-08-20 02:16:23 +04:00
|
|
|
public:
|
2013-10-29 06:27:50 +04:00
|
|
|
typedef mozilla::ScrollFrameHelper ScrollFrameHelper;
|
2013-07-10 13:58:13 +04:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2018-11-28 00:18:03 +03:00
|
|
|
typedef mozilla::layout::ScrollAnchorContainer ScrollAnchorContainer;
|
2013-07-10 13:58:13 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsXULScrollFrame)
|
2009-01-12 22:20:59 +03:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsXULScrollFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle,
|
2014-05-25 02:20:40 +04:00
|
|
|
bool aIsRoot,
|
|
|
|
bool aClipAllDescendants);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override {
|
2017-08-07 05:23:35 +03:00
|
|
|
mHelper.BuildDisplayList(aBuilder, aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// XXXldb Is this actually used?
|
|
|
|
#if 0
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#endif
|
2000-04-05 04:19:00 +04:00
|
|
|
|
2016-05-04 03:27:43 +03:00
|
|
|
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
|
|
|
|
return mHelper.ComputeCustomOverflow(aOverflowAreas);
|
2013-03-05 16:26:41 +04:00
|
|
|
}
|
|
|
|
|
2016-12-21 01:56:35 +03:00
|
|
|
bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
|
|
|
|
nscoord* aBaseline) const override {
|
|
|
|
*aBaseline = GetLogicalBaseline(aWM);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-05-28 23:36:58 +04:00
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aChildList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2017-11-07 03:20:33 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() override { return this; }
|
2009-09-01 15:22:31 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
|
2004-07-18 16:02:53 +04:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DoesClipChildren() override { return true; }
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2018-04-27 00:53:05 +03:00
|
|
|
nsPoint GetPositionOfChildIgnoringScrolling(const nsIFrame* aChild) override {
|
2006-06-16 06:40:29 +04:00
|
|
|
nsPoint pt = aChild->GetPosition();
|
2013-10-29 06:27:50 +04:00
|
|
|
if (aChild == mHelper.GetScrolledFrame())
|
|
|
|
pt += mHelper.GetLogicalScrollPosition();
|
2006-06-16 06:40:29 +04:00
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 22:41:57 +04:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFilter) override;
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2016-04-21 07:28:31 +03:00
|
|
|
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 07:28:31 +03:00
|
|
|
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 07:28:31 +03:00
|
|
|
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 07:28:32 +03:00
|
|
|
virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2016-04-21 07:28:35 +03:00
|
|
|
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
|
2016-04-21 07:28:33 +03:00
|
|
|
virtual nsresult GetXULPadding(nsMargin& aPadding) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2014-05-05 21:55:54 +04:00
|
|
|
virtual bool GetBorderRadii(const nsSize& aFrameSize,
|
|
|
|
const nsSize& aBorderArea, Sides aSkipSides,
|
2015-03-21 19:28:04 +03:00
|
|
|
nscoord aRadii[8]) const override {
|
2014-05-05 21:55:54 +04:00
|
|
|
return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii);
|
2010-09-08 02:20:35 +04:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:28:32 +03:00
|
|
|
nsresult XULLayout(nsBoxLayoutState& aState);
|
2009-10-08 07:01:15 +04:00
|
|
|
void LayoutScrollArea(nsBoxLayoutState& aState,
|
|
|
|
const nsPoint& aScrollPosition);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
static bool AddRemoveScrollbar(bool& aHasScrollbar, nscoord& aXY,
|
|
|
|
nscoord& aSize, nscoord aSbSize,
|
|
|
|
bool aOnRightOrBottom, bool aAdd);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
bool AddRemoveScrollbar(nsBoxLayoutState& aState, bool aOnRightOrBottom,
|
|
|
|
bool aHorizontal, bool aAdd);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool AddHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBottom);
|
|
|
|
bool AddVerticalScrollbar(nsBoxLayoutState& aState, bool aOnRight);
|
|
|
|
void RemoveHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBottom);
|
|
|
|
void RemoveVerticalScrollbar(nsBoxLayoutState& aState, bool aOnRight);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
static void AdjustReflowInputForPrintPreview(nsBoxLayoutState& aState,
|
|
|
|
bool& aSetBack);
|
|
|
|
static void AdjustReflowInputBack(nsBoxLayoutState& aState, bool aSetBack);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
1999-12-07 06:36:05 +03:00
|
|
|
// nsIScrollableFrame
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2018-08-01 09:14:26 +03:00
|
|
|
virtual mozilla::ScrollStyles GetScrollStyles() const override {
|
|
|
|
return mHelper.GetScrollStylesFromFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarVisibility();
|
2010-01-14 16:00:00 +03:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetActualScrollbarSizes();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetDesiredScrollbarSizes(aState);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext* aRC) override {
|
2009-09-01 08:11:11 +04:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
2013-05-27 02:05:10 +04:00
|
|
|
virtual nscoord GetNondisappearingScrollbarWidth(
|
|
|
|
nsPresContext* aPresContext, gfxContext* aRC,
|
2017-06-09 22:14:53 +03:00
|
|
|
mozilla::WritingMode aWM) override {
|
2013-05-27 02:05:10 +04:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
2015-07-27 18:52:12 +03:00
|
|
|
return mHelper.GetNondisappearingScrollbarWidth(&bls, aWM);
|
2013-05-27 02:05:10 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect GetScrolledRect() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledRect();
|
2013-07-23 17:22:58 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect GetScrollPortRect() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPortRect();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint GetScrollPosition() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLogicalScrollPosition();
|
2012-12-12 01:12:43 +04:00
|
|
|
}
|
Bug 1453425 - Add relative scroll offset updates using nsGkAtoms::relative. r=botond
This commit adds a scroll origin, nsGkAtoms::relative, which can be used to
mark main thread scrolling that can be combined with a concurrent APZ scroll.
The behavior of this is controlled by a pref, apz.relative-update. This pref
is initially activated and is intended as an aid to narrowing down causes
of regressions for users in bug reports.
Relative scroll updates work by tracking the last sent or accepted APZ
scroll offset. This is sent along with every FrameMetrics. Additionally,
a flag is added to FrameMetrics, mIsRelative, indicating whether the
scroll offset can be combined with a potential APZ scroll. When this
flag is set, AsyncPanZoomController will apply the delta between the sent
base scroll offset, and sent new scroll offset.
This flag is controlled by the last scroll origin on nsGfxScrollFrame. The
new origin, `relative`, is marked as being able to clobber APZ updates,
but can only be set if all scrolls since the last repaint request or
layers transaction have been relative.
Differential Revision: https://phabricator.services.mozilla.com/D8234
--HG--
extra : rebase_source : 51351a84c9cda228a0975e22eda3fd3bd8d261c4
extra : histedit_source : 4b564c19b16fe2bd26adc671b62b7cb6106e8163
2018-10-10 07:24:28 +03:00
|
|
|
virtual nsPoint GetApzScrollPosition() const override {
|
|
|
|
return mHelper.GetApzScrollPosition();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect GetScrollRange() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollRange();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2018-07-22 22:49:38 +03:00
|
|
|
virtual nsSize GetVisualViewportSize() const override {
|
|
|
|
return mHelper.GetVisualViewportSize();
|
2012-06-11 03:44:50 +04:00
|
|
|
}
|
2018-09-21 22:01:13 +03:00
|
|
|
virtual nsPoint GetVisualViewportOffset() const override {
|
|
|
|
return mHelper.GetVisualViewportOffset();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsSize GetLineScrollAmount() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLineScrollAmount();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsSize GetPageScrollAmount() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetPageScrollAmount();
|
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.
|
|
|
|
*/
|
2012-02-08 04:53:18 +04:00
|
|
|
virtual void ScrollTo(
|
|
|
|
nsPoint aScrollPosition, ScrollMode aMode, const nsRect* aRange = nullptr,
|
2015-03-25 21:40:31 +03:00
|
|
|
ScrollSnapMode aSnap = nsIScrollbarMediator::DISABLE_SNAP) override {
|
2018-10-06 03:06:40 +03:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, nsGkAtoms::other, aRange, aSnap);
|
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.
|
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
virtual void ScrollToCSSPixels(
|
|
|
|
const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::INSTANT,
|
2018-10-06 03:06:40 +03:00
|
|
|
nsAtom* aOrigin = nullptr) override {
|
|
|
|
mHelper.ScrollToCSSPixels(aScrollPosition, aMode, aOrigin);
|
2012-05-15 09:58:09 +04:00
|
|
|
}
|
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) override {
|
2013-12-16 21:04:45 +04:00
|
|
|
mHelper.ScrollToCSSPixelsApproximate(aScrollPosition, aOrigin);
|
2012-11-23 05:25:23 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPositionCSSPixels();
|
2012-08-10 15:17:06 +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
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsIntPoint* aOverflow, nsAtom* aOrigin = nullptr,
|
2015-02-20 02:53:30 +03:00
|
|
|
nsIScrollableFrame::ScrollMomentum aMomentum =
|
|
|
|
nsIScrollableFrame::NOT_MOMENTUM,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum,
|
|
|
|
aSnap);
|
|
|
|
}
|
2018-10-06 03:06:40 +03:00
|
|
|
virtual void ScrollByCSSPixels(
|
|
|
|
const CSSIntPoint& aDelta,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::INSTANT,
|
|
|
|
nsAtom* aOrigin = nullptr) override {
|
|
|
|
mHelper.ScrollByCSSPixels(aDelta, aMode, aOrigin);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollSnap() override { mHelper.ScrollSnap(); }
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollToRestoredPosition() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ScrollToRestoredPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void AddScrollPositionListener(
|
|
|
|
nsIScrollPositionListener* aListener) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.AddScrollPositionListener(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RemoveScrollPositionListener(
|
|
|
|
nsIScrollPositionListener* aListener) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.RemoveScrollPositionListener(aListener);
|
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.
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.CurPosAttributeChanged(aChild);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.PostScrolledAreaEvent();
|
2010-01-12 00:45:19 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsScrollingActive(nsDisplayListBuilder* aBuilder) override {
|
2014-10-22 05:54:06 +04:00
|
|
|
return mHelper.IsScrollingActive(aBuilder);
|
2010-07-16 01:08:02 +04:00
|
|
|
}
|
2017-05-20 01:04:19 +03:00
|
|
|
virtual bool IsMaybeScrollingActive() const override {
|
|
|
|
return mHelper.IsMaybeScrollingActive();
|
|
|
|
}
|
2018-01-29 15:24:04 +03:00
|
|
|
virtual bool IsMaybeAsynchronouslyScrolled() override {
|
|
|
|
return mHelper.IsMaybeAsynchronouslyScrolled();
|
2017-09-27 02:24:42 +03:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsProcessingAsyncScroll() override {
|
2014-01-29 02:54:59 +04:00
|
|
|
return mHelper.IsProcessingAsyncScroll();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ResetScrollPositionForLayerPixelAlignment();
|
2012-08-17 03:40:10 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DidHistoryRestore() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.mDidHistoryRestore;
|
2011-06-16 01:03:49 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ClearDidHistoryRestore() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.mDidHistoryRestore = false;
|
2013-03-16 02:32:35 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsRectNearlyVisible(const nsRect& aRect) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.IsRectNearlyVisible(aRect);
|
2013-09-15 04:05:04 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const override {
|
2014-06-07 06:23:22 +04:00
|
|
|
return mHelper.ExpandRectToNearlyVisible(aRect);
|
2014-06-07 06:23:20 +04:00
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* LastScrollOrigin() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastScrollOrigin();
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* LastSmoothScrollOrigin() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastSmoothScrollOrigin();
|
2013-12-16 21:04:45 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t CurrentScrollGeneration() override {
|
2014-02-06 02:43:20 +04:00
|
|
|
return mHelper.CurrentScrollGeneration();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint LastScrollDestination() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastScrollDestination();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ResetScrollInfoIfGeneration(uint32_t aGeneration) override {
|
2014-07-10 22:52:40 +04:00
|
|
|
mHelper.ResetScrollInfoIfGeneration(aGeneration);
|
2013-12-16 21:04:45 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool WantAsyncScroll() const override {
|
2014-03-13 00:20:26 +04:00
|
|
|
return mHelper.WantAsyncScroll();
|
|
|
|
}
|
2016-03-29 02:14:52 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
2017-07-20 19:33:09 +03:00
|
|
|
LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,
|
2018-10-19 17:24:50 +03:00
|
|
|
const Maybe<ContainerLayerParameters>& aParameters,
|
2015-12-22 18:54:19 +03:00
|
|
|
const mozilla::DisplayItemClip* aClip) const override {
|
2018-04-19 16:48:04 +03:00
|
|
|
return mHelper.ComputeScrollMetadata(
|
|
|
|
aLayerManager, aContainerReferenceFrame, aParameters, aClip);
|
|
|
|
}
|
|
|
|
virtual void ClipLayerToDisplayPort(
|
|
|
|
Layer* aLayer, const mozilla::DisplayItemClip* aClip,
|
|
|
|
const ContainerLayerParameters& aParameters) const override {
|
|
|
|
mHelper.ClipLayerToDisplayPort(aLayer, aClip, aParameters);
|
2015-07-02 23:42:10 +03:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void MarkScrollbarsDirtyForReflow() const override {
|
2014-10-09 06:56:38 +04:00
|
|
|
mHelper.MarkScrollbarsDirtyForReflow();
|
|
|
|
}
|
2003-04-09 15:27:09 +04:00
|
|
|
|
2004-09-13 06:10:29 +04:00
|
|
|
// nsIStatefulFrame
|
2018-03-02 21:18:35 +03:00
|
|
|
mozilla::UniquePtr<mozilla::PresState> SaveState() override {
|
|
|
|
return mHelper.SaveState();
|
2004-09-13 06:10:29 +04:00
|
|
|
}
|
2018-03-02 21:18:35 +03:00
|
|
|
NS_IMETHOD RestoreState(mozilla::PresState* aState) override {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.RestoreState(aState);
|
2004-09-13 06:10:29 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2007-02-24 21:33:33 +03:00
|
|
|
// Override bogus IsFrameOfType in nsBoxFrame.
|
|
|
|
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2007-02-24 21:33:33 +03:00
|
|
|
return nsBoxFrame::IsFrameOfType(aFlags);
|
|
|
|
}
|
|
|
|
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByPage(aScrollbar, aDirection, aSnap);
|
2014-02-05 05:33:18 +04:00
|
|
|
}
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByWhole(aScrollbar, aDirection, aSnap);
|
2014-02-05 05:33:18 +04:00
|
|
|
}
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap =
|
|
|
|
nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByLine(aScrollbar, aDirection, aSnap);
|
2014-02-05 05:33:18 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) override {
|
2014-02-05 05:33:18 +04:00
|
|
|
mHelper.RepeatButtonScroll(aScrollbar);
|
|
|
|
}
|
|
|
|
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar, nscoord aOldPos,
|
2015-03-21 19:28:04 +03:00
|
|
|
nscoord aNewPos) override {
|
2014-02-05 05:33:18 +04:00
|
|
|
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
|
|
|
}
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) override {
|
|
|
|
mHelper.ScrollbarReleased(aScrollbar);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void VisibilityChanged(bool aVisible) override {}
|
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) override {
|
2014-02-14 10:40:53 +04:00
|
|
|
return mHelper.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollbarActivityStarted() const override;
|
|
|
|
virtual void ScrollbarActivityStopped() const override;
|
2014-02-05 05:33:18 +04:00
|
|
|
|
2015-05-12 11:49:25 +03:00
|
|
|
virtual bool IsScrollbarOnRight() const override {
|
|
|
|
return mHelper.IsScrollbarOnRight();
|
|
|
|
}
|
|
|
|
|
2016-03-10 06:57:15 +03:00
|
|
|
virtual bool ShouldSuppressScrollbarRepaints() const override {
|
|
|
|
return mHelper.ShouldSuppressScrollbarRepaints();
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetTransformingByAPZ(bool aTransforming) override {
|
2015-02-25 17:32:09 +03:00
|
|
|
mHelper.SetTransformingByAPZ(aTransforming);
|
|
|
|
}
|
2015-06-03 02:34:46 +03:00
|
|
|
virtual bool UsesContainerScrolling() const override {
|
|
|
|
return mHelper.UsesContainerScrolling();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
bool IsTransformingByAPZ() const override {
|
2015-02-25 17:32:09 +03:00
|
|
|
return mHelper.IsTransformingByAPZ();
|
|
|
|
}
|
2016-03-10 06:57:14 +03:00
|
|
|
void SetScrollableByAPZ(bool aScrollable) override {
|
|
|
|
mHelper.SetScrollableByAPZ(aScrollable);
|
|
|
|
}
|
2015-09-12 04:58:16 +03:00
|
|
|
void SetZoomableByAPZ(bool aZoomable) override {
|
|
|
|
mHelper.SetZoomableByAPZ(aZoomable);
|
|
|
|
}
|
2017-11-28 00:45:29 +03:00
|
|
|
void SetHasOutOfFlowContentInsideFilter() override {
|
|
|
|
mHelper.SetHasOutOfFlowContentInsideFilter();
|
|
|
|
}
|
2015-10-12 23:21:49 +03:00
|
|
|
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
2017-10-04 04:28:38 +03:00
|
|
|
nsRect* aVisibleRect, nsRect* aDirtyRect,
|
2017-10-03 00:00:16 +03:00
|
|
|
bool aSetBase) override {
|
2017-10-04 04:28:38 +03:00
|
|
|
return mHelper.DecideScrollableLayer(aBuilder, aVisibleRect, aDirtyRect,
|
|
|
|
aSetBase);
|
2015-10-12 23:21:49 +03:00
|
|
|
}
|
Bug 1453425 - Add relative scroll offset updates using nsGkAtoms::relative. r=botond
This commit adds a scroll origin, nsGkAtoms::relative, which can be used to
mark main thread scrolling that can be combined with a concurrent APZ scroll.
The behavior of this is controlled by a pref, apz.relative-update. This pref
is initially activated and is intended as an aid to narrowing down causes
of regressions for users in bug reports.
Relative scroll updates work by tracking the last sent or accepted APZ
scroll offset. This is sent along with every FrameMetrics. Additionally,
a flag is added to FrameMetrics, mIsRelative, indicating whether the
scroll offset can be combined with a potential APZ scroll. When this
flag is set, AsyncPanZoomController will apply the delta between the sent
base scroll offset, and sent new scroll offset.
This flag is controlled by the last scroll origin on nsGfxScrollFrame. The
new origin, `relative`, is marked as being able to clobber APZ updates,
but can only be set if all scrolls since the last repaint request or
layers transaction have been relative.
Differential Revision: https://phabricator.services.mozilla.com/D8234
--HG--
extra : rebase_source : 51351a84c9cda228a0975e22eda3fd3bd8d261c4
extra : histedit_source : 4b564c19b16fe2bd26adc671b62b7cb6106e8163
2018-10-10 07:24:28 +03:00
|
|
|
virtual void NotifyApzTransaction() override {
|
|
|
|
mHelper.NotifyApzTransaction();
|
|
|
|
}
|
2017-04-05 08:18:11 +03:00
|
|
|
virtual void NotifyApproximateFrameVisibilityUpdate(
|
|
|
|
bool aIgnoreDisplayPort) override {
|
|
|
|
mHelper.NotifyApproximateFrameVisibilityUpdate(aIgnoreDisplayPort);
|
2016-01-22 04:09:04 +03:00
|
|
|
}
|
2016-03-26 00:49:43 +03:00
|
|
|
virtual bool GetDisplayPortAtLastApproximateFrameVisibilityUpdate(
|
|
|
|
nsRect* aDisplayPort) override {
|
|
|
|
return mHelper.GetDisplayPortAtLastApproximateFrameVisibilityUpdate(
|
|
|
|
aDisplayPort);
|
2016-01-22 09:29:17 +03:00
|
|
|
}
|
2016-02-04 03:13:35 +03:00
|
|
|
void TriggerDisplayPortExpiration() override {
|
|
|
|
mHelper.TriggerDisplayPortExpiration();
|
|
|
|
}
|
2015-02-25 17:32:09 +03:00
|
|
|
|
2016-03-12 06:04:53 +03:00
|
|
|
ScrollSnapInfo GetScrollSnapInfo() const override {
|
|
|
|
return mHelper.GetScrollSnapInfo();
|
|
|
|
}
|
|
|
|
|
2016-12-20 21:39:30 +03:00
|
|
|
virtual bool DragScroll(mozilla::WidgetEvent* aEvent) override {
|
|
|
|
return mHelper.DragScroll(aEvent);
|
|
|
|
}
|
|
|
|
|
2018-11-22 21:00:49 +03:00
|
|
|
virtual void AsyncScrollbarDragInitiated(
|
|
|
|
uint64_t aDragBlockId,
|
|
|
|
mozilla::layers::ScrollDirection aDirection) override {
|
|
|
|
return mHelper.AsyncScrollbarDragInitiated(aDragBlockId, aDirection);
|
|
|
|
}
|
|
|
|
|
2017-01-28 02:02:22 +03:00
|
|
|
virtual void AsyncScrollbarDragRejected() override {
|
|
|
|
return mHelper.AsyncScrollbarDragRejected();
|
|
|
|
}
|
|
|
|
|
2017-03-11 10:00:46 +03:00
|
|
|
virtual bool IsRootScrollFrameOfDocument() const override {
|
|
|
|
return mHelper.IsRootScrollFrameOfDocument();
|
|
|
|
}
|
|
|
|
|
2018-11-28 00:18:03 +03:00
|
|
|
virtual const ScrollAnchorContainer* GetAnchor() const override {
|
|
|
|
return &mHelper.mAnchor;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ScrollAnchorContainer* GetAnchor() override {
|
|
|
|
return &mHelper.mAnchor;
|
|
|
|
}
|
|
|
|
|
2017-06-16 12:22:33 +03:00
|
|
|
// Return the scrolled frame.
|
|
|
|
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override {
|
|
|
|
aResult.AppendElement(OwnedAnonBox(mHelper.GetScrolledFrame()));
|
2017-03-04 00:16:11 +03:00
|
|
|
}
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2003-12-10 06:43:39 +03:00
|
|
|
protected:
|
2018-03-22 21:20:41 +03:00
|
|
|
nsXULScrollFrame(ComputedStyle* aStyle, bool aIsRoot,
|
2013-06-17 09:16:27 +04:00
|
|
|
bool aClipAllDescendants);
|
2003-12-10 06:43:39 +03:00
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
void ClampAndSetBounds(nsBoxLayoutState& aState, nsRect& aRect,
|
2011-02-13 09:38:29 +03:00
|
|
|
nsPoint aScrollPosition,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRemoveOverflowAreas = false) {
|
2017-07-06 15:00:35 +03:00
|
|
|
/*
|
2011-02-13 09:38:29 +03:00
|
|
|
* For RTL frames, restore the original scrolled position of the right
|
|
|
|
* edge, then subtract the current width to find the physical position.
|
|
|
|
*/
|
2016-09-15 12:41:28 +03:00
|
|
|
if (!mHelper.IsPhysicalLTR()) {
|
2013-10-29 06:27:50 +04:00
|
|
|
aRect.x = mHelper.mScrollPort.XMost() - aScrollPosition.x - aRect.width;
|
2011-02-13 09:38:29 +03:00
|
|
|
}
|
2016-04-21 07:28:32 +03:00
|
|
|
mHelper.mScrolledFrame->SetXULBounds(aState, aRect, aRemoveOverflowAreas);
|
2011-02-13 09:38:29 +03:00
|
|
|
}
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
private:
|
2013-10-29 06:27:50 +04:00
|
|
|
friend class mozilla::ScrollFrameHelper;
|
|
|
|
ScrollFrameHelper mHelper;
|
1999-08-20 02:16:23 +04:00
|
|
|
};
|
|
|
|
|
2003-04-11 12:26:42 +04:00
|
|
|
#endif /* nsGfxScrollFrame_h___ */
|