2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
/* rendering object to wrap rendering objects that should be scrollable */
|
|
|
|
|
|
|
|
#ifndef nsGfxScrollFrame_h___
|
|
|
|
#define nsGfxScrollFrame_h___
|
|
|
|
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsIAnonymousContentCreator.h"
|
|
|
|
#include "nsBoxFrame.h"
|
2010-10-21 05:07:55 -07:00
|
|
|
#include "nsDisplayList.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIScrollableFrame.h"
|
|
|
|
#include "nsIScrollPositionListener.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"
|
2009-10-07 20:01:15 -07:00
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsSVGIntegrationUtils.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 nsIDocument;
|
|
|
|
class nsIScrollFrameInternal;
|
|
|
|
class nsPresState;
|
|
|
|
struct ScrollReflowState;
|
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
class nsGfxScrollFrameInner : public nsIReflowCallback {
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2009-10-07 20:01:15 -07:00
|
|
|
class AsyncScroll;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-02-06 23:59:20 -08:00
|
|
|
nsGfxScrollFrameInner(nsContainerFrame* aOuter, PRBool 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);
|
2010-10-15 08:34:35 -07:00
|
|
|
void AppendAnonymousContentTo(nsBaseContentList& aElements, PRUint32 aFilter);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult FireScrollPortEvent();
|
|
|
|
void PostOverflowEvent();
|
|
|
|
void Destroy();
|
|
|
|
|
2011-03-09 13:35:27 -08:00
|
|
|
PRBool ShouldBuildLayer() const;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2010-10-21 05:07:55 -07:00
|
|
|
nsresult AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
const nsDisplayListCollection& aDest,
|
|
|
|
PRBool& aCreateLayer);
|
|
|
|
|
2010-09-07 15:20:35 -07:00
|
|
|
PRBool GetBorderRadii(nscoord aRadii[8]) const;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIReflowCallback
|
|
|
|
virtual PRBool ReflowFinished();
|
2007-11-30 23:22:44 -08:00
|
|
|
virtual void ReflowCallbackCanceled();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// This gets called when the 'curpos' attribute on one of the scrollbars changes
|
|
|
|
void CurPosAttributeChanged(nsIContent* aChild);
|
|
|
|
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) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AsyncScrollPortEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
AsyncScrollPortEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2010-01-11 13:45:19 -08:00
|
|
|
class ScrolledAreaEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
ScrolledAreaEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07: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);
|
|
|
|
nscoord GetCoordAttribute(nsIBox* aFrame, nsIAtom* atom, nscoord defaultValue);
|
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
// Update scrollbar curpos attributes to reflect current scroll position
|
|
|
|
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;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
nsPoint ClampAndRestrictToDevPixels(const nsPoint& aPt, nsIntPoint* aPtDevPx) const;
|
|
|
|
nsPoint ClampScrollPosition(const nsPoint& aPt) const;
|
|
|
|
static void AsyncScrollCallback(nsITimer *aTimer, void* anInstance);
|
2009-08-31 21:11:11 -07:00
|
|
|
void ScrollTo(nsPoint aScrollPosition, nsIScrollableFrame::ScrollMode aMode);
|
2009-10-07 20:01:15 -07:00
|
|
|
void ScrollToImpl(nsPoint aScrollPosition);
|
2010-10-14 18:03:45 -07:00
|
|
|
void ScrollVisual();
|
2009-08-31 21:11:11 -07:00
|
|
|
void ScrollBy(nsIntPoint aDelta, nsIScrollableFrame::ScrollUnit aUnit,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode, nsIntPoint* aOverflow);
|
2007-03-22 10:30:00 -07:00
|
|
|
void ScrollToRestoredPosition();
|
2009-08-31 21:11:11 -07:00
|
|
|
nsSize GetLineScrollAmount() const;
|
|
|
|
nsSize GetPageScrollAmount() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsPresState* SaveState(nsIStatefulFrame::SpecialStateID aStateID);
|
|
|
|
void RestoreState(nsPresState* aState);
|
|
|
|
|
|
|
|
nsIFrame* GetScrolledFrame() const { return mScrolledFrame; }
|
2009-08-31 21:11:11 -07:00
|
|
|
nsIBox* GetScrollbarBox(PRBool aVertical) const {
|
|
|
|
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
|
|
|
|
|
|
|
static void SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
2010-01-14 05:00:00 -08:00
|
|
|
PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
|
|
|
|
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMargin GetActualScrollbarSizes() const;
|
|
|
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
|
|
|
PRBool IsLTR() const;
|
|
|
|
PRBool IsScrollbarOnRight() const;
|
2011-03-09 13:35:27 -08:00
|
|
|
PRBool IsScrollingActive() const { return mScrollingActive || ShouldBuildLayer(); }
|
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,
|
|
|
|
nsRect& aRect, PRBool aHasResizer, PRBool aVertical);
|
|
|
|
// returns true if a resizer should be visible
|
2011-01-17 06:35:32 -08:00
|
|
|
PRBool 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
|
|
|
|
2010-07-15 14:08:05 -07:00
|
|
|
PRBool IsAlwaysActive() const;
|
|
|
|
void MarkActive();
|
2011-01-04 00:46:59 -08:00
|
|
|
void MarkInactive();
|
2010-07-15 14:08:05 -07:00
|
|
|
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
|
|
|
|
|
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;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIBox* mHScrollbarBox;
|
|
|
|
nsIBox* mVScrollbarBox;
|
|
|
|
nsIFrame* mScrolledFrame;
|
|
|
|
nsIBox* mScrollCornerBox;
|
2011-01-17 06:35:32 -08:00
|
|
|
nsIBox* mResizerBox;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsContainerFrame* mOuter;
|
2009-10-07 20:01:15 -07:00
|
|
|
AsyncScroll* mAsyncScroll;
|
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
|
|
|
|
|
|
|
nsPoint mRestorePos;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsPoint mLastPos;
|
|
|
|
|
2010-07-15 14:08:05 -07:00
|
|
|
nsExpirationState mActivityExpirationState;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
PRPackedBool mNeverHasVerticalScrollbar:1;
|
|
|
|
PRPackedBool mNeverHasHorizontalScrollbar:1;
|
|
|
|
PRPackedBool mHasVerticalScrollbar:1;
|
|
|
|
PRPackedBool mHasHorizontalScrollbar:1;
|
2009-10-07 20:01:15 -07:00
|
|
|
PRPackedBool mFrameIsUpdatingScrollbar:1;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRPackedBool mDidHistoryRestore:1;
|
|
|
|
// Is this the scrollframe for the document's viewport?
|
|
|
|
PRPackedBool mIsRoot:1;
|
|
|
|
// 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.
|
|
|
|
PRPackedBool mSupppressScrollbarUpdate:1;
|
|
|
|
// 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.
|
|
|
|
PRPackedBool mSkippedScrollbarLayout:1;
|
2010-05-30 09:38:42 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
PRPackedBool mHadNonInitialReflow:1;
|
|
|
|
// State used only by PostScrollEvents so we know
|
|
|
|
// which overflow states have changed.
|
|
|
|
PRPackedBool mHorizontalOverflow:1;
|
|
|
|
PRPackedBool mVerticalOverflow:1;
|
|
|
|
PRPackedBool mPostedReflowCallback:1;
|
2007-12-20 15:49:46 -08:00
|
|
|
PRPackedBool mMayHaveDirtyFixedChildren:1;
|
2009-06-23 18:35:00 -07:00
|
|
|
// If true, need to actually update our scrollbar attributes in the
|
|
|
|
// reflow callback.
|
|
|
|
PRPackedBool 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)
|
|
|
|
PRPackedBool mScrollingActive:1;
|
2010-10-21 05:07:55 -07:00
|
|
|
// If true, scrollbars are stacked on the top of the display list and can
|
|
|
|
// float above the content as a result
|
|
|
|
PRPackedBool mScrollbarsCanOverlapContent:1;
|
2011-01-17 06:35:32 -08:00
|
|
|
// If true, the resizer is collapsed and not displayed
|
|
|
|
PRPackedBool 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.
|
|
|
|
PRPackedBool mShouldBuildLayer:1;
|
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
|
|
|
|
*/
|
|
|
|
class nsHTMLScrollFrame : public nsHTMLContainerFrame,
|
|
|
|
public nsIScrollableFrame,
|
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
|
|
|
public:
|
|
|
|
friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot);
|
|
|
|
|
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.
|
|
|
|
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
2009-07-28 05:53:20 -07:00
|
|
|
nsFrameList& aChildList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) {
|
|
|
|
return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool TryLayout(ScrollReflowState* aState,
|
2007-12-04 19:05:57 -08:00
|
|
|
nsHTMLReflowMetrics* aKidMetrics,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool aAssumeVScroll, PRBool aAssumeHScroll,
|
2007-12-04 19:05:57 -08:00
|
|
|
PRBool aForce, nsresult* aResult);
|
2008-02-23 02:15:59 -08:00
|
|
|
PRBool ScrolledContentDependsOnHeight(ScrollReflowState* aState);
|
2007-12-04 19:05:57 -08:00
|
|
|
nsresult ReflowScrolledFrame(ScrollReflowState* aState,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool aAssumeHScroll,
|
|
|
|
PRBool aAssumeVScroll,
|
|
|
|
nsHTMLReflowMetrics* aMetrics,
|
|
|
|
PRBool aFirstPass);
|
|
|
|
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
|
|
|
|
2010-09-07 15:20:35 -07:00
|
|
|
virtual PRBool GetBorderRadii(nscoord aRadii[8]) const {
|
|
|
|
return mInner.GetBorderRadii(aRadii);
|
|
|
|
}
|
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
|
|
|
virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-12-23 21:21:15 -08:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-09-01 04:22:31 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2009-09-01 04:22:31 -07:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 02:47:21 -07:00
|
|
|
PRUint32 aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual PRBool DoesClipChildren() { return PR_TRUE; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
|
|
|
|
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)
|
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
|
|
|
if (aChild == mInner.GetScrolledFrame()) pt += GetScrollPosition();
|
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2011-05-06 13:04:44 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
|
2010-10-15 08:34:35 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
|
|
|
PRUint32 aFilter);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const {
|
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2010-01-14 05:00:00 -08:00
|
|
|
virtual PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const {
|
|
|
|
return mInner.GetActualScrollbarSizes();
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) {
|
|
|
|
return mInner.GetDesiredScrollbarSizes(aState);
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2011-04-07 18:04:40 -07:00
|
|
|
nsRenderingContext* aRC) {
|
2009-08-31 21:11:11 -07: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();
|
|
|
|
}
|
|
|
|
virtual nsSize GetLineScrollAmount() const {
|
|
|
|
return mInner.GetLineScrollAmount();
|
|
|
|
}
|
|
|
|
virtual nsSize GetPageScrollAmount() const {
|
|
|
|
return mInner.GetPageScrollAmount();
|
|
|
|
}
|
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode) {
|
|
|
|
mInner.ScrollTo(aScrollPosition, aMode);
|
|
|
|
}
|
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
|
|
|
nsIntPoint* aOverflow) {
|
|
|
|
mInner.ScrollBy(aDelta, aUnit, aMode, aOverflow);
|
|
|
|
}
|
|
|
|
virtual void ScrollToRestoredPosition() {
|
|
|
|
mInner.ScrollToRestoredPosition();
|
|
|
|
}
|
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.AddScrollPositionListener(aListener);
|
|
|
|
}
|
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.RemoveScrollPositionListener(aListener);
|
|
|
|
}
|
|
|
|
virtual nsIBox* GetScrollbarBox(PRBool aVertical) {
|
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) {
|
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2010-01-11 13:45:19 -08:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() {
|
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2010-07-15 14:08:02 -07:00
|
|
|
virtual PRBool IsScrollingActive() {
|
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIStatefulFrame
|
|
|
|
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
*aState = mInner.SaveState(aStateID);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::scrollFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PRBool DidHistoryRestore() { return mInner.mDidHistoryRestore; }
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2010-06-28 05:02:03 -07:00
|
|
|
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsHTMLScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, PRBool aIsRoot);
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
|
|
|
void SetSuppressScrollbarUpdate(PRBool aSuppress) {
|
|
|
|
mInner.mSupppressScrollbarUpdate = aSuppress;
|
|
|
|
}
|
2008-02-23 02:15:59 -08:00
|
|
|
PRBool GuessHScrollbarNeeded(const ScrollReflowState& aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool GuessVScrollbarNeeded(const ScrollReflowState& aState);
|
|
|
|
|
|
|
|
PRBool IsScrollbarUpdateSuppressed() const {
|
|
|
|
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.
|
|
|
|
PRBool 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.
|
|
|
|
*/
|
|
|
|
virtual PRBool ShouldPropagateComputedHeightToScrolledContent() const { return PR_TRUE; }
|
|
|
|
|
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:
|
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
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot);
|
|
|
|
|
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
|
|
|
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
2009-07-28 05:53:20 -07:00
|
|
|
nsFrameList& aChildList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) {
|
|
|
|
return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXXldb Is this actually used?
|
|
|
|
#if 0
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-12-23 21:21:15 -08:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2009-09-01 04:22:31 -07:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 02:47:21 -07:00
|
|
|
PRUint32 aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual PRBool DoesClipChildren() { return PR_TRUE; }
|
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
|
|
|
|
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)
|
|
|
|
{ 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
|
2011-05-06 13:04:44 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
|
2010-10-15 08:34:35 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
|
|
|
PRUint32 aFilter);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
|
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
|
|
|
|
2010-09-07 15:20:35 -07:00
|
|
|
virtual PRBool GetBorderRadii(nscoord aRadii[8]) const {
|
|
|
|
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
|
|
|
|
|
|
|
static PRBool AddRemoveScrollbar(PRBool& aHasScrollbar,
|
|
|
|
nscoord& aXY,
|
|
|
|
nscoord& aSize,
|
|
|
|
nscoord aSbSize,
|
|
|
|
PRBool aOnRightOrBottom,
|
|
|
|
PRBool aAdd);
|
|
|
|
|
|
|
|
PRBool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
2011-03-03 13:18:42 -08:00
|
|
|
PRBool aOnRightOrBottom,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool aHorizontal,
|
|
|
|
PRBool aAdd);
|
|
|
|
|
2009-10-07 20:01:15 -07:00
|
|
|
PRBool AddHorizontalScrollbar (nsBoxLayoutState& aState, PRBool aOnBottom);
|
|
|
|
PRBool AddVerticalScrollbar (nsBoxLayoutState& aState, PRBool aOnRight);
|
|
|
|
void RemoveHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnBottom);
|
|
|
|
void RemoveVerticalScrollbar (nsBoxLayoutState& aState, PRBool aOnRight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, PRBool& aSetBack);
|
|
|
|
static void AdjustReflowStateBack(nsBoxLayoutState& aState, PRBool aSetBack);
|
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const {
|
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2010-01-14 05:00:00 -08:00
|
|
|
virtual PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2009-08-31 21:11:11 -07:00
|
|
|
virtual nsMargin GetActualScrollbarSizes() const {
|
|
|
|
return mInner.GetActualScrollbarSizes();
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) {
|
|
|
|
return mInner.GetDesiredScrollbarSizes(aState);
|
|
|
|
}
|
|
|
|
virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
|
2011-04-07 18:04:40 -07:00
|
|
|
nsRenderingContext* aRC) {
|
2009-08-31 21:11:11 -07: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();
|
|
|
|
}
|
|
|
|
virtual nsSize GetLineScrollAmount() const {
|
|
|
|
return mInner.GetLineScrollAmount();
|
|
|
|
}
|
|
|
|
virtual nsSize GetPageScrollAmount() const {
|
|
|
|
return mInner.GetPageScrollAmount();
|
|
|
|
}
|
|
|
|
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode) {
|
|
|
|
mInner.ScrollTo(aScrollPosition, aMode);
|
|
|
|
}
|
|
|
|
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
|
|
|
nsIntPoint* aOverflow) {
|
|
|
|
mInner.ScrollBy(aDelta, aUnit, aMode, aOverflow);
|
|
|
|
}
|
|
|
|
virtual void ScrollToRestoredPosition() {
|
|
|
|
mInner.ScrollToRestoredPosition();
|
|
|
|
}
|
|
|
|
virtual void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.AddScrollPositionListener(aListener);
|
|
|
|
}
|
|
|
|
virtual void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
|
|
|
mInner.RemoveScrollPositionListener(aListener);
|
|
|
|
}
|
|
|
|
virtual nsIBox* GetScrollbarBox(PRBool aVertical) {
|
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) {
|
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2010-01-11 13:45:19 -08:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() {
|
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2010-07-15 14:08:02 -07:00
|
|
|
virtual PRBool IsScrollingActive() {
|
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIStatefulFrame
|
|
|
|
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
*aState = mInner.SaveState(aStateID);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::scrollFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
|
|
|
{
|
|
|
|
// Override bogus IsFrameOfType in nsBoxFrame.
|
|
|
|
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
|
|
|
|
return PR_FALSE;
|
|
|
|
return nsBoxFrame::IsFrameOfType(aFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, PRBool aIsRoot);
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
2011-02-12 22:38:29 -08:00
|
|
|
void ClampAndSetBounds(nsBoxLayoutState& aState,
|
|
|
|
nsRect& aRect,
|
|
|
|
nsPoint aScrollPosition,
|
|
|
|
PRBool aRemoveOverflowAreas = PR_FALSE) {
|
|
|
|
/*
|
|
|
|
* For RTL frames, restore the original scrolled position of the right
|
|
|
|
* edge, then subtract the current width to find the physical position.
|
|
|
|
* This can break the invariant that the scroll position is a multiple of
|
|
|
|
* device pixels, so round off the result to the nearest device pixel.
|
|
|
|
*/
|
|
|
|
if (!mInner.IsLTR()) {
|
|
|
|
aRect.x = PresContext()->RoundAppUnitsToNearestDevPixels(
|
|
|
|
mInner.mScrollPort.XMost() - aScrollPosition.x - aRect.width);
|
|
|
|
}
|
|
|
|
mInner.mScrolledFrame->SetBounds(aState, aRect, aRemoveOverflowAreas);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
friend class nsGfxScrollFrameInner;
|
|
|
|
nsGfxScrollFrameInner mInner;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsGfxScrollFrame_h___ */
|