2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* rendering object to wrap rendering objects that should be scrollable */
|
|
|
|
|
|
|
|
#ifndef nsGfxScrollFrame_h___
|
|
|
|
#define nsGfxScrollFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
|
|
|
#include "nsBoxFrame.h"
|
|
|
|
#include "nsIScrollableFrame.h"
|
|
|
|
#include "nsIStatefulFrame.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsIReflowCallback.h"
|
2008-04-09 21:39:41 -07:00
|
|
|
#include "nsBoxLayoutState.h"
|
2009-10-25 00:04:18 -07:00
|
|
|
#include "nsQueryFrame.h"
|
2010-07-15 14:08:05 -07:00
|
|
|
#include "nsExpirationTracker.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsPresContext;
|
|
|
|
class nsIPresShell;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsIScrollFrameInternal;
|
|
|
|
class nsPresState;
|
2013-08-22 11:32:52 -07:00
|
|
|
class nsIScrollPositionListener;
|
2007-03-22 10:30:00 -07:00
|
|
|
struct ScrollReflowState;
|
|
|
|
|
2012-08-03 03:35:14 -07:00
|
|
|
namespace mozilla {
|
2013-05-02 07:58:00 -07:00
|
|
|
namespace layout {
|
2012-08-03 03:35:14 -07:00
|
|
|
class ScrollbarActivity;
|
|
|
|
}
|
2013-05-02 07:58:00 -07:00
|
|
|
}
|
2012-08-03 03:35:14 -07:00
|
|
|
|
2011-10-20 18:41:36 -07:00
|
|
|
// When set, the next scroll operation on the scrollframe will invalidate its
|
|
|
|
// entire contents. Useful for text-overflow.
|
|
|
|
// This bit is cleared after each time the scrollframe is scrolled. Whoever
|
|
|
|
// needs to set it should set it again on each paint.
|
|
|
|
#define NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL NS_FRAME_STATE_BIT(20)
|
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
class nsGfxScrollFrameInner : public nsIReflowCallback {
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2013-07-10 02:58:13 -07:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2013-05-02 07:58:00 -07:00
|
|
|
typedef mozilla::layout::ScrollbarActivity ScrollbarActivity;
|
2012-11-22 17:25:23 -08:00
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
class AsyncScroll;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
nsGfxScrollFrameInner(nsContainerFrame* aOuter, bool aIsRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
~nsGfxScrollFrameInner();
|
|
|
|
|
|
|
|
typedef nsIScrollableFrame::ScrollbarStyles ScrollbarStyles;
|
|
|
|
ScrollbarStyles GetScrollbarStylesFromFrame() const;
|
|
|
|
|
|
|
|
// If a child frame was added or removed on the scrollframe,
|
|
|
|
// reload our child frame list.
|
|
|
|
// We need this if a scrollbar frame is recreated.
|
|
|
|
void ReloadChildFrames();
|
|
|
|
|
2011-05-06 13:04:44 -07:00
|
|
|
nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aElements);
|
2012-08-22 08:56:38 -07:00
|
|
|
void AppendAnonymousContentTo(nsBaseContentList& aElements, uint32_t aFilter);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult FireScrollPortEvent();
|
|
|
|
void PostOverflowEvent();
|
|
|
|
void Destroy();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ShouldBuildLayer() const;
|
2011-03-09 13:35:27 -08:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-12-20 04:30:14 -08:00
|
|
|
void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
bool& aCreateLayer,
|
|
|
|
bool aPositioned);
|
2010-10-21 05:07:55 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GetBorderRadii(nscoord aRadii[8]) const;
|
2010-09-07 15:20:35 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIReflowCallback
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual bool ReflowFinished() MOZ_OVERRIDE;
|
|
|
|
virtual void ReflowCallbackCanceled() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
* Called when the 'curpos' attribute on one of the scrollbars changes.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
void CurPosAttributeChanged(nsIContent* aChild);
|
2013-08-08 15:04:59 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void PostScrollEvent();
|
|
|
|
void FireScrollEvent();
|
2010-01-11 13:45:19 -08:00
|
|
|
void PostScrolledAreaEvent();
|
|
|
|
void FireScrolledAreaEvent();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class ScrollEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
ScrollEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
2012-07-30 07:20:58 -07:00
|
|
|
void Revoke() { mInner = nullptr; }
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AsyncScrollPortEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
AsyncScrollPortEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
2012-07-30 07:20:58 -07:00
|
|
|
void Revoke() { mInner = nullptr; }
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2010-01-11 13:45:19 -08:00
|
|
|
class ScrolledAreaEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
ScrolledAreaEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
2012-07-30 07:20:58 -07:00
|
|
|
void Revoke() { mInner = nullptr; }
|
2010-01-11 13:45:19 -08:00
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-08-03 03:35:14 -07:00
|
|
|
void FinishReflowForScrollbar(nsIContent* aContent, nscoord aMinXY,
|
|
|
|
nscoord aMaxXY, nscoord aCurPosXY,
|
|
|
|
nscoord aPageIncrement,
|
|
|
|
nscoord aIncrement);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-08-08 15:04:59 -07:00
|
|
|
void SetScrollbarEnabled(nsIContent* aContent, nscoord aMaxPos);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-08-03 03:35:14 -07:00
|
|
|
void SetCoordAttribute(nsIContent* aContent, nsIAtom* aAtom, nscoord aSize);
|
2013-08-08 15:04:59 -07:00
|
|
|
|
2012-08-05 20:00:57 -07:00
|
|
|
nscoord GetCoordAttribute(nsIFrame* aFrame, nsIAtom* aAtom, nscoord aDefaultValue,
|
2012-05-09 22:24:19 -07:00
|
|
|
nscoord* aRangeStart, nscoord* aRangeLength);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
* Update scrollbar curpos attributes to reflect current scroll position
|
|
|
|
*/
|
2009-10-07 20:01:15 -07:00
|
|
|
void UpdateScrollbarPosition();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
nsRect GetScrollPortRect() const { return mScrollPort; }
|
2009-08-31 21:11:11 -07:00
|
|
|
nsPoint GetScrollPosition() const {
|
2009-10-07 20:01:15 -07:00
|
|
|
return mScrollPort.TopLeft() - mScrolledFrame->GetPosition();
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2011-02-06 23:59:20 -08:00
|
|
|
/**
|
|
|
|
* For LTR frames, the logical scroll position is the offset of the top left
|
|
|
|
* corner of the frame from the top left corner of the scroll port (same as
|
|
|
|
* GetScrollPosition).
|
|
|
|
* For RTL frames, it is the offset of the top right corner of the frame from
|
|
|
|
* the top right corner of the scroll port
|
|
|
|
*/
|
|
|
|
nsPoint GetLogicalScrollPosition() const {
|
|
|
|
nsPoint pt;
|
|
|
|
pt.x = IsLTR() ?
|
|
|
|
mScrollPort.x - mScrolledFrame->GetPosition().x :
|
|
|
|
mScrollPort.XMost() - mScrolledFrame->GetRect().XMost();
|
|
|
|
pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
|
|
|
|
return pt;
|
|
|
|
}
|
2009-08-31 21:11:11 -07:00
|
|
|
nsRect GetScrollRange() const;
|
2012-04-24 11:52:35 -07:00
|
|
|
// Get the scroll range assuming the scrollport has size (aWidth, aHeight).
|
|
|
|
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
|
2012-06-10 16:44:50 -07:00
|
|
|
nsSize GetScrollPositionClampingScrollPortSize() const;
|
2012-04-24 11:52:35 -07:00
|
|
|
protected:
|
|
|
|
nsRect GetScrollRangeForClamping() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-04-24 11:52:35 -07:00
|
|
|
public:
|
2012-03-31 06:08:00 -07:00
|
|
|
static void AsyncScrollCallback(void* anInstance, mozilla::TimeStamp aTime);
|
2012-02-07 16:53:18 -08:00
|
|
|
/**
|
2013-08-08 15:04:59 -07:00
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
2012-02-07 16:53:18 -08:00
|
|
|
* aRange is the range of allowable scroll positions around the desired
|
|
|
|
* aScrollPosition. Null means only aScrollPosition is allowed.
|
|
|
|
* This is a closed-ended range --- aRange.XMost()/aRange.YMost() are allowed.
|
|
|
|
*/
|
|
|
|
void ScrollTo(nsPoint aScrollPosition, nsIScrollableFrame::ScrollMode aMode,
|
2012-07-30 07:20:58 -07:00
|
|
|
const nsRect* aRange = nullptr) {
|
2012-02-07 16:53:18 -08:00
|
|
|
ScrollToWithOrigin(aScrollPosition, aMode, nsGkAtoms::other, aRange);
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-07-10 02:58:13 -07:00
|
|
|
void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-05-30 18:30:13 -07:00
|
|
|
void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition);
|
2013-08-08 15:04:59 -07:00
|
|
|
|
2013-07-10 02:58:13 -07:00
|
|
|
CSSIntPoint GetScrollPositionCSSPixels();
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-02-07 16:53:18 -08:00
|
|
|
void ScrollToImpl(nsPoint aScrollPosition, const nsRect& aRange);
|
2011-12-05 04:38:46 -08:00
|
|
|
void ScrollVisual(nsPoint aOldScrolledFramePosition);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2009-08-31 21:11:11 -07:00
|
|
|
void ScrollBy(nsIntPoint aDelta, nsIScrollableFrame::ScrollUnit aUnit,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsIScrollableFrame::ScrollMode aMode, nsIntPoint* aOverflow, nsIAtom *aOrigin = nullptr);
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
void ScrollToRestoredPosition();
|
2013-08-08 15:04:59 -07:00
|
|
|
|
2009-08-31 21:11:11 -07:00
|
|
|
nsSize GetLineScrollAmount() const;
|
|
|
|
nsSize GetPageScrollAmount() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-14 22:40:17 -08:00
|
|
|
nsPresState* SaveState();
|
2007-03-22 10:30:00 -07:00
|
|
|
void RestoreState(nsPresState* aState);
|
|
|
|
|
|
|
|
nsIFrame* GetScrolledFrame() const { return mScrolledFrame; }
|
2012-08-05 20:00:57 -07:00
|
|
|
nsIFrame* GetScrollbarBox(bool aVertical) const {
|
2009-08-31 21:11:11 -07:00
|
|
|
return aVertical ? mVScrollbarBox : mHScrollbarBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-28 16:03:42 -08:00
|
|
|
mListeners.AppendElement(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
|
|
|
void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-28 16:03:42 -08:00
|
|
|
mListeners.RemoveElement(aListener);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-05 20:00:57 -07:00
|
|
|
static void SetScrollbarVisibility(nsIFrame* aScrollbar, bool aVisible);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GetScrolledRect is designed to encapsulate deciding which
|
|
|
|
* directions of overflow should be reachable by scrolling and which
|
|
|
|
* should not. Callers should NOT depend on it having any particular
|
|
|
|
* behavior (although nsXULScrollFrame currently does).
|
2009-10-07 20:01:15 -07:00
|
|
|
*
|
|
|
|
* This should only be called when the scrolled frame has been
|
|
|
|
* reflowed with the scroll port size given in mScrollPort.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* Currently it allows scrolling down and to the right for
|
|
|
|
* nsHTMLScrollFrames with LTR directionality and for all
|
|
|
|
* nsXULScrollFrames, and allows scrolling down and to the left for
|
|
|
|
* nsHTMLScrollFrames with RTL directionality.
|
|
|
|
*/
|
2009-10-07 20:01:15 -07:00
|
|
|
nsRect GetScrolledRect() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GetScrolledRectInternal is designed to encapsulate deciding which
|
|
|
|
* directions of overflow should be reachable by scrolling and which
|
|
|
|
* should not. Callers should NOT depend on it having any particular
|
|
|
|
* behavior (although nsXULScrollFrame currently does).
|
|
|
|
*
|
|
|
|
* Currently it allows scrolling down and to the right for
|
|
|
|
* nsHTMLScrollFrames with LTR directionality and for all
|
|
|
|
* nsXULScrollFrames, and allows scrolling down and to the left for
|
|
|
|
* nsHTMLScrollFrames with RTL directionality.
|
|
|
|
*/
|
|
|
|
nsRect GetScrolledRectInternal(const nsRect& aScrolledOverflowArea,
|
|
|
|
const nsSize& aScrollPortSize) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t GetScrollbarVisibility() const {
|
2010-01-14 05:00:00 -08:00
|
|
|
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
|
|
|
|
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMargin GetActualScrollbarSizes() const;
|
|
|
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
2013-05-26 15:05:10 -07:00
|
|
|
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsLTR() const;
|
|
|
|
bool IsScrollbarOnRight() const;
|
|
|
|
bool IsScrollingActive() const { return mScrollingActive || ShouldBuildLayer(); }
|
2012-08-16 16:40:10 -07:00
|
|
|
void ResetScrollPositionForLayerPixelAlignment()
|
|
|
|
{
|
|
|
|
mScrollPosForLayerPixelAlignment = GetScrollPosition();
|
|
|
|
}
|
2011-06-15 14:03:49 -07:00
|
|
|
|
|
|
|
bool UpdateOverflow();
|
|
|
|
|
2010-03-19 04:49:34 -07:00
|
|
|
// adjust the scrollbar rectangle aRect to account for any visible resizer.
|
|
|
|
// aHasResizer specifies if there is a content resizer, however this method
|
|
|
|
// will also check if a widget resizer is present as well.
|
|
|
|
void AdjustScrollbarRectForResizer(nsIFrame* aFrame, nsPresContext* aPresContext,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsRect& aRect, bool aHasResizer, bool aVertical);
|
2010-03-19 04:49:34 -07:00
|
|
|
// returns true if a resizer should be visible
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasResizer() { return mResizerBox && !mCollapsedResizer; }
|
2007-03-22 10:30:00 -07:00
|
|
|
void LayoutScrollbars(nsBoxLayoutState& aState,
|
|
|
|
const nsRect& aContentArea,
|
2009-10-07 20:01:15 -07:00
|
|
|
const nsRect& aOldScrollArea);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-12-05 04:38:46 -08:00
|
|
|
bool IsIgnoringViewportClipping() const;
|
|
|
|
|
2012-02-17 15:41:13 -08:00
|
|
|
bool ShouldClampScrollPosition() const;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsAlwaysActive() const;
|
2010-07-15 14:08:05 -07:00
|
|
|
void MarkActive();
|
2011-01-04 00:46:59 -08:00
|
|
|
void MarkInactive();
|
2010-07-15 14:08:05 -07:00
|
|
|
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
|
|
|
|
|
2012-01-18 20:13:02 -08:00
|
|
|
void ScheduleSyntheticMouseMove();
|
|
|
|
static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance);
|
|
|
|
|
2013-07-16 05:58:44 -07:00
|
|
|
void HandleScrollbarStyleSwitching();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// owning references to the nsIAnonymousContentCreator-built content
|
|
|
|
nsCOMPtr<nsIContent> mHScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mVScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mScrollCornerContent;
|
2011-01-17 06:35:32 -08:00
|
|
|
nsCOMPtr<nsIContent> mResizerContent;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsRevocableEventPtr<ScrollEvent> mScrollEvent;
|
|
|
|
nsRevocableEventPtr<AsyncScrollPortEvent> mAsyncScrollPortEvent;
|
2010-01-11 13:45:19 -08:00
|
|
|
nsRevocableEventPtr<ScrolledAreaEvent> mScrolledAreaEvent;
|
2012-08-05 20:00:57 -07:00
|
|
|
nsIFrame* mHScrollbarBox;
|
|
|
|
nsIFrame* mVScrollbarBox;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* mScrolledFrame;
|
2012-08-05 20:00:57 -07:00
|
|
|
nsIFrame* mScrollCornerBox;
|
|
|
|
nsIFrame* mResizerBox;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsContainerFrame* mOuter;
|
2012-03-31 06:08:00 -07:00
|
|
|
nsRefPtr<AsyncScroll> mAsyncScroll;
|
2013-07-31 18:43:56 -07:00
|
|
|
nsRefPtr<ScrollbarActivity> mScrollbarActivity;
|
2010-01-28 16:03:42 -08:00
|
|
|
nsTArray<nsIScrollPositionListener*> mListeners;
|
2009-10-07 20:01:15 -07:00
|
|
|
nsRect mScrollPort;
|
|
|
|
// Where we're currently scrolling to, if we're scrolling asynchronously.
|
|
|
|
// If we're not in the middle of an asynchronous scroll then this is
|
|
|
|
// just the current scroll position. ScrollBy will choose its
|
|
|
|
// destination based on this value.
|
|
|
|
nsPoint mDestination;
|
2010-07-15 14:08:02 -07:00
|
|
|
nsPoint mScrollPosAtLastPaint;
|
2009-10-07 20:01:15 -07:00
|
|
|
|
2013-03-20 19:44:37 -07:00
|
|
|
// A goal position to try to scroll to as content loads. As long as mLastPos
|
|
|
|
// matches the current logical scroll position, we try to scroll to mRestorePos
|
|
|
|
// after every reflow --- because after each time content is loaded/added to the
|
|
|
|
// scrollable element, there will be a reflow.
|
2009-10-07 20:01:15 -07:00
|
|
|
nsPoint mRestorePos;
|
2013-03-20 19:44:37 -07:00
|
|
|
// The last logical position we scrolled to while trying to restore mRestorePos, or
|
|
|
|
// 0,0 when this is a new frame. Set to -1,-1 once we've scrolled for any reason
|
|
|
|
// other than trying to restore mRestorePos.
|
2007-03-22 10:30:00 -07:00
|
|
|
nsPoint mLastPos;
|
|
|
|
|
2010-07-15 14:08:05 -07:00
|
|
|
nsExpirationState mActivityExpirationState;
|
|
|
|
|
2012-01-18 20:13:02 -08:00
|
|
|
nsCOMPtr<nsITimer> mScrollActivityTimer;
|
2012-08-16 16:40:10 -07:00
|
|
|
nsPoint mScrollPosForLayerPixelAlignment;
|
2012-01-18 20:13:02 -08:00
|
|
|
|
2013-02-24 16:59:21 -08:00
|
|
|
// The scroll position where we last updated image visibility.
|
|
|
|
nsPoint mLastUpdateImagesPos;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mNeverHasVerticalScrollbar:1;
|
|
|
|
bool mNeverHasHorizontalScrollbar:1;
|
|
|
|
bool mHasVerticalScrollbar:1;
|
|
|
|
bool mHasHorizontalScrollbar:1;
|
|
|
|
bool mFrameIsUpdatingScrollbar:1;
|
|
|
|
bool mDidHistoryRestore:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// Is this the scrollframe for the document's viewport?
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsRoot:1;
|
2013-06-16 22:16:27 -07:00
|
|
|
// True if we should clip all descendants, false if we should only clip
|
|
|
|
// descendants for which we are the containing block.
|
|
|
|
bool mClipAllDescendants:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// If true, don't try to layout the scrollbars in Reflow(). This can be
|
|
|
|
// useful if multiple passes are involved, because we don't want to place the
|
|
|
|
// scrollbars at the wrong size.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mSupppressScrollbarUpdate:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// If true, we skipped a scrollbar layout due to mSupppressScrollbarUpdate
|
|
|
|
// being set at some point. That means we should lay out scrollbars even if
|
|
|
|
// it might not strictly be needed next time mSupppressScrollbarUpdate is
|
|
|
|
// false.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mSkippedScrollbarLayout:1;
|
2010-05-30 09:38:42 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHadNonInitialReflow:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
// State used only by PostScrollEvents so we know
|
|
|
|
// which overflow states have changed.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHorizontalOverflow:1;
|
|
|
|
bool mVerticalOverflow:1;
|
|
|
|
bool mPostedReflowCallback:1;
|
|
|
|
bool mMayHaveDirtyFixedChildren:1;
|
2009-06-23 18:35:00 -07:00
|
|
|
// If true, need to actually update our scrollbar attributes in the
|
|
|
|
// reflow callback.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mUpdateScrollbarAttributes:1;
|
2010-07-15 14:08:02 -07:00
|
|
|
// If true, we should be prepared to scroll using this scrollframe
|
|
|
|
// by placing descendant content into its own layer(s)
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mScrollingActive:1;
|
2011-01-17 06:35:32 -08:00
|
|
|
// If true, the resizer is collapsed and not displayed
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCollapsedResizer:1;
|
2011-03-09 13:35:27 -08:00
|
|
|
|
|
|
|
// If true, the layer should always be active because we always build a layer.
|
|
|
|
// Used for asynchronous scrolling.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mShouldBuildLayer:1;
|
2012-03-11 13:55:00 -07:00
|
|
|
|
2012-11-13 22:26:33 -08:00
|
|
|
// True if this frame has been scrolled at least once
|
|
|
|
bool mHasBeenScrolled:1;
|
|
|
|
|
2012-03-11 13:55:00 -07:00
|
|
|
protected:
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-03-26 02:53:45 -07:00
|
|
|
void ScrollToWithOrigin(nsPoint aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsIAtom *aOrigin, // nullptr indicates "other" origin
|
2012-02-07 16:53:18 -08:00
|
|
|
const nsRect* aRange);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The scroll frame creates and manages the scrolling view
|
|
|
|
*
|
|
|
|
* It only supports having a single child frame that typically is an area
|
|
|
|
* frame, but doesn't have to be. The child frame must have a view, though
|
|
|
|
*
|
|
|
|
* Scroll frames don't support incremental changes, i.e. you can't replace
|
|
|
|
* or remove the scrolled frame
|
|
|
|
*/
|
2011-12-27 12:18:48 -08:00
|
|
|
class nsHTMLScrollFrame : public nsContainerFrame,
|
2007-03-22 10:30:00 -07:00
|
|
|
public nsIScrollableFrame,
|
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
|
|
|
public:
|
2013-07-10 02:58:13 -07:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
2011-09-28 23:19:26 -07:00
|
|
|
friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE {
|
|
|
|
mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool TryLayout(ScrollReflowState* aState,
|
2007-12-04 19:05:57 -08:00
|
|
|
nsHTMLReflowMetrics* aKidMetrics,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aAssumeVScroll, bool aAssumeHScroll,
|
|
|
|
bool aForce, nsresult* aResult);
|
|
|
|
bool ScrolledContentDependsOnHeight(ScrollReflowState* aState);
|
2007-12-04 19:05:57 -08:00
|
|
|
nsresult ReflowScrolledFrame(ScrollReflowState* aState,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aAssumeHScroll,
|
|
|
|
bool aAssumeVScroll,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsHTMLReflowMetrics* aMetrics,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aFirstPass);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult ReflowContents(ScrollReflowState* aState,
|
|
|
|
const nsHTMLReflowMetrics& aDesiredSize);
|
2009-10-07 20:01:15 -07:00
|
|
|
void PlaceScrollArea(const ScrollReflowState& aState,
|
|
|
|
const nsPoint& aScrollPosition);
|
2011-04-07 18:04:40 -07:00
|
|
|
nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool GetBorderRadii(nscoord aRadii[8]) const MOZ_OVERRIDE {
|
2010-09-07 15:20:35 -07:00
|
|
|
return mInner.GetBorderRadii(aRadii);
|
|
|
|
}
|
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsCollapsed() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2013-05-14 09:33:23 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-03-05 04:26:41 -08:00
|
|
|
virtual bool UpdateOverflow() MOZ_OVERRIDE {
|
|
|
|
return mInner.UpdateOverflow();
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-09-01 04:22:31 -07:00
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE {
|
2009-09-01 04:22:31 -07:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool DoesClipChildren() MOZ_OVERRIDE { return true; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild) MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
|
|
|
if (aChild == mInner.GetScrolledFrame()) pt += GetScrollPosition();
|
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
|
2010-10-15 08:34:35 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
2012-09-14 09:10:08 -07:00
|
|
|
uint32_t aFilter) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-02 07:58:00 -07:00
|
|
|
// nsIScrollbarOwner
|
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE {
|
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIScrollableFrame
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const MOZ_OVERRIDE {
|
2010-01-14 05:00:00 -08:00
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetActualScrollbarSizes();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetDesiredScrollbarSizes(aState);
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsRenderingContext* aRC) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
2013-05-26 15:05:10 -07:00
|
|
|
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
|
|
|
nsRenderingContext* aRC) MOZ_OVERRIDE {
|
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return mInner.GetNondisappearingScrollbarWidth(&bls);
|
|
|
|
}
|
2013-07-23 06:22:58 -07:00
|
|
|
virtual nsRect GetScrolledRect() const MOZ_OVERRIDE {
|
|
|
|
return mInner.GetScrolledRect();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrollPortRect();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsPoint GetScrollPosition() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrollPosition();
|
|
|
|
}
|
2012-12-11 13:12:43 -08:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const MOZ_OVERRIDE {
|
|
|
|
return mInner.GetLogicalScrollPosition();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsRect GetScrollRange() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrollRange();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const MOZ_OVERRIDE {
|
2012-06-10 16:44:50 -07:00
|
|
|
return mInner.GetScrollPositionClampingScrollPortSize();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsSize GetLineScrollAmount() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetLineScrollAmount();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsSize GetPageScrollAmount() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetPageScrollAmount();
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-02-07 16:53:18 -08:00
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
2012-09-14 09:10:08 -07:00
|
|
|
const nsRect* aRange = nullptr) MOZ_OVERRIDE {
|
2012-02-07 16:53:18 -08:00
|
|
|
mInner.ScrollTo(aScrollPosition, aMode, aRange);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-07-10 02:58:13 -07:00
|
|
|
virtual void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition) MOZ_OVERRIDE {
|
2012-05-14 22:58:09 -07:00
|
|
|
mInner.ScrollToCSSPixels(aScrollPosition);
|
|
|
|
}
|
2013-05-30 18:30:13 -07:00
|
|
|
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition) MOZ_OVERRIDE {
|
2012-11-22 17:25:23 -08:00
|
|
|
mInner.ScrollToCSSPixelsApproximate(aScrollPosition);
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-07-10 02:58:13 -07:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() MOZ_OVERRIDE {
|
2012-08-10 04:17:06 -07:00
|
|
|
return mInner.GetScrollPositionCSSPixels();
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsIntPoint* aOverflow, nsIAtom *aOrigin = nullptr) MOZ_OVERRIDE {
|
2012-03-26 02:50:30 -07:00
|
|
|
mInner.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void ScrollToRestoredPosition() MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.ScrollToRestoredPosition();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.AddScrollPositionListener(aListener);
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.RemoveScrollPositionListener(aListener);
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() MOZ_OVERRIDE {
|
2010-01-11 13:45:19 -08:00
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual bool IsScrollingActive() MOZ_OVERRIDE {
|
2010-07-15 14:08:02 -07:00
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() MOZ_OVERRIDE {
|
2012-08-16 16:40:10 -07:00
|
|
|
mInner.ResetScrollPositionForLayerPixelAlignment();
|
|
|
|
}
|
2013-03-05 04:26:41 -08:00
|
|
|
virtual bool DidHistoryRestore() MOZ_OVERRIDE {
|
|
|
|
return mInner.mDidHistoryRestore;
|
2011-06-15 14:03:49 -07:00
|
|
|
}
|
2013-03-15 15:32:35 -07:00
|
|
|
virtual void ClearDidHistoryRestore() MOZ_OVERRIDE {
|
|
|
|
mInner.mDidHistoryRestore = false;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIStatefulFrame
|
2012-11-14 22:40:17 -08:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2012-11-14 22:40:17 -08:00
|
|
|
*aState = mInner.SaveState();
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::scrollFrame
|
|
|
|
*/
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-25 12:59:42 -07:00
|
|
|
#ifdef DEBUG
|
2013-05-14 09:33:23 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-28 14:53:44 -07:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2011-09-28 23:19:26 -07:00
|
|
|
nsHTMLScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot);
|
|
|
|
void SetSuppressScrollbarUpdate(bool aSuppress) {
|
2007-03-22 10:30:00 -07:00
|
|
|
mInner.mSupppressScrollbarUpdate = aSuppress;
|
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GuessHScrollbarNeeded(const ScrollReflowState& aState);
|
|
|
|
bool GuessVScrollbarNeeded(const ScrollReflowState& aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsScrollbarUpdateSuppressed() const {
|
2007-03-22 10:30:00 -07:00
|
|
|
return mInner.mSupppressScrollbarUpdate;
|
|
|
|
}
|
2007-04-25 19:29:21 -07:00
|
|
|
|
|
|
|
// Return whether we're in an "initial" reflow. Some reflows with
|
|
|
|
// NS_FRAME_FIRST_REFLOW set are NOT "initial" as far as we're concerned.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool InInitialReflow() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-12-06 16:10:31 -08:00
|
|
|
/**
|
|
|
|
* Override this to return false if computed height/min-height/max-height
|
|
|
|
* should NOT be propagated to child content.
|
|
|
|
* nsListControlFrame uses this.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool ShouldPropagateComputedHeightToScrolledContent() const { return true; }
|
2007-12-06 16:10:31 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
friend class nsGfxScrollFrameInner;
|
|
|
|
nsGfxScrollFrameInner mInner;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
class nsXULScrollFrame : public nsBoxFrame,
|
|
|
|
public nsIScrollableFrame,
|
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
|
|
|
public:
|
2013-07-10 02:58:13 -07:00
|
|
|
typedef mozilla::CSSIntPoint CSSIntPoint;
|
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 11:20:59 -08:00
|
|
|
|
2013-06-16 22:16:27 -07:00
|
|
|
friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext,
|
|
|
|
bool aIsRoot, bool aClipAllDescendants);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2013-05-14 09:33:23 -07:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE {
|
|
|
|
mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// XXXldb Is this actually used?
|
|
|
|
#if 0
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2013-03-05 04:26:41 -08:00
|
|
|
virtual bool UpdateOverflow() MOZ_OVERRIDE {
|
|
|
|
return mInner.UpdateOverflow();
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE {
|
2009-09-01 04:22:31 -07:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool DoesClipChildren() MOZ_OVERRIDE { return true; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild) MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
2011-02-06 23:59:20 -08:00
|
|
|
if (aChild == mInner.GetScrolledFrame())
|
|
|
|
pt += mInner.GetLogicalScrollPosition();
|
2007-03-22 10:30:00 -07:00
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
|
2010-10-15 08:34:35 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
2012-09-14 09:10:08 -07:00
|
|
|
uint32_t aFilter) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07: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;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool GetBorderRadii(nscoord aRadii[8]) const MOZ_OVERRIDE {
|
2010-09-07 15:20:35 -07:00
|
|
|
return mInner.GetBorderRadii(aRadii);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult Layout(nsBoxLayoutState& aState);
|
2009-10-07 20:01:15 -07:00
|
|
|
void LayoutScrollArea(nsBoxLayoutState& aState, const nsPoint& aScrollPosition);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool AddRemoveScrollbar(bool& aHasScrollbar,
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord& aXY,
|
|
|
|
nscoord& aSize,
|
|
|
|
nscoord aSbSize,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aAdd);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aHorizontal,
|
|
|
|
bool aAdd);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool AddHorizontalScrollbar (nsBoxLayoutState& aState, bool aOnBottom);
|
|
|
|
bool AddVerticalScrollbar (nsBoxLayoutState& aState, bool aOnRight);
|
|
|
|
void RemoveHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBottom);
|
|
|
|
void RemoveVerticalScrollbar (nsBoxLayoutState& aState, bool aOnRight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
|
|
|
|
static void AdjustReflowStateBack(nsBoxLayoutState& aState, bool aSetBack);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-02 07:58:00 -07:00
|
|
|
// nsIScrollbarOwner
|
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE {
|
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIScrollableFrame
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual uint32_t GetScrollbarVisibility() const MOZ_OVERRIDE {
|
2010-01-14 05:00:00 -08:00
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetActualScrollbarSizes();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetDesiredScrollbarSizes(aState);
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsRenderingContext* aRC) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
2013-05-26 15:05:10 -07:00
|
|
|
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
|
|
|
nsRenderingContext* aRC) MOZ_OVERRIDE {
|
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return mInner.GetNondisappearingScrollbarWidth(&bls);
|
|
|
|
}
|
2013-07-23 06:22:58 -07:00
|
|
|
virtual nsRect GetScrolledRect() const MOZ_OVERRIDE {
|
|
|
|
return mInner.GetScrolledRect();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrollPortRect();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsPoint GetScrollPosition() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrollPosition();
|
|
|
|
}
|
2012-12-11 13:12:43 -08:00
|
|
|
virtual nsPoint GetLogicalScrollPosition() const MOZ_OVERRIDE {
|
|
|
|
return mInner.GetLogicalScrollPosition();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsRect GetScrollRange() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetScrollRange();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const MOZ_OVERRIDE {
|
2012-06-10 16:44:50 -07:00
|
|
|
return mInner.GetScrollPositionClampingScrollPortSize();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsSize GetLineScrollAmount() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetLineScrollAmount();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsSize GetPageScrollAmount() const MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
return mInner.GetPageScrollAmount();
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-02-07 16:53:18 -08:00
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
2012-09-14 09:10:08 -07:00
|
|
|
const nsRect* aRange = nullptr) MOZ_OVERRIDE {
|
2012-02-07 16:53:18 -08:00
|
|
|
mInner.ScrollTo(aScrollPosition, aMode, aRange);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2013-07-10 02:58:13 -07:00
|
|
|
virtual void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition) MOZ_OVERRIDE {
|
2012-05-14 22:58:09 -07:00
|
|
|
mInner.ScrollToCSSPixels(aScrollPosition);
|
|
|
|
}
|
2013-05-30 18:30:13 -07:00
|
|
|
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition) MOZ_OVERRIDE {
|
2012-11-22 17:25:23 -08:00
|
|
|
mInner.ScrollToCSSPixelsApproximate(aScrollPosition);
|
|
|
|
}
|
2013-07-10 02:58:13 -07:00
|
|
|
virtual CSSIntPoint GetScrollPositionCSSPixels() MOZ_OVERRIDE {
|
2012-08-10 04:17:06 -07:00
|
|
|
return mInner.GetScrollPositionCSSPixels();
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsIntPoint* aOverflow, nsIAtom *aOrigin = nullptr) MOZ_OVERRIDE {
|
2012-03-26 02:50:30 -07:00
|
|
|
mInner.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin);
|
2009-08-31 21:11:11 -07:00
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void ScrollToRestoredPosition() MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.ScrollToRestoredPosition();
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.AddScrollPositionListener(aListener);
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.RemoveScrollPositionListener(aListener);
|
|
|
|
}
|
2013-08-08 15:04:59 -07:00
|
|
|
/**
|
|
|
|
* @note This method might destroy the frame, pres shell and other objects.
|
|
|
|
*/
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) MOZ_OVERRIDE {
|
2009-08-31 21:11:11 -07:00
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() MOZ_OVERRIDE {
|
2010-01-11 13:45:19 -08:00
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual bool IsScrollingActive() MOZ_OVERRIDE {
|
2010-07-15 14:08:02 -07:00
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual void ResetScrollPositionForLayerPixelAlignment() MOZ_OVERRIDE {
|
2012-08-16 16:40:10 -07:00
|
|
|
mInner.ResetScrollPositionForLayerPixelAlignment();
|
|
|
|
}
|
2013-03-05 04:26:41 -08:00
|
|
|
virtual bool DidHistoryRestore() MOZ_OVERRIDE {
|
|
|
|
return mInner.mDidHistoryRestore;
|
2011-06-15 14:03:49 -07:00
|
|
|
}
|
2013-03-15 15:32:35 -07:00
|
|
|
virtual void ClearDidHistoryRestore() MOZ_OVERRIDE {
|
|
|
|
mInner.mDidHistoryRestore = false;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIStatefulFrame
|
2012-11-14 22:40:17 -08:00
|
|
|
NS_IMETHOD SaveState(nsPresState** aState) MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2012-11-14 22:40:17 -08:00
|
|
|
*aState = mInner.SaveState();
|
2007-03-22 10:30:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) MOZ_OVERRIDE {
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::scrollFrame
|
|
|
|
*/
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// Override bogus IsFrameOfType in nsBoxFrame.
|
|
|
|
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2007-03-22 10:30:00 -07:00
|
|
|
return nsBoxFrame::IsFrameOfType(aFlags);
|
|
|
|
}
|
|
|
|
|
2012-06-25 12:59:42 -07:00
|
|
|
#ifdef DEBUG
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2013-06-16 22:16:27 -07:00
|
|
|
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot,
|
|
|
|
bool aClipAllDescendants);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-02-12 22:38:29 -08:00
|
|
|
void ClampAndSetBounds(nsBoxLayoutState& aState,
|
|
|
|
nsRect& aRect,
|
|
|
|
nsPoint aScrollPosition,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aRemoveOverflowAreas = false) {
|
2011-02-12 22:38:29 -08:00
|
|
|
/*
|
|
|
|
* For RTL frames, restore the original scrolled position of the right
|
|
|
|
* edge, then subtract the current width to find the physical position.
|
|
|
|
*/
|
|
|
|
if (!mInner.IsLTR()) {
|
2012-05-09 22:24:20 -07:00
|
|
|
aRect.x = mInner.mScrollPort.XMost() - aScrollPosition.x - aRect.width;
|
2011-02-12 22:38:29 -08:00
|
|
|
}
|
|
|
|
mInner.mScrolledFrame->SetBounds(aState, aRect, aRemoveOverflowAreas);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
friend class nsGfxScrollFrameInner;
|
|
|
|
nsGfxScrollFrameInner mInner;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsGfxScrollFrame_h___ */
|