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"
|
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;
|
2004-06-18 06:08:19 +04:00
|
|
|
class nsIScrollFrameInternal;
|
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 {
|
2013-05-02 18:58:00 +04:00
|
|
|
namespace layout {
|
2012-08-03 14:35:14 +04:00
|
|
|
class ScrollbarActivity;
|
|
|
|
}
|
2013-05-02 18:58:00 +04:00
|
|
|
}
|
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;
|
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-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
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual bool ReflowFinished() MOZ_OVERRIDE;
|
|
|
|
virtual void ReflowCallbackCanceled() MOZ_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
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
class ScrollEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2013-10-29 06:27:50 +04:00
|
|
|
ScrollEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
|
|
|
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
|
2013-10-29 06:27:50 +04:00
|
|
|
AsyncScrollPortEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
|
|
|
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
|
2013-10-29 06:27:50 +04:00
|
|
|
ScrolledAreaEvent(ScrollFrameHelper *helper) : mHelper(helper) {}
|
|
|
|
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;
|
2014-04-07 15:43:58 +04:00
|
|
|
gfxSize GetResolution() const;
|
|
|
|
void SetResolution(const gfxSize& aResolution);
|
|
|
|
|
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,
|
2012-07-30 18:20:58 +04:00
|
|
|
const nsRect* aRange = nullptr) {
|
2012-02-08 04:53:18 +04:00
|
|
|
ScrollToWithOrigin(aScrollPosition, aMode, nsGkAtoms::other, aRange);
|
|
|
|
}
|
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);
|
2011-12-05 16:38:46 +04:00
|
|
|
void ScrollVisual(nsPoint aOldScrolledFramePosition);
|
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,
|
|
|
|
nsIAtom* aOrigin = nullptr, bool aIsMomentum = false);
|
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();
|
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);
|
2013-05-27 02:05:10 +04:00
|
|
|
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsLTR() const;
|
|
|
|
bool IsScrollbarOnRight() const;
|
2013-11-02 07:47:21 +04:00
|
|
|
bool IsScrollingActive() const { return mScrollingActive || mShouldBuildScrollableLayer; }
|
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();
|
|
|
|
|
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;
|
|
|
|
|
2012-02-18 03:41:13 +04:00
|
|
|
bool ShouldClampScrollPosition() const;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsAlwaysActive() const;
|
2010-07-16 01:08:05 +04:00
|
|
|
void MarkActive();
|
2011-01-04 11:46:59 +03:00
|
|
|
void MarkInactive();
|
2010-07-16 01:08:05 +04:00
|
|
|
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
|
|
|
|
|
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();
|
|
|
|
|
2013-12-16 21:04:45 +04:00
|
|
|
nsIAtom* OriginOfLastScroll() const { return mOriginOfLastScroll; }
|
2014-02-06 02:43:20 +04:00
|
|
|
uint32_t CurrentScrollGeneration() const { return mScrollGeneration; }
|
|
|
|
void ResetOriginIfScrollAtGeneration(uint32_t aGeneration) {
|
|
|
|
if (aGeneration == mScrollGeneration) {
|
|
|
|
mOriginOfLastScroll = nullptr;
|
|
|
|
}
|
|
|
|
}
|
2014-03-13 00:20:26 +04:00
|
|
|
bool WantAsyncScroll() const;
|
2013-12-16 21:04:45 +04:00
|
|
|
|
2014-02-05 05:33:18 +04:00
|
|
|
// nsIScrollbarMediator
|
|
|
|
void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection);
|
|
|
|
void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection);
|
|
|
|
void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection);
|
|
|
|
void RepeatButtonScroll(nsScrollbarFrame* aScrollbar);
|
|
|
|
void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
|
|
|
nscoord aOldPos,
|
|
|
|
nscoord aNewPos);
|
|
|
|
void ScrollByUnit(nsScrollbarFrame* aScrollbar,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode,
|
|
|
|
int32_t aDirection,
|
|
|
|
nsIScrollableFrame::ScrollUnit aUnit);
|
|
|
|
|
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;
|
2013-12-16 21:04:45 +04:00
|
|
|
nsIAtom* mOriginOfLastScroll;
|
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.
|
|
|
|
gfxSize mResolution;
|
|
|
|
|
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;
|
|
|
|
|
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)
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mScrollingActive: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;
|
2012-03-12 00:55:00 +04:00
|
|
|
|
2012-11-14 10:26:33 +04:00
|
|
|
// True if this frame has been scrolled at least once
|
|
|
|
bool mHasBeenScrolled:1;
|
|
|
|
|
2014-05-12 21:26:53 +04:00
|
|
|
// True if the frame's resolution has been set via SetResolution or restored
|
|
|
|
// via RestoreState.
|
|
|
|
bool mIsResolutionSet:1;
|
|
|
|
|
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
|
2012-02-08 04:53:18 +04:00
|
|
|
const nsRect* aRange);
|
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
|
|
|
|
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
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_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,
|
2014-06-28 14:13:13 +04:00
|
|
|
Sides aSkipSides, nscoord aRadii[8]) const MOZ_OVERRIDE {
|
2014-05-05 21:55:54 +04:00
|
|
|
return mHelper.GetBorderRadii(aFrameSize, aBorderArea, aSkipSides, aRadii);
|
2010-09-08 02:20:35 +04:00
|
|
|
}
|
|
|
|
|
2014-07-24 21:03:25 +04:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetPadding(nsMargin& aPadding) MOZ_OVERRIDE;
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual bool IsCollapsed() MOZ_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,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2013-03-05 16:26:41 +04:00
|
|
|
virtual bool UpdateOverflow() MOZ_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,
|
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2014-05-28 23:36:58 +04:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 23:36:58 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
|
|
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE {
|
2009-09-01 15:22:31 +04:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2014-05-25 02:20:39 +04:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
|
2004-07-18 16:02:53 +04:00
|
|
|
}
|
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual bool DoesClipChildren() MOZ_OVERRIDE { return true; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild) MOZ_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
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
|
2014-07-16 22:41:57 +04:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2012-09-14 20:10:08 +04:00
|
|
|
uint32_t aFilter) MOZ_OVERRIDE;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2014-02-24 18:41:56 +04:00
|
|
|
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarStylesFromFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarVisibility();
|
2010-01-14 16:00:00 +03:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetActualScrollbarSizes();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) MOZ_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,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsRenderingContext* aRC) MOZ_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,
|
|
|
|
nsRenderingContext* aRC) MOZ_OVERRIDE {
|
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetNondisappearingScrollbarWidth(&bls);
|
2013-05-27 02:05:10 +04:00
|
|
|
}
|
2013-07-23 17:22:58 +04:00
|
|
|
virtual nsRect GetScrolledRect() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledRect();
|
2013-07-23 17:22:58 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPortRect();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsPoint GetScrollPosition() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-12-12 01:12:43 +04:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLogicalScrollPosition();
|
2012-12-12 01:12:43 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsRect GetScrollRange() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollRange();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPositionClampingScrollPortSize();
|
2012-06-11 03:44:50 +04:00
|
|
|
}
|
2014-04-07 15:43:58 +04:00
|
|
|
virtual gfxSize GetResolution() const MOZ_OVERRIDE {
|
|
|
|
return mHelper.GetResolution();
|
|
|
|
}
|
|
|
|
virtual void SetResolution(const gfxSize& aResolution) MOZ_OVERRIDE {
|
|
|
|
return mHelper.SetResolution(aResolution);
|
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsSize GetLineScrollAmount() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLineScrollAmount();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsSize GetPageScrollAmount() const MOZ_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,
|
2012-09-14 20:10:08 +04:00
|
|
|
const nsRect* aRange = nullptr) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, aRange);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
virtual void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode
|
|
|
|
= nsIScrollableFrame::INSTANT) MOZ_OVERRIDE {
|
|
|
|
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,
|
|
|
|
nsIAtom* aOrigin = nullptr) MOZ_OVERRIDE {
|
|
|
|
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.
|
|
|
|
*/
|
2013-07-10 13:58:13 +04:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() MOZ_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,
|
|
|
|
bool aIsMomentum = false) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aIsMomentum);
|
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-09-14 20:10:08 +04:00
|
|
|
virtual void ScrollToRestoredPosition() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ScrollToRestoredPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.AddScrollPositionListener(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_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.
|
|
|
|
*/
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.CurPosAttributeChanged(aChild);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.PostScrolledAreaEvent();
|
2010-01-12 00:45:19 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual bool IsScrollingActive() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.IsScrollingActive();
|
2010-07-16 01:08:02 +04:00
|
|
|
}
|
2014-01-29 02:54:59 +04:00
|
|
|
virtual bool IsProcessingAsyncScroll() MOZ_OVERRIDE {
|
|
|
|
return mHelper.IsProcessingAsyncScroll();
|
|
|
|
}
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ResetScrollPositionForLayerPixelAlignment();
|
2012-08-17 03:40:10 +04:00
|
|
|
}
|
2014-05-12 21:26:53 +04:00
|
|
|
virtual bool IsResolutionSet() const MOZ_OVERRIDE {
|
|
|
|
return mHelper.mIsResolutionSet;
|
|
|
|
}
|
2014-05-06 01:29:20 +04:00
|
|
|
virtual bool DidHistoryRestore() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.mDidHistoryRestore;
|
2011-06-16 01:03:49 +04:00
|
|
|
}
|
2013-03-16 02:32:35 +04:00
|
|
|
virtual void ClearDidHistoryRestore() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.mDidHistoryRestore = false;
|
2013-03-16 02:32:35 +04:00
|
|
|
}
|
2013-09-15 04:05:04 +04:00
|
|
|
virtual bool IsRectNearlyVisible(const nsRect& aRect) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.IsRectNearlyVisible(aRect);
|
2013-09-15 04:05:04 +04:00
|
|
|
}
|
2014-06-07 06:23:22 +04:00
|
|
|
virtual nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const MOZ_OVERRIDE {
|
|
|
|
return mHelper.ExpandRectToNearlyVisible(aRect);
|
2014-06-07 06:23:20 +04:00
|
|
|
}
|
2013-12-16 21:04:45 +04:00
|
|
|
virtual nsIAtom* OriginOfLastScroll() MOZ_OVERRIDE {
|
|
|
|
return mHelper.OriginOfLastScroll();
|
|
|
|
}
|
2014-02-06 02:43:20 +04:00
|
|
|
virtual uint32_t CurrentScrollGeneration() MOZ_OVERRIDE {
|
|
|
|
return mHelper.CurrentScrollGeneration();
|
|
|
|
}
|
|
|
|
virtual void ResetOriginIfScrollAtGeneration(uint32_t aGeneration) MOZ_OVERRIDE {
|
|
|
|
mHelper.ResetOriginIfScrollAtGeneration(aGeneration);
|
2013-12-16 21:04:45 +04:00
|
|
|
}
|
2014-03-13 00:20:26 +04:00
|
|
|
virtual bool WantAsyncScroll() const MOZ_OVERRIDE {
|
|
|
|
return mHelper.WantAsyncScroll();
|
|
|
|
}
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2004-09-13 06:10:29 +04:00
|
|
|
// nsIStatefulFrame
|
2012-11-15 10:40:17 +04:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) MOZ_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;
|
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) MOZ_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
|
|
|
*/
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2014-02-05 05:33:18 +04:00
|
|
|
|
|
|
|
// nsIScrollbarMediator
|
|
|
|
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollByPage(aScrollbar, aDirection);
|
|
|
|
}
|
|
|
|
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollByWhole(aScrollbar, aDirection);
|
|
|
|
}
|
|
|
|
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollByLine(aScrollbar, aDirection);
|
|
|
|
}
|
|
|
|
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {
|
|
|
|
mHelper.RepeatButtonScroll(aScrollbar);
|
|
|
|
}
|
|
|
|
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
|
|
|
nscoord aOldPos,
|
|
|
|
nscoord aNewPos) MOZ_OVERRIDE {
|
|
|
|
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
|
|
|
}
|
|
|
|
virtual void VisibilityChanged(bool aVisible) {}
|
2014-02-14 10:40:53 +04:00
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE {
|
|
|
|
return mHelper.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
virtual void ScrollbarActivityStarted() const MOZ_OVERRIDE;
|
|
|
|
virtual void ScrollbarActivityStopped() const MOZ_OVERRIDE;
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2004-06-18 06:08:19 +04:00
|
|
|
#endif
|
|
|
|
|
2004-09-01 18:58:34 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-29 01:53:44 +04:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
|
2004-09-01 18:58:34 +04:00
|
|
|
#endif
|
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
protected:
|
2011-09-29 10:19:26 +04:00
|
|
|
nsHTMLScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot);
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Override this to return false if computed height/min-height/max-height
|
|
|
|
* should NOT be propagated to child content.
|
|
|
|
* nsListControlFrame uses this.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ShouldPropagateComputedHeightToScrolledContent() 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
|
|
|
|
*/
|
2014-08-05 21:33:55 +04:00
|
|
|
class nsXULScrollFrame MOZ_FINAL : public nsBoxFrame,
|
|
|
|
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,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_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
|
2014-07-24 21:03:25 +04:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_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
|
|
|
|
2013-03-05 16:26:41 +04:00
|
|
|
virtual bool UpdateOverflow() MOZ_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,
|
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2014-05-28 23:36:58 +04:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 23:36:58 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
|
|
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE {
|
2009-09-01 15:22:31 +04:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2014-05-25 02:20:39 +04:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
|
2004-07-18 16:02:53 +04:00
|
|
|
}
|
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual bool DoesClipChildren() MOZ_OVERRIDE { return true; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild) MOZ_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
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
|
2014-07-16 22:41:57 +04:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2012-09-14 20:10:08 +04:00
|
|
|
uint32_t aFilter) MOZ_OVERRIDE;
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
|
|
|
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
|
|
|
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetPadding(nsMargin& aPadding) MOZ_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,
|
2014-06-28 14:13:13 +04:00
|
|
|
Sides aSkipSides, nscoord aRadii[8]) const MOZ_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
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2014-02-24 18:41:56 +04:00
|
|
|
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarStylesFromFrame();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollbarVisibility();
|
2010-01-14 16:00:00 +03:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetActualScrollbarSizes();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) MOZ_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,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsRenderingContext* aRC) MOZ_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,
|
|
|
|
nsRenderingContext* aRC) MOZ_OVERRIDE {
|
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetNondisappearingScrollbarWidth(&bls);
|
2013-05-27 02:05:10 +04:00
|
|
|
}
|
2013-07-23 17:22:58 +04:00
|
|
|
virtual nsRect GetScrolledRect() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrolledRect();
|
2013-07-23 17:22:58 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPortRect();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsPoint GetScrollPosition() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-12-12 01:12:43 +04:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLogicalScrollPosition();
|
2012-12-12 01:12:43 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsRect GetScrollRange() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollRange();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetScrollPositionClampingScrollPortSize();
|
2012-06-11 03:44:50 +04:00
|
|
|
}
|
2014-04-07 15:43:58 +04:00
|
|
|
virtual gfxSize GetResolution() const MOZ_OVERRIDE {
|
|
|
|
return mHelper.GetResolution();
|
|
|
|
}
|
|
|
|
virtual void SetResolution(const gfxSize& aResolution) MOZ_OVERRIDE {
|
|
|
|
return mHelper.SetResolution(aResolution);
|
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsSize GetLineScrollAmount() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.GetLineScrollAmount();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsSize GetPageScrollAmount() const MOZ_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,
|
2012-09-14 20:10:08 +04:00
|
|
|
const nsRect* aRange = nullptr) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ScrollTo(aScrollPosition, aMode, aRange);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2013-08-09 02:04:59 +04:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2014-07-09 21:02:31 +04:00
|
|
|
virtual void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode
|
|
|
|
= nsIScrollableFrame::INSTANT) MOZ_OVERRIDE {
|
|
|
|
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,
|
|
|
|
nsIAtom* aOrigin = nullptr) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollToCSSPixelsApproximate(aScrollPosition, aOrigin);
|
2012-11-23 05:25:23 +04:00
|
|
|
}
|
2013-07-10 13:58:13 +04:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() MOZ_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,
|
|
|
|
bool aIsMomentum = false) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aIsMomentum);
|
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-09-14 20:10:08 +04:00
|
|
|
virtual void ScrollToRestoredPosition() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ScrollToRestoredPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.AddScrollPositionListener(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_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.
|
|
|
|
*/
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.CurPosAttributeChanged(aChild);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.PostScrolledAreaEvent();
|
2010-01-12 00:45:19 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual bool IsScrollingActive() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.IsScrollingActive();
|
2010-07-16 01:08:02 +04:00
|
|
|
}
|
2014-01-29 02:54:59 +04:00
|
|
|
virtual bool IsProcessingAsyncScroll() MOZ_OVERRIDE {
|
|
|
|
return mHelper.IsProcessingAsyncScroll();
|
|
|
|
}
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.ResetScrollPositionForLayerPixelAlignment();
|
2012-08-17 03:40:10 +04:00
|
|
|
}
|
2014-05-12 21:26:53 +04:00
|
|
|
virtual bool IsResolutionSet() const MOZ_OVERRIDE {
|
|
|
|
return mHelper.mIsResolutionSet;
|
|
|
|
}
|
2014-05-06 01:29:20 +04:00
|
|
|
virtual bool DidHistoryRestore() const MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.mDidHistoryRestore;
|
2011-06-16 01:03:49 +04:00
|
|
|
}
|
2013-03-16 02:32:35 +04:00
|
|
|
virtual void ClearDidHistoryRestore() MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
mHelper.mDidHistoryRestore = false;
|
2013-03-16 02:32:35 +04:00
|
|
|
}
|
2013-09-15 04:05:04 +04:00
|
|
|
virtual bool IsRectNearlyVisible(const nsRect& aRect) MOZ_OVERRIDE {
|
2013-10-29 06:27:50 +04:00
|
|
|
return mHelper.IsRectNearlyVisible(aRect);
|
2013-09-15 04:05:04 +04:00
|
|
|
}
|
2014-06-07 06:23:22 +04:00
|
|
|
virtual nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const MOZ_OVERRIDE {
|
|
|
|
return mHelper.ExpandRectToNearlyVisible(aRect);
|
2014-06-07 06:23:20 +04:00
|
|
|
}
|
2013-12-16 21:04:45 +04:00
|
|
|
virtual nsIAtom* OriginOfLastScroll() MOZ_OVERRIDE {
|
|
|
|
return mHelper.OriginOfLastScroll();
|
|
|
|
}
|
2014-02-06 02:43:20 +04:00
|
|
|
virtual uint32_t CurrentScrollGeneration() MOZ_OVERRIDE {
|
|
|
|
return mHelper.CurrentScrollGeneration();
|
|
|
|
}
|
|
|
|
virtual void ResetOriginIfScrollAtGeneration(uint32_t aGeneration) MOZ_OVERRIDE {
|
|
|
|
mHelper.ResetOriginIfScrollAtGeneration(aGeneration);
|
2013-12-16 21:04:45 +04:00
|
|
|
}
|
2014-03-13 00:20:26 +04:00
|
|
|
virtual bool WantAsyncScroll() const MOZ_OVERRIDE {
|
|
|
|
return mHelper.WantAsyncScroll();
|
|
|
|
}
|
2003-04-09 15:27:09 +04:00
|
|
|
|
2004-09-13 06:10:29 +04:00
|
|
|
// nsIStatefulFrame
|
2012-11-15 10:40:17 +04:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) MOZ_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;
|
|
|
|
}
|
2012-09-14 20:10:08 +04:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) MOZ_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
|
|
|
*/
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_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);
|
|
|
|
}
|
|
|
|
|
2014-02-05 05:33:18 +04:00
|
|
|
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollByPage(aScrollbar, aDirection);
|
|
|
|
}
|
|
|
|
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollByWhole(aScrollbar, aDirection);
|
|
|
|
}
|
|
|
|
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
|
|
|
mHelper.ScrollByLine(aScrollbar, aDirection);
|
|
|
|
}
|
|
|
|
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {
|
|
|
|
mHelper.RepeatButtonScroll(aScrollbar);
|
|
|
|
}
|
|
|
|
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
|
|
|
nscoord aOldPos,
|
|
|
|
nscoord aNewPos) MOZ_OVERRIDE {
|
|
|
|
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
|
|
|
}
|
|
|
|
virtual void VisibilityChanged(bool aVisible) {}
|
2014-02-14 10:40:53 +04:00
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE {
|
|
|
|
return mHelper.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ScrollbarActivityStarted() const MOZ_OVERRIDE;
|
|
|
|
virtual void ScrollbarActivityStopped() const MOZ_OVERRIDE;
|
2014-02-05 05:33:18 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_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:
|
2013-06-17 09:16:27 +04:00
|
|
|
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot,
|
|
|
|
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___ */
|