2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-08-20 02:16:23 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
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
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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.
|
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
|
|
|
|
* either 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 NPL, 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 NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-08-20 02:16:23 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIReflowCommand.h"
|
|
|
|
#include "nsIDeviceContext.h"
|
|
|
|
#include "nsPageFrame.h"
|
|
|
|
#include "nsViewsCID.h"
|
2000-01-25 09:35:27 +03:00
|
|
|
#include "nsIServiceManager.h"
|
1999-08-20 02:16:23 +04:00
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsHTMLIIDs.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsIScrollableView.h"
|
|
|
|
#include "nsWidgetsCID.h"
|
|
|
|
#include "nsGfxScrollFrame.h"
|
|
|
|
#include "nsLayoutAtoms.h"
|
|
|
|
#include "nsIXMLContent.h"
|
|
|
|
#include "nsXULAtoms.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
#include "nsISupportsArray.h"
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIFontMetrics.h"
|
1999-10-12 04:16:06 +04:00
|
|
|
#include "nsIDocumentObserver.h"
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIScrollPositionListener.h"
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
//#include "nsBoxFrame.h"
|
2000-01-25 09:35:27 +03:00
|
|
|
#include "nsIElementFactory.h"
|
2000-03-31 11:02:06 +04:00
|
|
|
#include "nsBoxLayoutState.h"
|
2000-05-10 17:13:39 +04:00
|
|
|
#include "nsINodeInfo.h"
|
2000-07-14 03:00:59 +04:00
|
|
|
#include "nsIScrollbarFrame.h"
|
|
|
|
#include "nsIScrollbarMediator.h"
|
2000-08-04 02:42:36 +04:00
|
|
|
#include "nsIGfxTextControlFrame.h"
|
|
|
|
#include "nsIDOMHTMLTextAreaElement.h"
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2001-10-25 05:08:40 +04:00
|
|
|
static NS_DEFINE_CID(kWidgetCID, NS_CHILD_CID);
|
|
|
|
static NS_DEFINE_CID(kScrollingViewCID, NS_SCROLLING_VIEW_CID);
|
|
|
|
static NS_DEFINE_CID(kViewCID, NS_VIEW_CID);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
class nsGfxScrollFrameInner : public nsIDocumentObserver,
|
|
|
|
public nsIScrollPositionListener {
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
nsGfxScrollFrameInner(nsGfxScrollFrame* aOuter);
|
|
|
|
virtual ~nsGfxScrollFrameInner();
|
|
|
|
|
|
|
|
// nsIScrollPositionListener
|
|
|
|
|
1999-10-15 08:29:30 +04:00
|
|
|
NS_IMETHOD ScrollPositionWillChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY);
|
|
|
|
NS_IMETHOD ScrollPositionDidChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
|
|
|
// nsIDocumentObserver
|
|
|
|
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
|
|
|
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
|
|
|
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
|
|
|
|
NS_IMETHOD EndLoad(nsIDocument *aDocument) { return NS_OK; }
|
|
|
|
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
|
|
|
|
nsIPresShell* aShell) { return NS_OK; }
|
|
|
|
NS_IMETHOD EndReflow(nsIDocument *aDocument,
|
|
|
|
nsIPresShell* aShell) { return NS_OK; }
|
|
|
|
NS_IMETHOD ContentChanged(nsIDocument* aDoc,
|
|
|
|
nsIContent* aContent,
|
|
|
|
nsISupports* aSubContent) { return NS_OK; }
|
|
|
|
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
|
|
|
|
nsIContent* aContent1,
|
|
|
|
nsIContent* aContent2) { return NS_OK; }
|
|
|
|
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContent,
|
1999-10-16 03:16:45 +04:00
|
|
|
PRInt32 aNameSpaceID,
|
1999-10-12 04:16:06 +04:00
|
|
|
nsIAtom* aAttribute,
|
2001-08-25 06:01:08 +04:00
|
|
|
PRInt32 aModType,
|
1999-10-12 04:16:06 +04:00
|
|
|
PRInt32 aHint);
|
|
|
|
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
PRInt32 aNewIndexInContainer) { return NS_OK; }
|
|
|
|
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) { return NS_OK; }
|
|
|
|
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aOldChild,
|
|
|
|
nsIContent* aNewChild,
|
|
|
|
PRInt32 aIndexInContainer) { return NS_OK; }
|
|
|
|
NS_IMETHOD ContentRemoved(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) { return NS_OK; }
|
|
|
|
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
|
|
|
|
nsIStyleSheet* aStyleSheet) { return NS_OK; }
|
|
|
|
NS_IMETHOD StyleSheetRemoved(nsIDocument *aDocument,
|
|
|
|
nsIStyleSheet* aStyleSheet) { return NS_OK; }
|
|
|
|
NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
PRBool aDisabled) { return NS_OK; }
|
|
|
|
NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule,
|
|
|
|
PRInt32 aHint) { return NS_OK; }
|
|
|
|
NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule) { return NS_OK; }
|
|
|
|
NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument,
|
|
|
|
nsIStyleSheet* aStyleSheet,
|
|
|
|
nsIStyleRule* aStyleRule) { return NS_OK; }
|
|
|
|
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument) { mDocument = nsnull; return NS_OK; }
|
|
|
|
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
PRBool SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, PRBool aReflow=PR_TRUE);
|
|
|
|
PRInt32 GetIntegerAttribute(nsIBox* aFrame, nsIAtom* atom, PRInt32 defaultValue);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsresult Layout(nsBoxLayoutState& aState);
|
|
|
|
nsresult LayoutBox(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
PRBool AddRemoveScrollbar (PRBool& aHasScrollbar,
|
2000-04-03 10:26:38 +04:00
|
|
|
nscoord& aXY,
|
|
|
|
nscoord& aSize,
|
|
|
|
nscoord aSbSize,
|
|
|
|
PRBool aOnRightOrBottom,
|
|
|
|
PRBool aAdd);
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
PRBool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
|
|
|
nsRect& aScrollAreaSize,
|
|
|
|
PRBool aOnTop,
|
|
|
|
PRBool aHorizontal,
|
|
|
|
PRBool aAdd);
|
|
|
|
|
|
|
|
PRBool AddHorizontalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnBottom);
|
|
|
|
PRBool AddVerticalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight);
|
|
|
|
PRBool RemoveHorizontalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnBottom);
|
|
|
|
PRBool RemoveVerticalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
1999-10-26 08:44:41 +04:00
|
|
|
nsIScrollableView* GetScrollableView(nsIPresContext* aPresContext);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
1999-10-26 08:44:41 +04:00
|
|
|
void ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
void SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible);
|
|
|
|
|
2000-07-08 02:24:06 +04:00
|
|
|
NS_IMETHOD GetScrolledSize(nsIPresContext* aPresContext,
|
|
|
|
nscoord *aWidth,
|
|
|
|
nscoord *aHeight) const;
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIBox* mHScrollbarBox;
|
|
|
|
nsIBox* mVScrollbarBox;
|
|
|
|
nsIBox* mScrollAreaBox;
|
1999-10-12 04:16:06 +04:00
|
|
|
nscoord mOnePixel;
|
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
|
|
|
nsGfxScrollFrame* mOuter;
|
|
|
|
nsIScrollableView* mScrollableView;
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
nsSize mMaxElementSize;
|
|
|
|
|
2000-05-14 03:00:53 +04:00
|
|
|
PRBool mNeverHasVerticalScrollbar;
|
|
|
|
PRBool mNeverHasHorizontalScrollbar;
|
|
|
|
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
PRBool mHasVerticalScrollbar;
|
|
|
|
PRBool mHasHorizontalScrollbar;
|
|
|
|
PRBool mFirstPass;
|
|
|
|
PRBool mIsRoot;
|
2000-02-11 00:36:28 +03:00
|
|
|
PRBool mNeverReflowed;
|
1999-10-12 04:16:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS2(nsGfxScrollFrameInner, nsIDocumentObserver, nsIScrollPositionListener)
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
nsresult
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_NewGfxScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, nsIDocument* aDocument, PRBool aIsRoot)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrame* it = new (aPresShell) nsGfxScrollFrame(aPresShell, aDocument, aIsRoot);
|
1999-08-20 02:16:23 +04:00
|
|
|
if (nsnull == it) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
*aNewFrame = it;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrame::nsGfxScrollFrame(nsIPresShell* aShell, nsIDocument* aDocument, PRBool aIsRoot):nsBoxFrame(aShell, aIsRoot)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
1999-10-12 04:16:06 +04:00
|
|
|
mInner = new nsGfxScrollFrameInner(this);
|
|
|
|
mInner->AddRef();
|
|
|
|
mInner->mDocument = aDocument;
|
1999-10-26 08:44:41 +04:00
|
|
|
mPresContext = nsnull;
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
mInner->mIsRoot = PR_FALSE;
|
2000-02-11 00:36:28 +03:00
|
|
|
mInner->mNeverReflowed = PR_TRUE;
|
2000-03-31 11:02:06 +04:00
|
|
|
SetLayoutManager(nsnull);
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsGfxScrollFrame::~nsGfxScrollFrame()
|
|
|
|
{
|
|
|
|
mInner->mOuter = nsnull;
|
|
|
|
mInner->Release();
|
1999-10-26 08:44:41 +04:00
|
|
|
mPresContext = nsnull;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
1999-12-07 06:36:05 +03:00
|
|
|
/**
|
|
|
|
* Set the view that we are scrolling within the scrolling view.
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::SetScrolledFrame(nsIPresContext* aPresContext, nsIFrame *aScrolledFrame)
|
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_ERROR("Not implemented!");
|
|
|
|
/*
|
|
|
|
mFrames.DestroyFrame(aPresContext, mInner->mScrollAreaBox);
|
|
|
|
mInner->mScrollAreaBox = aScrolledFrame;
|
|
|
|
mFrames.InsertFrame(nsnull, nsnull, mInner->mScrollAreaBox);
|
|
|
|
*/
|
1999-12-07 06:36:05 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the view that we are scrolling within the scrolling view.
|
|
|
|
* @result child view
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetScrolledFrame(nsIPresContext* aPresContext, nsIFrame *&aScrolledFrame) const
|
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIBox* child = nsnull;
|
|
|
|
mInner->mScrollAreaBox->GetChildBox(&child);
|
|
|
|
child->GetFrame(&aScrolledFrame);
|
|
|
|
return NS_OK;
|
1999-12-07 06:36:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetClipSize(nsIPresContext* aPresContext,
|
|
|
|
nscoord *aWidth,
|
|
|
|
nscoord *aHeight) const
|
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
nsRect rect;
|
|
|
|
mInner->mScrollAreaBox->GetBounds(rect);
|
|
|
|
*aWidth = rect.width;
|
|
|
|
*aHeight = rect.height;
|
1999-12-07 06:36:05 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get information about whether the vertical and horizontal scrollbars
|
2000-05-14 03:00:53 +04:00
|
|
|
* are currently visible
|
1999-12-07 06:36:05 +03:00
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetScrollbarVisibility(nsIPresContext* aPresContext,
|
|
|
|
PRBool *aVerticalVisible,
|
|
|
|
PRBool *aHorizontalVisible) const
|
|
|
|
{
|
|
|
|
*aVerticalVisible = mInner->mHasVerticalScrollbar;
|
|
|
|
*aHorizontalVisible = mInner->mHasHorizontalScrollbar;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-07-27 10:57:32 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetScrollableView(nsIPresContext* aContext, nsIScrollableView** aResult)
|
|
|
|
{
|
|
|
|
*aResult = mInner->GetScrollableView(aContext);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2000-05-14 03:00:53 +04:00
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetScrollPosition(nsIPresContext* aContext, nscoord &aX, nscoord& aY) const
|
|
|
|
{
|
|
|
|
nsIScrollableView* s = mInner->GetScrollableView(aContext);
|
|
|
|
return s->GetScrollPosition(aX, aY);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::ScrollTo(nsIPresContext* aContext, nscoord aX, nscoord aY, PRUint32 aFlags)
|
|
|
|
{
|
|
|
|
nsIScrollableView* s = mInner->GetScrollableView(aContext);
|
|
|
|
return s->ScrollTo(aX, aY, aFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Query whether scroll bars should be displayed all the time, never or
|
|
|
|
* only when necessary.
|
|
|
|
* @return current scrollbar selection
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
2000-05-17 08:45:44 +04:00
|
|
|
nsGfxScrollFrame::GetScrollPreference(nsIPresContext* aPresContext, nsScrollPref* aScrollPreference) const
|
2000-05-15 08:12:31 +04:00
|
|
|
{
|
|
|
|
const nsStyleDisplay* styleDisplay = nsnull;
|
|
|
|
|
|
|
|
GetStyleData(eStyleStruct_Display,
|
|
|
|
(const nsStyleStruct*&)styleDisplay);
|
|
|
|
|
|
|
|
switch (styleDisplay->mOverflow)
|
|
|
|
{
|
|
|
|
case NS_STYLE_OVERFLOW_SCROLL:
|
|
|
|
*aScrollPreference = AlwaysScroll;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL:
|
|
|
|
*aScrollPreference = AlwaysScrollHorizontal;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL:
|
|
|
|
*aScrollPreference = AlwaysScrollVertical;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_OVERFLOW_AUTO:
|
|
|
|
*aScrollPreference = Auto;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
*aScrollPreference = NeverScroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetScrollbarSizes(nsIPresContext* aPresContext,
|
|
|
|
nscoord *aVbarWidth,
|
|
|
|
nscoord *aHbarHeight) const
|
|
|
|
{
|
|
|
|
nsBoxLayoutState state(aPresContext);
|
|
|
|
|
|
|
|
nsSize hs;
|
|
|
|
mInner->mHScrollbarBox->GetPrefSize(state, hs);
|
|
|
|
*aHbarHeight = hs.height;
|
|
|
|
|
|
|
|
nsSize vs;
|
|
|
|
mInner->mVScrollbarBox->GetPrefSize(state, vs);
|
|
|
|
*aVbarWidth = vs.width;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-05-14 03:00:53 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::SetScrollbarVisibility(nsIPresContext* aPresContext,
|
|
|
|
PRBool aVerticalVisible,
|
|
|
|
PRBool aHorizontalVisible)
|
|
|
|
{
|
|
|
|
mInner->mNeverHasVerticalScrollbar = !aVerticalVisible;
|
|
|
|
mInner->mNeverHasHorizontalScrollbar = !aHorizontalVisible;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-06-07 03:14:11 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetScrollbarBox(PRBool aVertical, nsIBox** aResult)
|
|
|
|
{
|
|
|
|
*aResult = aVertical ? mInner->mVScrollbarBox : mInner->mHScrollbarBox;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2000-05-14 03:00:53 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
NS_IMETHODIMP
|
2000-01-22 04:16:50 +03:00
|
|
|
nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
|
|
|
nsISupportsArray& aAnonymousChildren)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-08-04 02:42:36 +04:00
|
|
|
// The anonymous <div> used by <inputs> never gets scrollbars.
|
|
|
|
nsCOMPtr<nsIGfxTextControlFrame2> textFrame(do_QueryInterface(mParent));
|
|
|
|
if (textFrame) {
|
|
|
|
// Make sure we are not a text area.
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mParent->GetContent(getter_AddRefs(content));
|
2000-08-06 00:48:22 +04:00
|
|
|
nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement(do_QueryInterface(content));
|
2000-08-04 02:42:36 +04:00
|
|
|
if (!textAreaElement) {
|
|
|
|
SetScrollbarVisibility(aPresContext, PR_FALSE, PR_FALSE);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
// create horzontal scrollbar
|
2000-01-25 09:35:27 +03:00
|
|
|
nsresult rv;
|
2001-07-25 11:54:28 +04:00
|
|
|
nsCOMPtr<nsIElementFactory> elementFactory =
|
|
|
|
do_GetService(NS_ELEMENT_FACTORY_CONTRACTID_PREFIX "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", &rv);
|
2000-01-25 09:35:27 +03:00
|
|
|
if (!elementFactory)
|
|
|
|
return NS_ERROR_FAILURE;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-05-10 17:13:39 +04:00
|
|
|
nsCOMPtr<nsINodeInfoManager> nodeInfoManager;
|
|
|
|
mInner->mDocument->GetNodeInfoManager(*getter_AddRefs(nodeInfoManager));
|
|
|
|
NS_ENSURE_TRUE(nodeInfoManager, NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
nsCOMPtr<nsINodeInfo> nodeInfo;
|
2001-11-14 04:33:42 +03:00
|
|
|
nodeInfoManager->GetNodeInfo(NS_LITERAL_STRING("scrollbar"),
|
|
|
|
NS_LITERAL_STRING(""),
|
|
|
|
NS_LITERAL_STRING("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"),
|
|
|
|
*getter_AddRefs(nodeInfo));
|
2000-05-10 17:13:39 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
nsCOMPtr<nsIContent> content;
|
2000-05-10 17:13:39 +04:00
|
|
|
elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content));
|
2001-08-17 12:14:14 +04:00
|
|
|
content->SetAttr(kNameSpaceID_None, nsXULAtoms::orient,
|
|
|
|
NS_LITERAL_STRING("horizontal"), PR_FALSE);
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2001-08-17 12:14:14 +04:00
|
|
|
content->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed,
|
|
|
|
NS_LITERAL_STRING("true"), PR_FALSE);
|
2000-05-15 08:12:31 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
aAnonymousChildren.AppendElement(content);
|
|
|
|
|
|
|
|
// create vertical scrollbar
|
2000-01-25 09:35:27 +03:00
|
|
|
content = nsnull;
|
2000-05-10 17:13:39 +04:00
|
|
|
elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content));
|
2001-08-17 12:14:14 +04:00
|
|
|
content->SetAttr(kNameSpaceID_None, nsXULAtoms::orient,
|
|
|
|
NS_LITERAL_STRING("vertical"), PR_FALSE);
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2001-08-17 12:14:14 +04:00
|
|
|
content->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed,
|
|
|
|
NS_LITERAL_STRING("true"), PR_FALSE);
|
2000-05-15 08:12:31 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
aAnonymousChildren.AppendElement(content);
|
|
|
|
|
|
|
|
// XXX For GFX never have scrollbars
|
|
|
|
// mScrollableView->SetScrollPreference(nsScrollPreference_kNeverScroll);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxScrollFrame::Destroy(nsIPresContext* aPresContext)
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
return nsBoxFrame::Destroy(aPresContext);
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxScrollFrame::Init(nsIPresContext* aPresContext,
|
1999-08-20 02:16:23 +04:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aStyleContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
1999-11-24 09:03:41 +03:00
|
|
|
mPresContext = aPresContext;
|
2000-03-31 11:02:06 +04:00
|
|
|
nsresult rv = nsBoxFrame::Init(aPresContext, aContent,
|
1999-08-20 02:16:23 +04:00
|
|
|
aParent, aStyleContext,
|
|
|
|
aPrevInFlow);
|
1999-10-12 04:16:06 +04:00
|
|
|
mInner->mDocument->AddObserver(mInner);
|
1999-08-20 02:16:23 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxScrollFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
1999-08-20 02:16:23 +04:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
nsresult rv = nsBoxFrame::SetInitialChildList(aPresContext, aListName,
|
1999-08-20 02:16:23 +04:00
|
|
|
aChildList);
|
|
|
|
// get scroll area
|
2000-03-31 11:02:06 +04:00
|
|
|
GetChildBox(&mInner->mScrollAreaBox);
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
// horizontal scrollbar
|
2000-03-31 11:02:06 +04:00
|
|
|
mInner->mScrollAreaBox->GetNextBox(&mInner->mHScrollbarBox);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
// vertical scrollbar
|
2000-08-04 02:42:36 +04:00
|
|
|
if (mInner->mHScrollbarBox)
|
|
|
|
mInner->mHScrollbarBox->GetNextBox(&mInner->mVScrollbarBox);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
// listen for scroll events.
|
1999-11-24 09:03:41 +03:00
|
|
|
mInner->GetScrollableView(aPresContext)->AddScrollPositionListener(mInner);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
return rv;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxScrollFrame::AppendFrames(nsIPresContext* aPresContext,
|
2000-05-15 08:12:31 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-05-15 08:12:31 +04:00
|
|
|
nsIFrame* frame;
|
|
|
|
mInner->mScrollAreaBox->GetFrame(&frame);
|
|
|
|
return frame->AppendFrames(aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aFrameList);
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxScrollFrame::InsertFrames(nsIPresContext* aPresContext,
|
2000-05-15 08:12:31 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-05-15 08:12:31 +04:00
|
|
|
nsIFrame* frame;
|
|
|
|
mInner->mScrollAreaBox->GetFrame(&frame);
|
|
|
|
|
|
|
|
return frame->InsertFrames(aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aPrevFrame,
|
|
|
|
aFrameList);
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxScrollFrame::RemoveFrame(nsIPresContext* aPresContext,
|
2000-05-15 08:12:31 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-05-15 08:12:31 +04:00
|
|
|
nsIFrame* frame;
|
|
|
|
mInner->mScrollAreaBox->GetFrame(&frame);
|
|
|
|
|
|
|
|
return frame->RemoveFrame (aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aOldFrame);
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::ReplaceFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame)
|
|
|
|
{
|
|
|
|
nsIFrame* frame;
|
|
|
|
mInner->mScrollAreaBox->GetFrame(&frame);
|
|
|
|
|
|
|
|
return frame->ReplaceFrame (aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aOldFrame,
|
|
|
|
aNewFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
NS_IMETHODIMP
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrame::GetPadding(nsMargin& aMargin)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
aMargin.SizeTo(0,0,0,0);
|
|
|
|
return NS_OK;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2001-09-19 16:35:19 +04:00
|
|
|
nsGfxScrollFrame::Paint(nsIPresContext* aPresContext,
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
2001-09-19 16:35:19 +04:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
// Paint our children
|
|
|
|
return nsBoxFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
|
|
|
aWhichLayer);
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsIContent ** aNewContent,
|
|
|
|
PRInt32& aContentOffset,
|
|
|
|
PRInt32& aContentOffsetEnd,
|
|
|
|
PRBool& aBeginFrameContent)
|
|
|
|
{
|
|
|
|
if (! mInner)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
mInner->mScrollAreaBox->GetFrame(&frame);
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
return frame->GetContentAndOffsetsFromPoint(aCX, aPoint, aNewContent, aContentOffset, aContentOffsetEnd, aBeginFrameContent);
|
|
|
|
}
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
PRIntn
|
|
|
|
nsGfxScrollFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetFrameType(nsIAtom** aType) const
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
|
|
|
|
*aType = nsLayoutAtoms::scrollFrame;
|
|
|
|
NS_ADDREF(*aType);
|
1999-08-20 02:16:23 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
|
|
|
{
|
|
|
|
aAscent = 0;
|
|
|
|
nsresult rv = mInner->mScrollAreaBox->GetAscent(aState, aAscent);
|
|
|
|
nsMargin m(0,0,0,0);
|
|
|
|
GetBorderAndPadding(m);
|
|
|
|
aAscent += m.top;
|
|
|
|
GetMargin(m);
|
|
|
|
aAscent += m.top;
|
|
|
|
GetInset(m);
|
|
|
|
aAscent += m.top;
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
NS_IMETHODIMP
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
PropagateDebug(aState);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
GetFrame(&frame);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
const nsStyleDisplay* styleDisplay = nsnull;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
frame->GetStyleData(eStyleStruct_Display,
|
|
|
|
(const nsStyleStruct*&)styleDisplay);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsresult rv = mInner->mScrollAreaBox->GetPrefSize(aState, aSize);
|
|
|
|
nsBox::AddMargin(mInner->mScrollAreaBox, aSize);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
if (styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLL ||
|
|
|
|
styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL) {
|
2000-05-26 10:42:29 +04:00
|
|
|
// make sure they are visible.
|
|
|
|
mInner->SetScrollbarVisibility(mInner->mVScrollbarBox, PR_TRUE);
|
2000-03-31 11:02:06 +04:00
|
|
|
nsSize vSize(0,0);
|
|
|
|
mInner->mVScrollbarBox->GetPrefSize(aState, vSize);
|
|
|
|
nsBox::AddMargin(mInner->mVScrollbarBox, vSize);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
aSize.width += vSize.width;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLL ||
|
|
|
|
styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL) {
|
|
|
|
nsSize hSize(0,0);
|
2000-05-26 10:42:29 +04:00
|
|
|
mInner->SetScrollbarVisibility(mInner->mHScrollbarBox, PR_TRUE);
|
2000-03-31 11:02:06 +04:00
|
|
|
mInner->mHScrollbarBox->GetPrefSize(aState, hSize);
|
|
|
|
nsBox::AddMargin(mInner->mHScrollbarBox, hSize);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
aSize.height += hSize.height;
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
AddBorderAndPadding(aSize);
|
|
|
|
AddInset(aSize);
|
|
|
|
nsIBox::AddCSSPrefSize(aState, this, aSize);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
return rv;
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|
|
|
{
|
|
|
|
PropagateDebug(aState);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-05-02 06:28:41 +04:00
|
|
|
nsIFrame* frame = nsnull;
|
2000-03-31 11:02:06 +04:00
|
|
|
GetFrame(&frame);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
const nsStyleDisplay* styleDisplay = nsnull;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
frame->GetStyleData(eStyleStruct_Display,
|
|
|
|
(const nsStyleStruct*&)styleDisplay);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsresult rv = mInner->mScrollAreaBox->GetMinSize(aState, aSize);
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
if (styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLL ||
|
2000-03-31 11:02:06 +04:00
|
|
|
styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL) {
|
|
|
|
nsSize vSize(0,0);
|
|
|
|
mInner->mVScrollbarBox->GetMinSize(aState, vSize);
|
|
|
|
AddMargin(mInner->mVScrollbarBox, vSize);
|
|
|
|
aSize.width += vSize.width;
|
|
|
|
if (aSize.height < vSize.height)
|
|
|
|
aSize.height = vSize.height;
|
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
if (styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLL ||
|
2000-03-31 11:02:06 +04:00
|
|
|
styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL) {
|
|
|
|
nsSize hSize(0,0);
|
|
|
|
mInner->mHScrollbarBox->GetMinSize(aState, hSize);
|
|
|
|
AddMargin(mInner->mHScrollbarBox, hSize);
|
|
|
|
aSize.height += hSize.height;
|
|
|
|
if (aSize.width < hSize.width)
|
|
|
|
aSize.width = hSize.width;
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
AddBorderAndPadding(aSize);
|
|
|
|
AddInset(aSize);
|
|
|
|
nsIBox::AddCSSMinSize(aState, this, aSize);
|
|
|
|
return rv;
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
|
1999-11-18 22:40:52 +03:00
|
|
|
NS_IMETHODIMP
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
1999-11-18 22:40:52 +03:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
PropagateDebug(aState);
|
|
|
|
|
|
|
|
aSize.width = NS_INTRINSICSIZE;
|
|
|
|
aSize.height = NS_INTRINSICSIZE;
|
1999-11-18 22:40:52 +03:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
AddBorderAndPadding(aSize);
|
|
|
|
AddInset(aSize);
|
|
|
|
nsIBox::AddCSSMaxSize(aState, this, aSize);
|
|
|
|
return NS_OK;
|
1999-11-18 22:40:52 +03:00
|
|
|
}
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-04-05 04:19:00 +04:00
|
|
|
NS_IMETHODIMP
|
2001-10-29 04:43:59 +03:00
|
|
|
nsGfxScrollFrame::Reflow(nsIPresContext* aPresContext,
|
2000-04-05 04:19:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
2000-04-21 18:59:47 +04:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsGfxScrollFrame", aReflowState.reason);
|
2001-11-14 16:40:03 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
2000-05-02 06:28:41 +04:00
|
|
|
|
|
|
|
// if there is a max element request then set it to -1 so we can see if it gets set
|
|
|
|
if (aDesiredSize.maxElementSize)
|
|
|
|
{
|
|
|
|
aDesiredSize.maxElementSize->width = -1;
|
|
|
|
aDesiredSize.maxElementSize->height = -1;
|
|
|
|
}
|
|
|
|
|
2000-04-05 04:19:00 +04:00
|
|
|
nsresult rv = nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
|
|
|
|
2000-05-02 06:28:41 +04:00
|
|
|
// if it was set then cache it. Otherwise set it.
|
2000-04-05 04:19:00 +04:00
|
|
|
if (aDesiredSize.maxElementSize)
|
|
|
|
{
|
2000-05-02 06:28:41 +04:00
|
|
|
nsSize* size = aDesiredSize.maxElementSize;
|
|
|
|
|
|
|
|
// if not set then use the cached size. If set then set it.
|
|
|
|
if (size->width == -1)
|
|
|
|
size->width = mInner->mMaxElementSize.width;
|
|
|
|
else
|
|
|
|
mInner->mMaxElementSize.width = size->width;
|
|
|
|
|
|
|
|
if (size->height == -1)
|
|
|
|
size->height = mInner->mMaxElementSize.height;
|
|
|
|
else
|
|
|
|
mInner->mMaxElementSize.height = size->height;
|
|
|
|
}
|
|
|
|
|
2000-04-05 04:19:00 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_IMETHODIMP_(nsrefcnt)
|
|
|
|
nsGfxScrollFrame::AddRef(void)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
return NS_OK;
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_IMETHODIMP_(nsrefcnt)
|
|
|
|
nsGfxScrollFrame::Release(void)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
return NS_OK;
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef NS_DEBUG
|
1999-10-12 04:16:06 +04:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 04:33:42 +03:00
|
|
|
nsGfxScrollFrame::GetFrameName(nsAString& aResult) const
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2001-11-14 04:33:42 +03:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("GfxScroll"), aResult);
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-10-12 04:16:06 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_INTERFACE_MAP_BEGIN(nsGfxScrollFrame)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIFrameDebug)
|
|
|
|
#endif
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIScrollableFrame)
|
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
|
|
|
|
|
|
|
|
//-------------------- Inner ----------------------
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsGfxScrollFrame* aOuter):mHScrollbarBox(nsnull),
|
|
|
|
mVScrollbarBox(nsnull),
|
|
|
|
mScrollAreaBox(nsnull),
|
2000-03-30 07:21:26 +04:00
|
|
|
mOnePixel(20),
|
1999-10-12 04:16:06 +04:00
|
|
|
mHasVerticalScrollbar(PR_FALSE),
|
2000-03-30 07:21:26 +04:00
|
|
|
mHasHorizontalScrollbar(PR_FALSE)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2000-03-06 00:26:01 +03:00
|
|
|
NS_INIT_REFCNT();
|
1999-10-12 04:16:06 +04:00
|
|
|
mOuter = aOuter;
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
mMaxElementSize.width = 0;
|
|
|
|
mMaxElementSize.height = 0;
|
|
|
|
mFirstPass = PR_FALSE;
|
2000-05-14 03:00:53 +04:00
|
|
|
mNeverHasVerticalScrollbar = PR_FALSE;
|
|
|
|
mNeverHasHorizontalScrollbar = PR_FALSE;
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
|
1999-10-15 08:29:30 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrameInner::ScrollPositionWillChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY)
|
|
|
|
{
|
|
|
|
// Do nothing.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
/**
|
|
|
|
* Called if something externally moves the scroll area
|
|
|
|
* This can happen if the user pages up down or uses arrow keys
|
|
|
|
* So what we need to do up adjust the scrollbars to match.
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
1999-10-15 08:29:30 +04:00
|
|
|
nsGfxScrollFrameInner::ScrollPositionDidChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2000-08-04 02:42:36 +04:00
|
|
|
if (mVScrollbarBox)
|
|
|
|
SetAttribute(mVScrollbarBox, nsXULAtoms::curpos, aY);
|
|
|
|
|
|
|
|
if (mHScrollbarBox)
|
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::curpos, aX);
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument,
|
1999-10-26 08:44:41 +04:00
|
|
|
nsIContent* aContent,
|
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
2001-08-25 06:01:08 +04:00
|
|
|
PRInt32 aModType,
|
1999-10-26 08:44:41 +04:00
|
|
|
PRInt32 aHint)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
if (mHScrollbarBox && mVScrollbarBox)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIFrame* hframe = nsnull;
|
|
|
|
mHScrollbarBox->GetFrame(&hframe);
|
|
|
|
|
|
|
|
nsIFrame* vframe = nsnull;
|
|
|
|
mVScrollbarBox->GetFrame(&vframe);
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
nsCOMPtr<nsIContent> vcontent;
|
|
|
|
nsCOMPtr<nsIContent> hcontent;
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
hframe->GetContent(getter_AddRefs(hcontent));
|
|
|
|
vframe->GetContent(getter_AddRefs(vcontent));
|
1999-10-12 04:16:06 +04:00
|
|
|
|
|
|
|
if (hcontent.get() == aContent || vcontent.get() == aContent)
|
|
|
|
{
|
|
|
|
nscoord x = 0;
|
|
|
|
nscoord y = 0;
|
|
|
|
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 16:27:00 +03:00
|
|
|
nsAutoString value;
|
2001-08-17 12:14:14 +04:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == hcontent->GetAttr(kNameSpaceID_None, nsXULAtoms::curpos, value))
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
|
|
|
PRInt32 error;
|
|
|
|
|
|
|
|
// convert it to an integer
|
|
|
|
x = value.ToInteger(&error);
|
|
|
|
}
|
|
|
|
|
2001-08-17 12:14:14 +04:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == vcontent->GetAttr(kNameSpaceID_None, nsXULAtoms::curpos, value))
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
|
|
|
PRInt32 error;
|
|
|
|
|
|
|
|
// convert it to an integer
|
|
|
|
y = value.ToInteger(&error);
|
|
|
|
}
|
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
nsIScrollableView* s = GetScrollableView(mOuter->mPresContext);
|
|
|
|
s->RemoveScrollPositionListener(this);
|
1999-10-26 08:44:41 +04:00
|
|
|
ScrollbarChanged(mOuter->mPresContext, x*mOnePixel, y*mOnePixel);
|
2000-04-25 11:10:48 +04:00
|
|
|
s->AddScrollPositionListener(this);
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsIScrollableView*
|
1999-10-26 08:44:41 +04:00
|
|
|
nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext)
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
|
|
|
nsIScrollableView* scrollingView;
|
|
|
|
nsIView* view;
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
mScrollAreaBox->GetFrame(&frame);
|
|
|
|
frame->GetView(aPresContext, &view);
|
2001-01-04 23:44:42 +03:00
|
|
|
nsresult result = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView);
|
1999-10-12 04:16:06 +04:00
|
|
|
NS_ASSERTION(NS_SUCCEEDED(result), "assertion gfx scrollframe does not contain a scrollframe");
|
|
|
|
return scrollingView;
|
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
PRBool
|
|
|
|
nsGfxScrollFrameInner::AddHorizontalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnTop)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2001-04-12 03:04:11 +04:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
if (mHScrollbarBox) {
|
|
|
|
PRInt32 dir = GetIntegerAttribute(mHScrollbarBox, nsXULAtoms::dir, -1);
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleVisibility* vis;
|
|
|
|
mOuter->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
|
2001-04-12 03:04:11 +04:00
|
|
|
|
|
|
|
// when creating the scrollbar for the first time, or whenever
|
|
|
|
// display direction is changed, scroll the view horizontally
|
2001-06-01 02:19:43 +04:00
|
|
|
if (dir != vis->mDirection) {
|
2001-04-12 03:04:11 +04:00
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::curpos,
|
2001-06-01 02:19:43 +04:00
|
|
|
(NS_STYLE_DIRECTION_LTR == vis->mDirection) ? 0 : 0x7FFFFFFF);
|
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::dir, vis->mDirection * mOnePixel);
|
2001-04-12 03:04:11 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // IBMBIDI
|
2000-05-15 08:12:31 +04:00
|
|
|
return AddRemoveScrollbar(aState, aScrollAreaSize, aOnTop, PR_TRUE, PR_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsGfxScrollFrameInner::AddVerticalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight)
|
|
|
|
{
|
|
|
|
return AddRemoveScrollbar(aState, aScrollAreaSize, aOnRight, PR_FALSE, PR_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsGfxScrollFrameInner::RemoveHorizontalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnTop)
|
|
|
|
{
|
|
|
|
return AddRemoveScrollbar(aState, aScrollAreaSize, aOnTop, PR_TRUE, PR_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsGfxScrollFrameInner::RemoveVerticalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight)
|
|
|
|
{
|
|
|
|
return AddRemoveScrollbar(aState, aScrollAreaSize, aOnRight, PR_FALSE, PR_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsGfxScrollFrameInner::AddRemoveScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnTop, PRBool aHorizontal, PRBool aAdd)
|
|
|
|
{
|
|
|
|
if (aHorizontal) {
|
|
|
|
if (mNeverHasHorizontalScrollbar)
|
|
|
|
return PR_FALSE;
|
|
|
|
|
|
|
|
if (aAdd)
|
|
|
|
SetScrollbarVisibility(mHScrollbarBox, aAdd);
|
|
|
|
|
|
|
|
nsSize hSize;
|
|
|
|
mHScrollbarBox->GetPrefSize(aState, hSize);
|
|
|
|
nsBox::AddMargin(mHScrollbarBox, hSize);
|
|
|
|
|
|
|
|
if (!aAdd)
|
|
|
|
SetScrollbarVisibility(mHScrollbarBox, aAdd);
|
|
|
|
|
|
|
|
PRBool fit = AddRemoveScrollbar(mHasHorizontalScrollbar, aScrollAreaSize.y, aScrollAreaSize.height, hSize.height, aOnTop, aAdd);
|
|
|
|
if (!fit)
|
|
|
|
SetScrollbarVisibility(mHScrollbarBox, !aAdd);
|
|
|
|
|
|
|
|
return fit;
|
|
|
|
} else {
|
|
|
|
if (mNeverHasVerticalScrollbar)
|
|
|
|
return PR_FALSE;
|
|
|
|
|
|
|
|
if (aAdd)
|
|
|
|
SetScrollbarVisibility(mVScrollbarBox, aAdd);
|
|
|
|
|
|
|
|
nsSize vSize;
|
|
|
|
mVScrollbarBox->GetPrefSize(aState, vSize);
|
|
|
|
|
|
|
|
if (!aAdd)
|
|
|
|
SetScrollbarVisibility(mVScrollbarBox, aAdd);
|
|
|
|
|
|
|
|
nsBox::AddMargin(mVScrollbarBox, vSize);
|
|
|
|
PRBool fit = AddRemoveScrollbar(mHasVerticalScrollbar, aScrollAreaSize.x, aScrollAreaSize.width, vSize.width, aOnTop, aAdd);
|
|
|
|
if (!fit)
|
|
|
|
SetScrollbarVisibility(mVScrollbarBox, !aAdd);
|
|
|
|
|
|
|
|
return fit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsGfxScrollFrameInner::AddRemoveScrollbar(PRBool& aHasScrollbar, nscoord& aXY, nscoord& aSize, nscoord aSbSize, PRBool aRightOrBottom, PRBool aAdd)
|
|
|
|
{
|
1999-10-12 04:16:06 +04:00
|
|
|
nscoord size = aSize;
|
|
|
|
|
|
|
|
if (size != NS_INTRINSICSIZE) {
|
2000-04-03 10:26:38 +04:00
|
|
|
if (aAdd) {
|
1999-10-12 04:16:06 +04:00
|
|
|
size -= aSbSize;
|
2000-05-15 08:12:31 +04:00
|
|
|
if (!aRightOrBottom && size >= 0)
|
2000-04-03 10:26:38 +04:00
|
|
|
aXY += aSbSize;
|
|
|
|
} else {
|
1999-10-12 04:16:06 +04:00
|
|
|
size += aSbSize;
|
2000-04-03 10:26:38 +04:00
|
|
|
if (!aRightOrBottom)
|
|
|
|
aXY -= aSbSize;
|
|
|
|
}
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
// not enough room? Yes? Return true.
|
1999-10-12 04:16:06 +04:00
|
|
|
if (size >= aSbSize) {
|
|
|
|
aHasScrollbar = aAdd;
|
|
|
|
aSize = size;
|
2000-05-15 08:12:31 +04:00
|
|
|
return PR_TRUE;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
return PR_FALSE;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrameInner::LayoutBox(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
return mOuter->LayoutChildAt(aState, aBox, aRect);
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
NS_IMETHODIMP
|
2000-07-08 02:24:06 +04:00
|
|
|
nsGfxScrollFrame::DoLayout(nsBoxLayoutState& aState)
|
2000-03-31 11:02:06 +04:00
|
|
|
{
|
2000-04-25 11:10:48 +04:00
|
|
|
PRUint32 flags = 0;
|
|
|
|
aState.GetLayoutFlags(flags);
|
2000-03-31 11:02:06 +04:00
|
|
|
nsresult rv = mInner->Layout(aState);
|
2000-04-25 11:10:48 +04:00
|
|
|
aState.SetLayoutFlags(flags);
|
|
|
|
|
2000-07-08 02:24:06 +04:00
|
|
|
nsBox::DoLayout(aState);
|
2000-03-31 11:02:06 +04:00
|
|
|
return rv;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
/**
|
|
|
|
* Reflow the scroll area if it needs it and return its size. Also determine if the reflow will
|
|
|
|
* cause any of the scrollbars to need to be reflowed.
|
|
|
|
*/
|
2000-03-31 11:02:06 +04:00
|
|
|
nsresult
|
|
|
|
nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-04-03 10:26:38 +04:00
|
|
|
//TODO make bidi code set these from preferences
|
|
|
|
|
|
|
|
// if true places the vertical scrollbar on the right false puts it on the left.
|
|
|
|
PRBool scrollBarRight = PR_TRUE;
|
|
|
|
|
|
|
|
// if true places the horizontal scrollbar on the bottom false puts it on the top.
|
|
|
|
PRBool scrollBarBottom = PR_TRUE;
|
|
|
|
|
2001-04-12 03:04:11 +04:00
|
|
|
#ifdef IBMBIDI
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleVisibility* vis;
|
|
|
|
mOuter->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
|
|
|
|
|
2001-04-12 03:04:11 +04:00
|
|
|
//
|
|
|
|
// Direction Style from this->GetStyleData()
|
2001-06-01 02:19:43 +04:00
|
|
|
// now in (vis->mDirection)
|
2001-04-12 03:04:11 +04:00
|
|
|
// ------------------
|
|
|
|
// NS_STYLE_DIRECTION_LTR : LTR or Default
|
|
|
|
// NS_STYLE_DIRECTION_RTL
|
|
|
|
// NS_STYLE_DIRECTION_INHERIT
|
|
|
|
//
|
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
if (vis->mDirection == NS_STYLE_DIRECTION_RTL){
|
2001-04-12 03:04:11 +04:00
|
|
|
// if true places the vertical scrollbar on the right false puts it on the left.
|
|
|
|
scrollBarRight = PR_FALSE;
|
|
|
|
|
|
|
|
// if true places the horizontal scrollbar on the bottom false puts it on the top.
|
|
|
|
scrollBarBottom = PR_TRUE;
|
|
|
|
}
|
|
|
|
nsHTMLReflowState* reflowState = (nsHTMLReflowState*)aState.GetReflowState();
|
|
|
|
#endif // IBMBIDI
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
mOuter->GetFrame(&frame);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
const nsStyleDisplay* styleDisplay = nsnull;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
frame->GetStyleData(eStyleStruct_Display,
|
|
|
|
(const nsStyleStruct*&)styleDisplay);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
// get the content rect
|
|
|
|
nsRect clientRect(0,0,0,0);
|
|
|
|
mOuter->GetClientRect(clientRect);
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// get the preferred size of the scrollbars
|
|
|
|
nsSize hSize(0,0);
|
|
|
|
nsSize vSize(0,0);
|
|
|
|
nsSize hMinSize(0,0);
|
|
|
|
nsSize vMinSize(0,0);
|
2000-05-15 08:12:31 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
mHScrollbarBox->GetPrefSize(aState, hSize);
|
|
|
|
mVScrollbarBox->GetPrefSize(aState, vSize);
|
2000-03-31 11:02:06 +04:00
|
|
|
mHScrollbarBox->GetMinSize(aState, hMinSize);
|
|
|
|
mVScrollbarBox->GetMinSize(aState, vMinSize);
|
|
|
|
|
|
|
|
nsBox::AddMargin(mHScrollbarBox, hSize);
|
|
|
|
nsBox::AddMargin(mVScrollbarBox, vSize);
|
|
|
|
nsBox::AddMargin(mHScrollbarBox, hMinSize);
|
|
|
|
nsBox::AddMargin(mVScrollbarBox, vMinSize);
|
2000-05-15 08:12:31 +04:00
|
|
|
*/
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
// the scroll area size starts off as big as our content area
|
|
|
|
nsRect scrollAreaRect(clientRect);
|
|
|
|
|
|
|
|
// Look at our style do we always have vertical or horizontal scrollbars?
|
|
|
|
if (styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLL || styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL)
|
|
|
|
mHasHorizontalScrollbar = PR_TRUE;
|
|
|
|
if (styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLL || styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL)
|
|
|
|
mHasVerticalScrollbar = PR_TRUE;
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
if (mHasHorizontalScrollbar)
|
|
|
|
AddHorizontalScrollbar(aState, scrollAreaRect, scrollBarBottom);
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
if (mHasVerticalScrollbar)
|
|
|
|
AddVerticalScrollbar(aState, scrollAreaRect, scrollBarRight);
|
|
|
|
|
2001-04-17 05:45:38 +04:00
|
|
|
nsRect oldScrollAreaBounds;
|
|
|
|
mScrollAreaBox->GetClientRect(oldScrollAreaBounds);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// layout our the scroll area
|
|
|
|
LayoutBox(aState, mScrollAreaBox, scrollAreaRect);
|
|
|
|
|
|
|
|
// now look at the content area and see if we need scrollbars or not
|
|
|
|
PRBool needsLayout = PR_FALSE;
|
|
|
|
nsSize scrolledContentSize(0,0);
|
|
|
|
|
|
|
|
// if we have 'auto' scrollbars look at the vertical case
|
|
|
|
if (styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLL
|
|
|
|
&& styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL) {
|
|
|
|
// get the area frame is the scrollarea
|
2000-07-08 02:24:06 +04:00
|
|
|
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
// There are two cases to consider
|
|
|
|
if (scrolledContentSize.height <= scrollAreaRect.height
|
|
|
|
|| styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL
|
|
|
|
|| styleDisplay->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE) {
|
|
|
|
if (mHasVerticalScrollbar) {
|
|
|
|
// We left room for the vertical scrollbar, but it's not needed;
|
|
|
|
// remove it.
|
2000-09-13 00:19:11 +04:00
|
|
|
if (RemoveVerticalScrollbar(aState, scrollAreaRect, scrollBarRight)) {
|
2000-05-15 08:12:31 +04:00
|
|
|
needsLayout = PR_TRUE;
|
2000-09-13 00:19:11 +04:00
|
|
|
SetAttribute(mVScrollbarBox, nsXULAtoms::curpos, 0);
|
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!mHasVerticalScrollbar) {
|
|
|
|
// We didn't leave room for the vertical scrollbar, but it turns
|
|
|
|
// out we needed it
|
2000-05-15 08:12:31 +04:00
|
|
|
if (AddVerticalScrollbar(aState, scrollAreaRect, scrollBarRight))
|
2000-03-31 11:02:06 +04:00
|
|
|
needsLayout = PR_TRUE;
|
2000-05-15 08:12:31 +04:00
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// ok layout at the right size
|
|
|
|
if (needsLayout) {
|
|
|
|
nsBoxLayoutState resizeState(aState);
|
|
|
|
resizeState.SetLayoutReason(nsBoxLayoutState::Resize);
|
|
|
|
LayoutBox(resizeState, mScrollAreaBox, scrollAreaRect);
|
2000-05-15 08:12:31 +04:00
|
|
|
needsLayout = PR_FALSE;
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// if scrollbars are auto look at the horizontal case
|
|
|
|
if ((NS_STYLE_OVERFLOW_SCROLL != styleDisplay->mOverflow)
|
|
|
|
&& (NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL != styleDisplay->mOverflow))
|
|
|
|
{
|
|
|
|
// get the area frame is the scrollarea
|
2000-07-08 02:24:06 +04:00
|
|
|
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
// if the child is wider that the scroll area
|
|
|
|
// and we don't have a scrollbar add one.
|
|
|
|
if (scrolledContentSize.width > scrollAreaRect.width
|
|
|
|
&& styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL
|
|
|
|
&& styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLLBARS_NONE) {
|
|
|
|
|
|
|
|
if (!mHasHorizontalScrollbar) {
|
2000-05-15 08:12:31 +04:00
|
|
|
// no scrollbar?
|
|
|
|
if (AddHorizontalScrollbar(aState, scrollAreaRect, scrollBarBottom))
|
2000-03-31 11:02:06 +04:00
|
|
|
needsLayout = PR_TRUE;
|
2000-05-15 08:12:31 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// if we added a horizonal scrollbar and we did not have a vertical
|
|
|
|
// there is a chance that by adding the horizonal scrollbar we will
|
|
|
|
// suddenly need a vertical scrollbar. Is a special case but its
|
|
|
|
// important.
|
2000-04-27 01:01:57 +04:00
|
|
|
//if (!mHasVerticalScrollbar && scrolledContentSize.height > scrollAreaRect.height - sbSize.height)
|
2000-10-29 02:17:53 +04:00
|
|
|
// printf("****Gfx Scrollbar Special case hit!!*****\n");
|
2000-04-03 10:26:38 +04:00
|
|
|
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
}
|
2001-04-12 03:04:11 +04:00
|
|
|
#ifdef IBMBIDI
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleVisibility* ourVis;
|
|
|
|
frame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)ourVis);
|
|
|
|
|
|
|
|
if (NS_STYLE_DIRECTION_RTL == ourVis->mDirection) {
|
2001-04-12 03:04:11 +04:00
|
|
|
nsCOMPtr<nsIGfxTextControlFrame2> textControl(
|
|
|
|
do_QueryInterface(mOuter->mParent) );
|
|
|
|
if (textControl) {
|
|
|
|
needsLayout = PR_TRUE;
|
|
|
|
reflowState->mRightEdge = scrolledContentSize.width;
|
|
|
|
mScrollAreaBox->MarkDirty(aState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // IBMBIDI
|
2000-03-31 11:02:06 +04:00
|
|
|
} else {
|
|
|
|
// if the area is smaller or equal to and we have a scrollbar then
|
|
|
|
// remove it.
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
if (mHasHorizontalScrollbar) {
|
2000-05-15 08:12:31 +04:00
|
|
|
if (RemoveHorizontalScrollbar(aState, scrollAreaRect, scrollBarBottom))
|
|
|
|
needsLayout = PR_TRUE;
|
2000-09-13 00:19:11 +04:00
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::curpos, 0);
|
2000-03-31 11:02:06 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
// we only need to set the rect. The inner child stays the same size.
|
|
|
|
if (needsLayout) {
|
|
|
|
nsBoxLayoutState resizeState(aState);
|
|
|
|
resizeState.SetLayoutReason(nsBoxLayoutState::Resize);
|
2000-04-03 10:26:38 +04:00
|
|
|
LayoutBox(resizeState, mScrollAreaBox, scrollAreaRect);
|
2000-05-15 08:12:31 +04:00
|
|
|
needsLayout = PR_FALSE;
|
2001-04-12 03:04:11 +04:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
reflowState->mRightEdge = NS_UNCONSTRAINEDSIZE;
|
|
|
|
#endif // IBMBIDI
|
1999-11-19 18:33:29 +03:00
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2000-07-08 02:24:06 +04:00
|
|
|
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
nsIPresContext* presContext = aState.GetPresContext();
|
|
|
|
float p2t;
|
|
|
|
presContext->GetScaledPixelsToTwips(&p2t);
|
|
|
|
mOnePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
const nsStyleFont* font;
|
|
|
|
mOuter->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&) font);
|
|
|
|
const nsFont& f = font->mFont;
|
|
|
|
nsCOMPtr<nsIFontMetrics> fm;
|
|
|
|
presContext->GetMetricsFor(f, getter_AddRefs(fm));
|
|
|
|
nscoord fontHeight = 1;
|
2001-05-15 07:12:08 +04:00
|
|
|
NS_ASSERTION(fm,"FontMetrics is null assuming fontHeight == 1");
|
|
|
|
if (fm)
|
|
|
|
fm->GetHeight(fontHeight);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
|
|
|
nscoord maxX = scrolledContentSize.width - scrollAreaRect.width;
|
|
|
|
nscoord maxY = scrolledContentSize.height - scrollAreaRect.height;
|
|
|
|
|
|
|
|
nsIScrollableView* scrollable = GetScrollableView(presContext);
|
|
|
|
scrollable->SetLineHeight(fontHeight);
|
|
|
|
|
2000-08-04 02:42:36 +04:00
|
|
|
if (mHScrollbarBox)
|
|
|
|
mHScrollbarBox->GetPrefSize(aState, hSize);
|
|
|
|
|
|
|
|
if (mVScrollbarBox)
|
|
|
|
mVScrollbarBox->GetPrefSize(aState, vSize);
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
// layout vertical scrollbar
|
|
|
|
nsRect vRect(clientRect);
|
|
|
|
vRect.width = vSize.width;
|
|
|
|
vRect.y = clientRect.y;
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
if (mHasHorizontalScrollbar) {
|
|
|
|
vRect.height -= hSize.height;
|
|
|
|
if (!scrollBarBottom)
|
|
|
|
vRect.y += hSize.height;
|
|
|
|
}
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
vRect.x = clientRect.x;
|
2000-04-03 10:26:38 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
if (scrollBarRight)
|
|
|
|
vRect.x += clientRect.width - vSize.width;
|
2000-03-31 11:02:06 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
if (mHasVerticalScrollbar) {
|
|
|
|
SetAttribute(mVScrollbarBox, nsXULAtoms::maxpos, maxY);
|
|
|
|
SetAttribute(mVScrollbarBox, nsXULAtoms::pageincrement, nscoord(scrollAreaRect.height - fontHeight));
|
|
|
|
SetAttribute(mVScrollbarBox, nsXULAtoms::increment, fontHeight, PR_FALSE);
|
1999-11-19 18:33:29 +03:00
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-08-04 02:42:36 +04:00
|
|
|
if (mVScrollbarBox) {
|
|
|
|
LayoutBox(aState, mVScrollbarBox, vRect);
|
|
|
|
mVScrollbarBox->GetPrefSize(aState, vSize);
|
|
|
|
mVScrollbarBox->GetMinSize(aState, vMinSize);
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
if (mHasVerticalScrollbar && (vMinSize.width > vRect.width || vMinSize.height > vRect.height)) {
|
2000-09-13 00:19:11 +04:00
|
|
|
if (RemoveVerticalScrollbar(aState, scrollAreaRect, scrollBarRight)) {
|
2000-05-15 08:12:31 +04:00
|
|
|
needsLayout = PR_TRUE;
|
2000-09-13 00:19:11 +04:00
|
|
|
SetAttribute(mVScrollbarBox, nsXULAtoms::curpos, 0);
|
|
|
|
}
|
|
|
|
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
mVScrollbarBox->GetPrefSize(aState, vSize);
|
|
|
|
}
|
2000-04-03 10:26:38 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
// layout horizontal scrollbar
|
|
|
|
nsRect hRect(clientRect);
|
|
|
|
hRect.height = hSize.height;
|
2000-04-03 10:26:38 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
hRect.x = clientRect.x;
|
2000-04-03 10:26:38 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
if (mHasVerticalScrollbar) {
|
|
|
|
hRect.width -= vSize.width;
|
|
|
|
if (!scrollBarRight)
|
|
|
|
hRect.x += vSize.width;
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
hRect.y = clientRect.y;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
if (scrollBarBottom)
|
|
|
|
hRect.y += clientRect.height - hSize.height;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-04-25 11:10:48 +04:00
|
|
|
if (mHasHorizontalScrollbar) {
|
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::maxpos, maxX);
|
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::pageincrement, nscoord(float(scrollAreaRect.width)*0.8));
|
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::increment, 10*mOnePixel, PR_FALSE);
|
|
|
|
}
|
|
|
|
|
2000-08-04 02:42:36 +04:00
|
|
|
if (mHScrollbarBox) {
|
|
|
|
LayoutBox(aState, mHScrollbarBox, hRect);
|
|
|
|
mHScrollbarBox->GetMinSize(aState, hMinSize);
|
|
|
|
}
|
2000-05-15 08:12:31 +04:00
|
|
|
|
|
|
|
if (mHasHorizontalScrollbar && (hMinSize.width > hRect.width || hMinSize.height > hRect.height)) {
|
2000-09-13 00:19:11 +04:00
|
|
|
if (RemoveHorizontalScrollbar(aState, scrollAreaRect, scrollBarBottom)) {
|
2000-05-15 08:12:31 +04:00
|
|
|
needsLayout = PR_TRUE;
|
2000-09-13 00:19:11 +04:00
|
|
|
SetAttribute(mHScrollbarBox, nsXULAtoms::curpos, 0);
|
|
|
|
}
|
2000-04-25 11:10:48 +04:00
|
|
|
}
|
2000-05-15 08:12:31 +04:00
|
|
|
|
|
|
|
// we only need to set the rect. The inner child stays the same size.
|
|
|
|
if (needsLayout) {
|
|
|
|
nsBoxLayoutState resizeState(aState);
|
|
|
|
resizeState.SetLayoutReason(nsBoxLayoutState::Resize);
|
|
|
|
LayoutBox(resizeState, mScrollAreaBox, scrollAreaRect);
|
|
|
|
needsLayout = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2001-04-17 05:45:38 +04:00
|
|
|
// may need to update fixed position children of the viewport,
|
|
|
|
// if the client area changed size because of some dirty reflow
|
|
|
|
// (if the reflow is initial or resize, the fixed children will
|
|
|
|
// be re-laid out anyway)
|
|
|
|
if ((oldScrollAreaBounds.width != scrollAreaRect.width
|
|
|
|
|| oldScrollAreaBounds.height != scrollAreaRect.height)
|
|
|
|
&& nsBoxLayoutState::Dirty == aState.GetLayoutReason()) {
|
|
|
|
nsIFrame* parentFrame;
|
|
|
|
mOuter->GetParent(&parentFrame);
|
|
|
|
if (parentFrame) {
|
|
|
|
nsCOMPtr<nsIAtom> parentFrameType;
|
|
|
|
parentFrame->GetFrameType(getter_AddRefs(parentFrameType));
|
|
|
|
if (parentFrameType.get() == nsLayoutAtoms::viewportFrame) {
|
|
|
|
// Usually there are no fixed children, so don't do anything unless there's
|
|
|
|
// at least one fixed child
|
|
|
|
nsIFrame* child;
|
|
|
|
if (NS_SUCCEEDED(parentFrame->FirstChild(mOuter->mPresContext,
|
|
|
|
nsLayoutAtoms::fixedList, &child)) && child) {
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
mOuter->mPresContext->GetShell(getter_AddRefs(presShell));
|
|
|
|
|
|
|
|
// force a reflow of the fixed children
|
|
|
|
nsFrame::CreateAndPostReflowCommand(presShell, parentFrame,
|
|
|
|
nsIReflowCommand::UserDefined, nsnull, nsnull, nsLayoutAtoms::fixedList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-04-25 11:10:48 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
2001-04-17 05:45:38 +04:00
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
|
|
|
void
|
1999-10-26 08:44:41 +04:00
|
|
|
nsGfxScrollFrameInner::ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
1999-10-26 08:44:41 +04:00
|
|
|
nsIScrollableView* scrollable = GetScrollableView(aPresContext);
|
1999-08-27 10:06:39 +04:00
|
|
|
scrollable->ScrollTo(aX,aY, NS_SCROLL_PROPERTY_ALWAYS_BLIT);
|
2000-10-29 02:17:53 +04:00
|
|
|
// printf("scrolling to: %d, %d\n", aX, aY);
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
nsGfxScrollFrameInner::~nsGfxScrollFrameInner()
|
|
|
|
{
|
|
|
|
if (mDocument) {
|
|
|
|
mDocument->RemoveObserver(this);
|
|
|
|
mDocument = nsnull;
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
/**
|
|
|
|
* Returns whether it actually needed to change the attribute
|
|
|
|
*/
|
|
|
|
PRBool
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, PRBool aReflow)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
|
|
|
// convert to pixels
|
|
|
|
aSize /= mOnePixel;
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
// only set the attribute if it changed.
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2000-03-31 11:02:06 +04:00
|
|
|
PRInt32 current = GetIntegerAttribute(aBox, aAtom, -1);
|
1999-10-12 04:16:06 +04:00
|
|
|
if (current != aSize)
|
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
aBox->GetFrame(&frame);
|
1999-10-12 04:16:06 +04:00
|
|
|
nsCOMPtr<nsIContent> content;
|
2000-03-31 11:02:06 +04:00
|
|
|
frame->GetContent(getter_AddRefs(content));
|
2001-08-02 16:12:53 +04:00
|
|
|
nsAutoString newValue;
|
|
|
|
newValue.AppendInt(aSize);
|
2001-08-17 12:14:14 +04:00
|
|
|
content->SetAttr(kNameSpaceID_None, aAtom, newValue, aReflow);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
return PR_TRUE;
|
1999-10-12 04:16:06 +04:00
|
|
|
}
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
|
|
|
return PR_FALSE;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
2000-07-08 02:24:06 +04:00
|
|
|
/**
|
|
|
|
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxScrollFrameInner::GetScrolledSize(nsIPresContext* aPresContext,
|
|
|
|
nscoord *aWidth,
|
|
|
|
nscoord *aHeight) const
|
|
|
|
{
|
|
|
|
|
|
|
|
// our scrolled size is the size of our scrolled view.
|
|
|
|
nsSize size;
|
|
|
|
nsIBox* child = nsnull;
|
|
|
|
mScrollAreaBox->GetChildBox(&child);
|
|
|
|
nsIFrame* frame;
|
|
|
|
child->GetFrame(&frame);
|
|
|
|
nsIView* view;
|
|
|
|
frame->GetView(aPresContext, &view);
|
|
|
|
NS_ASSERTION(view,"Scrolled frame must have a view!!!");
|
|
|
|
|
|
|
|
nsRect rect(0,0,0,0);
|
|
|
|
view->GetBounds(rect);
|
|
|
|
|
|
|
|
size.width = rect.width;
|
|
|
|
size.height = rect.height;
|
|
|
|
|
|
|
|
nsBox::AddMargin(child, size);
|
|
|
|
nsBox::AddBorderAndPadding(mScrollAreaBox, size);
|
|
|
|
nsBox::AddInset(mScrollAreaBox, size);
|
|
|
|
|
|
|
|
*aWidth = size.width;
|
|
|
|
*aHeight = size.height;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
void
|
|
|
|
nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible)
|
|
|
|
{
|
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
aScrollbar->GetFrame(&frame);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
frame->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
PRBool old = PR_TRUE;
|
|
|
|
|
|
|
|
nsAutoString value;
|
|
|
|
|
2001-08-17 12:14:14 +04:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsXULAtoms::collapsed, value))
|
2000-05-15 08:12:31 +04:00
|
|
|
old = PR_FALSE;
|
|
|
|
|
|
|
|
if (aVisible == old)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!aVisible)
|
2001-08-17 12:14:14 +04:00
|
|
|
content->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_TRUE);
|
2000-05-15 08:12:31 +04:00
|
|
|
else
|
2001-08-17 12:14:14 +04:00
|
|
|
content->UnsetAttr(kNameSpaceID_None, nsXULAtoms::collapsed, PR_TRUE);
|
2000-07-14 03:00:59 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIScrollbarFrame> scrollbar(do_QueryInterface(aScrollbar));
|
|
|
|
if (scrollbar) {
|
|
|
|
// See if we have a mediator.
|
|
|
|
nsCOMPtr<nsIScrollbarMediator> mediator;
|
|
|
|
scrollbar->GetScrollbarMediator(getter_AddRefs(mediator));
|
|
|
|
if (mediator) {
|
|
|
|
// Inform the mediator of the visibility change.
|
|
|
|
mediator->VisibilityChanged(aVisible);
|
|
|
|
}
|
|
|
|
}
|
2000-05-15 08:12:31 +04:00
|
|
|
}
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
PRInt32
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrameInner::GetIntegerAttribute(nsIBox* aBox, nsIAtom* atom, PRInt32 defaultValue)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
aBox->GetFrame(&frame);
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
nsCOMPtr<nsIContent> content;
|
2000-03-31 11:02:06 +04:00
|
|
|
frame->GetContent(getter_AddRefs(content));
|
1999-08-20 02:16:23 +04:00
|
|
|
|
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me
[1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner
[2] Cutting down the size of content. Made nsITextContent inherit from nsIContent.
[3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done.
dom/public/nsDOMPropEnums.h,v - bug 12559
dom/public/nsIJSScriptObject.h,v - [1]
dom/public/html/MANIFEST,v - bug 12559
dom/public/html/Makefile.in,v - bug 12559
dom/public/html/makefile.win,v - bug 12559
dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544
dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559
dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559
dom/public/idl/html/HTMLInputElement.idl,v - bug 17544
dom/src/base/nsGlobalWindow.cpp,v - bug 30700
dom/src/base/nsGlobalWindow.h,v - [1]
dom/src/base/nsLocation.cpp,v - [1]
dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559
dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544
layout/base/public/nsIDocument.h,v - bug 27953
layout/base/public/nsITextContent.h,v - [2]
layout/base/src/nsCommentNode.cpp,v - [2]
layout/base/src/nsDocument.cpp,v - bug 27953
layout/base/src/nsDocument.h,v - bug 27953
layout/base/src/nsDocumentViewer.cpp,v - bug 27953
layout/base/src/nsGenericDOMDataNode.cpp,v - [3]
layout/base/src/nsGenericDOMDataNode.h,v - [3]
layout/base/src/nsGenericElement.cpp,v - [3]
layout/base/src/nsGenericElement.h,v - [3]
layout/base/src/nsNameSpaceManager.cpp,v - bug 7834
layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow
layout/base/src/nsTextNode.cpp,v - [2]
layout/events/src/nsEventListenerManager.cpp,v - [3]
layout/events/src/nsEventListenerManager.h,v - [3]
layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString
layout/html/content/src/nsAttributeContent.cpp,v - [2]
layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLModElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3]
layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3]
layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953
layout/html/document/src/nsHTMLDocument.h,v - bug 27953
layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2]
layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2]
layout/xml/content/src/nsXMLElement.h,v - [1][2]
layout/xml/content/src/nsXMLEntity.cpp,v - [1][2]
layout/xml/content/src/nsXMLNotation.cpp,v - [1][2]
layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2]
layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString
layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString
netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString
rdf/content/src/nsXULDocument.cpp,v - bug 27953
rdf/content/src/nsXULDocument.h,v - bug 27953
rdf/content/src/nsXULElement.h,v - [1]
xpcom/base/IIDS.h,v - bug 12559
2000-03-17 16:27:00 +03:00
|
|
|
nsAutoString value;
|
2001-08-17 12:14:14 +04:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, atom, value))
|
1999-10-12 04:16:06 +04:00
|
|
|
{
|
|
|
|
PRInt32 error;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
// convert it to an integer
|
|
|
|
defaultValue = value.ToInteger(&error);
|
|
|
|
}
|
1999-08-20 02:16:23 +04:00
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
return defaultValue;
|
1999-08-20 02:16:23 +04:00
|
|
|
}
|
|
|
|
|
1999-10-12 04:16:06 +04:00
|
|
|
nsresult
|
2000-03-31 11:02:06 +04:00
|
|
|
nsGfxScrollFrame::GetContentOf(nsIContent** aContent)
|
1999-08-20 02:16:23 +04:00
|
|
|
{
|
2000-03-31 11:02:06 +04:00
|
|
|
GetContent(aContent);
|
1999-08-20 02:16:23 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|