2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* rendering object to wrap rendering objects that should be scrollable */
|
|
|
|
|
|
|
|
#ifndef nsGfxScrollFrame_h___
|
|
|
|
#define nsGfxScrollFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
|
|
|
#include "nsBoxFrame.h"
|
|
|
|
#include "nsIScrollableFrame.h"
|
2014-02-04 17:33:18 -08:00
|
|
|
#include "nsIScrollbarMediator.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIStatefulFrame.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsIReflowCallback.h"
|
2008-04-09 21:39:41 -07:00
|
|
|
#include "nsBoxLayoutState.h"
|
2009-10-25 00:04:18 -07:00
|
|
|
#include "nsQueryFrame.h"
|
2010-07-15 14:08:05 -07:00
|
|
|
#include "nsExpirationTracker.h"
|
2015-02-25 06:33:00 -08:00
|
|
|
#include "TextOverflow.h"
|
2015-02-19 15:53:30 -08:00
|
|
|
#include "ScrollVelocityQueue.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsPresContext;
|
|
|
|
class nsIPresShell;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsPresState;
|
2013-08-22 11:32:52 -07:00
|
|
|
class nsIScrollPositionListener;
|
2007-03-22 10:30:00 -07:00
|
|
|
struct ScrollReflowState;
|
|
|
|
|
2012-08-03 03:35:14 -07:00
|
|
|
namespace mozilla {
|
2014-08-30 20:29:24 -07:00
|
|
|
namespace layers {
|
|
|
|
class Layer;
|
|
|
|
}
|
2013-05-02 07:58:00 -07:00
|
|
|
namespace layout {
|
2012-08-03 03:35:14 -07:00
|
|
|
class ScrollbarActivity;
|
|
|
|
}
|
2013-05-02 07:58:00 -07:00
|
|
|
}
|
2012-08-03 03:35:14 -07:00
|
|
|
|
2013-10-28 19:27:50 -07:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class ScrollFrameHelper : public nsIReflowCallback {
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2014-06-28 03:13:13 -07:00
|
|
|
typedef nsIFrame::Sides Sides;
|
2013-07-10 02:58:13 -07:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2013-05-02 07:58:00 -07:00
|
|
|
typedef mozilla::layout::ScrollbarActivity ScrollbarActivity;
|
2014-08-30 20:29:24 -07:00
|
|
|
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
|
|
|
typedef mozilla::layers::Layer Layer;
|
2012-11-22 17:25:23 -08:00
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
class AsyncScroll;
|
2014-07-09 10:02:31 -07:00
|
|
|
class AsyncSmoothMSDScroll;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-10-28 19:27:50 -07:00
|
|
|
ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot);
|
|
|
|
~ScrollFrameHelper();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-23 13:20:07 -07:00
|
|
|
mozilla::ScrollbarStyles GetScrollbarStylesFromFrame() const;
|
2007-03-22 10:30:00 -07: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-06 13:04:44 -07:00
|
|
|
nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aElements);
|
2014-07-16 11:41:57 -07:00
|
|
|
void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements, uint32_t aFilter);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult FireScrollPortEvent();
|
|
|
|
void PostOverflowEvent();
|
|
|
|
void Destroy();
|
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-12-20 04:30:14 -08:00
|
|
|
void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
2014-10-09 13:10:01 -07:00
|
|
|
bool aUsingDisplayPort,
|
2014-05-28 02:46:10 -07:00
|
|
|
bool aCreateLayer,
|
2011-12-20 04:30:14 -08:00
|
|
|
bool aPositioned);
|
2010-10-21 05:07:55 -07:00
|
|
|
|
2014-05-05 10:55:54 -07:00
|
|
|
bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
|
2014-06-28 03:13:13 -07:00
|
|
|
Sides aSkipSides, nscoord aRadii[8]) const;
|
2010-09-07 15:20:35 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIReflowCallback
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool ReflowFinished() override;
|
|
|
|
virtual void ReflowCallbackCanceled() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
* Called when the 'curpos' attribute on one of the scrollbars changes.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
void CurPosAttributeChanged(nsIContent* aChild);
|
2013-08-08 15:04:59 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void PostScrollEvent();
|
|
|
|
void FireScrollEvent();
|
2010-01-11 13:45:19 -08:00
|
|
|
void PostScrolledAreaEvent();
|
|
|
|
void FireScrolledAreaEvent();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-09-15 12:30:03 -07:00
|
|
|
bool IsSmoothScrollingEnabled();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class ScrollEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit ScrollEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
2013-10-28 19:27:50 -07:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2013-10-28 19:27:50 -07:00
|
|
|
ScrollFrameHelper *mHelper;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class AsyncScrollPortEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit AsyncScrollPortEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
2013-10-28 19:27:50 -07:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2013-10-28 19:27:50 -07:00
|
|
|
ScrollFrameHelper *mHelper;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2010-01-11 13:45:19 -08:00
|
|
|
class ScrolledAreaEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit ScrolledAreaEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
2013-10-28 19:27:50 -07:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
2010-01-11 13:45:19 -08:00
|
|
|
private:
|
2013-10-28 19:27:50 -07:00
|
|
|
ScrollFrameHelper *mHelper;
|
2010-01-11 13:45:19 -08:00
|
|
|
};
|
|
|
|
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-08-03 03:35:14 -07:00
|
|
|
void FinishReflowForScrollbar(nsIContent* aContent, nscoord aMinXY,
|
|
|
|
nscoord aMaxXY, nscoord aCurPosXY,
|
|
|
|
nscoord aPageIncrement,
|
|
|
|
nscoord aIncrement);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-08-08 15:04:59 -07:00
|
|
|
void SetScrollbarEnabled(nsIContent* aContent, nscoord aMaxPos);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-08-03 03:35:14 -07:00
|
|
|
void SetCoordAttribute(nsIContent* aContent, nsIAtom* aAtom, nscoord aSize);
|
2013-08-08 15:04:59 -07:00
|
|
|
|
2012-08-05 20:00:57 -07:00
|
|
|
nscoord GetCoordAttribute(nsIFrame* aFrame, nsIAtom* aAtom, nscoord aDefaultValue,
|
2012-05-09 22:24:19 -07:00
|
|
|
nscoord* aRangeStart, nscoord* aRangeLength);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
* Update scrollbar curpos attributes to reflect current scroll position
|
|
|
|
*/
|
2009-10-07 20:01:15 -07:00
|
|
|
void UpdateScrollbarPosition();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
nsRect GetScrollPortRect() const { return mScrollPort; }
|
2009-08-31 21:11:11 -07:00
|
|
|
nsPoint GetScrollPosition() const {
|
2009-10-07 20:01:15 -07:00
|
|
|
return mScrollPort.TopLeft() - mScrolledFrame->GetPosition();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2011-02-06 23:59:20 -08: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;
|
|
|
|
pt.x = IsLTR() ?
|
|
|
|
mScrollPort.x - mScrolledFrame->GetPosition().x :
|
|
|
|
mScrollPort.XMost() - mScrolledFrame->GetRect().XMost();
|
|
|
|
pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
|
|
|
|
return pt;
|
|
|
|
}
|
2009-08-31 21:11:11 -07:00
|
|
|
nsRect GetScrollRange() const;
|
2012-04-24 11:52:35 -07:00
|
|
|
// Get the scroll range assuming the scrollport has size (aWidth, aHeight).
|
|
|
|
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
|
2012-06-10 16:44:50 -07:00
|
|
|
nsSize GetScrollPositionClampingScrollPortSize() const;
|
2015-03-06 15:07:59 -08:00
|
|
|
float GetResolution() const;
|
|
|
|
void SetResolution(float aResolution);
|
|
|
|
void SetResolutionAndScaleTo(float aResolution);
|
2015-02-19 15:53:30 -08:00
|
|
|
void FlingSnap(const mozilla::CSSPoint& aDestination);
|
2015-03-25 11:40:31 -07:00
|
|
|
void ScrollSnap(nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
|
|
|
void ScrollSnap(const nsPoint &aDestination,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
2014-04-07 04:43:58 -07:00
|
|
|
|
2012-04-24 11:52:35 -07:00
|
|
|
protected:
|
|
|
|
nsRect GetScrollRangeForClamping() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-04-24 11:52:35 -07:00
|
|
|
public:
|
2014-07-09 10:02:31 -07:00
|
|
|
static void AsyncScrollCallback(ScrollFrameHelper* aInstance,
|
|
|
|
mozilla::TimeStamp aTime);
|
|
|
|
static void AsyncSmoothMSDScrollCallback(ScrollFrameHelper* aInstance,
|
|
|
|
mozilla::TimeDuration aDeltaTime);
|
2012-02-07 16:53:18 -08:00
|
|
|
/**
|
2013-08-08 15:04:59 -07:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2012-02-07 16:53:18 -08: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-19 15:53:30 -08:00
|
|
|
const nsRect* aRange = nullptr,
|
2015-03-25 11:40:31 -07:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) {
|
2015-02-19 15:53:30 -08:00
|
|
|
ScrollToWithOrigin(aScrollPosition, aMode, nsGkAtoms::other, aRange,
|
|
|
|
aSnap);
|
2012-02-07 16:53:18 -08:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2014-07-09 10:02:31 -07:00
|
|
|
void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode
|
|
|
|
= nsIScrollableFrame::INSTANT);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-12-16 09:04:45 -08:00
|
|
|
void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition,
|
|
|
|
nsIAtom* aOrigin = nullptr);
|
2013-08-08 15:04:59 -07:00
|
|
|
|
2013-07-10 02:58:13 -07:00
|
|
|
CSSIntPoint GetScrollPositionCSSPixels();
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-12-16 09:04:45 -08:00
|
|
|
void ScrollToImpl(nsPoint aScrollPosition, const nsRect& aRange, nsIAtom* aOrigin = nullptr);
|
2011-12-05 04:38:46 -08:00
|
|
|
void ScrollVisual(nsPoint aOldScrolledFramePosition);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2009-08-31 21:11:11 -07:00
|
|
|
void ScrollBy(nsIntPoint aDelta, nsIScrollableFrame::ScrollUnit aUnit,
|
2014-07-15 07:13:00 -07:00
|
|
|
nsIScrollableFrame::ScrollMode aMode, nsIntPoint* aOverflow,
|
2014-02-03 17:54:22 -08:00
|
|
|
nsIAtom* aOrigin = nullptr,
|
2015-02-19 15:53:30 -08:00
|
|
|
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
|
2015-03-25 11:40:31 -07:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
void ScrollToRestoredPosition();
|
2015-02-19 15:53:30 -08: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-08 15:04:59 -07:00
|
|
|
|
2009-08-31 21:11:11 -07:00
|
|
|
nsSize GetLineScrollAmount() const;
|
|
|
|
nsSize GetPageScrollAmount() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-04-07 04:43:58 -07:00
|
|
|
nsPresState* SaveState() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
void RestoreState(nsPresState* aState);
|
|
|
|
|
|
|
|
nsIFrame* GetScrolledFrame() const { return mScrolledFrame; }
|
2012-08-05 20:00:57 -07:00
|
|
|
nsIFrame* GetScrollbarBox(bool aVertical) const {
|
2009-08-31 21:11:11 -07:00
|
|
|
return aVertical ? mVScrollbarBox : mHScrollbarBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-28 16:03:42 -08:00
|
|
|
mListeners.AppendElement(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
|
|
|
void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-28 16:03:42 -08:00
|
|
|
mListeners.RemoveElement(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-05 20:00:57 -07:00
|
|
|
static void SetScrollbarVisibility(nsIFrame* aScrollbar, bool aVisible);
|
2007-03-22 10:30:00 -07: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).
|
2009-10-07 20:01:15 -07:00
|
|
|
*
|
|
|
|
* This should only be called when the scrolled frame has been
|
|
|
|
* reflowed with the scroll port size given in mScrollPort.
|
2007-03-22 10:30:00 -07: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-07 20:01:15 -07:00
|
|
|
nsRect GetScrolledRect() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GetScrolledRectInternal 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).
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
nsRect GetScrolledRectInternal(const nsRect& aScrolledOverflowArea,
|
|
|
|
const nsSize& aScrollPortSize) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t GetScrollbarVisibility() const {
|
2010-01-14 05:00:00 -08:00
|
|
|
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
|
|
|
|
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMargin GetActualScrollbarSizes() const;
|
|
|
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
2013-05-26 15:05:10 -07:00
|
|
|
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsLTR() const;
|
2015-04-21 13:09:48 -07:00
|
|
|
bool IsScrollbarOnRight() const;
|
2014-10-21 18:54:32 -07:00
|
|
|
bool IsScrollingActive(nsDisplayListBuilder* aBuilder) const;
|
2014-10-21 18:55:55 -07:00
|
|
|
bool IsMaybeScrollingActive() const;
|
2014-07-09 10:02:31 -07:00
|
|
|
bool IsProcessingAsyncScroll() const {
|
|
|
|
return mAsyncScroll != nullptr || mAsyncSmoothMSDScroll != nullptr;
|
|
|
|
}
|
2012-08-16 16:40:10 -07:00
|
|
|
void ResetScrollPositionForLayerPixelAlignment()
|
|
|
|
{
|
|
|
|
mScrollPosForLayerPixelAlignment = GetScrollPosition();
|
|
|
|
}
|
2011-06-15 14:03:49 -07:00
|
|
|
|
|
|
|
bool UpdateOverflow();
|
|
|
|
|
2013-09-06 06:35:16 -07:00
|
|
|
void UpdateSticky();
|
|
|
|
|
2015-02-08 09:57:00 -08:00
|
|
|
void UpdatePrevScrolledRect();
|
|
|
|
|
2013-09-14 17:05:04 -07:00
|
|
|
bool IsRectNearlyVisible(const nsRect& aRect) const;
|
2014-06-06 19:23:22 -07:00
|
|
|
nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const;
|
2013-09-14 17:05:04 -07:00
|
|
|
|
2010-03-19 04:49:34 -07: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.
|
|
|
|
void AdjustScrollbarRectForResizer(nsIFrame* aFrame, nsPresContext* aPresContext,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsRect& aRect, bool aHasResizer, bool aVertical);
|
2010-03-19 04:49:34 -07:00
|
|
|
// returns true if a resizer should be visible
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasResizer() { return mResizerBox && !mCollapsedResizer; }
|
2007-03-22 10:30:00 -07:00
|
|
|
void LayoutScrollbars(nsBoxLayoutState& aState,
|
|
|
|
const nsRect& aContentArea,
|
2009-10-07 20:01:15 -07:00
|
|
|
const nsRect& aOldScrollArea);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-12-05 04:38:46 -08:00
|
|
|
bool IsIgnoringViewportClipping() const;
|
|
|
|
|
2014-10-08 19:56:38 -07:00
|
|
|
void MarkScrollbarsDirtyForReflow() const;
|
|
|
|
|
2012-02-17 15:41:13 -08:00
|
|
|
bool ShouldClampScrollPosition() const;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsAlwaysActive() const;
|
2014-10-21 18:53:38 -07:00
|
|
|
void MarkRecentlyScrolled();
|
|
|
|
void MarkNotRecentlyScrolled();
|
2010-07-15 14:08:05 -07:00
|
|
|
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
|
|
|
|
|
2015-02-25 06:32:09 -08:00
|
|
|
void SetTransformingByAPZ(bool aTransforming) {
|
|
|
|
mTransformingByAPZ = aTransforming;
|
2015-02-25 06:33:00 -08: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 06:32:09 -08:00
|
|
|
}
|
|
|
|
bool IsTransformingByAPZ() const {
|
|
|
|
return mTransformingByAPZ;
|
|
|
|
}
|
|
|
|
|
2012-01-18 20:13:02 -08:00
|
|
|
void ScheduleSyntheticMouseMove();
|
|
|
|
static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance);
|
|
|
|
|
2013-07-16 05:58:44 -07:00
|
|
|
void HandleScrollbarStyleSwitching();
|
|
|
|
|
2014-07-10 11:52:40 -07:00
|
|
|
nsIAtom* LastScrollOrigin() const { return mLastScrollOrigin; }
|
|
|
|
nsIAtom* LastSmoothScrollOrigin() const { return mLastSmoothScrollOrigin; }
|
2014-02-05 14:43:20 -08:00
|
|
|
uint32_t CurrentScrollGeneration() const { return mScrollGeneration; }
|
2014-07-10 11:52:40 -07:00
|
|
|
nsPoint LastScrollDestination() const { return mDestination; }
|
|
|
|
void ResetScrollInfoIfGeneration(uint32_t aGeneration) {
|
2014-02-05 14:43:20 -08:00
|
|
|
if (aGeneration == mScrollGeneration) {
|
2014-07-10 11:52:40 -07:00
|
|
|
mLastScrollOrigin = nullptr;
|
|
|
|
mLastSmoothScrollOrigin = nullptr;
|
2014-02-05 14:43:20 -08:00
|
|
|
}
|
|
|
|
}
|
2014-03-12 13:20:26 -07:00
|
|
|
bool WantAsyncScroll() const;
|
2014-08-30 20:29:24 -07:00
|
|
|
void ComputeFrameMetrics(Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
|
|
|
const ContainerLayerParameters& aParameters,
|
|
|
|
nsRect* aClipRect,
|
|
|
|
nsTArray<FrameMetrics>* aOutput) const;
|
2013-12-16 09:04:45 -08:00
|
|
|
|
2014-02-04 17:33:18 -08:00
|
|
|
// nsIScrollbarMediator
|
2015-03-25 11:40:31 -07: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-04 17:33:18 -08:00
|
|
|
void RepeatButtonScroll(nsScrollbarFrame* aScrollbar);
|
|
|
|
void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
|
|
|
nscoord aOldPos,
|
|
|
|
nscoord aNewPos);
|
2015-03-25 11:40:31 -07:00
|
|
|
void ScrollbarReleased(nsScrollbarFrame* aScrollbar);
|
2014-02-04 17:33:18 -08:00
|
|
|
void ScrollByUnit(nsScrollbarFrame* aScrollbar,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode,
|
|
|
|
int32_t aDirection,
|
2015-03-25 11:40:31 -07:00
|
|
|
nsIScrollableFrame::ScrollUnit aUnit,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP);
|
2014-02-04 17:33:18 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// owning references to the nsIAnonymousContentCreator-built content
|
|
|
|
nsCOMPtr<nsIContent> mHScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mVScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mScrollCornerContent;
|
2011-01-17 06:35:32 -08:00
|
|
|
nsCOMPtr<nsIContent> mResizerContent;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsRevocableEventPtr<ScrollEvent> mScrollEvent;
|
|
|
|
nsRevocableEventPtr<AsyncScrollPortEvent> mAsyncScrollPortEvent;
|
2010-01-11 13:45:19 -08:00
|
|
|
nsRevocableEventPtr<ScrolledAreaEvent> mScrolledAreaEvent;
|
2012-08-05 20:00:57 -07:00
|
|
|
nsIFrame* mHScrollbarBox;
|
|
|
|
nsIFrame* mVScrollbarBox;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* mScrolledFrame;
|
2012-08-05 20:00:57 -07:00
|
|
|
nsIFrame* mScrollCornerBox;
|
|
|
|
nsIFrame* mResizerBox;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsContainerFrame* mOuter;
|
2012-03-31 06:08:00 -07:00
|
|
|
nsRefPtr<AsyncScroll> mAsyncScroll;
|
2014-07-09 10:02:31 -07:00
|
|
|
nsRefPtr<AsyncSmoothMSDScroll> mAsyncSmoothMSDScroll;
|
2013-07-31 18:43:56 -07:00
|
|
|
nsRefPtr<ScrollbarActivity> mScrollbarActivity;
|
2010-01-28 16:03:42 -08:00
|
|
|
nsTArray<nsIScrollPositionListener*> mListeners;
|
2014-07-10 11:52:40 -07:00
|
|
|
nsIAtom* mLastScrollOrigin;
|
|
|
|
nsIAtom* mLastSmoothScrollOrigin;
|
2014-02-05 14:43:20 -08:00
|
|
|
uint32_t mScrollGeneration;
|
2009-10-07 20:01:15 -07: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;
|
2010-07-15 14:08:02 -07:00
|
|
|
nsPoint mScrollPosAtLastPaint;
|
2009-10-07 20:01:15 -07:00
|
|
|
|
2013-03-20 19:44:37 -07: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-07 20:01:15 -07:00
|
|
|
nsPoint mRestorePos;
|
2013-03-20 19:44:37 -07: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.
|
2007-03-22 10:30:00 -07:00
|
|
|
nsPoint mLastPos;
|
|
|
|
|
2014-04-07 04:43:58 -07:00
|
|
|
// The current resolution derived from the zoom level and device pixel ratio.
|
2015-03-06 15:07:59 -08:00
|
|
|
float mResolution;
|
2014-04-07 04:43:58 -07:00
|
|
|
|
2010-07-15 14:08:05 -07:00
|
|
|
nsExpirationState mActivityExpirationState;
|
|
|
|
|
2012-01-18 20:13:02 -08:00
|
|
|
nsCOMPtr<nsITimer> mScrollActivityTimer;
|
2012-08-16 16:40:10 -07:00
|
|
|
nsPoint mScrollPosForLayerPixelAlignment;
|
2012-01-18 20:13:02 -08:00
|
|
|
|
2013-02-24 16:59:21 -08:00
|
|
|
// The scroll position where we last updated image visibility.
|
|
|
|
nsPoint mLastUpdateImagesPos;
|
|
|
|
|
2015-02-08 09:57:00 -08:00
|
|
|
nsRect mPrevScrolledRect;
|
|
|
|
|
2014-08-30 20:29:24 -07:00
|
|
|
FrameMetrics::ViewID mScrollParentID;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mNeverHasVerticalScrollbar:1;
|
|
|
|
bool mNeverHasHorizontalScrollbar:1;
|
|
|
|
bool mHasVerticalScrollbar:1;
|
|
|
|
bool mHasHorizontalScrollbar:1;
|
|
|
|
bool mFrameIsUpdatingScrollbar:1;
|
|
|
|
bool mDidHistoryRestore:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// Is this the scrollframe for the document's viewport?
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsRoot:1;
|
2013-06-16 22:16:27 -07: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-03-22 10:30:00 -07: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.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mSupppressScrollbarUpdate:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// If true, we skipped a scrollbar layout due to mSupppressScrollbarUpdate
|
|
|
|
// being set at some point. That means we should lay out scrollbars even if
|
|
|
|
// it might not strictly be needed next time mSupppressScrollbarUpdate is
|
|
|
|
// false.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mSkippedScrollbarLayout:1;
|
2010-05-30 09:38:42 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHadNonInitialReflow:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// State used only by PostScrollEvents so we know
|
|
|
|
// which overflow states have changed.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHorizontalOverflow:1;
|
|
|
|
bool mVerticalOverflow:1;
|
|
|
|
bool mPostedReflowCallback:1;
|
|
|
|
bool mMayHaveDirtyFixedChildren:1;
|
2009-06-23 18:35:00 -07:00
|
|
|
// If true, need to actually update our scrollbar attributes in the
|
|
|
|
// reflow callback.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mUpdateScrollbarAttributes:1;
|
2010-07-15 14:08:02 -07:00
|
|
|
// If true, we should be prepared to scroll using this scrollframe
|
|
|
|
// by placing descendant content into its own layer(s)
|
2014-10-21 18:53:38 -07:00
|
|
|
bool mHasBeenScrolledRecently:1;
|
2011-01-17 06:35:32 -08:00
|
|
|
// If true, the resizer is collapsed and not displayed
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCollapsedResizer:1;
|
2011-03-09 13:35:27 -08:00
|
|
|
|
2013-11-01 20:47:21 -07:00
|
|
|
// If true, the layer should always be active because we always build a
|
|
|
|
// scrollable layer. Used for asynchronous scrolling.
|
|
|
|
bool mShouldBuildScrollableLayer:1;
|
2014-12-17 15:37:28 -08:00
|
|
|
|
2015-04-02 11:28:42 -07: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;
|
|
|
|
|
2014-10-27 21:34:58 -07:00
|
|
|
// If true, add clipping in ScrollFrameHelper::ComputeFrameMetrics.
|
|
|
|
bool mAddClipRectToLayer:1;
|
2012-03-11 13:55:00 -07:00
|
|
|
|
2012-11-13 22:26:33 -08:00
|
|
|
// True if this frame has been scrolled at least once
|
|
|
|
bool mHasBeenScrolled:1;
|
|
|
|
|
2015-01-02 17:06:14 -08:00
|
|
|
// True if the frame's resolution has been set via SetResolution or
|
|
|
|
// SetResolutionAndScaleTo or restored via RestoreState.
|
2014-05-12 10:26:53 -07:00
|
|
|
bool mIsResolutionSet:1;
|
|
|
|
|
2014-02-03 17:54:22 -08: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-01-02 17:06:14 -08:00
|
|
|
// True if the frame's resolution has been set via SetResolutionAndScaleTo.
|
|
|
|
// Only meaningful for root scroll frames.
|
|
|
|
bool mScaleToResolution:1;
|
|
|
|
|
2015-02-25 06:32:09 -08: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;
|
|
|
|
|
2015-02-19 15:53:30 -08:00
|
|
|
mozilla::layout::ScrollVelocityQueue mVelocityQueue;
|
|
|
|
|
2012-03-11 13:55:00 -07:00
|
|
|
protected:
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-03-26 02:53:45 -07:00
|
|
|
void ScrollToWithOrigin(nsPoint aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsIAtom *aOrigin, // nullptr indicates "other" origin
|
2015-02-19 15:53:30 -08:00
|
|
|
const nsRect* aRange,
|
2015-03-25 11:40:31 -07:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP);
|
2013-09-14 17:05:04 -07:00
|
|
|
|
2014-07-09 10:02:31 -07:00
|
|
|
void CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin = nullptr);
|
|
|
|
|
2013-09-14 17:05:04 -07:00
|
|
|
static void EnsureImageVisPrefsCached();
|
|
|
|
static bool sImageVisPrefsCached;
|
|
|
|
// The number of scrollports wide/high to expand when looking for images.
|
|
|
|
static uint32_t sHorzExpandScrollPort;
|
|
|
|
static uint32_t sVertExpandScrollPort;
|
|
|
|
// The fraction of the scrollport we allow to scroll by before we schedule
|
|
|
|
// an update of image visibility.
|
|
|
|
static int32_t sHorzScrollFraction;
|
|
|
|
static int32_t sVertScrollFraction;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2013-10-28 19:27:50 -07:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07: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-27 12:18:48 -08:00
|
|
|
class nsHTMLScrollFrame : public nsContainerFrame,
|
2007-03-22 10:30:00 -07:00
|
|
|
public nsIScrollableFrame,
|
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
|
|
|
public:
|
2013-10-28 19:27:50 -07:00
|
|
|
typedef mozilla::ScrollFrameHelper ScrollFrameHelper;
|
2013-07-10 02:58:13 -07:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2014-05-24 15:20:40 -07:00
|
|
|
friend nsHTMLScrollFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
bool aIsRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::WritingMode GetWritingMode() const override
|
2014-12-16 01:45:11 -08:00
|
|
|
{
|
|
|
|
if (mHelper.mScrolledFrame) {
|
|
|
|
return mHelper.mScrolledFrame->GetWritingMode();
|
|
|
|
}
|
|
|
|
return nsIFrame::GetWritingMode();
|
|
|
|
}
|
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsDisplayListSet& aLists) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool TryLayout(ScrollReflowState* aState,
|
2007-12-04 19:05:57 -08:00
|
|
|
nsHTMLReflowMetrics* aKidMetrics,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aAssumeVScroll, bool aAssumeHScroll,
|
2014-05-12 17:47:52 -07:00
|
|
|
bool aForce);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ScrolledContentDependsOnHeight(ScrollReflowState* aState);
|
2014-05-12 17:47:52 -07:00
|
|
|
void ReflowScrolledFrame(ScrollReflowState* aState,
|
|
|
|
bool aAssumeHScroll,
|
|
|
|
bool aAssumeVScroll,
|
|
|
|
nsHTMLReflowMetrics* aMetrics,
|
|
|
|
bool aFirstPass);
|
|
|
|
void ReflowContents(ScrollReflowState* aState,
|
|
|
|
const nsHTMLReflowMetrics& aDesiredSize);
|
2009-10-07 20:01:15 -07:00
|
|
|
void PlaceScrollArea(const ScrollReflowState& aState,
|
|
|
|
const nsPoint& aScrollPosition);
|
2011-04-07 18:04:40 -07:00
|
|
|
nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-05 10:55:54 -07:00
|
|
|
virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
|
2015-03-21 09:28:04 -07:00
|
|
|
Sides aSkipSides, nscoord aRadii[8]) const override {
|
2014-05-05 10:55:54 -07:00
|
|
|
return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii);
|
2010-09-07 15:20:35 -07:00
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nsresult GetPadding(nsMargin& aPadding) override;
|
|
|
|
virtual bool IsCollapsed() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-12 17:47:52 -07:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsReflowStatus& aStatus) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool UpdateOverflow() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.UpdateOverflow();
|
2013-03-05 04:26:41 -08:00
|
|
|
}
|
|
|
|
|
2014-05-28 12:36:58 -07: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 09:28:04 -07:00
|
|
|
nsFrameList& aChildList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 12:36:58 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIFrame* aOldFrame) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() override {
|
2009-09-01 04:22:31 -07:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool DoesClipChildren() override { return true; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild) override
|
2007-03-22 10:30:00 -07:00
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
2013-10-28 19:27:50 -07:00
|
|
|
if (aChild == mHelper.GetScrolledFrame()) pt += GetScrollPosition();
|
2007-03-22 10:30:00 -07:00
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 11:41:57 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 09:28:04 -07:00
|
|
|
uint32_t aFilter) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrolledFrame();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollbarStylesFromFrame();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollbarVisibility();
|
2010-01-14 05:00:00 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetActualScrollbarSizes();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetDesiredScrollbarSizes(aState);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsRenderingContext* aRC) override {
|
2009-08-31 21:11:11 -07:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
2013-05-26 15:05:10 -07:00
|
|
|
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsRenderingContext* aRC) override {
|
2013-05-26 15:05:10 -07:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetNondisappearingScrollbarWidth(&bls);
|
2013-05-26 15:05:10 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect GetScrolledRect() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrolledRect();
|
2013-07-23 06:22:58 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect GetScrollPortRect() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPortRect();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint GetScrollPosition() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPosition();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetLogicalScrollPosition();
|
2012-12-11 13:12:43 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect GetScrollRange() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollRange();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPositionClampingScrollPortSize();
|
2012-06-10 16:44:50 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual float GetResolution() const override {
|
2014-04-07 04:43:58 -07:00
|
|
|
return mHelper.GetResolution();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void SetResolution(float aResolution) override {
|
2014-04-07 04:43:58 -07:00
|
|
|
return mHelper.SetResolution(aResolution);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void SetResolutionAndScaleTo(float aResolution) override {
|
2015-01-02 17:06:14 -08:00
|
|
|
return mHelper.SetResolutionAndScaleTo(aResolution);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetLineScrollAmount() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetLineScrollAmount();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetPageScrollAmount() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetPageScrollAmount();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-02-07 16:53:18 -08:00
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
2015-02-19 15:53:30 -08:00
|
|
|
const nsRect* aRange = nullptr,
|
2015-03-25 11:40:31 -07:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP)
|
2015-03-21 09:28:04 -07:00
|
|
|
override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, aRange, aSnap);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2014-07-09 10:02:31 -07:00
|
|
|
virtual void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode
|
2015-03-21 09:28:04 -07:00
|
|
|
= nsIScrollableFrame::INSTANT) override {
|
2014-07-09 10:02:31 -07:00
|
|
|
mHelper.ScrollToCSSPixels(aScrollPosition, aMode);
|
2012-05-14 22:58:09 -07:00
|
|
|
}
|
2013-12-16 09:04:45 -08:00
|
|
|
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIAtom* aOrigin = nullptr) override {
|
2013-12-16 09:04:45 -08:00
|
|
|
mHelper.ScrollToCSSPixelsApproximate(aScrollPosition, aOrigin);
|
2012-11-22 17:25:23 -08:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPositionCSSPixels();
|
2012-08-10 04:17:06 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2014-07-15 07:13:00 -07:00
|
|
|
nsIntPoint* aOverflow, nsIAtom* aOrigin = nullptr,
|
2015-02-19 15:53:30 -08:00
|
|
|
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
|
2015-03-25 11:40:31 -07:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP)
|
2015-03-21 09:28:04 -07:00
|
|
|
override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void FlingSnap(const mozilla::CSSPoint& aDestination) override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.FlingSnap(aDestination);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ScrollSnap() override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.ScrollSnap();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ScrollToRestoredPosition() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.ScrollToRestoredPosition();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.AddScrollPositionListener(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.RemoveScrollPositionListener(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.CurPosAttributeChanged(aChild);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.PostScrolledAreaEvent();
|
2010-01-11 13:45:19 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsScrollingActive(nsDisplayListBuilder* aBuilder) override {
|
2014-10-21 18:54:06 -07:00
|
|
|
return mHelper.IsScrollingActive(aBuilder);
|
2010-07-15 14:08:02 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsProcessingAsyncScroll() override {
|
2014-01-28 14:54:59 -08:00
|
|
|
return mHelper.IsProcessingAsyncScroll();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.ResetScrollPositionForLayerPixelAlignment();
|
2012-08-16 16:40:10 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsResolutionSet() const override {
|
2014-05-12 10:26:53 -07:00
|
|
|
return mHelper.mIsResolutionSet;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool DidHistoryRestore() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.mDidHistoryRestore;
|
2011-06-15 14:03:49 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ClearDidHistoryRestore() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.mDidHistoryRestore = false;
|
2013-03-15 15:32:35 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsRectNearlyVisible(const nsRect& aRect) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.IsRectNearlyVisible(aRect);
|
2013-09-14 17:05:04 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const override {
|
2014-06-06 19:23:22 -07:00
|
|
|
return mHelper.ExpandRectToNearlyVisible(aRect);
|
2014-06-06 19:23:20 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* LastScrollOrigin() override {
|
2014-07-10 11:52:40 -07:00
|
|
|
return mHelper.LastScrollOrigin();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* LastSmoothScrollOrigin() override {
|
2014-07-10 11:52:40 -07:00
|
|
|
return mHelper.LastSmoothScrollOrigin();
|
2013-12-16 09:04:45 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint32_t CurrentScrollGeneration() override {
|
2014-02-05 14:43:20 -08:00
|
|
|
return mHelper.CurrentScrollGeneration();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint LastScrollDestination() override {
|
2014-07-10 11:52:40 -07:00
|
|
|
return mHelper.LastScrollDestination();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ResetScrollInfoIfGeneration(uint32_t aGeneration) override {
|
2014-07-10 11:52:40 -07:00
|
|
|
mHelper.ResetScrollInfoIfGeneration(aGeneration);
|
2013-12-16 09:04:45 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool WantAsyncScroll() const override {
|
2014-03-12 13:20:26 -07:00
|
|
|
return mHelper.WantAsyncScroll();
|
|
|
|
}
|
2014-08-30 20:29:24 -07:00
|
|
|
virtual void ComputeFrameMetrics(Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
|
|
|
const ContainerLayerParameters& aParameters,
|
|
|
|
nsRect* aClipRect,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsTArray<FrameMetrics>* aOutput) const override {
|
2014-08-30 20:29:24 -07:00
|
|
|
mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame,
|
|
|
|
aParameters, aClipRect, aOutput);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsIgnoringViewportClipping() const override {
|
2014-09-23 06:44:00 -07:00
|
|
|
return mHelper.IsIgnoringViewportClipping();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void MarkScrollbarsDirtyForReflow() const override {
|
2014-10-08 19:56:38 -07:00
|
|
|
mHelper.MarkScrollbarsDirtyForReflow();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIStatefulFrame
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) override {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-28 19:27:50 -07:00
|
|
|
*aState = mHelper.SaveState();
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) override {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.RestoreState(aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::scrollFrame
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2014-02-04 17:33:18 -08:00
|
|
|
|
|
|
|
// nsIScrollbarMediator
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByPage(aScrollbar, aDirection, aSnap);
|
2014-02-04 17:33:18 -08:00
|
|
|
}
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByWhole(aScrollbar, aDirection, aSnap);
|
2014-02-04 17:33:18 -08:00
|
|
|
}
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByLine(aScrollbar, aDirection, aSnap);
|
2014-02-04 17:33:18 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) override {
|
2014-02-04 17:33:18 -08:00
|
|
|
mHelper.RepeatButtonScroll(aScrollbar);
|
|
|
|
}
|
|
|
|
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
|
|
|
nscoord aOldPos,
|
2015-03-21 09:28:04 -07:00
|
|
|
nscoord aNewPos) override {
|
2014-02-04 17:33:18 -08:00
|
|
|
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
|
|
|
}
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) override {
|
|
|
|
mHelper.ScrollbarReleased(aScrollbar);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void VisibilityChanged(bool aVisible) override {}
|
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) override {
|
2014-02-13 22:40:53 -08:00
|
|
|
return mHelper.GetScrollbarBox(aVertical);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ScrollbarActivityStarted() const override;
|
|
|
|
virtual void ScrollbarActivityStopped() const override;
|
2015-02-25 06:32:09 -08:00
|
|
|
|
2015-05-12 01:49:25 -07:00
|
|
|
virtual bool IsScrollbarOnRight() const override {
|
|
|
|
return mHelper.IsScrollbarOnRight();
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void SetTransformingByAPZ(bool aTransforming) override {
|
2015-02-25 06:32:09 -08:00
|
|
|
mHelper.SetTransformingByAPZ(aTransforming);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
bool IsTransformingByAPZ() const override {
|
2015-02-25 06:32:09 -08:00
|
|
|
return mHelper.IsTransformingByAPZ();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2015-01-06 01:27:56 -08:00
|
|
|
nsHTMLScrollFrame(nsStyleContext* aContext, bool aIsRoot);
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetSuppressScrollbarUpdate(bool aSuppress) {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.mSupppressScrollbarUpdate = aSuppress;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GuessHScrollbarNeeded(const ScrollReflowState& aState);
|
|
|
|
bool GuessVScrollbarNeeded(const ScrollReflowState& aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsScrollbarUpdateSuppressed() const {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.mSupppressScrollbarUpdate;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2007-04-25 19:29:21 -07: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-28 23:19:26 -07:00
|
|
|
bool InInitialReflow() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-12-06 16:10:31 -08:00
|
|
|
/**
|
|
|
|
* Override this to return false if computed height/min-height/max-height
|
|
|
|
* should NOT be propagated to child content.
|
|
|
|
* nsListControlFrame uses this.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool ShouldPropagateComputedHeightToScrolledContent() const { return true; }
|
2007-12-06 16:10:31 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2013-10-28 19:27:50 -07:00
|
|
|
friend class mozilla::ScrollFrameHelper;
|
|
|
|
ScrollFrameHelper mHelper;
|
2007-03-22 10:30:00 -07: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 09:28:04 -07:00
|
|
|
class nsXULScrollFrame final : public nsBoxFrame,
|
2015-03-27 11:52:19 -07:00
|
|
|
public nsIScrollableFrame,
|
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame
|
|
|
|
{
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2013-10-28 19:27:50 -07:00
|
|
|
typedef mozilla::ScrollFrameHelper ScrollFrameHelper;
|
2013-07-10 02:58:13 -07:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 11:20:59 -08:00
|
|
|
|
2014-05-24 15:20:40 -07:00
|
|
|
friend nsXULScrollFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
bool aIsRoot,
|
|
|
|
bool aClipAllDescendants);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsDisplayListSet& aLists) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// XXXldb Is this actually used?
|
|
|
|
#if 0
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool UpdateOverflow() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.UpdateOverflow();
|
2013-03-05 04:26:41 -08:00
|
|
|
}
|
|
|
|
|
2014-05-28 12:36:58 -07: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 09:28:04 -07:00
|
|
|
nsFrameList& aChildList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 12:36:58 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIFrame* aOldFrame) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() override {
|
2009-09-01 04:22:31 -07:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool DoesClipChildren() override { return true; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild) override
|
2007-03-22 10:30:00 -07:00
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
2013-10-28 19:27:50 -07:00
|
|
|
if (aChild == mHelper.GetScrolledFrame())
|
|
|
|
pt += mHelper.GetLogicalScrollPosition();
|
2007-03-22 10:30:00 -07:00
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 11:41:57 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 09:28:04 -07:00
|
|
|
uint32_t aFilter) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
virtual nsresult GetPadding(nsMargin& aPadding) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-05 10:55:54 -07:00
|
|
|
virtual bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
|
2015-03-21 09:28:04 -07:00
|
|
|
Sides aSkipSides, nscoord aRadii[8]) const override {
|
2014-05-05 10:55:54 -07:00
|
|
|
return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii);
|
2010-09-07 15:20:35 -07:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult Layout(nsBoxLayoutState& aState);
|
2009-10-07 20:01:15 -07:00
|
|
|
void LayoutScrollArea(nsBoxLayoutState& aState, const nsPoint& aScrollPosition);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool AddRemoveScrollbar(bool& aHasScrollbar,
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord& aXY,
|
|
|
|
nscoord& aSize,
|
|
|
|
nscoord aSbSize,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aAdd);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aHorizontal,
|
|
|
|
bool aAdd);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07: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);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
|
|
|
|
static void AdjustReflowStateBack(nsBoxLayoutState& aState, bool aSetBack);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrolledFrame();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollbarStylesFromFrame();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollbarVisibility();
|
2010-01-14 05:00:00 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetActualScrollbarSizes();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetDesiredScrollbarSizes(aState);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsRenderingContext* aRC) override {
|
2009-08-31 21:11:11 -07:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
2013-05-26 15:05:10 -07:00
|
|
|
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsRenderingContext* aRC) override {
|
2013-05-26 15:05:10 -07:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetNondisappearingScrollbarWidth(&bls);
|
2013-05-26 15:05:10 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect GetScrolledRect() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrolledRect();
|
2013-07-23 06:22:58 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect GetScrollPortRect() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPortRect();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint GetScrollPosition() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPosition();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetLogicalScrollPosition();
|
2012-12-11 13:12:43 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect GetScrollRange() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollRange();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPositionClampingScrollPortSize();
|
2012-06-10 16:44:50 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual float GetResolution() const override {
|
2014-04-07 04:43:58 -07:00
|
|
|
return mHelper.GetResolution();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void SetResolution(float aResolution) override {
|
2014-04-07 04:43:58 -07:00
|
|
|
return mHelper.SetResolution(aResolution);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void SetResolutionAndScaleTo(float aResolution) override {
|
2015-01-02 17:06:14 -08:00
|
|
|
return mHelper.SetResolutionAndScaleTo(aResolution);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetLineScrollAmount() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetLineScrollAmount();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetPageScrollAmount() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetPageScrollAmount();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-02-07 16:53:18 -08:00
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
2015-02-19 15:53:30 -08:00
|
|
|
const nsRect* aRange = nullptr,
|
2015-03-25 11:40:31 -07:00
|
|
|
ScrollSnapMode aSnap = nsIScrollbarMediator::DISABLE_SNAP)
|
|
|
|
override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, aRange, aSnap);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2014-07-09 10:02:31 -07:00
|
|
|
virtual void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode
|
2015-03-21 09:28:04 -07:00
|
|
|
= nsIScrollableFrame::INSTANT) override {
|
2014-07-09 10:02:31 -07:00
|
|
|
mHelper.ScrollToCSSPixels(aScrollPosition, aMode);
|
2012-05-14 22:58:09 -07:00
|
|
|
}
|
2013-12-16 09:04:45 -08:00
|
|
|
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIAtom* aOrigin = nullptr) override {
|
2013-12-16 09:04:45 -08:00
|
|
|
mHelper.ScrollToCSSPixelsApproximate(aScrollPosition, aOrigin);
|
2012-11-22 17:25:23 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.GetScrollPositionCSSPixels();
|
2012-08-10 04:17:06 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2014-07-15 07:13:00 -07:00
|
|
|
nsIntPoint* aOverflow, nsIAtom* aOrigin = nullptr,
|
2015-02-19 15:53:30 -08:00
|
|
|
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
|
2015-03-25 11:40:31 -07:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP)
|
2015-03-21 09:28:04 -07:00
|
|
|
override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void FlingSnap(const mozilla::CSSPoint& aDestination) override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.FlingSnap(aDestination);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ScrollSnap() override {
|
2015-02-19 15:53:30 -08:00
|
|
|
mHelper.ScrollSnap();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ScrollToRestoredPosition() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.ScrollToRestoredPosition();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.AddScrollPositionListener(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.RemoveScrollPositionListener(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.CurPosAttributeChanged(aChild);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.PostScrolledAreaEvent();
|
2010-01-11 13:45:19 -08:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsScrollingActive(nsDisplayListBuilder* aBuilder) override {
|
2014-10-21 18:54:06 -07:00
|
|
|
return mHelper.IsScrollingActive(aBuilder);
|
2010-07-15 14:08:02 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsProcessingAsyncScroll() override {
|
2014-01-28 14:54:59 -08:00
|
|
|
return mHelper.IsProcessingAsyncScroll();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.ResetScrollPositionForLayerPixelAlignment();
|
2012-08-16 16:40:10 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsResolutionSet() const override {
|
2014-05-12 10:26:53 -07:00
|
|
|
return mHelper.mIsResolutionSet;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool DidHistoryRestore() const override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.mDidHistoryRestore;
|
2011-06-15 14:03:49 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ClearDidHistoryRestore() override {
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.mDidHistoryRestore = false;
|
2013-03-15 15:32:35 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsRectNearlyVisible(const nsRect& aRect) override {
|
2013-10-28 19:27:50 -07:00
|
|
|
return mHelper.IsRectNearlyVisible(aRect);
|
2013-09-14 17:05:04 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const override {
|
2014-06-06 19:23:22 -07:00
|
|
|
return mHelper.ExpandRectToNearlyVisible(aRect);
|
2014-06-06 19:23:20 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* LastScrollOrigin() override {
|
2014-07-10 11:52:40 -07:00
|
|
|
return mHelper.LastScrollOrigin();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* LastSmoothScrollOrigin() override {
|
2014-07-10 11:52:40 -07:00
|
|
|
return mHelper.LastSmoothScrollOrigin();
|
2013-12-16 09:04:45 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint32_t CurrentScrollGeneration() override {
|
2014-02-05 14:43:20 -08:00
|
|
|
return mHelper.CurrentScrollGeneration();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsPoint LastScrollDestination() override {
|
2014-07-10 11:52:40 -07:00
|
|
|
return mHelper.LastScrollDestination();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ResetScrollInfoIfGeneration(uint32_t aGeneration) override {
|
2014-07-10 11:52:40 -07:00
|
|
|
mHelper.ResetScrollInfoIfGeneration(aGeneration);
|
2013-12-16 09:04:45 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool WantAsyncScroll() const override {
|
2014-03-12 13:20:26 -07:00
|
|
|
return mHelper.WantAsyncScroll();
|
|
|
|
}
|
2014-08-30 20:29:24 -07:00
|
|
|
virtual void ComputeFrameMetrics(Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
|
|
|
const ContainerLayerParameters& aParameters,
|
|
|
|
nsRect* aClipRect,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsTArray<FrameMetrics>* aOutput) const override {
|
2014-08-30 20:29:24 -07:00
|
|
|
mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame,
|
|
|
|
aParameters, aClipRect, aOutput);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsIgnoringViewportClipping() const override {
|
2014-09-23 06:44:00 -07:00
|
|
|
return mHelper.IsIgnoringViewportClipping();
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void MarkScrollbarsDirtyForReflow() const override {
|
2014-10-08 19:56:38 -07:00
|
|
|
mHelper.MarkScrollbarsDirtyForReflow();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIStatefulFrame
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) override {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-28 19:27:50 -07:00
|
|
|
*aState = mHelper.SaveState();
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) override {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.RestoreState(aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::scrollFrame
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// Override bogus IsFrameOfType in nsBoxFrame.
|
|
|
|
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2007-03-22 10:30:00 -07:00
|
|
|
return nsBoxFrame::IsFrameOfType(aFlags);
|
|
|
|
}
|
|
|
|
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByPage(aScrollbar, aDirection, aSnap);
|
2014-02-04 17:33:18 -08:00
|
|
|
}
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByWhole(aScrollbar, aDirection, aSnap);
|
2014-02-04 17:33:18 -08:00
|
|
|
}
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) override {
|
|
|
|
mHelper.ScrollByLine(aScrollbar, aDirection, aSnap);
|
2014-02-04 17:33:18 -08:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) override {
|
2014-02-04 17:33:18 -08:00
|
|
|
mHelper.RepeatButtonScroll(aScrollbar);
|
|
|
|
}
|
|
|
|
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
|
|
|
nscoord aOldPos,
|
2015-03-21 09:28:04 -07:00
|
|
|
nscoord aNewPos) override {
|
2014-02-04 17:33:18 -08:00
|
|
|
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
|
|
|
}
|
2015-03-25 11:40:31 -07:00
|
|
|
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) override {
|
|
|
|
mHelper.ScrollbarReleased(aScrollbar);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void VisibilityChanged(bool aVisible) override {}
|
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) override {
|
2014-02-13 22:40:53 -08:00
|
|
|
return mHelper.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void ScrollbarActivityStarted() const override;
|
|
|
|
virtual void ScrollbarActivityStopped() const override;
|
2014-02-04 17:33:18 -08:00
|
|
|
|
2015-05-12 01:49:25 -07:00
|
|
|
virtual bool IsScrollbarOnRight() const override {
|
|
|
|
return mHelper.IsScrollbarOnRight();
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void SetTransformingByAPZ(bool aTransforming) override {
|
2015-02-25 06:32:09 -08:00
|
|
|
mHelper.SetTransformingByAPZ(aTransforming);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
bool IsTransformingByAPZ() const override {
|
2015-02-25 06:32:09 -08:00
|
|
|
return mHelper.IsTransformingByAPZ();
|
|
|
|
}
|
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2015-01-06 01:27:56 -08:00
|
|
|
nsXULScrollFrame(nsStyleContext* aContext, bool aIsRoot,
|
2013-06-16 22:16:27 -07:00
|
|
|
bool aClipAllDescendants);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-02-12 22:38:29 -08:00
|
|
|
void ClampAndSetBounds(nsBoxLayoutState& aState,
|
|
|
|
nsRect& aRect,
|
|
|
|
nsPoint aScrollPosition,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aRemoveOverflowAreas = false) {
|
2011-02-12 22:38:29 -08:00
|
|
|
/*
|
|
|
|
* For RTL frames, restore the original scrolled position of the right
|
|
|
|
* edge, then subtract the current width to find the physical position.
|
|
|
|
*/
|
2013-10-28 19:27:50 -07:00
|
|
|
if (!mHelper.IsLTR()) {
|
|
|
|
aRect.x = mHelper.mScrollPort.XMost() - aScrollPosition.x - aRect.width;
|
2011-02-12 22:38:29 -08:00
|
|
|
}
|
2013-10-28 19:27:50 -07:00
|
|
|
mHelper.mScrolledFrame->SetBounds(aState, aRect, aRemoveOverflowAreas);
|
2011-02-12 22:38:29 -08:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2013-10-28 19:27:50 -07:00
|
|
|
friend class mozilla::ScrollFrameHelper;
|
|
|
|
ScrollFrameHelper mHelper;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsGfxScrollFrame_h___ */
|