2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 18:29:03 +00:00
|
|
|
|
|
|
|
/* rendering object to wrap rendering objects that should be scrollable */
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
#ifndef nsGfxScrollFrame_h___
|
|
|
|
#define nsGfxScrollFrame_h___
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2011-12-27 20:18:48 +00:00
|
|
|
#include "nsContainerFrame.h"
|
1999-08-19 22:16:23 +00:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
2000-03-31 07:02:06 +00:00
|
|
|
#include "nsBoxFrame.h"
|
2010-10-21 12:07:55 +00:00
|
|
|
#include "nsDisplayList.h"
|
1999-12-07 03:36:05 +00:00
|
|
|
#include "nsIScrollableFrame.h"
|
2004-05-05 02:32:27 +00:00
|
|
|
#include "nsIScrollPositionListener.h"
|
2004-09-13 02:10:29 +00:00
|
|
|
#include "nsIStatefulFrame.h"
|
2006-05-10 17:30:15 +00:00
|
|
|
#include "nsThreadUtils.h"
|
2007-03-05 01:39:53 +00:00
|
|
|
#include "nsIReflowCallback.h"
|
2008-04-10 04:39:41 +00:00
|
|
|
#include "nsBoxLayoutState.h"
|
2009-10-25 07:04:18 +00:00
|
|
|
#include "nsQueryFrame.h"
|
2009-10-08 03:01:15 +00:00
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsSVGIntegrationUtils.h"
|
2010-07-15 21:08:05 +00:00
|
|
|
#include "nsExpirationTracker.h"
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
class nsPresContext;
|
2004-05-05 02:32:27 +00:00
|
|
|
class nsIPresShell;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsIDocument;
|
2004-06-18 02:08:19 +00:00
|
|
|
class nsIScrollFrameInternal;
|
2005-01-27 22:52:53 +00:00
|
|
|
class nsPresState;
|
2005-04-28 21:57:22 +00:00
|
|
|
struct ScrollReflowState;
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2011-10-21 01:41:36 +00: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-08 03:01:15 +00:00
|
|
|
class nsGfxScrollFrameInner : public nsIReflowCallback {
|
2004-05-05 02:32:27 +00:00
|
|
|
public:
|
2009-10-08 03:01:15 +00:00
|
|
|
class AsyncScroll;
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
nsGfxScrollFrameInner(nsContainerFrame* aOuter, bool aIsRoot);
|
2005-08-21 23:37:13 +00:00
|
|
|
~nsGfxScrollFrameInner();
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2012-06-07 05:11:42 +00:00
|
|
|
void Init();
|
|
|
|
|
2004-06-18 02:08:19 +00:00
|
|
|
typedef nsIScrollableFrame::ScrollbarStyles ScrollbarStyles;
|
2004-05-05 02:32:27 +00:00
|
|
|
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 20:04:44 +00:00
|
|
|
nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aElements);
|
2010-10-15 15:34:35 +00:00
|
|
|
void AppendAnonymousContentTo(nsBaseContentList& aElements, PRUint32 aFilter);
|
2007-01-27 22:50:18 +00:00
|
|
|
nsresult FireScrollPortEvent();
|
|
|
|
void PostOverflowEvent();
|
2007-02-18 17:34:09 +00:00
|
|
|
void Destroy();
|
2005-04-03 21:00:41 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ShouldBuildLayer() const;
|
2011-03-09 21:35:27 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
nsresult BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2011-12-20 12:30:14 +00:00
|
|
|
void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
bool& aCreateLayer,
|
|
|
|
bool aPositioned);
|
2010-10-21 12:07:55 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetBorderRadii(nscoord aRadii[8]) const;
|
2010-09-07 22:20:35 +00:00
|
|
|
|
2007-03-05 01:39:53 +00:00
|
|
|
// nsIReflowCallback
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool ReflowFinished();
|
2007-12-01 07:22:44 +00:00
|
|
|
virtual void ReflowCallbackCanceled();
|
2007-03-05 01:39:53 +00:00
|
|
|
|
2004-05-05 02:32:27 +00:00
|
|
|
// This gets called when the 'curpos' attribute on one of the scrollbars changes
|
2006-03-15 16:55:19 +00:00
|
|
|
void CurPosAttributeChanged(nsIContent* aChild);
|
2005-08-21 23:37:13 +00:00
|
|
|
void PostScrollEvent();
|
|
|
|
void FireScrollEvent();
|
2010-01-11 21:45:19 +00:00
|
|
|
void PostScrolledAreaEvent();
|
|
|
|
void FireScrolledAreaEvent();
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
class ScrollEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
ScrollEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2007-01-27 22:50:18 +00:00
|
|
|
class AsyncScrollPortEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
AsyncScrollPortEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2010-01-11 21:45:19 +00:00
|
|
|
class ScrolledAreaEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
ScrolledAreaEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2007-03-13 22:11:14 +00:00
|
|
|
static void FinishReflowForScrollbar(nsIContent* aContent, nscoord aMinXY,
|
|
|
|
nscoord aMaxXY, nscoord aCurPosXY,
|
|
|
|
nscoord aPageIncrement,
|
|
|
|
nscoord aIncrement);
|
|
|
|
static void SetScrollbarEnabled(nsIContent* aContent, nscoord aMaxPos);
|
|
|
|
static void SetCoordAttribute(nsIContent* aContent, nsIAtom* aAtom,
|
|
|
|
nscoord aSize);
|
2012-05-10 05:24:19 +00:00
|
|
|
nscoord GetCoordAttribute(nsIBox* aFrame, nsIAtom* aAtom, nscoord aDefaultValue,
|
|
|
|
nscoord* aRangeStart, nscoord* aRangeLength);
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2009-10-08 03:01:15 +00:00
|
|
|
// Update scrollbar curpos attributes to reflect current scroll position
|
|
|
|
void UpdateScrollbarPosition();
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2009-10-08 03:01:15 +00:00
|
|
|
nsRect GetScrollPortRect() const { return mScrollPort; }
|
2009-09-01 04:11:11 +00:00
|
|
|
nsPoint GetScrollPosition() const {
|
2009-10-08 03:01:15 +00:00
|
|
|
return mScrollPort.TopLeft() - mScrolledFrame->GetPosition();
|
2009-09-01 04:11:11 +00:00
|
|
|
}
|
2011-02-07 07:59:20 +00: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 04:11:11 +00:00
|
|
|
nsRect GetScrollRange() const;
|
2012-04-24 18:52:35 +00:00
|
|
|
// Get the scroll range assuming the scrollport has size (aWidth, aHeight).
|
|
|
|
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
|
2012-06-09 16:14:39 +00:00
|
|
|
nsSize GetScrollPositionClampingScrollPortSize() const;
|
2012-04-24 18:52:35 +00:00
|
|
|
protected:
|
|
|
|
nsRect GetScrollRangeForClamping() const;
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2012-04-24 18:52:35 +00:00
|
|
|
public:
|
2012-03-31 13:08:00 +00:00
|
|
|
static void AsyncScrollCallback(void* anInstance, mozilla::TimeStamp aTime);
|
2012-02-08 00:53:18 +00: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,
|
|
|
|
const nsRect* aRange = nsnull) {
|
|
|
|
ScrollToWithOrigin(aScrollPosition, aMode, nsGkAtoms::other, aRange);
|
|
|
|
}
|
2012-05-15 05:58:09 +00:00
|
|
|
void ScrollToCSSPixels(nsIntPoint aScrollPosition);
|
2012-02-08 00:53:18 +00:00
|
|
|
void ScrollToImpl(nsPoint aScrollPosition, const nsRect& aRange);
|
2011-12-05 12:38:46 +00:00
|
|
|
void ScrollVisual(nsPoint aOldScrolledFramePosition);
|
2009-09-01 04:11:11 +00:00
|
|
|
void ScrollBy(nsIntPoint aDelta, nsIScrollableFrame::ScrollUnit aUnit,
|
2012-03-26 09:50:30 +00:00
|
|
|
nsIScrollableFrame::ScrollMode aMode, nsIntPoint* aOverflow, nsIAtom *aOrigin = nsnull);
|
2004-07-23 21:39:47 +00:00
|
|
|
void ScrollToRestoredPosition();
|
2009-09-01 04:11:11 +00:00
|
|
|
nsSize GetLineScrollAmount() const;
|
|
|
|
nsSize GetPageScrollAmount() const;
|
2004-07-23 21:39:47 +00:00
|
|
|
|
2005-12-06 23:56:17 +00:00
|
|
|
nsPresState* SaveState(nsIStatefulFrame::SpecialStateID aStateID);
|
2005-01-27 22:52:53 +00:00
|
|
|
void RestoreState(nsPresState* aState);
|
2004-09-13 02:10:29 +00:00
|
|
|
|
2005-04-03 21:00:41 +00:00
|
|
|
nsIFrame* GetScrolledFrame() const { return mScrolledFrame; }
|
2011-09-29 06:19:26 +00:00
|
|
|
nsIBox* GetScrollbarBox(bool aVertical) const {
|
2009-09-01 04:11:11 +00:00
|
|
|
return aVertical ? mVScrollbarBox : mHScrollbarBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-29 00:03:42 +00:00
|
|
|
mListeners.AppendElement(aListener);
|
2009-09-01 04:11:11 +00:00
|
|
|
}
|
|
|
|
void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-29 00:03:42 +00:00
|
|
|
mListeners.RemoveElement(aListener);
|
2009-09-01 04:11:11 +00:00
|
|
|
}
|
2004-07-18 12:02:53 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static void SetScrollbarVisibility(nsIBox* aScrollbar, bool aVisible);
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2006-03-15 16:55:19 +00: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 03:01:15 +00:00
|
|
|
*
|
|
|
|
* This should only be called when the scrolled frame has been
|
|
|
|
* reflowed with the scroll port size given in mScrollPort.
|
2006-03-15 16:55:19 +00: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 03:01:15 +00: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 16:55:19 +00:00
|
|
|
|
2010-01-14 13:00:00 +00:00
|
|
|
PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
|
|
|
|
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
|
|
|
|
}
|
2004-09-29 02:19:06 +00:00
|
|
|
nsMargin GetActualScrollbarSizes() const;
|
2005-04-28 21:57:22 +00:00
|
|
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsLTR() const;
|
|
|
|
bool IsScrollbarOnRight() const;
|
|
|
|
bool IsScrollingActive() const { return mScrollingActive || ShouldBuildLayer(); }
|
2011-06-15 21:03:49 +00:00
|
|
|
|
|
|
|
bool UpdateOverflow();
|
|
|
|
|
2010-03-19 11:49:34 +00: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 06:19:26 +00:00
|
|
|
nsRect& aRect, bool aHasResizer, bool aVertical);
|
2010-03-19 11:49:34 +00:00
|
|
|
// returns true if a resizer should be visible
|
2011-09-29 06:19:26 +00:00
|
|
|
bool HasResizer() { return mResizerBox && !mCollapsedResizer; }
|
2005-04-28 21:57:22 +00:00
|
|
|
void LayoutScrollbars(nsBoxLayoutState& aState,
|
|
|
|
const nsRect& aContentArea,
|
2009-10-08 03:01:15 +00:00
|
|
|
const nsRect& aOldScrollArea);
|
2004-05-05 02:32:27 +00:00
|
|
|
|
2011-12-05 12:38:46 +00:00
|
|
|
bool IsIgnoringViewportClipping() const;
|
|
|
|
|
2012-02-17 23:41:13 +00:00
|
|
|
bool ShouldClampScrollPosition() const;
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsAlwaysActive() const;
|
2010-07-15 21:08:05 +00:00
|
|
|
void MarkActive();
|
2011-01-04 08:46:59 +00:00
|
|
|
void MarkInactive();
|
2010-07-15 21:08:05 +00:00
|
|
|
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
|
|
|
|
|
2012-01-19 04:13:02 +00:00
|
|
|
void ScheduleSyntheticMouseMove();
|
|
|
|
static void ScrollActivityCallback(nsITimer *aTimer, void* anInstance);
|
|
|
|
|
2007-02-18 17:34:09 +00:00
|
|
|
// owning references to the nsIAnonymousContentCreator-built content
|
|
|
|
nsCOMPtr<nsIContent> mHScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mVScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mScrollCornerContent;
|
2011-01-17 14:35:32 +00:00
|
|
|
nsCOMPtr<nsIContent> mResizerContent;
|
2007-02-18 17:34:09 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
nsRevocableEventPtr<ScrollEvent> mScrollEvent;
|
2007-01-27 22:50:18 +00:00
|
|
|
nsRevocableEventPtr<AsyncScrollPortEvent> mAsyncScrollPortEvent;
|
2010-01-11 21:45:19 +00:00
|
|
|
nsRevocableEventPtr<ScrolledAreaEvent> mScrolledAreaEvent;
|
2004-05-05 02:32:27 +00:00
|
|
|
nsIBox* mHScrollbarBox;
|
|
|
|
nsIBox* mVScrollbarBox;
|
2005-04-03 21:00:41 +00:00
|
|
|
nsIFrame* mScrolledFrame;
|
2004-05-05 02:32:27 +00:00
|
|
|
nsIBox* mScrollCornerBox;
|
2011-01-17 14:35:32 +00:00
|
|
|
nsIBox* mResizerBox;
|
2005-04-28 21:57:22 +00:00
|
|
|
nsContainerFrame* mOuter;
|
2012-03-31 13:08:00 +00:00
|
|
|
nsRefPtr<AsyncScroll> mAsyncScroll;
|
2010-01-29 00:03:42 +00:00
|
|
|
nsTArray<nsIScrollPositionListener*> mListeners;
|
2009-10-08 03:01:15 +00: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 21:08:02 +00:00
|
|
|
nsPoint mScrollPosAtLastPaint;
|
2009-10-08 03:01:15 +00:00
|
|
|
|
|
|
|
nsPoint mRestorePos;
|
2004-09-13 02:10:29 +00:00
|
|
|
nsPoint mLastPos;
|
|
|
|
|
2010-07-15 21:08:05 +00:00
|
|
|
nsExpirationState mActivityExpirationState;
|
|
|
|
|
2012-01-19 04:13:02 +00:00
|
|
|
nsCOMPtr<nsITimer> mScrollActivityTimer;
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mNeverHasVerticalScrollbar:1;
|
|
|
|
bool mNeverHasHorizontalScrollbar:1;
|
|
|
|
bool mHasVerticalScrollbar:1;
|
|
|
|
bool mHasHorizontalScrollbar:1;
|
|
|
|
bool mFrameIsUpdatingScrollbar:1;
|
|
|
|
bool mDidHistoryRestore:1;
|
2005-04-03 22:40:25 +00:00
|
|
|
// Is this the scrollframe for the document's viewport?
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsRoot:1;
|
2007-01-19 18:01:10 +00: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 06:19:26 +00:00
|
|
|
bool mSupppressScrollbarUpdate:1;
|
2007-01-19 18:01:10 +00: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 06:19:26 +00:00
|
|
|
bool mSkippedScrollbarLayout:1;
|
2010-05-30 16:38:42 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mHadNonInitialReflow:1;
|
2005-08-31 00:57:27 +00:00
|
|
|
// State used only by PostScrollEvents so we know
|
|
|
|
// which overflow states have changed.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mHorizontalOverflow:1;
|
|
|
|
bool mVerticalOverflow:1;
|
|
|
|
bool mPostedReflowCallback:1;
|
|
|
|
bool mMayHaveDirtyFixedChildren:1;
|
2009-06-24 01:35:00 +00:00
|
|
|
// If true, need to actually update our scrollbar attributes in the
|
|
|
|
// reflow callback.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mUpdateScrollbarAttributes:1;
|
2010-07-15 21:08:02 +00:00
|
|
|
// If true, we should be prepared to scroll using this scrollframe
|
|
|
|
// by placing descendant content into its own layer(s)
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mScrollingActive:1;
|
2011-01-17 14:35:32 +00:00
|
|
|
// If true, the resizer is collapsed and not displayed
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mCollapsedResizer:1;
|
2011-03-09 21:35:27 +00:00
|
|
|
|
|
|
|
// If true, the layer should always be active because we always build a layer.
|
|
|
|
// Used for asynchronous scrolling.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mShouldBuildLayer:1;
|
2012-03-11 20:55:00 +00:00
|
|
|
|
|
|
|
protected:
|
2012-03-26 09:53:45 +00:00
|
|
|
void ScrollToWithOrigin(nsPoint aScrollPosition,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode,
|
2012-02-08 00:53:18 +00:00
|
|
|
nsIAtom *aOrigin, // nsnull indicates "other" origin
|
|
|
|
const nsRect* aRange);
|
2004-05-05 02:32:27 +00:00
|
|
|
};
|
1999-08-19 22:16:23 +00: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 20:18:48 +00:00
|
|
|
class nsHTMLScrollFrame : public nsContainerFrame,
|
2004-06-18 02:08:19 +00:00
|
|
|
public nsIScrollableFrame,
|
2004-09-13 02:10:29 +00:00
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
2004-06-18 02:08:19 +00:00
|
|
|
public:
|
2011-09-29 06:19:26 +00:00
|
|
|
friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsRoot);
|
2004-06-18 02:08:19 +00:00
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2005-04-28 21:57:22 +00:00
|
|
|
|
2004-06-18 02:08:19 +00:00
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
2012-06-07 05:11:42 +00:00
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 12:53:20 +00:00
|
|
|
nsFrameList& aChildList);
|
2004-06-18 02:08:19 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) {
|
|
|
|
return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool TryLayout(ScrollReflowState* aState,
|
2007-12-05 03:05:57 +00:00
|
|
|
nsHTMLReflowMetrics* aKidMetrics,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aAssumeVScroll, bool aAssumeHScroll,
|
|
|
|
bool aForce, nsresult* aResult);
|
|
|
|
bool ScrolledContentDependsOnHeight(ScrollReflowState* aState);
|
2007-12-05 03:05:57 +00:00
|
|
|
nsresult ReflowScrolledFrame(ScrollReflowState* aState,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aAssumeHScroll,
|
|
|
|
bool aAssumeVScroll,
|
2005-04-28 21:57:22 +00:00
|
|
|
nsHTMLReflowMetrics* aMetrics,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aFirstPass);
|
2005-04-28 21:57:22 +00:00
|
|
|
nsresult ReflowContents(ScrollReflowState* aState,
|
|
|
|
const nsHTMLReflowMetrics& aDesiredSize);
|
2009-10-08 03:01:15 +00:00
|
|
|
void PlaceScrollArea(const ScrollReflowState& aState,
|
|
|
|
const nsPoint& aScrollPosition);
|
2011-04-08 01:04:40 +00:00
|
|
|
nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext);
|
2005-04-28 21:57:22 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool GetBorderRadii(nscoord aRadii[8]) const {
|
2010-09-07 22:20:35 +00:00
|
|
|
return mInner.GetBorderRadii(aRadii);
|
|
|
|
}
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
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 05:38:33 +00:00
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
2011-06-15 21:03:49 +00:00
|
|
|
virtual bool IsCollapsed();
|
2007-01-22 04:27:31 +00:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
2004-06-18 02:08:19 +00:00
|
|
|
|
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList);
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
2004-06-18 02:08:19 +00:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList);
|
2004-06-18 02:08:19 +00:00
|
|
|
|
2009-12-24 05:21:15 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2004-06-18 02:08:19 +00:00
|
|
|
|
2009-09-01 11:22:31 +00:00
|
|
|
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
2004-06-18 02:08:19 +00:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2009-09-01 11:22:31 +00:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2004-07-18 12:02:53 +00:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
2006-06-08 01:11:43 +00:00
|
|
|
virtual void InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 09:47:21 +00:00
|
|
|
PRUint32 aFlags);
|
2006-06-08 01:11:43 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool DoesClipChildren() { return true; }
|
2006-12-20 03:52:34 +00:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
2005-04-03 21:00:41 +00:00
|
|
|
|
2006-06-16 02:40:29 +00:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)
|
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
|
|
|
if (aChild == mInner.GetScrolledFrame()) pt += GetScrollPosition();
|
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
2004-06-18 02:08:19 +00:00
|
|
|
// nsIAnonymousContentCreator
|
2011-05-06 20:04:44 +00:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
|
2010-10-15 15:34:35 +00:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
|
|
|
PRUint32 aFilter);
|
2004-06-18 02:08:19 +00:00
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const {
|
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2010-01-14 13:00:00 +00:00
|
|
|
virtual PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const {
|
|
|
|
return mInner.GetActualScrollbarSizes();
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) {
|
|
|
|
return mInner.GetDesiredScrollbarSizes(aState);
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext* aRC) {
|
2009-09-01 04:11:11 +00:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
|
|
|
virtual nsRect GetScrollPortRect() const {
|
|
|
|
return mInner.GetScrollPortRect();
|
|
|
|
}
|
|
|
|
virtual nsPoint GetScrollPosition() const {
|
|
|
|
return mInner.GetScrollPosition();
|
|
|
|
}
|
|
|
|
virtual nsRect GetScrollRange() const {
|
|
|
|
return mInner.GetScrollRange();
|
|
|
|
}
|
2012-06-09 16:14:39 +00:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const {
|
|
|
|
return mInner.GetScrollPositionClampingScrollPortSize();
|
|
|
|
}
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual nsSize GetLineScrollAmount() const {
|
|
|
|
return mInner.GetLineScrollAmount();
|
|
|
|
}
|
|
|
|
virtual nsSize GetPageScrollAmount() const {
|
|
|
|
return mInner.GetPageScrollAmount();
|
|
|
|
}
|
2012-02-08 00:53:18 +00:00
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
|
|
|
const nsRect* aRange = nsnull) {
|
|
|
|
mInner.ScrollTo(aScrollPosition, aMode, aRange);
|
2009-09-01 04:11:11 +00:00
|
|
|
}
|
2012-05-15 05:58:09 +00:00
|
|
|
virtual void ScrollToCSSPixels(nsIntPoint aScrollPosition) {
|
|
|
|
mInner.ScrollToCSSPixels(aScrollPosition);
|
|
|
|
}
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2012-03-26 09:50:30 +00:00
|
|
|
nsIntPoint* aOverflow, nsIAtom *aOrigin = nsnull) {
|
|
|
|
mInner.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin);
|
2009-09-01 04:11:11 +00:00
|
|
|
}
|
|
|
|
virtual void ScrollToRestoredPosition() {
|
|
|
|
mInner.ScrollToRestoredPosition();
|
|
|
|
}
|
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.AddScrollPositionListener(aListener);
|
|
|
|
}
|
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.RemoveScrollPositionListener(aListener);
|
|
|
|
}
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual nsIBox* GetScrollbarBox(bool aVertical) {
|
2009-09-01 04:11:11 +00:00
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) {
|
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2010-01-11 21:45:19 +00:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() {
|
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsScrollingActive() {
|
2010-07-15 21:08:02 +00:00
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2011-06-15 21:03:49 +00:00
|
|
|
virtual bool UpdateOverflow() {
|
|
|
|
return mInner.UpdateOverflow();
|
|
|
|
}
|
2004-06-18 02:08:19 +00:00
|
|
|
|
2004-09-13 02:10:29 +00:00
|
|
|
// nsIStatefulFrame
|
2005-12-06 23:56:17 +00:00
|
|
|
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState) {
|
2004-09-13 02:10:29 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2005-12-06 23:56:17 +00:00
|
|
|
*aState = mInner.SaveState(aStateID);
|
2004-09-13 02:10:29 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-12-06 23:56:17 +00:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) {
|
2004-09-13 02:10:29 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-06-18 02:08:19 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 00:06:41 +00:00
|
|
|
* @see nsGkAtoms::scrollFrame
|
2004-06-18 02:08:19 +00:00
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool DidHistoryRestore() { return mInner.mDidHistoryRestore; }
|
2004-09-13 02:10:29 +00:00
|
|
|
|
2004-09-01 14:58:34 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-05-29 01:18:45 +00:00
|
|
|
virtual already_AddRefed<Accessible> CreateAccessible();
|
2004-09-01 14:58:34 +00:00
|
|
|
#endif
|
|
|
|
|
2004-06-18 02:08:19 +00:00
|
|
|
protected:
|
2011-09-29 06:19:26 +00:00
|
|
|
nsHTMLScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot);
|
2004-06-18 02:08:19 +00:00
|
|
|
virtual PRIntn GetSkipSides() const;
|
2005-07-25 23:23:53 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
void SetSuppressScrollbarUpdate(bool aSuppress) {
|
2005-07-25 23:23:53 +00:00
|
|
|
mInner.mSupppressScrollbarUpdate = aSuppress;
|
|
|
|
}
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GuessHScrollbarNeeded(const ScrollReflowState& aState);
|
|
|
|
bool GuessVScrollbarNeeded(const ScrollReflowState& aState);
|
2004-06-18 02:08:19 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsScrollbarUpdateSuppressed() 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 05:38:33 +00:00
|
|
|
return mInner.mSupppressScrollbarUpdate;
|
|
|
|
}
|
2007-04-26 02:29:21 +00: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 06:19:26 +00: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 05:38:33 +00:00
|
|
|
|
2007-12-07 00:10:31 +00: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 06:19:26 +00:00
|
|
|
virtual bool ShouldPropagateComputedHeightToScrolledContent() const { return true; }
|
2007-12-07 00:10:31 +00:00
|
|
|
|
2004-06-18 02:08:19 +00: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,
|
2000-10-09 21:10:05 +00:00
|
|
|
public nsIScrollableFrame,
|
2004-09-13 02:10:29 +00:00
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
1999-08-19 22:16:23 +00:00
|
|
|
public:
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 19:20:59 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsRoot);
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2003-04-08 20:50:57 +00:00
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
2012-06-07 05:11:42 +00:00
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 12:53:20 +00:00
|
|
|
nsFrameList& aChildList);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) {
|
|
|
|
return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
|
|
|
}
|
|
|
|
|
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 05:38:33 +00:00
|
|
|
// XXXldb Is this actually used?
|
|
|
|
#if 0
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
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 05:38:33 +00:00
|
|
|
#endif
|
2000-04-05 00:19:00 +00:00
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList);
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
1999-08-19 22:16:23 +00:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2009-12-24 05:21:15 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
1999-08-19 22:16:23 +00:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2009-09-01 11:22:31 +00:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2004-07-18 12:02:53 +00:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
2006-06-08 01:11:43 +00:00
|
|
|
virtual void InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 09:47:21 +00:00
|
|
|
PRUint32 aFlags);
|
2006-06-08 01:11:43 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool DoesClipChildren() { return true; }
|
2006-12-20 03:52:34 +00:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
2005-04-03 21:00:41 +00:00
|
|
|
|
2006-06-16 02:40:29 +00:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)
|
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
2011-02-07 07:59:20 +00:00
|
|
|
if (aChild == mInner.GetScrolledFrame())
|
|
|
|
pt += mInner.GetLogicalScrollPosition();
|
2006-06-16 02:40:29 +00:00
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
// nsIAnonymousContentCreator
|
2011-05-06 20:04:44 +00:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
|
2010-10-15 15:34:35 +00:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
|
|
|
PRUint32 aFilter);
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2007-01-08 02:57:59 +00:00
|
|
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
2007-01-31 16:02:42 +00:00
|
|
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
2000-05-15 04:12:31 +00:00
|
|
|
|
2000-07-07 22:24:06 +00:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
2000-03-31 07:02:06 +00:00
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool GetBorderRadii(nscoord aRadii[8]) const {
|
2010-09-07 22:20:35 +00:00
|
|
|
return mInner.GetBorderRadii(aRadii);
|
|
|
|
}
|
|
|
|
|
2005-04-28 21:57:22 +00:00
|
|
|
nsresult Layout(nsBoxLayoutState& aState);
|
2009-10-08 03:01:15 +00:00
|
|
|
void LayoutScrollArea(nsBoxLayoutState& aState, const nsPoint& aScrollPosition);
|
2005-04-28 21:57:22 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool AddRemoveScrollbar(bool& aHasScrollbar,
|
2005-04-28 21:57:22 +00:00
|
|
|
nscoord& aXY,
|
|
|
|
nscoord& aSize,
|
|
|
|
nscoord aSbSize,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aAdd);
|
2005-04-28 21:57:22 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aHorizontal,
|
|
|
|
bool aAdd);
|
2005-04-28 21:57:22 +00:00
|
|
|
|
2011-09-29 06:19:26 +00: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-28 21:57:22 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
|
|
|
|
static void AdjustReflowStateBack(nsBoxLayoutState& aState, bool aSetBack);
|
2005-04-28 21:57:22 +00:00
|
|
|
|
1999-12-07 03:36:05 +00:00
|
|
|
// nsIScrollableFrame
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const {
|
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2010-01-14 13:00:00 +00:00
|
|
|
virtual PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const {
|
|
|
|
return mInner.GetActualScrollbarSizes();
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) {
|
|
|
|
return mInner.GetDesiredScrollbarSizes(aState);
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext* aRC) {
|
2009-09-01 04:11:11 +00:00
|
|
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
|
|
|
return GetDesiredScrollbarSizes(&bls);
|
|
|
|
}
|
|
|
|
virtual nsRect GetScrollPortRect() const {
|
|
|
|
return mInner.GetScrollPortRect();
|
|
|
|
}
|
|
|
|
virtual nsPoint GetScrollPosition() const {
|
|
|
|
return mInner.GetScrollPosition();
|
|
|
|
}
|
|
|
|
virtual nsRect GetScrollRange() const {
|
|
|
|
return mInner.GetScrollRange();
|
|
|
|
}
|
2012-06-09 16:14:39 +00:00
|
|
|
virtual nsSize GetScrollPositionClampingScrollPortSize() const {
|
|
|
|
return mInner.GetScrollPositionClampingScrollPortSize();
|
|
|
|
}
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual nsSize GetLineScrollAmount() const {
|
|
|
|
return mInner.GetLineScrollAmount();
|
|
|
|
}
|
|
|
|
virtual nsSize GetPageScrollAmount() const {
|
|
|
|
return mInner.GetPageScrollAmount();
|
|
|
|
}
|
2012-02-08 00:53:18 +00:00
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
|
|
|
const nsRect* aRange = nsnull) {
|
|
|
|
mInner.ScrollTo(aScrollPosition, aMode, aRange);
|
2009-09-01 04:11:11 +00:00
|
|
|
}
|
2012-05-15 05:58:09 +00:00
|
|
|
virtual void ScrollToCSSPixels(nsIntPoint aScrollPosition) {
|
|
|
|
mInner.ScrollToCSSPixels(aScrollPosition);
|
|
|
|
}
|
2009-09-01 04:11:11 +00:00
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
2012-03-26 09:50:30 +00:00
|
|
|
nsIntPoint* aOverflow, nsIAtom *aOrigin = nsnull) {
|
|
|
|
mInner.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin);
|
2009-09-01 04:11:11 +00:00
|
|
|
}
|
|
|
|
virtual void ScrollToRestoredPosition() {
|
|
|
|
mInner.ScrollToRestoredPosition();
|
|
|
|
}
|
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.AddScrollPositionListener(aListener);
|
|
|
|
}
|
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.RemoveScrollPositionListener(aListener);
|
|
|
|
}
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual nsIBox* GetScrollbarBox(bool aVertical) {
|
2009-09-01 04:11:11 +00:00
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) {
|
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2010-01-11 21:45:19 +00:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() {
|
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsScrollingActive() {
|
2010-07-15 21:08:02 +00:00
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2011-06-15 21:03:49 +00:00
|
|
|
virtual bool UpdateOverflow() {
|
|
|
|
return mInner.UpdateOverflow();
|
|
|
|
}
|
2003-04-09 11:27:09 +00:00
|
|
|
|
2004-09-13 02:10:29 +00:00
|
|
|
// nsIStatefulFrame
|
2005-12-06 23:56:17 +00:00
|
|
|
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState) {
|
2004-09-13 02:10:29 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2005-12-06 23:56:17 +00:00
|
|
|
*aState = mInner.SaveState(aStateID);
|
2004-09-13 02:10:29 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-12-06 23:56:17 +00:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) {
|
2004-09-13 02:10:29 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 00:06:41 +00:00
|
|
|
* @see nsGkAtoms::scrollFrame
|
1999-08-19 22:16:23 +00:00
|
|
|
*/
|
2003-10-31 20:19:18 +00:00
|
|
|
virtual nsIAtom* GetType() const;
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
2007-02-24 18:33:33 +00:00
|
|
|
{
|
|
|
|
// Override bogus IsFrameOfType in nsBoxFrame.
|
|
|
|
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2007-02-24 18:33:33 +00:00
|
|
|
return nsBoxFrame::IsFrameOfType(aFlags);
|
|
|
|
}
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef NS_DEBUG
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2003-12-10 03:43:39 +00:00
|
|
|
protected:
|
2011-09-29 06:19:26 +00:00
|
|
|
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot);
|
2003-12-10 03:43:39 +00:00
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
2011-02-13 06:38:29 +00:00
|
|
|
void ClampAndSetBounds(nsBoxLayoutState& aState,
|
|
|
|
nsRect& aRect,
|
|
|
|
nsPoint aScrollPosition,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aRemoveOverflowAreas = false) {
|
2011-02-13 06:38:29 +00: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-10 05:24:20 +00:00
|
|
|
aRect.x = mInner.mScrollPort.XMost() - aScrollPosition.x - aRect.width;
|
2011-02-13 06:38:29 +00:00
|
|
|
}
|
|
|
|
mInner.mScrolledFrame->SetBounds(aState, aRect, aRemoveOverflowAreas);
|
|
|
|
}
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
private:
|
1999-10-12 22:58:04 +00:00
|
|
|
friend class nsGfxScrollFrameInner;
|
2004-05-05 02:32:27 +00:00
|
|
|
nsGfxScrollFrameInner mInner;
|
1999-08-19 22:16:23 +00:00
|
|
|
};
|
|
|
|
|
2003-04-11 08:26:42 +00:00
|
|
|
#endif /* nsGfxScrollFrame_h___ */
|