2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-08-20 02:16:23 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* 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/
|
1999-08-20 02:16:23 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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.
|
1999-08-20 02:16:23 +04:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* 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"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* rendering object to wrap rendering objects that should be scrollable */
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
#ifndef nsGfxScrollFrame_h___
|
|
|
|
#define nsGfxScrollFrame_h___
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsIAnonymousContentCreator.h"
|
2000-03-31 11:02:06 +04:00
|
|
|
#include "nsBoxFrame.h"
|
2010-10-21 16:07:55 +04:00
|
|
|
#include "nsDisplayList.h"
|
1999-12-07 06:36:05 +03:00
|
|
|
#include "nsIScrollableFrame.h"
|
2004-05-05 06:32:27 +04:00
|
|
|
#include "nsIScrollPositionListener.h"
|
2004-09-13 06:10:29 +04:00
|
|
|
#include "nsIStatefulFrame.h"
|
2006-05-10 21:30:15 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2007-03-05 04:39:53 +03:00
|
|
|
#include "nsIReflowCallback.h"
|
2008-04-10 08:39:41 +04:00
|
|
|
#include "nsBoxLayoutState.h"
|
2009-10-25 10:04:18 +03:00
|
|
|
#include "nsQueryFrame.h"
|
2009-10-08 07:01:15 +04:00
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsSVGIntegrationUtils.h"
|
2010-07-16 01:08:05 +04:00
|
|
|
#include "nsExpirationTracker.h"
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
class nsPresContext;
|
2004-05-05 06:32:27 +04:00
|
|
|
class nsIPresShell;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsIDocument;
|
2004-06-18 06:08:19 +04:00
|
|
|
class nsIScrollFrameInternal;
|
2005-01-28 01:52:53 +03:00
|
|
|
class nsPresState;
|
2005-04-29 01:57:22 +04:00
|
|
|
struct ScrollReflowState;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2009-10-08 07:01:15 +04:00
|
|
|
class nsGfxScrollFrameInner : public nsIReflowCallback {
|
2004-05-05 06:32:27 +04:00
|
|
|
public:
|
2009-10-08 07:01:15 +04:00
|
|
|
class AsyncScroll;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
nsGfxScrollFrameInner(nsContainerFrame* aOuter, bool aIsRoot);
|
2005-08-22 03:37:13 +04:00
|
|
|
~nsGfxScrollFrameInner();
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
typedef nsIScrollableFrame::ScrollbarStyles ScrollbarStyles;
|
2004-05-05 06:32:27 +04: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-07 00:04:44 +04:00
|
|
|
nsresult CreateAnonymousContent(
|
|
|
|
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aElements);
|
2010-10-15 19:34:35 +04:00
|
|
|
void AppendAnonymousContentTo(nsBaseContentList& aElements, PRUint32 aFilter);
|
2007-01-28 01:50:18 +03:00
|
|
|
nsresult FireScrollPortEvent();
|
|
|
|
void PostOverflowEvent();
|
2007-02-18 20:34:09 +03:00
|
|
|
void Destroy();
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ShouldBuildLayer() const;
|
2011-03-10 00:35:27 +03:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
nsresult BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2010-10-21 16:07:55 +04:00
|
|
|
nsresult AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
const nsDisplayListCollection& aDest,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool& aCreateLayer);
|
2010-10-21 16:07:55 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetBorderRadii(nscoord aRadii[8]) const;
|
2010-09-08 02:20:35 +04:00
|
|
|
|
2007-03-05 04:39:53 +03:00
|
|
|
// nsIReflowCallback
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ReflowFinished();
|
2007-12-01 10:22:44 +03:00
|
|
|
virtual void ReflowCallbackCanceled();
|
2007-03-05 04:39:53 +03:00
|
|
|
|
2004-05-05 06:32:27 +04:00
|
|
|
// This gets called when the 'curpos' attribute on one of the scrollbars changes
|
2006-03-15 19:55:19 +03:00
|
|
|
void CurPosAttributeChanged(nsIContent* aChild);
|
2005-08-22 03:37:13 +04:00
|
|
|
void PostScrollEvent();
|
|
|
|
void FireScrollEvent();
|
2010-01-12 00:45:19 +03:00
|
|
|
void PostScrolledAreaEvent();
|
|
|
|
void FireScrolledAreaEvent();
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
class ScrollEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
ScrollEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2007-01-28 01:50:18 +03:00
|
|
|
class AsyncScrollPortEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
AsyncScrollPortEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2010-01-12 00:45:19 +03:00
|
|
|
class ScrolledAreaEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
ScrolledAreaEvent(nsGfxScrollFrameInner *inner) : mInner(inner) {}
|
|
|
|
void Revoke() { mInner = nsnull; }
|
|
|
|
private:
|
|
|
|
nsGfxScrollFrameInner *mInner;
|
|
|
|
};
|
|
|
|
|
2007-03-14 01:11:14 +03: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);
|
2006-03-23 06:45:41 +03:00
|
|
|
nscoord GetCoordAttribute(nsIBox* aFrame, nsIAtom* atom, nscoord defaultValue);
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2009-10-08 07:01:15 +04:00
|
|
|
// Update scrollbar curpos attributes to reflect current scroll position
|
|
|
|
void UpdateScrollbarPosition();
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2009-10-08 07:01:15 +04:00
|
|
|
nsRect GetScrollPortRect() const { return mScrollPort; }
|
2009-09-01 08:11:11 +04:00
|
|
|
nsPoint GetScrollPosition() const {
|
2009-10-08 07:01:15 +04:00
|
|
|
return mScrollPort.TopLeft() - mScrolledFrame->GetPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2011-02-07 10:59:20 +03:00
|
|
|
/**
|
|
|
|
* For LTR frames, the logical scroll position is the offset of the top left
|
|
|
|
* corner of the frame from the top left corner of the scroll port (same as
|
|
|
|
* GetScrollPosition).
|
|
|
|
* For RTL frames, it is the offset of the top right corner of the frame from
|
|
|
|
* the top right corner of the scroll port
|
|
|
|
*/
|
|
|
|
nsPoint GetLogicalScrollPosition() const {
|
|
|
|
nsPoint pt;
|
|
|
|
pt.x = IsLTR() ?
|
|
|
|
mScrollPort.x - mScrolledFrame->GetPosition().x :
|
|
|
|
mScrollPort.XMost() - mScrolledFrame->GetRect().XMost();
|
|
|
|
pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
|
|
|
|
return pt;
|
|
|
|
}
|
2009-09-01 08:11:11 +04:00
|
|
|
nsRect GetScrollRange() const;
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2009-10-08 07:01:15 +04:00
|
|
|
nsPoint ClampAndRestrictToDevPixels(const nsPoint& aPt, nsIntPoint* aPtDevPx) const;
|
|
|
|
nsPoint ClampScrollPosition(const nsPoint& aPt) const;
|
|
|
|
static void AsyncScrollCallback(nsITimer *aTimer, void* anInstance);
|
2009-09-01 08:11:11 +04:00
|
|
|
void ScrollTo(nsPoint aScrollPosition, nsIScrollableFrame::ScrollMode aMode);
|
2009-10-08 07:01:15 +04:00
|
|
|
void ScrollToImpl(nsPoint aScrollPosition);
|
2010-10-15 05:03:45 +04:00
|
|
|
void ScrollVisual();
|
2009-09-01 08:11:11 +04:00
|
|
|
void ScrollBy(nsIntPoint aDelta, nsIScrollableFrame::ScrollUnit aUnit,
|
|
|
|
nsIScrollableFrame::ScrollMode aMode, nsIntPoint* aOverflow);
|
2004-07-24 01:39:47 +04:00
|
|
|
void ScrollToRestoredPosition();
|
2009-09-01 08:11:11 +04:00
|
|
|
nsSize GetLineScrollAmount() const;
|
|
|
|
nsSize GetPageScrollAmount() const;
|
2004-07-24 01:39:47 +04:00
|
|
|
|
2005-12-07 02:56:17 +03:00
|
|
|
nsPresState* SaveState(nsIStatefulFrame::SpecialStateID aStateID);
|
2005-01-28 01:52:53 +03:00
|
|
|
void RestoreState(nsPresState* aState);
|
2004-09-13 06:10:29 +04:00
|
|
|
|
2005-04-04 01:00:41 +04:00
|
|
|
nsIFrame* GetScrolledFrame() const { return mScrolledFrame; }
|
2011-09-29 10:19:26 +04:00
|
|
|
nsIBox* GetScrollbarBox(bool aVertical) const {
|
2009-09-01 08:11:11 +04:00
|
|
|
return aVertical ? mVScrollbarBox : mHScrollbarBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-29 03:03:42 +03:00
|
|
|
mListeners.AppendElement(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
|
|
|
void RemoveScrollPositionListener(nsIScrollPositionListener* aListener) {
|
2010-01-29 03:03:42 +03:00
|
|
|
mListeners.RemoveElement(aListener);
|
2009-09-01 08:11:11 +04:00
|
|
|
}
|
2004-07-18 16:02:53 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static void SetScrollbarVisibility(nsIBox* aScrollbar, bool aVisible);
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2006-03-15 19:55:19 +03:00
|
|
|
/**
|
|
|
|
* GetScrolledRect is designed to encapsulate deciding which
|
|
|
|
* directions of overflow should be reachable by scrolling and which
|
|
|
|
* should not. Callers should NOT depend on it having any particular
|
|
|
|
* behavior (although nsXULScrollFrame currently does).
|
2009-10-08 07:01:15 +04:00
|
|
|
*
|
|
|
|
* This should only be called when the scrolled frame has been
|
|
|
|
* reflowed with the scroll port size given in mScrollPort.
|
2006-03-15 19:55:19 +03:00
|
|
|
*
|
|
|
|
* Currently it allows scrolling down and to the right for
|
|
|
|
* nsHTMLScrollFrames with LTR directionality and for all
|
|
|
|
* nsXULScrollFrames, and allows scrolling down and to the left for
|
|
|
|
* nsHTMLScrollFrames with RTL directionality.
|
|
|
|
*/
|
2009-10-08 07:01:15 +04:00
|
|
|
nsRect GetScrolledRect() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GetScrolledRectInternal is designed to encapsulate deciding which
|
|
|
|
* directions of overflow should be reachable by scrolling and which
|
|
|
|
* should not. Callers should NOT depend on it having any particular
|
|
|
|
* behavior (although nsXULScrollFrame currently does).
|
|
|
|
*
|
|
|
|
* Currently it allows scrolling down and to the right for
|
|
|
|
* nsHTMLScrollFrames with LTR directionality and for all
|
|
|
|
* nsXULScrollFrames, and allows scrolling down and to the left for
|
|
|
|
* nsHTMLScrollFrames with RTL directionality.
|
|
|
|
*/
|
|
|
|
nsRect GetScrolledRectInternal(const nsRect& aScrolledOverflowArea,
|
|
|
|
const nsSize& aScrollPortSize) const;
|
2006-03-15 19:55:19 +03:00
|
|
|
|
2010-01-14 16:00:00 +03:00
|
|
|
PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return (mHasVerticalScrollbar ? nsIScrollableFrame::VERTICAL : 0) |
|
|
|
|
(mHasHorizontalScrollbar ? nsIScrollableFrame::HORIZONTAL : 0);
|
|
|
|
}
|
2004-09-29 06:19:06 +04:00
|
|
|
nsMargin GetActualScrollbarSizes() const;
|
2005-04-29 01:57:22 +04:00
|
|
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsLTR() const;
|
|
|
|
bool IsScrollbarOnRight() const;
|
|
|
|
bool IsScrollingActive() const { return mScrollingActive || ShouldBuildLayer(); }
|
2010-03-19 14:49:34 +03:00
|
|
|
// adjust the scrollbar rectangle aRect to account for any visible resizer.
|
|
|
|
// aHasResizer specifies if there is a content resizer, however this method
|
|
|
|
// will also check if a widget resizer is present as well.
|
|
|
|
void AdjustScrollbarRectForResizer(nsIFrame* aFrame, nsPresContext* aPresContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
nsRect& aRect, bool aHasResizer, bool aVertical);
|
2010-03-19 14:49:34 +03:00
|
|
|
// returns true if a resizer should be visible
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasResizer() { return mResizerBox && !mCollapsedResizer; }
|
2005-04-29 01:57:22 +04:00
|
|
|
void LayoutScrollbars(nsBoxLayoutState& aState,
|
|
|
|
const nsRect& aContentArea,
|
2009-10-08 07:01:15 +04:00
|
|
|
const nsRect& aOldScrollArea);
|
2004-05-05 06:32:27 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsAlwaysActive() const;
|
2010-07-16 01:08:05 +04:00
|
|
|
void MarkActive();
|
2011-01-04 11:46:59 +03:00
|
|
|
void MarkInactive();
|
2010-07-16 01:08:05 +04:00
|
|
|
nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
|
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
// owning references to the nsIAnonymousContentCreator-built content
|
|
|
|
nsCOMPtr<nsIContent> mHScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mVScrollbarContent;
|
|
|
|
nsCOMPtr<nsIContent> mScrollCornerContent;
|
2011-01-17 17:35:32 +03:00
|
|
|
nsCOMPtr<nsIContent> mResizerContent;
|
2007-02-18 20:34:09 +03:00
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
nsRevocableEventPtr<ScrollEvent> mScrollEvent;
|
2007-01-28 01:50:18 +03:00
|
|
|
nsRevocableEventPtr<AsyncScrollPortEvent> mAsyncScrollPortEvent;
|
2010-01-12 00:45:19 +03:00
|
|
|
nsRevocableEventPtr<ScrolledAreaEvent> mScrolledAreaEvent;
|
2004-05-05 06:32:27 +04:00
|
|
|
nsIBox* mHScrollbarBox;
|
|
|
|
nsIBox* mVScrollbarBox;
|
2005-04-04 01:00:41 +04:00
|
|
|
nsIFrame* mScrolledFrame;
|
2004-05-05 06:32:27 +04:00
|
|
|
nsIBox* mScrollCornerBox;
|
2011-01-17 17:35:32 +03:00
|
|
|
nsIBox* mResizerBox;
|
2005-04-29 01:57:22 +04:00
|
|
|
nsContainerFrame* mOuter;
|
2009-10-08 07:01:15 +04:00
|
|
|
AsyncScroll* mAsyncScroll;
|
2010-01-29 03:03:42 +03:00
|
|
|
nsTArray<nsIScrollPositionListener*> mListeners;
|
2009-10-08 07:01:15 +04:00
|
|
|
nsRect mScrollPort;
|
|
|
|
// Where we're currently scrolling to, if we're scrolling asynchronously.
|
|
|
|
// If we're not in the middle of an asynchronous scroll then this is
|
|
|
|
// just the current scroll position. ScrollBy will choose its
|
|
|
|
// destination based on this value.
|
|
|
|
nsPoint mDestination;
|
2010-07-16 01:08:02 +04:00
|
|
|
nsPoint mScrollPosAtLastPaint;
|
2009-10-08 07:01:15 +04:00
|
|
|
|
|
|
|
nsPoint mRestorePos;
|
2004-09-13 06:10:29 +04:00
|
|
|
nsPoint mLastPos;
|
|
|
|
|
2010-07-16 01:08:05 +04:00
|
|
|
nsExpirationState mActivityExpirationState;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mNeverHasVerticalScrollbar:1;
|
|
|
|
bool mNeverHasHorizontalScrollbar:1;
|
|
|
|
bool mHasVerticalScrollbar:1;
|
|
|
|
bool mHasHorizontalScrollbar:1;
|
|
|
|
bool mFrameIsUpdatingScrollbar:1;
|
|
|
|
bool mDidHistoryRestore:1;
|
2005-04-04 02:40:25 +04:00
|
|
|
// Is this the scrollframe for the document's viewport?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsRoot:1;
|
2007-01-19 21:01:10 +03:00
|
|
|
// If true, don't try to layout the scrollbars in Reflow(). This can be
|
|
|
|
// useful if multiple passes are involved, because we don't want to place the
|
|
|
|
// scrollbars at the wrong size.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSupppressScrollbarUpdate:1;
|
2007-01-19 21:01:10 +03:00
|
|
|
// If true, we skipped a scrollbar layout due to mSupppressScrollbarUpdate
|
|
|
|
// being set at some point. That means we should lay out scrollbars even if
|
|
|
|
// it might not strictly be needed next time mSupppressScrollbarUpdate is
|
|
|
|
// false.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSkippedScrollbarLayout:1;
|
2010-05-30 20:38:42 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHadNonInitialReflow:1;
|
2005-08-31 04:57:27 +04:00
|
|
|
// State used only by PostScrollEvents so we know
|
|
|
|
// which overflow states have changed.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHorizontalOverflow:1;
|
|
|
|
bool mVerticalOverflow:1;
|
|
|
|
bool mPostedReflowCallback:1;
|
|
|
|
bool mMayHaveDirtyFixedChildren:1;
|
2009-06-24 05:35:00 +04:00
|
|
|
// If true, need to actually update our scrollbar attributes in the
|
|
|
|
// reflow callback.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mUpdateScrollbarAttributes:1;
|
2010-07-16 01:08:02 +04:00
|
|
|
// If true, we should be prepared to scroll using this scrollframe
|
|
|
|
// by placing descendant content into its own layer(s)
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mScrollingActive:1;
|
2010-10-21 16:07:55 +04:00
|
|
|
// If true, scrollbars are stacked on the top of the display list and can
|
|
|
|
// float above the content as a result
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mScrollbarsCanOverlapContent:1;
|
2011-01-17 17:35:32 +03:00
|
|
|
// If true, the resizer is collapsed and not displayed
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCollapsedResizer:1;
|
2011-03-10 00:35:27 +03:00
|
|
|
|
|
|
|
// If true, the layer should always be active because we always build a layer.
|
|
|
|
// Used for asynchronous scrolling.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mShouldBuildLayer:1;
|
2004-05-05 06:32:27 +04:00
|
|
|
};
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The scroll frame creates and manages the scrolling view
|
|
|
|
*
|
|
|
|
* It only supports having a single child frame that typically is an area
|
|
|
|
* frame, but doesn't have to be. The child frame must have a view, though
|
|
|
|
*
|
|
|
|
* Scroll frames don't support incremental changes, i.e. you can't replace
|
|
|
|
* or remove the scrolled frame
|
|
|
|
*/
|
2005-04-29 01:57:22 +04:00
|
|
|
class nsHTMLScrollFrame : public nsHTMLContainerFrame,
|
2004-06-18 06:08:19 +04:00
|
|
|
public nsIScrollableFrame,
|
2004-09-13 06:10:29 +04:00
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
2004-06-18 06:08:19 +04:00
|
|
|
public:
|
2011-09-29 10:19:26 +04:00
|
|
|
friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsRoot);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 16:53:20 +04:00
|
|
|
nsFrameList& aChildList);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) {
|
|
|
|
return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool TryLayout(ScrollReflowState* aState,
|
2007-12-05 06:05:57 +03:00
|
|
|
nsHTMLReflowMetrics* aKidMetrics,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aAssumeVScroll, bool aAssumeHScroll,
|
|
|
|
bool aForce, nsresult* aResult);
|
|
|
|
bool ScrolledContentDependsOnHeight(ScrollReflowState* aState);
|
2007-12-05 06:05:57 +03:00
|
|
|
nsresult ReflowScrolledFrame(ScrollReflowState* aState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aAssumeHScroll,
|
|
|
|
bool aAssumeVScroll,
|
2005-04-29 01:57:22 +04:00
|
|
|
nsHTMLReflowMetrics* aMetrics,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aFirstPass);
|
2005-04-29 01:57:22 +04:00
|
|
|
nsresult ReflowContents(ScrollReflowState* aState,
|
|
|
|
const nsHTMLReflowMetrics& aDesiredSize);
|
2009-10-08 07:01:15 +04:00
|
|
|
void PlaceScrollArea(const ScrollReflowState& aState,
|
|
|
|
const nsPoint& aScrollPosition);
|
2011-04-08 05:04:40 +04:00
|
|
|
nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool GetBorderRadii(nscoord aRadii[8]) const {
|
2010-09-08 02:20:35 +04:00
|
|
|
return mInner.GetBorderRadii(aRadii);
|
|
|
|
}
|
|
|
|
|
2011-04-08 05:04:40 +04: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 08:38:33 +03:00
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsCollapsed(nsBoxLayoutState& aBoxLayoutState);
|
2007-01-22 07:27:31 +03:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
2004-06-18 06:08:19 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2009-12-24 08:21:15 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2009-09-01 15:22:31 +04:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
2004-06-18 06:08:19 +04:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2009-09-01 15:22:31 +04:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2004-07-18 16:02:53 +04:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
2006-06-08 05:11:43 +04:00
|
|
|
virtual void InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 13:47:21 +04:00
|
|
|
PRUint32 aFlags);
|
2006-06-08 05:11:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool DoesClipChildren() { return true; }
|
2006-12-20 06:52:34 +03:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2006-06-16 06:40:29 +04:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)
|
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
|
|
|
if (aChild == mInner.GetScrolledFrame()) pt += GetScrollPosition();
|
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
// nsIAnonymousContentCreator
|
2011-05-07 00:04:44 +04:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
|
2010-10-15 19:34:35 +04:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
|
|
|
PRUint32 aFilter);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
|
|
|
// nsIScrollableFrame
|
2009-09-01 08:11:11 +04:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const {
|
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2010-01-14 16:00:00 +03:00
|
|
|
virtual PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2009-09-01 08:11:11 +04: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 05:04:40 +04:00
|
|
|
nsRenderingContext* aRC) {
|
2009-09-01 08:11:11 +04: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);
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsIBox* GetScrollbarBox(bool aVertical) {
|
2009-09-01 08:11:11 +04:00
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) {
|
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2010-01-12 00:45:19 +03:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() {
|
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsScrollingActive() {
|
2010-07-16 01:08:02 +04:00
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2004-09-13 06:10:29 +04:00
|
|
|
// nsIStatefulFrame
|
2005-12-07 02:56:17 +03:00
|
|
|
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState) {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2005-12-07 02:56:17 +03:00
|
|
|
*aState = mInner.SaveState(aStateID);
|
2004-09-13 06:10:29 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-12-07 02:56:17 +03:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::scrollFrame
|
2004-06-18 06:08:19 +04:00
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool DidHistoryRestore() { return mInner.mDidHistoryRestore; }
|
2004-09-13 06:10:29 +04:00
|
|
|
|
2004-09-01 18:58:34 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2010-06-28 16:02:03 +04:00
|
|
|
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
2004-09-01 18:58:34 +04:00
|
|
|
#endif
|
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
protected:
|
2011-09-29 10:19:26 +04:00
|
|
|
nsHTMLScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot);
|
2004-06-18 06:08:19 +04:00
|
|
|
virtual PRIntn GetSkipSides() const;
|
2005-07-26 03:23:53 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetSuppressScrollbarUpdate(bool aSuppress) {
|
2005-07-26 03:23:53 +04:00
|
|
|
mInner.mSupppressScrollbarUpdate = aSuppress;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GuessHScrollbarNeeded(const ScrollReflowState& aState);
|
|
|
|
bool GuessVScrollbarNeeded(const ScrollReflowState& aState);
|
2004-06-18 06:08:19 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsScrollbarUpdateSuppressed() const {
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
return mInner.mSupppressScrollbarUpdate;
|
|
|
|
}
|
2007-04-26 06:29:21 +04:00
|
|
|
|
|
|
|
// Return whether we're in an "initial" reflow. Some reflows with
|
|
|
|
// NS_FRAME_FIRST_REFLOW set are NOT "initial" as far as we're concerned.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool InInitialReflow() const;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
2007-12-07 03:10:31 +03:00
|
|
|
/**
|
|
|
|
* Override this to return false if computed height/min-height/max-height
|
|
|
|
* should NOT be propagated to child content.
|
|
|
|
* nsListControlFrame uses this.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ShouldPropagateComputedHeightToScrolledContent() const { return true; }
|
2007-12-07 03:10:31 +03:00
|
|
|
|
2004-06-18 06:08:19 +04:00
|
|
|
private:
|
|
|
|
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-10 01:10:05 +04:00
|
|
|
public nsIScrollableFrame,
|
2004-09-13 06:10:29 +04:00
|
|
|
public nsIAnonymousContentCreator,
|
|
|
|
public nsIStatefulFrame {
|
1999-08-20 02:16:23 +04:00
|
|
|
public:
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 22:20:59 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsRoot);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2003-04-09 00:50:57 +04:00
|
|
|
// Called to set the child frames. We typically have three: the scroll area,
|
|
|
|
// the vertical scrollbar, and the horizontal scrollbar.
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 16:53:20 +04:00
|
|
|
nsFrameList& aChildList);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2006-01-26 05:29:17 +03: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 08:38:33 +03:00
|
|
|
// XXXldb Is this actually used?
|
|
|
|
#if 0
|
2011-04-08 05:04:40 +04: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 08:38:33 +03:00
|
|
|
#endif
|
2000-04-05 04:19:00 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
// Because there can be only one child frame, these two function return
|
|
|
|
// NS_ERROR_FAILURE
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
1999-08-20 02:16:23 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2009-12-24 08:21:15 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
1999-08-20 02:16:23 +04:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2009-09-01 15:22:31 +04:00
|
|
|
virtual nsIScrollableFrame* GetScrollTargetFrame() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2004-07-18 16:02:53 +04:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
|
|
|
return mInner.GetScrolledFrame()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
2006-06-08 05:11:43 +04:00
|
|
|
virtual void InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 13:47:21 +04:00
|
|
|
PRUint32 aFlags);
|
2006-06-08 05:11:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool DoesClipChildren() { return true; }
|
2006-12-20 06:52:34 +03:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
2005-04-04 01:00:41 +04:00
|
|
|
|
2006-06-16 06:40:29 +04:00
|
|
|
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)
|
|
|
|
{ nsPoint pt = aChild->GetPosition();
|
2011-02-07 10:59:20 +03:00
|
|
|
if (aChild == mInner.GetScrolledFrame())
|
|
|
|
pt += mInner.GetLogicalScrollPosition();
|
2006-06-16 06:40:29 +04:00
|
|
|
return pt;
|
|
|
|
}
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
// nsIAnonymousContentCreator
|
2011-05-07 00:04:44 +04:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
|
2010-10-15 19:34:35 +04:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
|
|
|
PRUint32 aFilter);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2007-01-08 05:57:59 +03:00
|
|
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
2007-01-31 19:02:42 +03:00
|
|
|
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState);
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2000-07-08 02:24:06 +04:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool GetBorderRadii(nscoord aRadii[8]) const {
|
2010-09-08 02:20:35 +04:00
|
|
|
return mInner.GetBorderRadii(aRadii);
|
|
|
|
}
|
|
|
|
|
2005-04-29 01:57:22 +04:00
|
|
|
nsresult Layout(nsBoxLayoutState& aState);
|
2009-10-08 07:01:15 +04:00
|
|
|
void LayoutScrollArea(nsBoxLayoutState& aState, const nsPoint& aScrollPosition);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool AddRemoveScrollbar(bool& aHasScrollbar,
|
2005-04-29 01:57:22 +04:00
|
|
|
nscoord& aXY,
|
|
|
|
nscoord& aSize,
|
|
|
|
nscoord aSbSize,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aAdd);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
|
|
|
bool aOnRightOrBottom,
|
|
|
|
bool aHorizontal,
|
|
|
|
bool aAdd);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool AddHorizontalScrollbar (nsBoxLayoutState& aState, bool aOnBottom);
|
|
|
|
bool AddVerticalScrollbar (nsBoxLayoutState& aState, bool aOnRight);
|
|
|
|
void RemoveHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBottom);
|
|
|
|
void RemoveVerticalScrollbar (nsBoxLayoutState& aState, bool aOnRight);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, bool& aSetBack);
|
|
|
|
static void AdjustReflowStateBack(nsBoxLayoutState& aState, bool aSetBack);
|
2005-04-29 01:57:22 +04:00
|
|
|
|
1999-12-07 06:36:05 +03:00
|
|
|
// nsIScrollableFrame
|
2009-09-01 08:11:11 +04:00
|
|
|
virtual nsIFrame* GetScrolledFrame() const {
|
|
|
|
return mInner.GetScrolledFrame();
|
|
|
|
}
|
|
|
|
virtual nsGfxScrollFrameInner::ScrollbarStyles GetScrollbarStyles() const {
|
|
|
|
return mInner.GetScrollbarStylesFromFrame();
|
|
|
|
}
|
2010-01-14 16:00:00 +03:00
|
|
|
virtual PRUint32 GetScrollbarVisibility() const {
|
|
|
|
return mInner.GetScrollbarVisibility();
|
|
|
|
}
|
2009-09-01 08:11:11 +04: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 05:04:40 +04:00
|
|
|
nsRenderingContext* aRC) {
|
2009-09-01 08:11:11 +04: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);
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsIBox* GetScrollbarBox(bool aVertical) {
|
2009-09-01 08:11:11 +04:00
|
|
|
return mInner.GetScrollbarBox(aVertical);
|
|
|
|
}
|
|
|
|
virtual void CurPosAttributeChanged(nsIContent* aChild) {
|
|
|
|
mInner.CurPosAttributeChanged(aChild);
|
|
|
|
}
|
2010-01-12 00:45:19 +03:00
|
|
|
NS_IMETHOD PostScrolledAreaEventForCurrentArea() {
|
|
|
|
mInner.PostScrolledAreaEvent();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsScrollingActive() {
|
2010-07-16 01:08:02 +04:00
|
|
|
return mInner.IsScrollingActive();
|
|
|
|
}
|
2003-04-09 15:27:09 +04:00
|
|
|
|
2004-09-13 06:10:29 +04:00
|
|
|
// nsIStatefulFrame
|
2005-12-07 02:56:17 +03:00
|
|
|
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState) {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
2005-12-07 02:56:17 +03:00
|
|
|
*aState = mInner.SaveState(aStateID);
|
2004-09-13 06:10:29 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-12-07 02:56:17 +03:00
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState) {
|
2004-09-13 06:10:29 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
mInner.RestoreState(aState);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::scrollFrame
|
1999-08-20 02:16:23 +04:00
|
|
|
*/
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
2007-02-24 21:33:33 +03:00
|
|
|
{
|
|
|
|
// Override bogus IsFrameOfType in nsBoxFrame.
|
|
|
|
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2007-02-24 21:33:33 +03:00
|
|
|
return nsBoxFrame::IsFrameOfType(aFlags);
|
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef NS_DEBUG
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2003-12-10 06:43:39 +03:00
|
|
|
protected:
|
2011-09-29 10:19:26 +04:00
|
|
|
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, bool aIsRoot);
|
2003-12-10 06:43:39 +03:00
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
2011-02-13 09:38:29 +03:00
|
|
|
void ClampAndSetBounds(nsBoxLayoutState& aState,
|
|
|
|
nsRect& aRect,
|
|
|
|
nsPoint aScrollPosition,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRemoveOverflowAreas = false) {
|
2011-02-13 09:38:29 +03:00
|
|
|
/*
|
|
|
|
* For RTL frames, restore the original scrolled position of the right
|
|
|
|
* edge, then subtract the current width to find the physical position.
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
private:
|
1999-10-13 02:58:04 +04:00
|
|
|
friend class nsGfxScrollFrameInner;
|
2004-05-05 06:32:27 +04:00
|
|
|
nsGfxScrollFrameInner mInner;
|
1999-08-20 02:16:23 +04:00
|
|
|
};
|
|
|
|
|
2003-04-11 12:26:42 +04:00
|
|
|
#endif /* nsGfxScrollFrame_h___ */
|