1998-09-10 21:23:31 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03: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/
|
1998-09-10 21:23:31 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03: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.
|
1998-09-10 21:23:31 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-09-10 21:23:31 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
2000-02-10 10:04:09 +03:00
|
|
|
* Contributor(s):
|
|
|
|
* Travis Bogard <travis@netscape.com>
|
1998-09-10 21:23:31 +04:00
|
|
|
*/
|
1999-02-12 20:45:58 +03:00
|
|
|
#include "nsCOMPtr.h"
|
1998-09-10 21:23:31 +04:00
|
|
|
#include "nsLeafFrame.h"
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
1998-09-25 01:37:45 +04:00
|
|
|
#include "nsIHTMLContent.h"
|
1998-09-10 21:23:31 +04:00
|
|
|
#include "nsIWebShell.h"
|
1999-12-18 05:09:29 +03:00
|
|
|
#include "nsIDocShell.h"
|
2000-04-01 04:26:21 +04:00
|
|
|
#include "nsIDocShellLoadInfo.h"
|
1999-12-18 05:09:29 +03:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDocShellTreeNode.h"
|
2000-02-10 10:04:09 +03:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
2000-03-11 03:41:04 +03:00
|
|
|
#include "nsIWebNavigation.h"
|
1999-11-27 06:06:59 +03:00
|
|
|
#include "nsIBaseWindow.h"
|
1999-11-19 10:35:27 +03:00
|
|
|
#include "nsIContentViewer.h"
|
|
|
|
#include "nsIMarkupDocumentViewer.h"
|
1998-09-10 21:23:31 +04:00
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsHTMLIIDs.h"
|
1999-03-09 12:44:27 +03:00
|
|
|
#include "nsIComponentManager.h"
|
1998-09-10 21:23:31 +04:00
|
|
|
#include "nsIStreamListener.h"
|
|
|
|
#include "nsIURL.h"
|
1999-11-30 07:50:42 +03:00
|
|
|
#include "nsNetUtil.h"
|
1998-09-10 21:23:31 +04:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsWidgetsCID.h"
|
|
|
|
#include "nsViewsCID.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsIScrollableView.h"
|
|
|
|
#include "nsStyleCoord.h"
|
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsIDocumentLoader.h"
|
|
|
|
#include "nsIPref.h"
|
|
|
|
#include "nsFrameSetFrame.h"
|
|
|
|
#include "nsIDOMHTMLFrameElement.h"
|
|
|
|
#include "nsIDOMHTMLIFrameElement.h"
|
1999-05-11 02:49:39 +04:00
|
|
|
#include "nsLayoutAtoms.h"
|
1999-11-23 12:57:47 +03:00
|
|
|
#include "nsIChromeEventHandler.h"
|
2000-01-26 18:29:43 +03:00
|
|
|
#include "nsIScriptSecurityManager.h"
|
2000-03-11 09:32:42 +03:00
|
|
|
#include "nsICodebasePrincipal.h"
|
|
|
|
#include "nsXPIDLString.h"
|
2000-02-29 09:51:48 +03:00
|
|
|
#include "nsIScrollable.h"
|
2000-12-30 22:22:22 +03:00
|
|
|
#include "nsINameSpaceManager.h"
|
2001-01-08 23:26:05 +03:00
|
|
|
#include "nsIPrintContext.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsIWidget.h"
|
2001-05-19 04:17:01 +04:00
|
|
|
#include "nsIWebProgress.h"
|
|
|
|
#include "nsIWebProgressListener.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsIDOMEventTarget.h"
|
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsIRenderingContext.h"
|
1999-05-11 02:49:39 +04:00
|
|
|
|
2001-05-12 01:11:38 +04:00
|
|
|
// For Accessibility
|
|
|
|
#include "nsIAccessibilityService.h"
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
|
2000-10-03 03:23:55 +04:00
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
#include "nsIDOMXULElement.h"
|
|
|
|
#include "nsIBoxObject.h"
|
|
|
|
#include "nsIBrowserBoxObject.h"
|
|
|
|
#include "nsISHistory.h"
|
2001-03-17 01:40:15 +03:00
|
|
|
#include "nsIWebProgress.h"
|
|
|
|
#include "nsIWebProgressListener.h"
|
|
|
|
#include "nsISecureBrowserUI.h"
|
|
|
|
#include "nsIDOMWindowInternal.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
2000-10-03 03:23:55 +04:00
|
|
|
#endif
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
class nsHTMLFrame;
|
|
|
|
|
2001-04-12 12:16:54 +04:00
|
|
|
static NS_DEFINE_IID(kIFramesetFrameIID, NS_IFRAMESETFRAME_IID);
|
2000-09-09 09:46:14 +04:00
|
|
|
static NS_DEFINE_CID(kWebShellCID, NS_WEB_SHELL_CID);
|
|
|
|
static NS_DEFINE_CID(kCViewCID, NS_VIEW_CID);
|
|
|
|
static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2001-02-06 03:52:36 +03:00
|
|
|
// Bug 8065: Limit content frame depth to some reasonable level.
|
|
|
|
// This does not count chrome frames when determining depth,
|
|
|
|
// nor does it prevent chrome recursion.
|
|
|
|
#define MAX_DEPTH_CONTENT_FRAMES 25
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
* FrameLoadingInfo
|
|
|
|
******************************************************************************/
|
|
|
|
class FrameLoadingInfo : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FrameLoadingInfo(const nsSize& aSize);
|
|
|
|
|
|
|
|
// nsISupports interface...
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~FrameLoadingInfo() {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
nsSize mFrameSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFrameOuterFrame
|
|
|
|
******************************************************************************/
|
1999-04-27 22:21:30 +04:00
|
|
|
#define nsHTMLFrameOuterFrameSuper nsHTMLContainerFrame
|
|
|
|
|
|
|
|
class nsHTMLFrameOuterFrame : public nsHTMLFrameOuterFrameSuper {
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
public:
|
1998-12-03 09:31:43 +03:00
|
|
|
nsHTMLFrameOuterFrame();
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsString& aResult) const;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2001-05-12 01:11:38 +04:00
|
|
|
// nsISupports
|
|
|
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
|
|
|
|
1999-05-11 02:49:39 +04:00
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
1998-09-10 21:23:31 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
1999-04-27 22:21:30 +04:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1999-05-11 02:49:39 +04:00
|
|
|
|
1998-10-03 01:59:59 +04:00
|
|
|
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
1999-10-16 03:16:45 +04:00
|
|
|
PRInt32 aNameSpaceID,
|
1998-10-03 01:59:59 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint);
|
2001-05-18 03:52:32 +04:00
|
|
|
|
|
|
|
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_IMETHOD VerifyTree() const;
|
|
|
|
PRBool IsInline();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsHTMLFrameOuterFrame();
|
|
|
|
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
1998-09-10 21:23:31 +04:00
|
|
|
virtual PRIntn GetSkipSides() const;
|
1999-04-27 22:21:30 +04:00
|
|
|
PRBool mIsInline;
|
2001-05-12 01:11:38 +04:00
|
|
|
nsCOMPtr<nsIPresContext> mPresContext;
|
1998-09-10 21:23:31 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFrameInnerFrame
|
|
|
|
******************************************************************************/
|
2001-05-19 04:17:01 +04:00
|
|
|
class nsHTMLFrameInnerFrame : public nsLeafFrame,
|
|
|
|
public nsIWebProgressListener,
|
|
|
|
public nsSupportsWeakReference
|
|
|
|
{
|
1998-09-10 21:23:31 +04:00
|
|
|
public:
|
1998-12-03 09:31:43 +03:00
|
|
|
nsHTMLFrameInnerFrame();
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2001-05-19 04:17:01 +04:00
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
2001-05-19 11:29:25 +04:00
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef(void) { return 2; }
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release(void) { return 1; }
|
2001-05-19 04:17:01 +04:00
|
|
|
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsString& aResult) const;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-05-11 02:49:39 +04:00
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
/**
|
|
|
|
* @see nsIFrame::Paint
|
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
1998-09-10 21:23:31 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see nsIFrame::Reflow
|
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aCX,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
1999-05-20 02:14:11 +04:00
|
|
|
nsDidReflowStatus aStatus);
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_IMETHOD GetParentContent(nsIContent*& aContent);
|
|
|
|
PRBool GetURL(nsIContent* aContent, nsString& aResult);
|
|
|
|
PRBool GetName(nsIContent* aContent, nsString& aResult);
|
1998-11-10 02:30:16 +03:00
|
|
|
PRInt32 GetScrolling(nsIContent* aContent, PRBool aStandardMode);
|
1998-09-10 21:23:31 +04:00
|
|
|
nsFrameborder GetFrameBorder(PRBool aStandardMode);
|
|
|
|
PRInt32 GetMarginWidth(nsIPresContext* aPresContext, nsIContent* aContent);
|
|
|
|
PRInt32 GetMarginHeight(nsIPresContext* aPresContext, nsIContent* aContent);
|
1998-10-03 01:59:59 +04:00
|
|
|
|
2000-05-12 04:57:28 +04:00
|
|
|
nsresult ReloadURL(nsIPresContext* aPresContext);
|
1998-10-03 01:59:59 +04:00
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
protected:
|
2000-03-11 03:41:04 +03:00
|
|
|
nsresult CreateDocShell(nsIPresContext* aPresContext, const nsSize& aSize);
|
2000-05-12 04:57:28 +04:00
|
|
|
nsresult DoLoadURL(nsIPresContext* aPresContext);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
virtual ~nsHTMLFrameInnerFrame();
|
|
|
|
|
|
|
|
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsIBaseWindow> mSubShell;
|
2001-06-20 10:20:26 +04:00
|
|
|
nsWeakPtr mPresShellWeak; // weak reference to the nsIPresShell
|
1998-09-10 21:23:31 +04:00
|
|
|
PRBool mCreatingViewer;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFrameOuterFrame
|
|
|
|
******************************************************************************/
|
1998-12-03 09:31:43 +03:00
|
|
|
nsHTMLFrameOuterFrame::nsHTMLFrameOuterFrame()
|
|
|
|
: nsHTMLContainerFrame()
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
1999-04-27 22:21:30 +04:00
|
|
|
mIsInline = PR_FALSE;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsHTMLFrameOuterFrame::~nsHTMLFrameOuterFrame()
|
|
|
|
{
|
2000-10-29 02:17:53 +04:00
|
|
|
//printf("nsHTMLFrameOuterFrame destructor %X \n", this);
|
1999-04-27 22:21:30 +04:00
|
|
|
}
|
|
|
|
|
2001-05-18 03:52:32 +04:00
|
|
|
NS_IMETHODIMP nsHTMLFrameOuterFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
|
|
|
|
if (accService) {
|
|
|
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
|
|
|
|
return accService->CreateHTMLIFrameAccessible(node, mPresContext, aAccessible);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2001-05-12 01:11:38 +04:00
|
|
|
//--------------------------------------------------------------
|
|
|
|
// Frames are not refcounted, no need to AddRef
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
|
|
|
|
if (NULL == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsHTMLFrameOuterFrameSuper::QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
|
1999-04-27 22:21:30 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLFrameOuterFrame::Init(nsIPresContext* aPresContext,
|
1999-04-27 22:21:30 +04:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
2001-05-12 01:11:38 +04:00
|
|
|
mPresContext = aPresContext;
|
1999-04-27 22:21:30 +04:00
|
|
|
// determine if we are a <frame> or <iframe>
|
|
|
|
if (aContent) {
|
1999-10-14 14:58:04 +04:00
|
|
|
nsCOMPtr<nsIDOMHTMLFrameElement> frameElem = do_QueryInterface(aContent);
|
|
|
|
mIsInline = frameElem ? PR_FALSE : PR_TRUE;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
1999-04-27 22:21:30 +04:00
|
|
|
return nsHTMLFrameOuterFrameSuper::Init(aPresContext, aContent, aParent,
|
|
|
|
aContext, aPrevInFlow);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRIntn
|
|
|
|
nsHTMLFrameOuterFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
|
|
|
// <frame> processing does not use this routine, only <iframe>
|
1998-11-14 04:52:27 +03:00
|
|
|
float p2t;
|
1999-02-12 20:45:58 +03:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2000-05-12 04:57:28 +04:00
|
|
|
// If no width/height was specified, use 300/150.
|
|
|
|
// This is for compatability with IE.
|
1999-07-20 07:41:03 +04:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedWidth) {
|
|
|
|
aDesiredSize.width = aReflowState.mComputedWidth;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
1998-10-12 21:00:32 +04:00
|
|
|
else {
|
2000-05-12 04:57:28 +04:00
|
|
|
aDesiredSize.width = NSIntPixelsToTwips(300, p2t);
|
1998-10-12 21:00:32 +04:00
|
|
|
}
|
1999-07-20 07:41:03 +04:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) {
|
|
|
|
aDesiredSize.height = aReflowState.mComputedHeight;
|
1998-10-12 21:00:32 +04:00
|
|
|
}
|
|
|
|
else {
|
2000-05-12 04:57:28 +04:00
|
|
|
aDesiredSize.height = NSIntPixelsToTwips(150, p2t);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
2000-05-12 04:57:28 +04:00
|
|
|
|
|
|
|
// For unknown reasons, the maxElementSize for the InnerFrame is used, but the
|
|
|
|
// maxElementSize for the OuterFrame is ignored, the following is not used!
|
|
|
|
if (aDesiredSize.maxElementSize) {
|
|
|
|
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
|
|
|
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool nsHTMLFrameOuterFrame::IsInline()
|
|
|
|
{
|
1999-04-27 22:21:30 +04:00
|
|
|
return mIsInline;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLFrameOuterFrame::Paint(nsIPresContext* aPresContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
2001-04-13 15:34:31 +04:00
|
|
|
PRBool isVisible;
|
|
|
|
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) && !isVisible) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-10-29 02:17:53 +04:00
|
|
|
//printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
|
1999-01-16 01:53:39 +03:00
|
|
|
nsIFrame* firstChild = mFrames.FirstChild();
|
|
|
|
if (nsnull != firstChild) {
|
|
|
|
firstChild->Paint(aPresContext, aRenderingContext, aDirtyRect,
|
|
|
|
aWhichLayer);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
if (IsInline()) {
|
1998-12-18 18:54:23 +03:00
|
|
|
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext,
|
|
|
|
aDirtyRect, aWhichLayer);
|
1998-09-10 21:23:31 +04:00
|
|
|
} else {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHODIMP nsHTMLFrameOuterFrame::GetFrameName(nsString& aResult) const
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
1998-11-19 20:22:29 +03:00
|
|
|
return MakeFrameName("FrameOuter", aResult);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-05-11 02:49:39 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameOuterFrame::GetFrameType(nsIAtom** aType) const
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
|
|
|
|
*aType = nsLayoutAtoms::htmlFrameOuterFrame;
|
|
|
|
NS_ADDREF(*aType);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
2000-04-22 01:51:35 +04:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsHTMLFrameOuterFrame", aReflowState.reason);
|
2000-10-29 02:17:53 +04:00
|
|
|
//printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
|
|
|
("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d",
|
1999-01-06 02:31:18 +03:00
|
|
|
aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.reason));
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
if (IsInline()) {
|
2000-05-12 04:57:28 +04:00
|
|
|
GetDesiredSize(aPresContext, aReflowState, aDesiredSize); // IFRAME
|
1998-09-10 21:23:31 +04:00
|
|
|
} else {
|
2000-05-12 04:57:28 +04:00
|
|
|
aDesiredSize.width = aReflowState.availableWidth; // FRAME
|
1999-01-06 02:31:18 +03:00
|
|
|
aDesiredSize.height = aReflowState.availableHeight;
|
2000-05-12 04:57:28 +04:00
|
|
|
if (aDesiredSize.maxElementSize) { // Probably not used...
|
|
|
|
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
|
|
|
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
1999-01-16 01:53:39 +03:00
|
|
|
nsIFrame* firstChild = mFrames.FirstChild();
|
|
|
|
if (nsnull == firstChild) {
|
1999-12-05 02:49:50 +03:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
|
|
|
firstChild = new (shell.get()) nsHTMLFrameInnerFrame;
|
2000-08-23 04:12:30 +04:00
|
|
|
if (firstChild) {
|
|
|
|
mFrames.SetFrames(firstChild);
|
|
|
|
// Resolve the style context for the inner frame
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsIStyleContext *innerStyleContext = nsnull;
|
|
|
|
rv = aPresContext->ResolveStyleContextFor(mContent, mStyleContext,
|
|
|
|
PR_FALSE,
|
|
|
|
&innerStyleContext);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
rv = firstChild->Init(aPresContext, mContent, this, innerStyleContext, nsnull);
|
2000-08-23 05:22:26 +04:00
|
|
|
// have to release the context: Init does its own AddRef...
|
|
|
|
NS_RELEASE(innerStyleContext);
|
2000-08-23 04:12:30 +04:00
|
|
|
} else {
|
|
|
|
NS_WARNING( "Error resolving style for InnerFrame in nsHTMLFrameOuterFrame");
|
|
|
|
}
|
|
|
|
if (NS_FAILED(rv)){
|
|
|
|
NS_WARNING( "Error initializing InnerFrame in nsHTMLFrameOuterFrame");
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
NS_WARNING("no memory allocating inner frame in nsHTMLFrameOuterFrame");
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
1999-03-03 03:37:55 +03:00
|
|
|
nsSize innerSize(aDesiredSize.width, aDesiredSize.height);
|
|
|
|
nsPoint offset(0,0);
|
2000-05-17 01:59:23 +04:00
|
|
|
nsMargin border = aReflowState.mComputedBorderPadding;
|
|
|
|
if (IsInline()) {
|
1999-03-03 03:37:55 +03:00
|
|
|
offset.x = border.left;
|
2000-05-12 04:57:28 +04:00
|
|
|
offset.y = border.top;
|
1999-05-10 01:46:24 +04:00
|
|
|
// XXX Don't subtract the border!!! The size we are given does not include our
|
|
|
|
// border! -EDV
|
|
|
|
//innerSize.width -= border.left + border.right;
|
|
|
|
//innerSize.height -= border.top + border.bottom;
|
|
|
|
|
|
|
|
// we now need to add our border in. -EDV
|
|
|
|
aDesiredSize.width += border.left + border.right;
|
|
|
|
aDesiredSize.height += border.top + border.bottom;
|
1999-03-03 03:37:55 +03:00
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
// Reflow the child and get its desired size
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
|
1999-03-05 07:19:09 +03:00
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstChild,
|
1998-10-12 18:48:02 +04:00
|
|
|
innerSize);
|
1999-11-19 18:33:29 +03:00
|
|
|
ReflowChild(firstChild, aPresContext, kidMetrics, kidReflowState,
|
|
|
|
offset.x, offset.y, 0, aStatus);
|
1999-10-30 06:52:11 +04:00
|
|
|
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2000-05-12 04:57:28 +04:00
|
|
|
// For unknown reasons, the maxElementSize for the InnerFrame is used, but the
|
|
|
|
// maxElementSize for the OuterFrame is ignored, add in border here to prevent
|
|
|
|
// a table from shrinking inside the iframe's border when resized.
|
2000-05-17 01:59:23 +04:00
|
|
|
if (IsInline()) {
|
2000-05-12 04:57:28 +04:00
|
|
|
if (kidMetrics.maxElementSize) {
|
|
|
|
kidMetrics.maxElementSize->width += border.left + border.right;
|
|
|
|
kidMetrics.maxElementSize->height += border.top + border.bottom;
|
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
2000-05-12 04:57:28 +04:00
|
|
|
// Place and size the child
|
|
|
|
FinishReflowChild(firstChild, aPresContext, kidMetrics, offset.x, offset.y, 0);
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
|
|
|
("exit nsHTMLFrameOuterFrame::Reflow: size=%d,%d status=%x",
|
|
|
|
aDesiredSize.width, aDesiredSize.height, aStatus));
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameOuterFrame::VerifyTree() const
|
|
|
|
{
|
|
|
|
// XXX Completely disabled for now; once pseud-frames are reworked
|
|
|
|
// then we can turn it back on.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-03 01:59:59 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
1999-10-16 03:16:45 +04:00
|
|
|
PRInt32 aNameSpaceID,
|
1998-10-03 01:59:59 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint)
|
|
|
|
{
|
|
|
|
if (nsHTMLAtoms::src == aAttribute) {
|
2001-02-06 03:52:36 +03:00
|
|
|
nsHTMLFrameInnerFrame* firstChild = NS_STATIC_CAST(nsHTMLFrameInnerFrame*,
|
|
|
|
mFrames.FirstChild());
|
|
|
|
if (firstChild) {
|
|
|
|
firstChild->ReloadURL(aPresContext);
|
1998-10-03 01:59:59 +04:00
|
|
|
}
|
|
|
|
}
|
2001-04-12 12:16:54 +04:00
|
|
|
// If the noResize attribute changes, dis/allow frame to be resized
|
|
|
|
else if (nsHTMLAtoms::noresize == aAttribute) {
|
|
|
|
nsCOMPtr<nsIContent> parentContent;
|
|
|
|
mContent->GetParent(*getter_AddRefs(parentContent));
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAtom> parentTag;
|
|
|
|
parentContent->GetTag(*getter_AddRefs(parentTag));
|
|
|
|
|
|
|
|
if (nsHTMLAtoms::frameset == parentTag) {
|
|
|
|
nsIFrame* parentFrame = nsnull;
|
|
|
|
GetParent(&parentFrame);
|
|
|
|
|
|
|
|
if (parentFrame) {
|
|
|
|
// There is no interface for kIFramesetFrameIID
|
|
|
|
// so QI'ing to concrete class, yay!
|
|
|
|
nsHTMLFramesetFrame* framesetFrame = nsnull;
|
|
|
|
parentFrame->QueryInterface(kIFramesetFrameIID, (void **)&framesetFrame);
|
|
|
|
if (framesetFrame) {
|
|
|
|
framesetFrame->RecalculateBorderResize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-10-03 01:59:59 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
nsresult
|
1999-12-05 02:49:50 +03:00
|
|
|
NS_NewHTMLFrameOuterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
1999-05-12 02:03:29 +04:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-05 02:49:50 +03:00
|
|
|
nsHTMLFrameOuterFrame* it = new (aPresShell) nsHTMLFrameOuterFrame;
|
1999-05-12 02:03:29 +04:00
|
|
|
if (!it) {
|
1998-09-10 21:23:31 +04:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1999-05-12 02:03:29 +04:00
|
|
|
*aNewFrame = it;
|
1998-09-10 21:23:31 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFrameInnerFrame
|
|
|
|
******************************************************************************/
|
1998-12-03 09:31:43 +03:00
|
|
|
nsHTMLFrameInnerFrame::nsHTMLFrameInnerFrame()
|
|
|
|
: nsLeafFrame()
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
|
|
|
mCreatingViewer = PR_FALSE;
|
2001-06-20 10:20:26 +04:00
|
|
|
mPresShellWeak = nsnull;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame()
|
|
|
|
{
|
2000-10-29 02:17:53 +04:00
|
|
|
//printf("nsHTMLFrameInnerFrame destructor %X \n", this);
|
1999-11-27 06:06:59 +03:00
|
|
|
|
2000-10-03 03:23:55 +04:00
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
nsCOMPtr<nsIDOMXULElement> xulElt(do_QueryInterface(mContent));
|
|
|
|
if (xulElt && mSubShell) {
|
|
|
|
// We might be a XUL browser and may need to store the current URL in our box object.
|
|
|
|
nsCOMPtr<nsIBoxObject> boxObject;
|
|
|
|
xulElt->GetBoxObject(getter_AddRefs(boxObject));
|
|
|
|
if (boxObject) {
|
|
|
|
nsCOMPtr<nsIBrowserBoxObject> browser(do_QueryInterface(boxObject));
|
|
|
|
if (browser) {
|
|
|
|
nsCOMPtr<nsIWebNavigation> webShell(do_QueryInterface(mSubShell));
|
|
|
|
nsCOMPtr<nsISHistory> hist;
|
|
|
|
webShell->GetSessionHistory(getter_AddRefs(hist));
|
|
|
|
if (hist)
|
2001-03-08 11:05:05 +03:00
|
|
|
boxObject->SetPropertyAsSupports(NS_LITERAL_STRING("history").get(), hist);
|
2001-03-17 01:40:15 +03:00
|
|
|
nsCOMPtr<nsISupports> supports;
|
|
|
|
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("listenerkungfu").get(), getter_AddRefs(supports));
|
|
|
|
if (supports)
|
|
|
|
boxObject->SetPropertyAsSupports(NS_LITERAL_STRING("listener").get(), supports);
|
2000-10-03 03:23:55 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2001-05-19 04:17:01 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(mSubShell));
|
|
|
|
nsCOMPtr<nsIDOMEventTarget> eventTarget(do_QueryInterface(win));
|
|
|
|
nsCOMPtr<nsIDOMEventListener> eventListener(do_QueryInterface(mContent));
|
|
|
|
|
|
|
|
if (eventTarget && eventListener) {
|
|
|
|
eventTarget->RemoveEventListener(NS_LITERAL_STRING("load"), eventListener,
|
|
|
|
PR_FALSE);
|
|
|
|
}
|
|
|
|
|
2001-06-20 10:20:26 +04:00
|
|
|
if(mSubShell) {
|
|
|
|
// notify the pres shell that a docshell has been destroyed
|
|
|
|
if (mPresShellWeak) {
|
|
|
|
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
|
|
|
if (ps) {
|
|
|
|
ps->SetSubShellFor(mContent, nsnull);
|
|
|
|
}
|
|
|
|
}
|
2000-10-03 03:23:55 +04:00
|
|
|
mSubShell->Destroy();
|
2001-06-20 10:20:26 +04:00
|
|
|
}
|
2000-10-03 03:23:55 +04:00
|
|
|
mSubShell = nsnull; // This is the location it was released before...
|
|
|
|
// Not sure if there is ordering depending on this.
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
|
|
|
|
{
|
2000-10-03 03:23:55 +04:00
|
|
|
aResult.SetLength(0);
|
1999-10-14 14:58:04 +04:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::src, aResult))) {
|
|
|
|
if (aResult.Length() > 0) {
|
|
|
|
return PR_TRUE;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
}
|
1999-10-14 14:58:04 +04:00
|
|
|
|
|
|
|
return PR_FALSE;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool nsHTMLFrameInnerFrame::GetName(nsIContent* aContent, nsString& aResult)
|
|
|
|
{
|
1999-10-14 14:58:04 +04:00
|
|
|
aResult.SetLength(0);
|
|
|
|
|
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::name, aResult))) {
|
|
|
|
if (aResult.Length() > 0) {
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
1999-10-14 14:58:04 +04:00
|
|
|
|
|
|
|
return PR_FALSE;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
1998-11-10 02:30:16 +03:00
|
|
|
PRInt32 nsHTMLFrameInnerFrame::GetScrolling(nsIContent* aContent, PRBool aStandardMode)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
2000-05-17 01:59:23 +04:00
|
|
|
PRInt32 returnValue = -1;
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsIHTMLContent> content = do_QueryInterface(mContent, &rv);
|
|
|
|
if (NS_SUCCEEDED(rv) && content) {
|
1998-09-10 21:23:31 +04:00
|
|
|
nsHTMLValue value;
|
1998-12-20 04:21:23 +03:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == (content->GetHTMLAttribute(nsHTMLAtoms::scrolling, value))) {
|
1998-09-10 21:23:31 +04:00
|
|
|
if (eHTMLUnit_Enumerated == value.GetUnit()) {
|
|
|
|
PRInt32 intValue;
|
|
|
|
intValue = value.GetIntValue();
|
|
|
|
if (!aStandardMode) {
|
|
|
|
if ((NS_STYLE_FRAME_ON == intValue) || (NS_STYLE_FRAME_SCROLL == intValue)) {
|
2000-05-17 01:59:23 +04:00
|
|
|
returnValue = NS_STYLE_OVERFLOW_SCROLL;
|
1998-11-10 02:30:16 +03:00
|
|
|
} else if ((NS_STYLE_FRAME_OFF == intValue) || (NS_STYLE_FRAME_NOSCROLL == intValue)) {
|
2000-05-17 01:59:23 +04:00
|
|
|
returnValue = NS_STYLE_OVERFLOW_HIDDEN;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (NS_STYLE_FRAME_YES == intValue) {
|
|
|
|
returnValue = NS_STYLE_OVERFLOW_SCROLL;
|
|
|
|
} else if (NS_STYLE_FRAME_NO == intValue) {
|
|
|
|
returnValue = NS_STYLE_OVERFLOW_HIDDEN;
|
|
|
|
} else if (NS_STYLE_FRAME_AUTO == intValue) {
|
|
|
|
returnValue = NS_STYLE_OVERFLOW_AUTO;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-10-07 09:37:27 +04:00
|
|
|
|
|
|
|
// Check style for overflow
|
|
|
|
const nsStyleDisplay* display;
|
|
|
|
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
|
|
|
|
if (display->mOverflow)
|
|
|
|
returnValue = display->mOverflow;
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
2000-05-17 01:59:23 +04:00
|
|
|
return returnValue;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsFrameborder nsHTMLFrameInnerFrame::GetFrameBorder(PRBool aStandardMode)
|
|
|
|
{
|
2000-05-17 01:59:23 +04:00
|
|
|
nsFrameborder rv = eFrameborder_Notset;
|
|
|
|
nsresult res = NS_OK;
|
|
|
|
nsCOMPtr<nsIHTMLContent> content = do_QueryInterface(mContent, &res);
|
|
|
|
if (NS_SUCCEEDED(res) && content) {
|
1998-09-10 21:23:31 +04:00
|
|
|
nsHTMLValue value;
|
1998-12-20 04:21:23 +03:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == (content->GetHTMLAttribute(nsHTMLAtoms::frameborder, value))) {
|
1998-09-10 21:23:31 +04:00
|
|
|
if (eHTMLUnit_Enumerated == value.GetUnit()) {
|
|
|
|
PRInt32 intValue;
|
|
|
|
intValue = value.GetIntValue();
|
|
|
|
if (!aStandardMode) {
|
|
|
|
if (NS_STYLE_FRAME_YES == intValue) {
|
2000-05-17 01:59:23 +04:00
|
|
|
rv = eFrameborder_Yes;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
else if (NS_STYLE_FRAME_NO == intValue) {
|
2000-05-17 01:59:23 +04:00
|
|
|
rv = eFrameborder_No;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (NS_STYLE_FRAME_0 == intValue) {
|
|
|
|
rv = eFrameborder_No;
|
|
|
|
}
|
|
|
|
else if (NS_STYLE_FRAME_1 == intValue) {
|
|
|
|
rv = eFrameborder_Yes;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
}
|
2000-05-17 01:59:23 +04:00
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// XXX if we get here, check for nsIDOMFRAMESETElement interface
|
2000-05-17 01:59:23 +04:00
|
|
|
return rv;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PRInt32 nsHTMLFrameInnerFrame::GetMarginWidth(nsIPresContext* aPresContext, nsIContent* aContent)
|
|
|
|
{
|
|
|
|
PRInt32 marginWidth = -1;
|
2000-05-17 01:59:23 +04:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsIHTMLContent> content = do_QueryInterface(mContent, &rv);
|
|
|
|
if (NS_SUCCEEDED(rv) && content) {
|
1998-09-10 21:23:31 +04:00
|
|
|
nsHTMLValue value;
|
1998-12-20 04:21:23 +03:00
|
|
|
content->GetHTMLAttribute(nsHTMLAtoms::marginwidth, value);
|
2001-06-01 02:19:43 +04:00
|
|
|
if (eHTMLUnit_Pixel == value.GetUnit())
|
|
|
|
return value.GetPixelValue();
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
return marginWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 nsHTMLFrameInnerFrame::GetMarginHeight(nsIPresContext* aPresContext, nsIContent* aContent)
|
|
|
|
{
|
|
|
|
PRInt32 marginHeight = -1;
|
2000-05-17 01:59:23 +04:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsIHTMLContent> content = do_QueryInterface(mContent, &rv);
|
|
|
|
if (NS_SUCCEEDED(rv) && content) {
|
1998-09-10 21:23:31 +04:00
|
|
|
nsHTMLValue value;
|
1998-12-20 04:21:23 +03:00
|
|
|
content->GetHTMLAttribute(nsHTMLAtoms::marginheight, value);
|
2001-06-01 02:19:43 +04:00
|
|
|
if (eHTMLUnit_Pixel == value.GetUnit())
|
|
|
|
return value.GetPixelValue();
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
return marginHeight;
|
|
|
|
}
|
|
|
|
|
2001-05-19 04:17:01 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
|
|
|
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsIWebProgressListener))) {
|
|
|
|
nsISupports *tmp = NS_STATIC_CAST(nsIWebProgressListener *, this);
|
|
|
|
*aInstancePtr = tmp;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsISupportsWeakReference))) {
|
|
|
|
nsISupports *tmp = NS_STATIC_CAST(nsISupportsWeakReference *, this);
|
|
|
|
*aInstancePtr = tmp;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsLeafFrame::QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::OnStateChange(nsIWebProgress *aWebProgress,
|
|
|
|
nsIRequest *aRequest,
|
|
|
|
PRInt32 aStateFlags, PRUint32 aStatus)
|
|
|
|
{
|
|
|
|
if (!((~aStateFlags) & (nsIWebProgressListener::STATE_IS_DOCUMENT |
|
|
|
|
nsIWebProgressListener::STATE_TRANSFERRING))) {
|
|
|
|
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(mSubShell));
|
|
|
|
nsCOMPtr<nsIDOMEventTarget> eventTarget(do_QueryInterface(win));
|
|
|
|
nsCOMPtr<nsIDOMEventListener> eventListener(do_QueryInterface(mContent));
|
|
|
|
|
|
|
|
if (eventTarget && eventListener) {
|
|
|
|
eventTarget->AddEventListener(NS_LITERAL_STRING("load"), eventListener,
|
|
|
|
PR_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::OnProgressChange(nsIWebProgress *aWebProgress,
|
|
|
|
nsIRequest *aRequest,
|
|
|
|
PRInt32 aCurSelfProgress,
|
|
|
|
PRInt32 aMaxSelfProgress,
|
|
|
|
PRInt32 aCurTotalProgress,
|
|
|
|
PRInt32 aMaxTotalProgress)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::OnLocationChange(nsIWebProgress *aWebProgress,
|
|
|
|
nsIRequest *aRequest, nsIURI *location)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::OnStatusChange(nsIWebProgress *aWebProgress,
|
|
|
|
nsIRequest *aRequest,
|
|
|
|
nsresult aStatus,
|
|
|
|
const PRUnichar *aMessage)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|
|
|
nsIRequest *aRequest, PRInt32 state)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHODIMP nsHTMLFrameInnerFrame::GetFrameName(nsString& aResult) const
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
1998-11-19 20:22:29 +03:00
|
|
|
return MakeFrameName("FrameInner", aResult);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-05-11 02:49:39 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::GetFrameType(nsIAtom** aType) const
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
|
|
|
|
*aType = nsLayoutAtoms::htmlFrameInnerFrame;
|
|
|
|
NS_ADDREF(*aType);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLFrameInnerFrame::Paint(nsIPresContext* aPresContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1999-04-27 22:21:30 +04:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
2000-10-29 02:17:53 +04:00
|
|
|
//printf("inner paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
|
1999-04-28 01:05:32 +04:00
|
|
|
// if there is not web shell paint based on our background color,
|
|
|
|
// otherwise let the web shell paint the sub document
|
2001-04-13 15:34:31 +04:00
|
|
|
|
|
|
|
// isPaginated is a temporary fix for Bug 75737
|
|
|
|
// and this should all be fixed correctly by Bug 75739
|
|
|
|
PRBool isPaginated;
|
|
|
|
aPresContext->IsPaginated(&isPaginated);
|
|
|
|
if (!mSubShell && !isPaginated) {
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleBackground* color =
|
|
|
|
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
|
1999-04-28 01:05:32 +04:00
|
|
|
aRenderingContext.SetColor(color->mBackgroundColor);
|
1999-04-27 22:21:30 +04:00
|
|
|
aRenderingContext.FillRect(mRect);
|
|
|
|
}
|
2001-03-13 04:47:22 +03:00
|
|
|
DO_GLOBAL_REFLOW_COUNT_DSP("nsHTMLFrameInnerFrame", &aRenderingContext);
|
1998-09-10 21:23:31 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFrameInnerFrame::GetParentContent(nsIContent*& aContent)
|
|
|
|
{
|
|
|
|
nsHTMLFrameOuterFrame* parent;
|
2000-05-12 04:57:28 +04:00
|
|
|
nsresult rv = GetParent((nsIFrame**)&parent);
|
|
|
|
if (NS_SUCCEEDED(rv) && parent) {
|
|
|
|
rv = parent->GetContent(&aContent);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
2000-05-12 04:57:28 +04:00
|
|
|
return rv;
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
1999-05-20 02:14:11 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
|
1999-05-20 02:14:11 +04:00
|
|
|
nsDidReflowStatus aStatus)
|
|
|
|
{
|
|
|
|
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
|
|
|
|
|
|
|
|
|
|
|
|
// The view is created hidden; once we have reflowed it and it has been
|
|
|
|
// positioned then we show it.
|
|
|
|
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
|
|
|
|
nsIView* view = nsnull;
|
1999-11-24 09:03:41 +03:00
|
|
|
GetView(aPresContext, &view);
|
1999-06-03 08:34:49 +04:00
|
|
|
if (view) {
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleVisibility* vis;
|
|
|
|
GetStyleData(eStyleStruct_Visibility, ((const nsStyleStruct *&)vis));
|
|
|
|
nsViewVisibility newVis = vis->IsVisible() ? nsViewVisibility_kShow : nsViewVisibility_kHide;
|
1999-06-03 08:34:49 +04:00
|
|
|
nsViewVisibility oldVis;
|
|
|
|
// only change if different.
|
|
|
|
view->GetVisibility(oldVis);
|
|
|
|
if (newVis != oldVis)
|
|
|
|
view->SetVisibility(newVis);
|
|
|
|
}
|
1999-05-20 02:14:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
nsresult
|
2000-03-11 03:41:04 +03:00
|
|
|
nsHTMLFrameInnerFrame::CreateDocShell(nsIPresContext* aPresContext,
|
1998-09-10 21:23:31 +04:00
|
|
|
const nsSize& aSize)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsIContent> parentContent;
|
|
|
|
GetParentContent(*getter_AddRefs(parentContent));
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2001-02-06 03:52:36 +03:00
|
|
|
// Bug 8065: Don't exceed some maximum depth in content frames (MAX_DEPTH_CONTENT_FRAMES)
|
|
|
|
PRInt32 depth = 0;
|
|
|
|
nsCOMPtr<nsISupports> parentAsSupports;
|
|
|
|
aPresContext->GetContainer(getter_AddRefs(parentAsSupports));
|
|
|
|
if (parentAsSupports) {
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> parentAsItem(do_QueryInterface(parentAsSupports));
|
|
|
|
while (parentAsItem) {
|
|
|
|
depth++;
|
|
|
|
if (MAX_DEPTH_CONTENT_FRAMES < depth)
|
|
|
|
return NS_ERROR_UNEXPECTED; // Too deep, give up! (silently?)
|
|
|
|
|
|
|
|
// Only count depth on content, not chrome.
|
|
|
|
// If we wanted to limit total depth, skip the following check:
|
|
|
|
PRInt32 parentType;
|
|
|
|
parentAsItem->GetItemType(&parentType);
|
|
|
|
if (nsIDocShellTreeItem::typeContent == parentType) {
|
|
|
|
nsIDocShellTreeItem* temp = parentAsItem;
|
|
|
|
temp->GetParent(getter_AddRefs(parentAsItem));
|
|
|
|
} else {
|
|
|
|
break; // we have exited content, stop counting, depth is OK!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
mSubShell = do_CreateInstance(kWebShellCID);
|
|
|
|
NS_ENSURE_TRUE(mSubShell, NS_ERROR_FAILURE);
|
2000-03-04 02:16:43 +03:00
|
|
|
|
|
|
|
// notify the pres shell that a docshell has been created
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
|
|
|
if (presShell)
|
|
|
|
{
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsISupports> subShellAsSupports(do_QueryInterface(mSubShell));
|
|
|
|
NS_ENSURE_TRUE(subShellAsSupports, NS_ERROR_FAILURE);
|
|
|
|
presShell->SetSubShellFor(mContent, subShellAsSupports);
|
2001-06-20 10:20:26 +04:00
|
|
|
//We need to be able to get back to the presShell to unset the subshell at destruction
|
|
|
|
mPresShellWeak = getter_AddRefs(NS_GetWeakReference(presShell));
|
2000-03-04 02:16:43 +03:00
|
|
|
}
|
1999-05-05 03:29:06 +04:00
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mSubShell));
|
|
|
|
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
1998-11-10 02:30:16 +03:00
|
|
|
// pass along marginwidth, marginheight, scrolling so sub document can use it
|
2000-03-11 03:41:04 +03:00
|
|
|
docShell->SetMarginWidth(GetMarginWidth(aPresContext, parentContent));
|
|
|
|
docShell->SetMarginHeight(GetMarginHeight(aPresContext, parentContent));
|
1998-11-10 02:30:16 +03:00
|
|
|
nsCompatibility mode;
|
1999-11-24 09:03:41 +03:00
|
|
|
aPresContext->GetCompatibilityMode(&mode);
|
2000-02-19 05:32:38 +03:00
|
|
|
// Current and initial scrolling is set so that all succeeding docs
|
|
|
|
// will use the scrolling value set here, regardless if scrolling is
|
|
|
|
// set by viewing a particular document (e.g. XUL turns off scrolling)
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsIScrollable> scrollableContainer(do_QueryInterface(mSubShell));
|
|
|
|
if (scrollableContainer) {
|
|
|
|
scrollableContainer->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,
|
|
|
|
GetScrolling(parentContent, mode));
|
|
|
|
scrollableContainer->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X,
|
|
|
|
GetScrolling(parentContent, mode));
|
2000-02-29 09:51:48 +03:00
|
|
|
}
|
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mSubShell));
|
|
|
|
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
1998-09-10 21:23:31 +04:00
|
|
|
nsString frameName;
|
2000-03-11 03:41:04 +03:00
|
|
|
if (GetName(parentContent, frameName)) {
|
2001-06-30 15:02:25 +04:00
|
|
|
docShellAsItem->SetName(frameName.get());
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// If our container is a web-shell, inform it that it has a new
|
|
|
|
// child. If it's not a web-shell then some things will not operate
|
|
|
|
// properly.
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsISupports> container;
|
|
|
|
aPresContext->GetContainer(getter_AddRefs(container));
|
|
|
|
if (container) {
|
1999-12-18 05:09:29 +03:00
|
|
|
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(container));
|
|
|
|
if (parentAsNode) {
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> parentAsItem(do_QueryInterface(parentAsNode));
|
|
|
|
PRInt32 parentType;
|
|
|
|
parentAsItem->GetItemType(&parentType);
|
2000-02-10 10:04:09 +03:00
|
|
|
|
1999-04-21 04:19:30 +04:00
|
|
|
nsIAtom* typeAtom = NS_NewAtom("type");
|
1999-06-27 01:48:29 +04:00
|
|
|
nsAutoString value, valuePiece;
|
|
|
|
PRBool isContent;
|
|
|
|
|
|
|
|
isContent = PR_FALSE;
|
2000-03-11 03:41:04 +03:00
|
|
|
if (NS_SUCCEEDED(parentContent->GetAttribute(kNameSpaceID_None,
|
|
|
|
typeAtom, value))) {
|
1999-06-27 01:48:29 +04:00
|
|
|
|
|
|
|
// we accept "content" and "content-xxx" values.
|
|
|
|
// at time of writing, we expect "xxx" to be "primary", but
|
|
|
|
// someday it might be an integer expressing priority
|
|
|
|
value.Left(valuePiece, 7);
|
|
|
|
if (valuePiece.EqualsIgnoreCase("content") &&
|
|
|
|
(value.Length() == 7 ||
|
2000-04-16 01:18:29 +04:00
|
|
|
value.Mid(valuePiece, 7, 1) == 1 && valuePiece.EqualsWithConversion("-")))
|
1999-06-27 01:48:29 +04:00
|
|
|
isContent = PR_TRUE;
|
1999-04-21 04:19:30 +04:00
|
|
|
}
|
2000-05-15 17:12:27 +04:00
|
|
|
NS_IF_RELEASE(typeAtom);
|
1999-06-27 01:48:29 +04:00
|
|
|
if (isContent) {
|
|
|
|
// The web shell's type is content.
|
1999-12-18 05:09:29 +03:00
|
|
|
docShellAsItem->SetItemType(nsIDocShellTreeItem::typeContent);
|
1999-06-27 01:48:29 +04:00
|
|
|
} else {
|
1999-04-21 04:19:30 +04:00
|
|
|
// Inherit our type from our parent webshell. If it is
|
1999-06-27 01:48:29 +04:00
|
|
|
// chrome, we'll be chrome. If it is content, we'll be
|
|
|
|
// content.
|
1999-12-18 05:09:29 +03:00
|
|
|
docShellAsItem->SetItemType(parentType);
|
1999-04-21 04:19:30 +04:00
|
|
|
}
|
2000-02-10 10:04:09 +03:00
|
|
|
|
|
|
|
parentAsNode->AddChild(docShellAsItem);
|
|
|
|
|
|
|
|
if (isContent) {
|
|
|
|
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
|
|
|
parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
|
|
|
if(parentTreeOwner)
|
|
|
|
parentTreeOwner->ContentShellAdded(docShellAsItem,
|
|
|
|
value.EqualsIgnoreCase("content-primary") ? PR_TRUE : PR_FALSE,
|
2001-06-30 15:02:25 +04:00
|
|
|
value.get());
|
2000-02-10 10:04:09 +03:00
|
|
|
}
|
|
|
|
// connect the container...
|
2000-03-11 03:41:04 +03:00
|
|
|
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mSubShell));
|
2000-02-10 10:04:09 +03:00
|
|
|
nsCOMPtr<nsIWebShellContainer> outerContainer(do_QueryInterface(container));
|
|
|
|
if (outerContainer)
|
2000-03-11 03:41:04 +03:00
|
|
|
webShell->SetContainer(outerContainer);
|
2000-02-10 10:04:09 +03:00
|
|
|
|
1999-05-28 01:04:52 +04:00
|
|
|
|
1999-09-21 05:03:00 +04:00
|
|
|
// Make sure all shells have links back to the content element in the
|
|
|
|
// nearest enclosing chrome shell.
|
1999-12-18 05:09:29 +03:00
|
|
|
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
|
1999-11-23 12:57:47 +03:00
|
|
|
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
|
2000-02-10 10:04:09 +03:00
|
|
|
if (parentType == nsIDocShellTreeItem::typeChrome) {
|
1999-09-21 05:03:00 +04:00
|
|
|
// Our parent shell is a chrome shell. It is therefore our nearest
|
1999-11-23 12:57:47 +03:00
|
|
|
// enclosing chrome shell.
|
|
|
|
chromeEventHandler = do_QueryInterface(mContent);
|
|
|
|
NS_WARN_IF_FALSE(chromeEventHandler, "This mContent should implement this.");
|
1999-09-21 05:03:00 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Our parent shell is a content shell. Get the chrome info from
|
|
|
|
// it and use that for our shell as well.
|
1999-12-18 05:09:29 +03:00
|
|
|
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
1999-09-21 05:03:00 +04:00
|
|
|
}
|
1999-06-27 01:48:29 +04:00
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
docShell->SetChromeEventHandler(chromeEventHandler);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
float t2p;
|
1999-11-24 09:03:41 +03:00
|
|
|
aPresContext->GetTwipsToPixels(&t2p);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
// create, init, set the parent of the view
|
|
|
|
nsIView* view;
|
2000-09-09 09:46:14 +04:00
|
|
|
rv = nsComponentManager::CreateInstance(kCViewCID, nsnull, NS_GET_IID(nsIView),
|
1998-09-10 21:23:31 +04:00
|
|
|
(void **)&view);
|
|
|
|
if (NS_OK != rv) {
|
|
|
|
NS_ASSERTION(0, "Could not create view for nsHTMLFrame");
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIView* parView;
|
|
|
|
nsPoint origin;
|
1999-11-24 09:03:41 +03:00
|
|
|
GetOffsetFromView(aPresContext, origin, &parView);
|
1998-09-10 21:23:31 +04:00
|
|
|
nsRect viewBounds(origin.x, origin.y, aSize.width, aSize.height);
|
|
|
|
|
1999-02-12 20:45:58 +03:00
|
|
|
nsCOMPtr<nsIViewManager> viewMan;
|
|
|
|
presShell->GetViewManager(getter_AddRefs(viewMan));
|
1998-11-04 07:14:10 +03:00
|
|
|
rv = view->Init(viewMan, viewBounds, parView);
|
1998-09-10 21:23:31 +04:00
|
|
|
viewMan->InsertChild(parView, view, 0);
|
2001-07-18 12:23:57 +04:00
|
|
|
|
|
|
|
nsWidgetInitData initData;
|
|
|
|
initData.clipChildren = PR_TRUE;
|
|
|
|
initData.clipSiblings = PR_TRUE;
|
|
|
|
|
|
|
|
rv = view->CreateWidget(kCChildCID, &initData);
|
1999-11-24 09:03:41 +03:00
|
|
|
SetView(aPresContext, view);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-04-24 01:55:15 +04:00
|
|
|
// if the visibility is hidden, reflect that in the view
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleVisibility* vis;
|
|
|
|
GetStyleData(eStyleStruct_Visibility, ((const nsStyleStruct *&)vis));
|
|
|
|
if (!vis->IsVisible()) {
|
1999-04-24 01:55:15 +04:00
|
|
|
view->SetVisibility(nsViewVisibility_kHide);
|
|
|
|
}
|
|
|
|
|
1999-11-27 06:06:59 +03:00
|
|
|
nsCOMPtr<nsIWidget> widget;
|
|
|
|
view->GetWidget(*getter_AddRefs(widget));
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
mSubShell->InitWindow(nsnull, widget, 0, 0, NSToCoordRound(aSize.width * t2p),
|
|
|
|
NSToCoordRound(aSize.height * t2p));
|
|
|
|
mSubShell->Create();
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
mSubShell->SetVisibility(PR_TRUE);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-10-03 03:23:55 +04:00
|
|
|
static PRBool CheckForBrowser(nsIContent* aContent, nsIBaseWindow* aShell)
|
|
|
|
{
|
2001-03-17 01:40:15 +03:00
|
|
|
PRBool didReload = PR_FALSE;
|
2000-10-03 03:23:55 +04:00
|
|
|
#ifdef INCLUDE_XUL
|
2001-03-17 01:40:15 +03:00
|
|
|
// XXXjag see bug 68662
|
2000-10-03 03:23:55 +04:00
|
|
|
nsCOMPtr<nsIDOMXULElement> xulElt(do_QueryInterface(aContent));
|
|
|
|
if (xulElt) {
|
2001-03-17 01:40:15 +03:00
|
|
|
// We might be a XUL browser and may have stored state in our box object.
|
2000-10-03 03:23:55 +04:00
|
|
|
nsCOMPtr<nsIBoxObject> boxObject;
|
|
|
|
xulElt->GetBoxObject(getter_AddRefs(boxObject));
|
|
|
|
if (boxObject) {
|
|
|
|
nsCOMPtr<nsIBrowserBoxObject> browser(do_QueryInterface(boxObject));
|
|
|
|
if (browser) {
|
|
|
|
nsCOMPtr<nsISupports> supp;
|
2001-03-17 01:40:15 +03:00
|
|
|
/* reregister the progress listener */
|
|
|
|
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("listener").get(), getter_AddRefs(supp));
|
|
|
|
if (supp) {
|
|
|
|
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(supp));
|
|
|
|
if (listener) {
|
|
|
|
nsCOMPtr<nsIDocShell> docShell;
|
|
|
|
browser->GetDocShell(getter_AddRefs(docShell));
|
|
|
|
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(docShell));
|
|
|
|
webProgress->AddProgressListener(listener);
|
|
|
|
boxObject->RemoveProperty(NS_LITERAL_STRING("listener").get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* reinitialize the security module */
|
|
|
|
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("xulwindow").get(), getter_AddRefs(supp));
|
|
|
|
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(supp));
|
|
|
|
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("secureBrowserUI").get(), getter_AddRefs(supp));
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
nsCOMPtr<nsISecureBrowserUI> secureBrowserUI(do_QueryInterface(supp));
|
2001-03-17 01:40:15 +03:00
|
|
|
if (domWindow && secureBrowserUI) {
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
nsCOMPtr<nsIDOMWindow> contentWindow;
|
|
|
|
domWindow->GetContent(getter_AddRefs(contentWindow));
|
2001-03-17 01:40:15 +03:00
|
|
|
nsCOMPtr<nsIDOMDocument> doc;
|
|
|
|
domWindow->GetDocument(getter_AddRefs(doc));
|
|
|
|
if (contentWindow && doc) {
|
|
|
|
nsCOMPtr<nsIDOMElement> button;
|
|
|
|
doc->GetElementById(NS_LITERAL_STRING("security-button"), getter_AddRefs(button));
|
|
|
|
if (button)
|
|
|
|
secureBrowserUI->Init(contentWindow, button);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set session history on the new docshell */
|
2001-03-08 11:05:05 +03:00
|
|
|
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("history").get(), getter_AddRefs(supp));
|
2000-10-03 03:23:55 +04:00
|
|
|
if (supp) {
|
|
|
|
nsCOMPtr<nsISHistory> hist(do_QueryInterface(supp));
|
|
|
|
if (hist) {
|
|
|
|
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aShell));
|
|
|
|
webNav->SetSessionHistory(hist);
|
|
|
|
nsCOMPtr<nsIWebNavigation> histNav(do_QueryInterface(hist));
|
|
|
|
histNav->Reload(0);
|
2001-03-17 01:40:15 +03:00
|
|
|
didReload = PR_TRUE;
|
2001-03-08 11:05:05 +03:00
|
|
|
boxObject->RemoveProperty(NS_LITERAL_STRING("history").get());
|
2000-10-03 03:23:55 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2001-03-17 01:40:15 +03:00
|
|
|
return didReload;
|
2000-10-03 03:23:55 +04:00
|
|
|
}
|
|
|
|
|
2000-05-12 04:57:28 +04:00
|
|
|
nsresult
|
|
|
|
nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
|
|
|
|
{
|
2001-02-06 03:52:36 +03:00
|
|
|
// Bug 8065: Preventing frame nesting recursion - if the frames are
|
|
|
|
// too deep we don't create a mSubShell, so this isn't an assert:
|
|
|
|
if (!mSubShell) return NS_OK;
|
2000-05-12 04:57:28 +04:00
|
|
|
|
|
|
|
// Prevent recursion
|
|
|
|
mCreatingViewer=PR_TRUE;
|
|
|
|
|
|
|
|
// Get the URL to load
|
|
|
|
nsCOMPtr<nsIContent> parentContent;
|
2001-02-06 03:52:36 +03:00
|
|
|
nsresult rv = GetParentContent(*getter_AddRefs(parentContent));
|
2000-05-12 04:57:28 +04:00
|
|
|
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && parentContent, rv);
|
|
|
|
|
2001-03-17 01:40:15 +03:00
|
|
|
PRBool load = !CheckForBrowser(parentContent, mSubShell);
|
2000-05-12 04:57:28 +04:00
|
|
|
|
2000-10-03 03:23:55 +04:00
|
|
|
if (load) {
|
|
|
|
nsAutoString url;
|
|
|
|
GetURL(parentContent, url);
|
|
|
|
url.Trim(" \t\n\r");
|
|
|
|
if (url.IsEmpty()) // Load about:blank into a frame if not URL is specified (bug 35986)
|
|
|
|
url = NS_ConvertASCIItoUCS2("about:blank");
|
2000-05-12 04:57:28 +04:00
|
|
|
|
2000-10-03 03:23:55 +04:00
|
|
|
// Make an absolute URL
|
|
|
|
nsCOMPtr<nsIURI> baseURL;
|
|
|
|
nsCOMPtr<nsIHTMLContent> htmlContent = do_QueryInterface(parentContent, &rv);
|
|
|
|
if (NS_SUCCEEDED(rv) && htmlContent) {
|
|
|
|
htmlContent->GetBaseURL(*getter_AddRefs(baseURL));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsCOMPtr<nsIDocument> doc;
|
|
|
|
rv = parentContent->GetDocument(*getter_AddRefs(doc));
|
|
|
|
if (NS_SUCCEEDED(rv) && doc) {
|
|
|
|
doc->GetBaseURL(*getter_AddRefs(baseURL));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nsAutoString absURL;
|
|
|
|
rv = NS_MakeAbsoluteURI(absURL, url, baseURL);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
NS_NewURI(getter_AddRefs(uri), absURL, nsnull);
|
|
|
|
|
|
|
|
// Check for security
|
2001-07-25 11:54:28 +04:00
|
|
|
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
|
|
|
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
2000-10-03 03:23:55 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// Get base URL
|
|
|
|
nsCOMPtr<nsIURI> baseURI;
|
|
|
|
rv = aPresContext->GetBaseURL(getter_AddRefs(baseURI));
|
|
|
|
|
|
|
|
// Get docshell and create load info
|
|
|
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mSubShell));
|
|
|
|
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
|
|
|
nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
|
|
|
|
docShell->CreateLoadInfo(getter_AddRefs(loadInfo));
|
|
|
|
NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
// Get referring URL
|
|
|
|
nsCOMPtr<nsIURI> referrer;
|
|
|
|
nsCOMPtr<nsIPrincipal> principal;
|
|
|
|
rv = secMan->GetSubjectPrincipal(getter_AddRefs(principal));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
// If we were called from script, get the referring URL from the script
|
|
|
|
if (principal) {
|
|
|
|
nsCOMPtr<nsICodebasePrincipal> codebase = do_QueryInterface(principal);
|
|
|
|
if (codebase) {
|
|
|
|
rv = codebase->GetURI(getter_AddRefs(referrer));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
// Pass the script principal to the docshell
|
|
|
|
nsCOMPtr<nsISupports> owner = do_QueryInterface(principal);
|
|
|
|
loadInfo->SetOwner(owner);
|
|
|
|
}
|
|
|
|
if (!referrer) { // We're not being called form script, tell the docshell
|
|
|
|
// to inherit an owner from the current document.
|
|
|
|
loadInfo->SetInheritOwner(PR_TRUE);
|
|
|
|
referrer = baseURI;
|
|
|
|
}
|
2000-05-12 04:57:28 +04:00
|
|
|
|
2001-02-03 04:17:00 +03:00
|
|
|
loadInfo->SetReferrer(referrer);
|
|
|
|
|
2000-10-03 03:23:55 +04:00
|
|
|
// Check if we are allowed to load absURL
|
|
|
|
nsCOMPtr<nsIURI> newURI;
|
|
|
|
rv = NS_NewURI(getter_AddRefs(newURI), absURL, baseURI);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2000-10-14 02:59:47 +04:00
|
|
|
rv = secMan->CheckLoadURI(referrer, newURI, nsIScriptSecurityManager::STANDARD);
|
2000-10-03 03:23:55 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv; // We're not
|
2000-05-12 04:57:28 +04:00
|
|
|
|
2001-05-19 04:17:01 +04:00
|
|
|
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mSubShell));
|
|
|
|
|
|
|
|
if (webProgress) {
|
|
|
|
webProgress->AddProgressListener(this);
|
|
|
|
}
|
|
|
|
|
2000-10-03 03:23:55 +04:00
|
|
|
rv = docShell->LoadURI(uri, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to load URL");
|
|
|
|
}
|
2000-05-12 04:57:28 +04:00
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
1999-05-20 02:14:11 +04:00
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLFrameInnerFrame::Reflow(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
2000-04-22 01:51:35 +04:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsHTMLFrameInnerFrame", aReflowState.reason);
|
1998-09-10 21:23:31 +04:00
|
|
|
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
|
|
|
("enter nsHTMLFrameInnerFrame::Reflow: maxSize=%d,%d reason=%d",
|
1999-01-06 02:31:18 +03:00
|
|
|
aReflowState.availableWidth,
|
|
|
|
aReflowState.availableHeight,
|
1998-09-10 21:23:31 +04:00
|
|
|
aReflowState.reason));
|
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
// use the max size set in aReflowState by the nsHTMLFrameOuterFrame as our size
|
2001-01-08 23:26:05 +03:00
|
|
|
|
|
|
|
// determine if we are a printcontext
|
|
|
|
|
2001-02-07 02:03:17 +03:00
|
|
|
PRBool shouldCreateDoc = PR_TRUE;
|
2001-01-08 23:26:05 +03:00
|
|
|
nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);
|
|
|
|
if (thePrinterContext) {
|
|
|
|
// we are printing
|
2001-02-07 02:03:17 +03:00
|
|
|
shouldCreateDoc = PR_FALSE;
|
2001-01-08 23:26:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-07 02:03:17 +03:00
|
|
|
if (!mCreatingViewer && shouldCreateDoc) {
|
2000-01-07 09:18:48 +03:00
|
|
|
// create the web shell
|
1999-12-15 03:09:10 +03:00
|
|
|
// we do this even if the size is not positive (bug 11762)
|
2000-01-07 09:18:48 +03:00
|
|
|
// we do this even if there is no src (bug 16218)
|
2000-03-11 03:41:04 +03:00
|
|
|
if (!mSubShell) {
|
2000-01-07 09:18:48 +03:00
|
|
|
nsSize maxSize(aReflowState.availableWidth, aReflowState.availableHeight);
|
2000-03-11 03:41:04 +03:00
|
|
|
rv = CreateDocShell(aPresContext, maxSize);
|
2000-01-07 09:18:48 +03:00
|
|
|
}
|
2000-05-12 04:57:28 +04:00
|
|
|
// Whether or not we had to create a webshell, load the document
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2001-02-06 03:52:36 +03:00
|
|
|
DoLoadURL(aPresContext);
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-12 04:57:28 +04:00
|
|
|
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1999-04-28 01:05:32 +04:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
// resize the sub document
|
2000-03-11 03:41:04 +03:00
|
|
|
if(mSubShell) {
|
1999-02-12 20:45:58 +03:00
|
|
|
float t2p;
|
1999-11-24 09:03:41 +03:00
|
|
|
aPresContext->GetTwipsToPixels(&t2p);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
2000-03-11 03:41:04 +03:00
|
|
|
PRInt32 x = 0;
|
|
|
|
PRInt32 y = 0;
|
|
|
|
|
|
|
|
mSubShell->GetPositionAndSize(&x, &y, nsnull, nsnull);
|
|
|
|
PRInt32 cx = NSToCoordRound(aDesiredSize.width * t2p);
|
|
|
|
PRInt32 cy = NSToCoordRound(aDesiredSize.height * t2p);
|
|
|
|
mSubShell->SetPositionAndSize(x, y, cx, cy, PR_FALSE);
|
1998-09-10 21:23:31 +04:00
|
|
|
|
1998-11-23 20:37:46 +03:00
|
|
|
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
|
|
|
("exit nsHTMLFrameInnerFrame::Reflow: size=%d,%d rv=%x",
|
1998-09-10 21:23:31 +04:00
|
|
|
aDesiredSize.width, aDesiredSize.height, aStatus));
|
1998-11-23 20:37:46 +03:00
|
|
|
}
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2000-05-12 04:57:28 +04:00
|
|
|
// load a new url
|
1998-10-03 01:59:59 +04:00
|
|
|
nsresult
|
2000-05-12 04:57:28 +04:00
|
|
|
nsHTMLFrameInnerFrame::ReloadURL(nsIPresContext* aPresContext)
|
1998-10-03 01:59:59 +04:00
|
|
|
{
|
2000-05-12 04:57:28 +04:00
|
|
|
return DoLoadURL(aPresContext);
|
1998-10-03 01:59:59 +04:00
|
|
|
}
|
|
|
|
|
1998-09-10 21:23:31 +04:00
|
|
|
void
|
|
|
|
nsHTMLFrameInnerFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize)
|
1998-09-10 21:23:31 +04:00
|
|
|
{
|
2000-05-12 04:57:28 +04:00
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
|
|
|
aDesiredSize.height = aReflowState.availableHeight;
|
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
1998-09-10 21:23:31 +04:00
|
|
|
aDesiredSize.descent = 0;
|
2000-05-12 04:57:28 +04:00
|
|
|
|
|
|
|
// For unknown reasons, the maxElementSize for the InnerFrame is used, but the
|
|
|
|
// maxElementSize for the OuterFrame is ignored, make sure to get it right here!
|
|
|
|
if (aDesiredSize.maxElementSize) {
|
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) ||
|
|
|
|
(eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit())) {
|
|
|
|
aDesiredSize.maxElementSize->width = 0; // percent width springy down to 0 px
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
|
|
|
}
|
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) ||
|
|
|
|
(eStyleUnit_Percent == aReflowState.mStylePosition->mHeight.GetUnit())) {
|
|
|
|
aDesiredSize.maxElementSize->height = 0; // percent height springy down to 0px
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aDesiredSize.maxElementSize->height = aDesiredSize.height;
|
|
|
|
}
|
|
|
|
}
|
1998-09-10 21:23:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* FrameLoadingInfo
|
|
|
|
******************************************************************************/
|
|
|
|
FrameLoadingInfo::FrameLoadingInfo(const nsSize& aSize)
|
|
|
|
{
|
|
|
|
NS_INIT_REFCNT();
|
|
|
|
|
|
|
|
mFrameSize = aSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Implementation of ISupports methods...
|
|
|
|
*/
|
2000-09-09 09:46:14 +04:00
|
|
|
NS_IMPL_ISUPPORTS(FrameLoadingInfo, NS_GET_IID(nsISupports));
|
1998-09-10 21:23:31 +04:00
|
|
|
|