2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
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"
|
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"
|
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;
|
|
|
|
class nsIAtom;
|
2005-01-28 01:52:53 +03:00
|
|
|
class nsPresState;
|
2013-08-22 22:32:52 +04:00
|
|
|
class nsIScrollPositionListener;
|
2005-04-29 01:57:22 +04:00
|
|
|
struct ScrollReflowState;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2012-08-03 14:35:14 +04:00
|
|
|
namespace mozilla {
|
2014-08-31 07:29:24 +04:00
|
|
|
namespace layers {
|
|
|
|
class Layer;
|
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
|
|
|
|
} // namespace mozilla
|
2012-08-03 14:35:14 +04:00
|
|
|
|
2013-10-29 06:27:50 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
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;
|
|
|
|
typedef mozilla::layers::Layer Layer;
|
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
|
|
|
|
2013-08-24 00:20:07 +04:00
|
|
|
mozilla::ScrollbarStyles GetScrollbarStylesFromFrame() 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();
|
|
|
|
void PostOverflowEvent();
|
2007-02-18 20:34:09 +03:00
|
|
|
void Destroy();
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2011-12-20 16:30:14 +04:00
|
|
|
void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
2014-10-10 00:10:01 +04:00
|
|
|
bool aUsingDisplayPort,
|
2014-05-28 13:46:10 +04:00
|
|
|
bool aCreateLayer,
|
2011-12-20 16:30:14 +04:00
|
|
|
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.
|
|
|
|
*/
|
2006-03-15 19:55:19 +03:00
|
|
|
void CurPosAttributeChanged(nsIContent* aChild);
|
2013-08-09 02:04:59 +04:00
|
|
|
|
2005-08-22 03:37:13 +04:00
|
|
|
void PostScrollEvent();
|
|
|
|
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();
|
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
class ScrollEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit ScrollEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
2013-10-29 06:27:50 +04:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
2006-05-10 21:30:15 +04:00
|
|
|
private:
|
2013-10-29 06:27:50 +04:00
|
|
|
ScrollFrameHelper *mHelper;
|
2006-05-10 21:30:15 +04:00
|
|
|
};
|
|
|
|
|
2007-01-28 01:50:18 +03:00
|
|
|
class AsyncScrollPortEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit AsyncScrollPortEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
2013-10-29 06:27:50 +04:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
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
|
|
|
};
|
|
|
|
|
2010-01-12 00:45:19 +03:00
|
|
|
class ScrolledAreaEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit ScrolledAreaEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
2013-10-29 06:27:50 +04:00
|
|
|
void Revoke() { mHelper = nullptr; }
|
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.
|
|
|
|
*/
|
2012-08-03 14:35:14 +04:00
|
|
|
void FinishReflowForScrollbar(nsIContent* aContent, 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.
|
|
|
|
*/
|
2013-08-09 02:04:59 +04:00
|
|
|
void SetScrollbarEnabled(nsIContent* aContent, nscoord aMaxPos);
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-08-03 14:35:14 +04:00
|
|
|
void SetCoordAttribute(nsIContent* aContent, nsIAtom* aAtom, nscoord aSize);
|
2013-08-09 02:04:59 +04:00
|
|
|
|
2012-08-06 07:00:57 +04:00
|
|
|
nscoord GetCoordAttribute(nsIFrame* aFrame, nsIAtom* aAtom, nscoord aDefaultValue,
|
2012-05-10 09:24:19 +04:00
|
|
|
nscoord* aRangeStart, 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;
|
|
|
|
pt.x = IsLTR() ?
|
|
|
|
mScrollPort.x - mScrolledFrame->GetPosition().x :
|
|
|
|
mScrollPort.XMost() - mScrolledFrame->GetRect().XMost();
|
|
|
|
pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
|
|
|
|
return pt;
|
|
|
|
}
|
2009-09-01 08:11:11 +04:00
|
|
|
nsRect GetScrollRange() const;
|
2012-04-24 22:52:35 +04:00
|
|
|
// Get the scroll range assuming the scrollport has size (aWidth, aHeight).
|
|
|
|
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
|
2012-06-11 03:44:50 +04:00
|
|
|
nsSize GetScrollPositionClampingScrollPortSize() const;
|
2015-03-07 02:07:59 +03:00
|
|
|
float GetResolution() const;
|
|
|
|
void SetResolution(float aResolution);
|
|
|
|
void SetResolutionAndScaleTo(float aResolution);
|
2015-02-20 02:53:30 +03:00
|
|
|
void FlingSnap(const mozilla::CSSPoint& aDestination);
|
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
|
|
|
const nsRect* aRange = nullptr,
|
2015-03-25 21:40:31 +03:00
|
|
|
nsIScrollbarMediator::ScrollSnapMode aSnap
|
|
|
|
= nsIScrollbarMediator::DISABLE_SNAP) {
|
2015-02-20 02:53:30 +03:00
|
|
|
ScrollToWithOrigin(aScrollPosition, aMode, nsGkAtoms::other, aRange,
|
|
|
|
aSnap);
|
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.
|
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode
|
|
|
|
= nsIScrollableFrame::INSTANT);
|
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,
|
|
|
|
nsIAtom* 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.
|
|
|
|
*/
|
2013-12-16 21:04:45 +04:00
|
|
|
void ScrollToImpl(nsPoint aScrollPosition, const nsRect& aRange, nsIAtom* 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,
|
2014-02-04 05:54:22 +04:00
|
|
|
nsIAtom* 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);
|
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();
|
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
|
|
|
|
2014-04-07 15:43:58 +04:00
|
|
|
nsPresState* SaveState() const;
|
2005-01-28 01:52:53 +03:00
|
|
|
void RestoreState(nsPresState* 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).
|
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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
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);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsLTR() const;
|
2015-04-21 23:09:48 +03:00
|
|
|
bool IsScrollbarOnRight() const;
|
2014-10-22 05:54:32 +04:00
|
|
|
bool IsScrollingActive(nsDisplayListBuilder* aBuilder) const;
|
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
|
|
|
|
|
|
|
bool UpdateOverflow();
|
|
|
|
|
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.
|
|
|
|
void AdjustScrollbarRectForResizer(nsIFrame* aFrame, nsPresContext* aPresContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
nsRect& aRect, bool aHasResizer, bool aVertical);
|
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
|
|
|
|
2011-12-05 16:38:46 +04:00
|
|
|
bool IsIgnoringViewportClipping() const;
|
|
|
|
|
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) {
|
|
|
|
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;
|
|
|
|
}
|
2015-06-03 02:34:46 +03:00
|
|
|
bool UsesContainerScrolling() const;
|
2015-02-25 17:32:09 +03:00
|
|
|
|
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();
|
|
|
|
|
2014-07-10 22:52:40 +04:00
|
|
|
nsIAtom* LastScrollOrigin() const { return mLastScrollOrigin; }
|
|
|
|
nsIAtom* 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;
|
2015-06-21 19:27:31 +03:00
|
|
|
Maybe<FrameMetricsAndClip> ComputeFrameMetrics(
|
|
|
|
Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
2015-07-02 20:42:34 +03:00
|
|
|
const ContainerLayerParameters& aParameters,
|
|
|
|
bool aIsForCaret) const;
|
2015-09-10 02:08:03 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::DisplayItemClip> ComputeScrollClip(bool aIsForCaret) 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);
|
2014-02-05 05:33:18 +04:00
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
// owning references to the nsIAnonymousContentCreator-built content
|
|
|
|
nsCOMPtr<nsIContent> mHScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mVScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mScrollCornerContent;
|
2011-01-17 17:35:32 +03:00
|
|
|
nsCOMPtr<nsIContent> mResizerContent;
|
2007-02-18 20:34:09 +03:00
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
nsRevocableEventPtr<ScrollEvent> mScrollEvent;
|
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;
|
2012-03-31 17:08:00 +04:00
|
|
|
nsRefPtr<AsyncScroll> mAsyncScroll;
|
2014-07-09 21:02:31 +04:00
|
|
|
nsRefPtr<AsyncSmoothMSDScroll> mAsyncSmoothMSDScroll;
|
2013-08-01 05:43:56 +04:00
|
|
|
nsRefPtr<ScrollbarActivity> mScrollbarActivity;
|
2010-01-29 03:03:42 +03:00
|
|
|
nsTArray<nsIScrollPositionListener*> mListeners;
|
2014-07-10 22:52:40 +04:00
|
|
|
nsIAtom* mLastScrollOrigin;
|
|
|
|
nsIAtom* mLastSmoothScrollOrigin;
|
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;
|
2010-07-16 01:08:02 +04:00
|
|
|
nsPoint mScrollPosAtLastPaint;
|
2009-10-08 07:01:15 +04:00
|
|
|
|
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;
|
|
|
|
|
2014-04-07 15:43:58 +04:00
|
|
|
// The current resolution derived from the zoom level and device pixel ratio.
|
2015-03-07 02:07:59 +03:00
|
|
|
float mResolution;
|
2014-04-07 15:43:58 +04:00
|
|
|
|
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
|
|
|
|
2013-02-25 04:59:21 +04:00
|
|
|
// The scroll position where we last updated image visibility.
|
|
|
|
nsPoint mLastUpdateImagesPos;
|
|
|
|
|
2015-02-08 20:57:00 +03:00
|
|
|
nsRect mPrevScrolledRect;
|
|
|
|
|
2014-08-31 07:29:24 +04:00
|
|
|
FrameMetrics::ViewID mScrollParentID;
|
|
|
|
|
2015-09-10 02:08:03 +03:00
|
|
|
// The scroll port clip.
|
|
|
|
Maybe<DisplayItemClip> mAncestorClip;
|
|
|
|
Maybe<DisplayItemClip> mAncestorClipForCaret;
|
2015-05-26 22:40:41 +03:00
|
|
|
|
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.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSupppressScrollbarUpdate:1;
|
2007-01-19 21:01:10 +03: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-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
|
|
|
|
2013-11-02 07:47:21 +04: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-18 02:37:28 +03:00
|
|
|
|
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;
|
|
|
|
|
2014-10-28 07:34:58 +03:00
|
|
|
// If true, add clipping in ScrollFrameHelper::ComputeFrameMetrics.
|
|
|
|
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;
|
|
|
|
|
2015-01-03 04:06:14 +03:00
|
|
|
// True if the frame's resolution has been set via SetResolution or
|
|
|
|
// SetResolutionAndScaleTo or restored via RestoreState.
|
2014-05-12 21:26:53 +04:00
|
|
|
bool mIsResolutionSet: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-01-03 04:06:14 +03:00
|
|
|
// True if the frame's resolution has been set via SetResolutionAndScaleTo.
|
|
|
|
// Only meaningful for root scroll frames.
|
|
|
|
bool mScaleToResolution: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;
|
|
|
|
|
2015-02-20 02:53:30 +03:00
|
|
|
mozilla::layout::ScrollVelocityQueue mVelocityQueue;
|
|
|
|
|
2012-03-12 00:55:00 +04:00
|
|
|
protected:
|
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,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsIAtom *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
|
|
|
|
2014-07-09 21:02:31 +04:00
|
|
|
void CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin = nullptr);
|
|
|
|
|
2013-09-15 04:05:04 +04: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;
|
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;
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsHTMLScrollFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
bool aIsRoot);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::WritingMode GetWritingMode() const override
|
2014-12-16 12:45:11 +03:00
|
|
|
{
|
|
|
|
if (mHelper.mScrolledFrame) {
|
|
|
|
return mHelper.mScrolledFrame->GetWritingMode();
|
|
|
|
}
|
|
|
|
return nsIFrame::GetWritingMode();
|
|
|
|
}
|
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool TryLayout(ScrollReflowState* aState,
|
2007-12-05 06:05:57 +03:00
|
|
|
nsHTMLReflowMetrics* aKidMetrics,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aAssumeVScroll, bool aAssumeHScroll,
|
2014-05-13 04:47:52 +04:00
|
|
|
bool aForce);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ScrolledContentDependsOnHeight(ScrollReflowState* aState);
|
2014-05-13 04:47:52 +04:00
|
|
|
void ReflowScrolledFrame(ScrollReflowState* aState,
|
|
|
|
bool aAssumeHScroll,
|
|
|
|
bool aAssumeVScroll,
|
|
|
|
nsHTMLReflowMetrics* aMetrics,
|
|
|
|
bool aFirstPass);
|
|
|
|
void ReflowContents(ScrollReflowState* aState,
|
|
|
|
const nsHTMLReflowMetrics& aDesiredSize);
|
2009-10-08 07:01:15 +04:00
|
|
|
void PlaceScrollArea(const ScrollReflowState& aState,
|
|
|
|
const nsPoint& aScrollPosition);
|
2011-04-08 05:04:40 +04:00
|
|
|
nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *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,
|
2015-03-21 19:28:04 +03:00
|
|
|
Sides aSkipSides, 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
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nsresult GetPadding(nsMargin& aPadding) override;
|
|
|
|
virtual bool IsCollapsed() override;
|
2007-01-22 07:27:31 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool UpdateOverflow() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.UpdateOverflow();
|
2013-03-05 16:26:41 +04:00
|
|
|
}
|
|
|
|
|
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,
|
2014-05-28 23:36:58 +04:00
|
|
|
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,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aOldFrame) override;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() override {
|
2009-09-01 15:22:31 +04:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
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; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const override;
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(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
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarStylesFromFrame();
|
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,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsRenderingContext* 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,
|
2015-07-27 18:52:12 +03:00
|
|
|
nsRenderingContext* aRC, 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
|
|
|
}
|
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
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPositionClampingScrollPortSize();
|
2012-06-11 03:44:50 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual float GetResolution() const override {
|
2014-04-07 15:43:58 +04:00
|
|
|
return mHelper.GetResolution();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetResolution(float aResolution) override {
|
2014-04-07 15:43:58 +04:00
|
|
|
return mHelper.SetResolution(aResolution);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetResolutionAndScaleTo(float aResolution) override {
|
2015-01-03 04:06:14 +03:00
|
|
|
return mHelper.SetResolutionAndScaleTo(aResolution);
|
|
|
|
}
|
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)
|
2015-03-21 19:28:04 +03:00
|
|
|
override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, 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
|
2015-03-21 19:28:04 +03:00
|
|
|
= nsIScrollableFrame::INSTANT) override {
|
2014-07-09 21:02:31 +04:00
|
|
|
mHelper.ScrollToCSSPixels(aScrollPosition, aMode);
|
2012-05-15 09:58:09 +04:00
|
|
|
}
|
2013-12-16 21:04:45 +04:00
|
|
|
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIAtom* 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,
|
2014-07-15 18:13:00 +04:00
|
|
|
nsIntPoint* aOverflow, nsIAtom* 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)
|
2015-03-21 19:28:04 +03:00
|
|
|
override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void FlingSnap(const mozilla::CSSPoint& aDestination) override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.FlingSnap(aDestination);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollSnap() override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollSnap();
|
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 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
|
|
|
}
|
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 IsResolutionSet() const override {
|
2014-05-12 21:26:53 +04:00
|
|
|
return mHelper.mIsResolutionSet;
|
|
|
|
}
|
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
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* LastScrollOrigin() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastScrollOrigin();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* 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();
|
|
|
|
}
|
2015-06-21 19:27:31 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::FrameMetricsAndClip> ComputeFrameMetrics(
|
|
|
|
Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
2015-07-02 20:42:34 +03:00
|
|
|
const ContainerLayerParameters& aParameters,
|
|
|
|
bool aIsForCaret) const override
|
2015-06-21 19:27:31 +03:00
|
|
|
{
|
2015-07-02 20:42:34 +03:00
|
|
|
return mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame, aParameters, aIsForCaret);
|
2014-08-31 07:29:24 +04:00
|
|
|
}
|
2015-09-10 02:08:03 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::DisplayItemClip> ComputeScrollClip(bool aIsForCaret) const override
|
2015-07-02 23:42:10 +03:00
|
|
|
{
|
|
|
|
return mHelper.ComputeScrollClip(aIsForCaret);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsIgnoringViewportClipping() const override {
|
2014-09-23 17:44:00 +04:00
|
|
|
return mHelper.IsIgnoringViewportClipping();
|
|
|
|
}
|
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();
|
|
|
|
}
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2004-09-13 06:10:29 +04:00
|
|
|
// nsIStatefulFrame
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) override {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-29 06:27:50 +04:00
|
|
|
*aState = mHelper.SaveState();
|
2004-09-13 06:10:29 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* 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;
|
|
|
|
}
|
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::scrollFrame
|
2004-06-18 06:08:19 +04:00
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* GetType() const override;
|
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();
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
}
|
2004-06-18 06:08:19 +04: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:
|
2015-01-06 12:27:56 +03:00
|
|
|
nsHTMLScrollFrame(nsStyleContext* aContext, bool aIsRoot);
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetSuppressScrollbarUpdate(bool aSuppress) {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.mSupppressScrollbarUpdate = aSuppress;
|
2005-07-26 03:23:53 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GuessHScrollbarNeeded(const ScrollReflowState& aState);
|
|
|
|
bool GuessVScrollbarNeeded(const ScrollReflowState& aState);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsScrollbarUpdateSuppressed() const {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.mSupppressScrollbarUpdate;
|
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;
|
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-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;
|
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 22:20:59 +03:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsXULScrollFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
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,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.BuildDisplayList(aBuilder, aDirtyRect, 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
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool UpdateOverflow() override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.UpdateOverflow();
|
2013-03-05 16:26:41 +04:00
|
|
|
}
|
|
|
|
|
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,
|
2014-05-28 23:36:58 +04:00
|
|
|
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,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aOldFrame) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() override {
|
2009-09-01 15:22:31 +04:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
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; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const override;
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(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
|
|
|
|
2015-03-21 19:28:04 +03: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;
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
virtual nsresult GetPadding(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,
|
2015-03-21 19:28:04 +03:00
|
|
|
Sides aSkipSides, 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
|
|
|
}
|
|
|
|
|
2005-04-29 01:57:22 +04:00
|
|
|
nsresult Layout(nsBoxLayoutState& aState);
|
2009-10-08 07:01:15 +04:00
|
|
|
void LayoutScrollArea(nsBoxLayoutState& aState, const nsPoint& aScrollPosition);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool AddRemoveScrollbar(bool& aHasScrollbar,
|
2005-04-29 01:57:22 +04:00
|
|
|
nscoord& aXY,
|
|
|
|
nscoord& aSize,
|
|
|
|
nscoord aSbSize,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aAdd);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aHorizontal,
|
|
|
|
bool aAdd);
|
2005-04-29 01:57:22 +04: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
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
|
|
|
|
static void AdjustReflowStateBack(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
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarStylesFromFrame();
|
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,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsRenderingContext* 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,
|
2015-07-27 18:52:12 +03:00
|
|
|
nsRenderingContext* aRC, 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
|
|
|
}
|
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
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPositionClampingScrollPortSize();
|
2012-06-11 03:44:50 +04:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual float GetResolution() const override {
|
2014-04-07 15:43:58 +04:00
|
|
|
return mHelper.GetResolution();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetResolution(float aResolution) override {
|
2014-04-07 15:43:58 +04:00
|
|
|
return mHelper.SetResolution(aResolution);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetResolutionAndScaleTo(float aResolution) override {
|
2015-01-03 04:06:14 +03:00
|
|
|
return mHelper.SetResolutionAndScaleTo(aResolution);
|
|
|
|
}
|
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
|
|
|
ScrollSnapMode aSnap = nsIScrollbarMediator::DISABLE_SNAP)
|
|
|
|
override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, 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
|
2015-03-21 19:28:04 +03:00
|
|
|
= nsIScrollableFrame::INSTANT) override {
|
2014-07-09 21:02:31 +04:00
|
|
|
mHelper.ScrollToCSSPixels(aScrollPosition, aMode);
|
2012-05-15 09:58:09 +04:00
|
|
|
}
|
2013-12-16 21:04:45 +04:00
|
|
|
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIAtom* 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,
|
2014-07-15 18:13:00 +04:00
|
|
|
nsIntPoint* aOverflow, nsIAtom* 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)
|
2015-03-21 19:28:04 +03:00
|
|
|
override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void FlingSnap(const mozilla::CSSPoint& aDestination) override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.FlingSnap(aDestination);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ScrollSnap() override {
|
2015-02-20 02:53:30 +03:00
|
|
|
mHelper.ScrollSnap();
|
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 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
|
|
|
}
|
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 IsResolutionSet() const override {
|
2014-05-12 21:26:53 +04:00
|
|
|
return mHelper.mIsResolutionSet;
|
|
|
|
}
|
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
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* LastScrollOrigin() override {
|
2014-07-10 22:52:40 +04:00
|
|
|
return mHelper.LastScrollOrigin();
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* 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();
|
|
|
|
}
|
2015-06-21 19:27:31 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::FrameMetricsAndClip> ComputeFrameMetrics(
|
|
|
|
Layer* aLayer, nsIFrame* aContainerReferenceFrame,
|
2015-07-02 20:42:34 +03:00
|
|
|
const ContainerLayerParameters& aParameters,
|
|
|
|
bool aIsForCaret) const override
|
2015-06-21 19:27:31 +03:00
|
|
|
{
|
2015-07-02 20:42:34 +03:00
|
|
|
return mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame, aParameters, aIsForCaret);
|
2014-08-31 07:29:24 +04:00
|
|
|
}
|
2015-09-10 02:08:03 +03:00
|
|
|
virtual mozilla::Maybe<mozilla::DisplayItemClip> ComputeScrollClip(bool aIsForCaret) const override
|
2015-07-02 23:42:10 +03:00
|
|
|
{
|
|
|
|
return mHelper.ComputeScrollClip(aIsForCaret);
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsIgnoringViewportClipping() const override {
|
2014-09-23 17:44:00 +04:00
|
|
|
return mHelper.IsIgnoringViewportClipping();
|
|
|
|
}
|
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
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) override {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2013-10-29 06:27:50 +04:00
|
|
|
*aState = mHelper.SaveState();
|
2004-09-13 06:10:29 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* 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;
|
|
|
|
}
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::scrollFrame
|
1999-08-20 02:16:23 +04:00
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* GetType() const override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
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:
|
2015-01-06 12:27:56 +03:00
|
|
|
nsXULScrollFrame(nsStyleContext* aContext, bool aIsRoot,
|
2013-06-17 09:16:27 +04:00
|
|
|
bool aClipAllDescendants);
|
2003-12-10 06:43:39 +03:00
|
|
|
|
2011-02-13 09:38:29 +03:00
|
|
|
void ClampAndSetBounds(nsBoxLayoutState& aState,
|
|
|
|
nsRect& aRect,
|
|
|
|
nsPoint aScrollPosition,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRemoveOverflowAreas = false) {
|
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.
|
|
|
|
*/
|
2013-10-29 06:27:50 +04:00
|
|
|
if (!mHelper.IsLTR()) {
|
|
|
|
aRect.x = mHelper.mScrollPort.XMost() - aScrollPosition.x - aRect.width;
|
2011-02-13 09:38:29 +03:00
|
|
|
}
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.mScrolledFrame->SetBounds(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___ */
|