1998-04-13 20:24:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
1999-02-12 17:45:58 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsFrame.h"
|
1999-02-01 17:31:10 +00:00
|
|
|
#include "nsFrameList.h"
|
1998-10-09 23:46:02 +00:00
|
|
|
#include "nsLineLayout.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "nsGUIEvent.h"
|
1998-07-23 02:55:33 +00:00
|
|
|
#include "nsDOMEvent.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsStyleConsts.h"
|
1998-05-08 16:33:07 +00:00
|
|
|
#include "nsIPresShell.h"
|
1998-05-20 16:24:13 +00:00
|
|
|
#include "prlog.h"
|
|
|
|
#include "prprf.h"
|
|
|
|
#include <stdarg.h>
|
1998-06-02 05:28:11 +00:00
|
|
|
#include "nsIPtr.h"
|
1998-06-05 21:06:24 +00:00
|
|
|
#include "nsISizeOfHandler.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-27 16:44:52 +00:00
|
|
|
#include "nsIDOMText.h"
|
1998-05-08 18:33:42 +00:00
|
|
|
#include "nsDocument.h"
|
|
|
|
#include "nsIDeviceContext.h"
|
1998-10-01 04:46:11 +00:00
|
|
|
#include "nsHTMLIIDs.h"
|
1998-11-18 05:25:26 +00:00
|
|
|
#include "nsIEventStateManager.h"
|
1999-02-11 23:12:28 +00:00
|
|
|
#include "nsIDOMSelection.h"
|
|
|
|
#include "nsIFrameSelection.h"
|
1998-12-14 18:34:14 +00:00
|
|
|
#include "nsIFocusTracker.h"
|
1999-01-15 01:29:15 +00:00
|
|
|
#include "nsHTMLParts.h"
|
1999-01-22 22:48:00 +00:00
|
|
|
#include "nsLayoutAtoms.h"
|
1998-05-08 18:33:42 +00:00
|
|
|
|
1999-02-10 18:55:25 +00:00
|
|
|
#include "nsFrameTraversal.h"
|
|
|
|
#include "nsCOMPtr.h"
|
1999-03-25 06:43:38 +00:00
|
|
|
#include "nsStyleChangeList.h"
|
1999-02-10 18:55:25 +00:00
|
|
|
|
|
|
|
|
1998-07-18 18:18:20 +00:00
|
|
|
// Some Misc #defines
|
1998-07-22 22:01:46 +00:00
|
|
|
#define SELECTION_DEBUG 0
|
1998-07-18 18:18:20 +00:00
|
|
|
#define FORCE_SELECTION_UPDATE 1
|
|
|
|
#define TRACKER_DEBUG 0
|
|
|
|
#define CALC_DEBUG 0
|
|
|
|
|
|
|
|
// Tracker Data
|
|
|
|
#define kInsertInRemoveList 0
|
|
|
|
#define kInsertInAddList 1
|
|
|
|
|
1998-05-08 18:33:42 +00:00
|
|
|
// Kludged Content stuff
|
|
|
|
nsIFrame * fFrameArray[1024];
|
|
|
|
nsIContent * fContentArray[1024];
|
|
|
|
PRInt32 fMax = -1;
|
|
|
|
|
|
|
|
nsIContent * fTrackerContentArrayRemoveList[1024];
|
|
|
|
PRInt32 fTrackerRemoveListMax = 0;
|
|
|
|
nsIContent * fTrackerContentArrayAddList[1024];
|
|
|
|
PRInt32 fTrackerAddListMax = 0;
|
1998-04-27 16:44:52 +00:00
|
|
|
|
1998-07-17 23:00:54 +00:00
|
|
|
nsIDocument *gDoc = nsnull;
|
|
|
|
|
1998-04-27 16:44:52 +00:00
|
|
|
// [HACK] Foward Declarations
|
1998-05-08 18:33:42 +00:00
|
|
|
void ForceDrawFrame(nsFrame * aFrame);
|
1999-02-08 17:56:00 +00:00
|
|
|
#if 0
|
1998-12-18 21:04:33 +00:00
|
|
|
static void RefreshContentFrames(nsIPresContext& aPresContext, nsIContent * aStartContent, nsIContent * aEndContent);
|
1999-02-08 17:56:00 +00:00
|
|
|
#endif
|
1998-05-08 18:33:42 +00:00
|
|
|
|
|
|
|
PRBool nsFrame::mDoingSelection = PR_FALSE;
|
|
|
|
PRBool nsFrame::mDidDrag = PR_FALSE;
|
|
|
|
|
|
|
|
|
1998-05-20 16:24:13 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
static PRBool gShowFrameBorders = PR_FALSE;
|
1998-05-08 18:33:42 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
NS_LAYOUT void nsIFrame::ShowFrameBorders(PRBool aEnable)
|
|
|
|
{
|
|
|
|
gShowFrameBorders = aEnable;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_LAYOUT PRBool nsIFrame::GetShowFrameBorders()
|
|
|
|
{
|
|
|
|
return gShowFrameBorders;
|
|
|
|
}
|
|
|
|
|
1998-05-20 16:24:13 +00:00
|
|
|
/**
|
|
|
|
* Note: the log module is created during library initialization which
|
|
|
|
* means that you cannot perform logging before then.
|
|
|
|
*/
|
1999-02-26 17:05:20 +00:00
|
|
|
static PRLogModuleInfo* gLogModule;
|
1998-05-20 16:24:13 +00:00
|
|
|
|
|
|
|
static PRLogModuleInfo* gFrameVerifyTreeLogModuleInfo;
|
|
|
|
|
|
|
|
static PRBool gFrameVerifyTreeEnable = PRBool(0x55);
|
|
|
|
|
|
|
|
NS_LAYOUT PRBool
|
|
|
|
nsIFrame::GetVerifyTreeEnable()
|
|
|
|
{
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
if (gFrameVerifyTreeEnable == PRBool(0x55)) {
|
|
|
|
if (nsnull == gFrameVerifyTreeLogModuleInfo) {
|
|
|
|
gFrameVerifyTreeLogModuleInfo = PR_NewLogModule("frameverifytree");
|
|
|
|
gFrameVerifyTreeEnable = 0 != gFrameVerifyTreeLogModuleInfo->level;
|
|
|
|
printf("Note: frameverifytree is %sabled\n",
|
|
|
|
gFrameVerifyTreeEnable ? "en" : "dis");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return gFrameVerifyTreeEnable;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_LAYOUT void
|
|
|
|
nsIFrame::SetVerifyTreeEnable(PRBool aEnabled)
|
|
|
|
{
|
|
|
|
gFrameVerifyTreeEnable = aEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_LAYOUT PRLogModuleInfo*
|
|
|
|
nsIFrame::GetLogModuleInfo()
|
|
|
|
{
|
1999-02-26 17:05:20 +00:00
|
|
|
if (nsnull == gLogModule) {
|
|
|
|
gLogModule = PR_NewLogModule("frame");
|
|
|
|
}
|
1998-05-20 16:24:13 +00:00
|
|
|
return gLogModule;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
1998-12-14 18:34:14 +00:00
|
|
|
static NS_DEFINE_IID(kIFocusTracker, NS_IFOCUSTRACKER_IID);
|
1999-02-11 23:12:28 +00:00
|
|
|
static NS_DEFINE_IID(kIFrameSelection, NS_IFRAMESELECTION_IID);
|
1998-04-13 20:24:54 +00:00
|
|
|
nsresult
|
1998-12-03 06:31:43 +00:00
|
|
|
NS_NewEmptyFrame(nsIFrame** aInstancePtrResult)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
|
|
|
if (nsnull == aInstancePtrResult) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1998-12-03 06:31:43 +00:00
|
|
|
nsIFrame* it = new nsFrame;
|
1998-04-13 20:24:54 +00:00
|
|
|
if (nsnull == it) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
*aInstancePtrResult = it;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-02-26 20:02:06 +00:00
|
|
|
NS_IMPL_ZEROING_OPERATOR_NEW(nsFrame)
|
1999-02-26 17:05:20 +00:00
|
|
|
|
1998-12-03 06:31:43 +00:00
|
|
|
nsFrame::nsFrame()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-10-16 20:09:32 +00:00
|
|
|
mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_SYNC_FRAME_AND_VIEW;
|
1998-12-14 18:34:14 +00:00
|
|
|
mSelected = PR_FALSE;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsFrame::~nsFrame()
|
|
|
|
{
|
1998-08-04 18:19:51 +00:00
|
|
|
NS_IF_RELEASE(mContent);
|
1998-04-13 20:24:54 +00:00
|
|
|
NS_IF_RELEASE(mStyleContext);
|
|
|
|
if (nsnull != mView) {
|
|
|
|
// Break association between view and frame
|
1998-08-08 04:23:33 +00:00
|
|
|
mView->Destroy();
|
|
|
|
mView = nsnull;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-08-03 22:22:27 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsISupports
|
|
|
|
|
|
|
|
nsresult nsFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
if (NULL == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
|
|
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|
|
|
static NS_DEFINE_IID(kClassIID, kIFrameIID);
|
1998-10-01 04:46:11 +00:00
|
|
|
if (aIID.Equals(kIHTMLReflowIID)) {
|
|
|
|
*aInstancePtr = (void*)(nsIHTMLReflow*)this;
|
|
|
|
return NS_OK;
|
|
|
|
} else if (aIID.Equals(kClassIID) || aIID.Equals(kISupportsIID)) {
|
1998-04-13 20:24:54 +00:00
|
|
|
*aInstancePtr = (void*)this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsrefcnt nsFrame::AddRef(void)
|
|
|
|
{
|
1998-09-24 01:50:16 +00:00
|
|
|
NS_WARNING("not supported for frames");
|
|
|
|
return 1;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsrefcnt nsFrame::Release(void)
|
|
|
|
{
|
1998-09-24 01:50:16 +00:00
|
|
|
NS_WARNING("not supported for frames");
|
|
|
|
return 1;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIFrame
|
|
|
|
|
1998-12-03 06:31:43 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::Init(nsIPresContext& aPresContext,
|
|
|
|
nsIContent* aContent,
|
1999-01-14 05:16:23 +00:00
|
|
|
nsIFrame* aParent,
|
1999-02-25 03:27:57 +00:00
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
1998-12-03 06:31:43 +00:00
|
|
|
{
|
|
|
|
mContent = aContent;
|
|
|
|
NS_IF_ADDREF(mContent);
|
1999-01-14 05:16:23 +00:00
|
|
|
mParent = aParent;
|
1998-12-03 06:31:43 +00:00
|
|
|
return SetStyleContext(&aPresContext, aContext);
|
|
|
|
}
|
|
|
|
|
1998-11-10 06:05:32 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1998-09-10 19:32:14 +00:00
|
|
|
{
|
1998-11-10 06:05:32 +00:00
|
|
|
// XXX This shouldn't be getting called at all, but currently is for backwards
|
|
|
|
// compatility reasons...
|
|
|
|
#if 0
|
|
|
|
NS_ERROR("not a container");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
#else
|
|
|
|
NS_ASSERTION(nsnull == aChildList, "not a container");
|
1998-09-10 19:32:14 +00:00
|
|
|
return NS_OK;
|
1998-11-10 06:05:32 +00:00
|
|
|
#endif
|
1998-09-10 19:32:14 +00:00
|
|
|
}
|
|
|
|
|
1999-01-15 01:29:15 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::AppendFrames(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
#else
|
1999-02-01 17:31:10 +00:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsFrameList tmp(aFrameList);
|
|
|
|
tmp.VerifyParent(this);
|
|
|
|
#endif
|
1999-01-15 01:29:15 +00:00
|
|
|
// XXX temporary code until frame containers stop using the old
|
|
|
|
// reflow command api's
|
|
|
|
nsIReflowCommand* reflowCmd = nsnull;
|
|
|
|
nsresult rv;
|
|
|
|
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
|
|
|
|
nsIReflowCommand::FrameAppended,
|
|
|
|
aFrameList);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
if (nsnull != aListName) {
|
|
|
|
reflowCmd->SetChildListName(aListName);
|
|
|
|
}
|
|
|
|
aPresShell.AppendReflowCommand(reflowCmd);
|
|
|
|
NS_RELEASE(reflowCmd);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::InsertFrames(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
#else
|
1999-02-01 17:31:10 +00:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsFrameList tmp(aFrameList);
|
|
|
|
tmp.VerifyParent(this);
|
|
|
|
#endif
|
|
|
|
|
1999-01-15 01:29:15 +00:00
|
|
|
// XXX temporary code until frame containers stop using the old
|
|
|
|
// reflow command api's
|
1999-02-01 17:31:10 +00:00
|
|
|
|
|
|
|
// By default, the reflow command is aimed at the first-in-flow. We
|
|
|
|
// map that to the flow block that contains aPrevFrame for
|
|
|
|
// compatability.
|
|
|
|
nsIFrame* target = this;
|
|
|
|
if (nsnull != aPrevFrame) {
|
1999-02-10 01:36:30 +00:00
|
|
|
aPrevFrame->GetParent(&target);
|
1999-02-01 17:31:10 +00:00
|
|
|
}
|
|
|
|
|
1999-01-15 01:29:15 +00:00
|
|
|
nsIReflowCommand* reflowCmd = nsnull;
|
|
|
|
nsresult rv;
|
1999-02-01 17:31:10 +00:00
|
|
|
rv = NS_NewHTMLReflowCommand(&reflowCmd, target, aFrameList, aPrevFrame);
|
1999-01-15 01:29:15 +00:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
if (nsnull != aListName) {
|
|
|
|
reflowCmd->SetChildListName(aListName);
|
|
|
|
}
|
|
|
|
aPresShell.AppendReflowCommand(reflowCmd);
|
|
|
|
NS_RELEASE(reflowCmd);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::RemoveFrame(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
#else
|
1999-02-01 17:31:10 +00:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsIFrame* parent;
|
1999-02-10 01:36:30 +00:00
|
|
|
aOldFrame->GetParent(&parent);
|
1999-02-01 17:31:10 +00:00
|
|
|
NS_ASSERTION(parent == this, "bad child parent");
|
|
|
|
#endif
|
|
|
|
|
1999-01-15 01:29:15 +00:00
|
|
|
// XXX temporary code until frame containers stop using the old
|
|
|
|
// reflow command api's
|
1999-02-01 17:31:10 +00:00
|
|
|
|
|
|
|
// By default, the reflow command is aimed at the first-in-flow. We
|
|
|
|
// map that to the flow block that contains aPrevFrame for
|
|
|
|
// compatability.
|
|
|
|
nsIFrame* target = this;
|
|
|
|
if (nsnull != aOldFrame) {
|
1999-02-10 01:36:30 +00:00
|
|
|
aOldFrame->GetParent(&target);
|
1999-02-01 17:31:10 +00:00
|
|
|
}
|
|
|
|
|
1999-01-15 01:29:15 +00:00
|
|
|
nsIReflowCommand* reflowCmd = nsnull;
|
|
|
|
nsresult rv;
|
1999-02-01 17:31:10 +00:00
|
|
|
rv = NS_NewHTMLReflowCommand(&reflowCmd, target,
|
1999-01-15 01:29:15 +00:00
|
|
|
nsIReflowCommand::FrameRemoved,
|
|
|
|
aOldFrame);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
if (nsnull != aListName) {
|
|
|
|
reflowCmd->SetChildListName(aListName);
|
|
|
|
}
|
|
|
|
aPresShell.AppendReflowCommand(reflowCmd);
|
|
|
|
NS_RELEASE(reflowCmd);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::DeleteFrame(nsIPresContext& aPresContext)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-03-12 00:17:14 +00:00
|
|
|
if (mState & NS_FRAME_EXTERNAL_REFERENCE || mSelected) {
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
|
1999-02-12 18:41:26 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && shell) {
|
1998-11-19 00:43:36 +00:00
|
|
|
shell->ClearFrameRefs(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-08-28 02:52:54 +00:00
|
|
|
//XXX Why is this done in nsFrame instead of some frame class
|
1998-08-08 04:23:33 +00:00
|
|
|
// that actually loads images?
|
1998-08-28 02:52:54 +00:00
|
|
|
aPresContext.StopLoadImage(this);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-08-10 02:28:23 +00:00
|
|
|
//Set to prevent event dispatch during destruct
|
|
|
|
if (nsnull != mView) {
|
1998-08-28 02:52:54 +00:00
|
|
|
mView->SetClientData(nsnull);
|
1998-08-10 02:28:23 +00:00
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
delete this;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-06-05 21:06:24 +00:00
|
|
|
NS_IMETHODIMP
|
1999-02-10 00:42:56 +00:00
|
|
|
nsFrame::GetContent(nsIContent** aContent) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 00:42:56 +00:00
|
|
|
NS_PRECONDITION(nsnull != aContent, "null OUT parameter pointer");
|
1998-11-12 23:03:35 +00:00
|
|
|
NS_IF_ADDREF(mContent);
|
1999-02-10 00:42:56 +00:00
|
|
|
*aContent = mContent;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-01-22 18:58:14 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const
|
|
|
|
{
|
|
|
|
aStart = 0;
|
|
|
|
aEnd = 0;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-01-16 00:00:50 +00:00
|
|
|
NS_IMETHODIMP
|
1999-02-10 00:42:56 +00:00
|
|
|
nsFrame::GetStyleContext(nsIStyleContext** aStyleContext) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 00:42:56 +00:00
|
|
|
NS_PRECONDITION(nsnull != aStyleContext, "null OUT parameter pointer");
|
1998-11-03 20:23:15 +00:00
|
|
|
NS_ASSERTION(nsnull != mStyleContext, "frame should always have style context");
|
1998-04-13 20:24:54 +00:00
|
|
|
NS_IF_ADDREF(mStyleContext);
|
1999-02-10 00:42:56 +00:00
|
|
|
*aStyleContext = mStyleContext;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* aContext)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-05 03:58:27 +00:00
|
|
|
NS_PRECONDITION(0 == (mState & NS_FRAME_IN_REFLOW), "Shouldn't set style context during reflow");
|
1998-04-13 20:24:54 +00:00
|
|
|
NS_PRECONDITION(nsnull != aContext, "null ptr");
|
|
|
|
if (aContext != mStyleContext) {
|
|
|
|
NS_IF_RELEASE(mStyleContext);
|
|
|
|
if (nsnull != aContext) {
|
|
|
|
mStyleContext = aContext;
|
|
|
|
NS_ADDREF(aContext);
|
1998-05-01 20:43:02 +00:00
|
|
|
DidSetStyleContext(aPresContext);
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
1998-04-17 01:41:24 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-04-28 23:25:07 +00:00
|
|
|
// Subclass hook for style post processing
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
1998-04-28 23:25:07 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const
|
1998-04-17 01:41:24 +00:00
|
|
|
{
|
|
|
|
NS_ASSERTION(mStyleContext!=nsnull,"null style context");
|
|
|
|
if (mStyleContext) {
|
1998-06-05 06:09:09 +00:00
|
|
|
aStyleStruct = mStyleContext->GetStyleData(aSID);
|
1998-04-17 01:41:24 +00:00
|
|
|
} else {
|
|
|
|
aStyleStruct = nsnull;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-03-25 06:43:38 +00:00
|
|
|
void nsFrame::CaptureStyleChangeFor(nsIFrame* aFrame,
|
|
|
|
nsIStyleContext* aOldContext,
|
|
|
|
nsIStyleContext* aNewContext,
|
|
|
|
PRInt32 aParentChange,
|
|
|
|
nsStyleChangeList* aChangeList,
|
|
|
|
PRInt32* aLocalChange)
|
|
|
|
{
|
|
|
|
if (aChangeList && aLocalChange) { // does caller really want change data?
|
|
|
|
PRInt32 change = NS_STYLE_HINT_NONE;
|
|
|
|
if (aOldContext) {
|
|
|
|
aNewContext->CalcStyleDifference(aOldContext, change);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsIStyleContext* parent = aNewContext->GetParent();
|
|
|
|
if (parent) {
|
|
|
|
aNewContext->CalcStyleDifference(parent, change);
|
|
|
|
NS_RELEASE(parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aParentChange < change) { // found larger change, record it
|
|
|
|
aChangeList->AppendChange(aFrame, change);
|
|
|
|
*aLocalChange = change;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*aLocalChange = aParentChange;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-03 20:23:15 +00:00
|
|
|
NS_IMETHODIMP nsFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
1999-03-25 06:43:38 +00:00
|
|
|
nsIStyleContext* aParentContext,
|
|
|
|
PRInt32 aParentChange,
|
|
|
|
nsStyleChangeList* aChangeList,
|
|
|
|
PRInt32* aLocalChange)
|
1998-11-03 20:23:15 +00:00
|
|
|
{
|
1999-02-05 03:58:27 +00:00
|
|
|
// XXX TURN THIS ON NS_PRECONDITION(0 == (mState & NS_FRAME_IN_REFLOW), "Shouldn't set style context during reflow");
|
1998-11-03 20:23:15 +00:00
|
|
|
NS_ASSERTION(nsnull != mStyleContext, "null style context");
|
1999-03-25 06:43:38 +00:00
|
|
|
|
|
|
|
nsresult result = NS_COMFALSE;
|
|
|
|
|
1998-11-03 20:23:15 +00:00
|
|
|
if (nsnull != mStyleContext) {
|
|
|
|
nsIAtom* pseudoTag = nsnull;
|
|
|
|
mStyleContext->GetPseudoType(pseudoTag);
|
|
|
|
nsIStyleContext* newContext;
|
|
|
|
if (nsnull != pseudoTag) {
|
1999-03-25 06:43:38 +00:00
|
|
|
result = aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag,
|
|
|
|
aParentContext,
|
|
|
|
PR_FALSE, &newContext);
|
1998-11-03 20:23:15 +00:00
|
|
|
}
|
|
|
|
else {
|
1999-03-25 06:43:38 +00:00
|
|
|
result = aPresContext->ResolveStyleContextFor(mContent, aParentContext,
|
|
|
|
PR_FALSE, &newContext);
|
1998-11-03 20:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(nsnull != newContext, "failed to get new style context");
|
|
|
|
if (nsnull != newContext) {
|
|
|
|
if (newContext != mStyleContext) {
|
1999-03-25 06:43:38 +00:00
|
|
|
nsIStyleContext* oldContext = mStyleContext;
|
1998-11-03 20:23:15 +00:00
|
|
|
mStyleContext = newContext;
|
1999-03-25 06:43:38 +00:00
|
|
|
result = DidSetStyleContext(aPresContext);
|
|
|
|
CaptureStyleChangeFor(this, oldContext, newContext,
|
|
|
|
aParentChange, aChangeList, aLocalChange);
|
|
|
|
NS_RELEASE(oldContext);
|
1998-11-03 20:23:15 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
NS_RELEASE(newContext);
|
1999-03-25 06:43:38 +00:00
|
|
|
result = NS_COMFALSE;
|
1998-11-03 20:23:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-03-25 06:43:38 +00:00
|
|
|
return result;
|
1998-11-03 20:23:15 +00:00
|
|
|
}
|
|
|
|
|
1999-01-14 05:16:23 +00:00
|
|
|
// Geometric parent member functions
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-02-10 01:36:30 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetParent(nsIFrame** aParent) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 01:36:30 +00:00
|
|
|
NS_PRECONDITION(nsnull != aParent, "null OUT parameter pointer");
|
|
|
|
*aParent = mParent;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-01-14 05:16:23 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetParent(const nsIFrame* aParent)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-01-14 05:16:23 +00:00
|
|
|
mParent = (nsIFrame*)aParent;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bounding rect member functions
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetRect(nsRect& aRect) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
aRect = mRect;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetOrigin(nsPoint& aPoint) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
aPoint.x = mRect.x;
|
|
|
|
aPoint.y = mRect.y;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetSize(nsSize& aSize) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-04-17 01:41:24 +00:00
|
|
|
aSize.width = mRect.width;
|
|
|
|
aSize.height = mRect.height;
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetRect(const nsRect& aRect)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
MoveTo(aRect.x, aRect.y);
|
|
|
|
SizeTo(aRect.width, aRect.height);
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-06-26 00:31:44 +00:00
|
|
|
mRect.x = aX;
|
|
|
|
mRect.y = aY;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-10-16 20:09:32 +00:00
|
|
|
if (nsnull != mView) {
|
|
|
|
// If we should keep the view position and size in sync with the frame
|
|
|
|
// then position the view. Don't do this if we're in the middle of reflow.
|
|
|
|
// Instead wait until the DidReflow() notification
|
|
|
|
if (NS_FRAME_SYNC_FRAME_AND_VIEW == (mState & (NS_FRAME_IN_REFLOW |
|
|
|
|
NS_FRAME_SYNC_FRAME_AND_VIEW))) {
|
|
|
|
// Position view relative to its parent, not relative to our
|
|
|
|
// parent frame (our parent frame may not have a view).
|
|
|
|
nsIView* parentWithView;
|
|
|
|
nsPoint origin;
|
1999-02-10 05:38:18 +00:00
|
|
|
GetOffsetFromView(origin, &parentWithView);
|
1998-10-16 20:09:32 +00:00
|
|
|
nsIViewManager *vm;
|
|
|
|
mView->GetViewManager(vm);
|
|
|
|
vm->MoveViewTo(mView, origin.x, origin.y);
|
|
|
|
NS_RELEASE(vm);
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-04-17 01:41:24 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SizeTo(nscoord aWidth, nscoord aHeight)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-05-07 16:13:09 +00:00
|
|
|
mRect.width = aWidth;
|
|
|
|
mRect.height = aHeight;
|
1998-04-17 01:41:24 +00:00
|
|
|
|
1998-05-07 16:13:09 +00:00
|
|
|
// Let the view know
|
1998-10-16 20:09:32 +00:00
|
|
|
if (nsnull != mView) {
|
|
|
|
// If we should keep the view position and size in sync with the frame
|
|
|
|
// then resize the view. Don't do this if we're in the middle of reflow.
|
|
|
|
// Instead wait until the DidReflow() notification
|
|
|
|
if (NS_FRAME_SYNC_FRAME_AND_VIEW == (mState & (NS_FRAME_IN_REFLOW |
|
|
|
|
NS_FRAME_SYNC_FRAME_AND_VIEW))) {
|
|
|
|
// Resize the view to be the same size as the frame
|
|
|
|
nsIViewManager *vm;
|
|
|
|
mView->GetViewManager(vm);
|
|
|
|
vm->ResizeView(mView, aWidth, aHeight);
|
|
|
|
NS_RELEASE(vm);
|
|
|
|
}
|
1998-05-07 16:13:09 +00:00
|
|
|
}
|
1998-10-16 20:09:32 +00:00
|
|
|
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Child frame enumeration
|
|
|
|
|
1998-11-09 19:59:33 +00:00
|
|
|
NS_IMETHODIMP
|
1999-02-10 02:25:01 +00:00
|
|
|
nsFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const
|
1998-11-09 19:59:33 +00:00
|
|
|
{
|
1999-02-10 02:25:01 +00:00
|
|
|
NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer");
|
1998-11-09 19:59:33 +00:00
|
|
|
NS_PRECONDITION(aIndex >= 0, "invalid index number");
|
1999-02-10 02:25:01 +00:00
|
|
|
*aListName = nsnull;
|
1998-11-09 19:59:33 +00:00
|
|
|
return aIndex < 0 ? NS_ERROR_INVALID_ARG : NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-02-10 02:25:01 +00:00
|
|
|
NS_IMETHODIMP nsFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 02:25:01 +00:00
|
|
|
*aFirstChild = nsnull;
|
1998-11-09 19:40:27 +00:00
|
|
|
return nsnull == aListName ? NS_OK : NS_ERROR_INVALID_ARG;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-12 17:45:58 +00:00
|
|
|
PRBool
|
|
|
|
nsFrame::DisplaySelection(nsIPresContext& aPresContext, PRBool isOkToTurnOn)
|
1998-08-03 23:39:16 +00:00
|
|
|
{
|
|
|
|
PRBool result = PR_FALSE;
|
|
|
|
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
|
1999-02-12 18:41:26 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && shell) {
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIDocument> doc;
|
|
|
|
rv = shell->GetDocument(getter_AddRefs(doc));
|
1999-02-12 18:41:26 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && doc) {
|
1998-08-03 23:39:16 +00:00
|
|
|
result = doc->GetDisplaySelection();
|
|
|
|
if (isOkToTurnOn && !result) {
|
|
|
|
doc->SetDisplaySelection(PR_TRUE);
|
|
|
|
result = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-02-12 17:45:58 +00:00
|
|
|
|
1998-07-27 18:05:35 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1998-12-18 15:54:23 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
|
|
|
{
|
|
|
|
if (eFramePaintLayer_Overlay == aWhichLayer) {
|
|
|
|
if (DisplaySelection(aPresContext) == PR_FALSE)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
// Get Content
|
|
|
|
nsIContent* content;
|
1999-02-10 00:42:56 +00:00
|
|
|
nsresult rv = GetContent(&content);
|
1998-12-18 15:54:23 +00:00
|
|
|
if (NS_FAILED(rv) || (nsnull == content)) {
|
|
|
|
return rv;
|
|
|
|
}
|
1998-05-08 18:33:42 +00:00
|
|
|
|
1998-12-18 15:54:23 +00:00
|
|
|
PRInt32 n;
|
|
|
|
content->ChildCount(n);
|
|
|
|
if ((n == 0) && mSelected) {
|
|
|
|
nsRect rect;
|
|
|
|
GetRect(rect);
|
|
|
|
rect.width--;
|
|
|
|
rect.height--;
|
|
|
|
aRenderingContext.SetColor(NS_RGB(0,0,255));
|
|
|
|
aRenderingContext.DrawRect(rect);
|
|
|
|
aRenderingContext.DrawLine(rect.x, rect.y, rect.XMost(), rect.YMost());
|
|
|
|
aRenderingContext.DrawLine(rect.x, rect.YMost(), rect.XMost(), rect.y);
|
|
|
|
}
|
1998-05-18 21:03:55 +00:00
|
|
|
NS_RELEASE(content);
|
1998-05-08 18:33:42 +00:00
|
|
|
}
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-04-27 16:44:52 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
1998-12-18 15:54:23 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::HandleEvent(nsIPresContext& aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aEventStatus)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-11-18 05:25:26 +00:00
|
|
|
if (nsEventStatus_eConsumeNoDefault == aEventStatus) {
|
|
|
|
return NS_OK;
|
1998-06-23 21:53:02 +00:00
|
|
|
}
|
1998-04-27 16:44:52 +00:00
|
|
|
|
1998-08-03 23:39:16 +00:00
|
|
|
if (DisplaySelection(aPresContext) == PR_FALSE) {
|
|
|
|
if (aEvent->message != NS_MOUSE_LEFT_BUTTON_DOWN) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
1998-04-27 16:44:52 +00:00
|
|
|
|
1998-08-06 07:55:05 +00:00
|
|
|
if(nsEventStatus_eConsumeNoDefault != aEventStatus) {
|
1998-08-05 22:38:24 +00:00
|
|
|
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
|
|
|
|
} else if (aEvent->message == NS_MOUSE_MOVE && mDoingSelection ||
|
|
|
|
aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
|
|
|
|
// no-op
|
1998-06-08 00:57:15 +00:00
|
|
|
} else {
|
|
|
|
return NS_OK;
|
1998-04-27 16:44:52 +00:00
|
|
|
}
|
1998-07-18 18:18:20 +00:00
|
|
|
if (SELECTION_DEBUG) printf("Message: %d-------------------------------------------------------------\n",aEvent->message);
|
1998-04-27 16:44:52 +00:00
|
|
|
|
|
|
|
|
1998-06-08 00:57:15 +00:00
|
|
|
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) {
|
|
|
|
if (mDoingSelection) {
|
1998-08-28 15:58:37 +00:00
|
|
|
HandleRelease(aPresContext, aEvent, aEventStatus);
|
1998-06-08 00:57:15 +00:00
|
|
|
}
|
|
|
|
} else if (aEvent->message == NS_MOUSE_MOVE) {
|
|
|
|
mDidDrag = PR_TRUE;
|
1998-08-28 15:58:37 +00:00
|
|
|
HandleDrag(aPresContext, aEvent, aEventStatus);
|
1998-12-08 18:26:06 +00:00
|
|
|
//DEBUG MJUDGE DEBUG MESSAGE FOR DRAGGING FROM SELECTION
|
1998-06-08 00:57:15 +00:00
|
|
|
} else if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) {
|
1998-08-28 15:58:37 +00:00
|
|
|
HandlePress(aPresContext, aEvent, aEventStatus);
|
1998-06-08 00:57:15 +00:00
|
|
|
}
|
1998-04-27 16:44:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-05-08 18:33:42 +00:00
|
|
|
/**
|
|
|
|
* Handles the Mouse Press Event for the frame
|
|
|
|
*/
|
1999-02-12 17:45:58 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::HandlePress(nsIPresContext& aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aEventStatus)
|
1998-04-27 16:44:52 +00:00
|
|
|
{
|
1999-02-12 17:45:58 +00:00
|
|
|
if (!DisplaySelection(aPresContext, PR_TRUE)) {
|
1998-07-27 18:05:35 +00:00
|
|
|
aEventStatus = nsEventStatus_eIgnore;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-12-14 18:34:14 +00:00
|
|
|
mDoingSelection = PR_TRUE;
|
|
|
|
mDidDrag = PR_FALSE;
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
|
1999-02-21 01:23:40 +00:00
|
|
|
nsInputEvent *inputEvent = (nsInputEvent *)aEvent;
|
1999-02-12 18:41:26 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && shell) {
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIRenderingContext> acx;
|
|
|
|
rv = shell->CreateRenderingContext(this, getter_AddRefs(acx));
|
|
|
|
if (NS_SUCCEEDED(rv)){
|
1998-12-14 18:34:14 +00:00
|
|
|
PRInt32 startPos = 0;
|
|
|
|
PRUint32 contentOffset = 0;
|
|
|
|
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
|
1999-02-11 23:12:28 +00:00
|
|
|
nsIDOMSelection *selection = nsnull;
|
1998-12-14 18:34:14 +00:00
|
|
|
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
|
|
|
|
nsIFocusTracker *tracker;
|
|
|
|
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))){
|
1999-02-11 23:12:28 +00:00
|
|
|
nsIFrameSelection *frameselection = nsnull;
|
|
|
|
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection,
|
|
|
|
(void **)&frameselection))) {
|
1999-02-19 23:47:36 +00:00
|
|
|
frameselection->EnableFrameNotification(PR_FALSE);
|
1999-02-21 01:23:40 +00:00
|
|
|
frameselection->TakeFocus(tracker, this, startPos, contentOffset, inputEvent->isShift);
|
1999-02-19 23:47:36 +00:00
|
|
|
frameselection->EnableFrameNotification(PR_TRUE);//prevent cyclic call to reset selection.
|
1999-02-11 23:12:28 +00:00
|
|
|
NS_RELEASE(frameselection);
|
|
|
|
}
|
1998-12-14 18:34:14 +00:00
|
|
|
NS_RELEASE(tracker);
|
|
|
|
}
|
|
|
|
NS_RELEASE(selection);
|
|
|
|
}
|
|
|
|
//no release
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-27 16:44:52 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
|
1998-04-27 16:44:52 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1998-08-28 15:58:37 +00:00
|
|
|
nsEventStatus& aEventStatus)
|
1998-04-27 16:44:52 +00:00
|
|
|
{
|
1999-02-12 17:45:58 +00:00
|
|
|
if (!DisplaySelection(aPresContext, PR_TRUE)) {
|
1998-12-14 18:34:14 +00:00
|
|
|
aEventStatus = nsEventStatus_eIgnore;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
mDoingSelection = PR_TRUE;
|
|
|
|
mDidDrag = PR_FALSE;
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
|
1999-02-12 18:41:26 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && shell) {
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIRenderingContext> acx;
|
|
|
|
rv = shell->CreateRenderingContext(this, getter_AddRefs(acx));
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
1998-12-14 18:34:14 +00:00
|
|
|
PRInt32 startPos = 0;
|
|
|
|
PRUint32 contentOffset = 0;
|
|
|
|
if (NS_SUCCEEDED(GetPosition(aPresContext, acx, aEvent, this, contentOffset, startPos))){
|
1999-02-11 23:12:28 +00:00
|
|
|
nsIDOMSelection *selection = nsnull;
|
1998-12-14 18:34:14 +00:00
|
|
|
if (NS_SUCCEEDED(shell->GetSelection(&selection))){
|
|
|
|
nsIFocusTracker *tracker;
|
1999-02-11 23:12:28 +00:00
|
|
|
if (NS_SUCCEEDED(shell->QueryInterface(kIFocusTracker,(void **)&tracker))) {
|
|
|
|
nsIFrameSelection* frameselection;
|
|
|
|
if (NS_SUCCEEDED(selection->QueryInterface(kIFrameSelection, (void **)&frameselection))) {
|
1999-02-19 23:47:36 +00:00
|
|
|
frameselection->EnableFrameNotification(PR_FALSE);
|
1999-02-11 23:12:28 +00:00
|
|
|
frameselection->TakeFocus(tracker, this, startPos, contentOffset, PR_TRUE); //TRUE IS THE DIFFERENCE
|
1999-02-19 23:47:36 +00:00
|
|
|
frameselection->EnableFrameNotification(PR_TRUE);//prevent cyclic call to reset selection.
|
1999-02-11 23:12:28 +00:00
|
|
|
NS_RELEASE(frameselection);
|
|
|
|
}
|
1998-12-14 18:34:14 +00:00
|
|
|
NS_RELEASE(tracker);
|
|
|
|
}
|
|
|
|
NS_RELEASE(selection);
|
|
|
|
}
|
|
|
|
//no release
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-04-27 16:44:52 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::HandleRelease(nsIPresContext& aPresContext,
|
1998-04-27 16:44:52 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1998-08-28 15:58:37 +00:00
|
|
|
nsEventStatus& aEventStatus)
|
1998-04-27 16:44:52 +00:00
|
|
|
{
|
|
|
|
mDoingSelection = PR_FALSE;
|
|
|
|
aEventStatus = nsEventStatus_eIgnore;
|
1998-07-17 23:00:54 +00:00
|
|
|
NS_IF_RELEASE(gDoc);
|
1998-04-27 16:44:52 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-05-08 18:33:42 +00:00
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
//-- GetPosition
|
|
|
|
//--------------------------------------------------------------------------
|
1998-10-02 01:12:39 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetPosition(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext * aRendContext,
|
|
|
|
nsGUIEvent * aEvent,
|
|
|
|
nsIFrame * aNewFrame,
|
|
|
|
PRUint32& aAcutalContentOffset,
|
|
|
|
PRInt32& aOffset)
|
|
|
|
{
|
1998-05-08 18:33:42 +00:00
|
|
|
|
|
|
|
//PRInt32 offset;
|
|
|
|
//PRInt32 width;
|
|
|
|
//CalcCursorPosition(aPresContext, aEvent, aNewFrame, offset, width);
|
|
|
|
//offset += aNewFrame->GetContentOffset();
|
|
|
|
|
|
|
|
//return offset;
|
1998-07-22 21:56:48 +00:00
|
|
|
aAcutalContentOffset = 0;
|
1998-10-02 01:12:39 +00:00
|
|
|
aOffset = -1;
|
|
|
|
|
|
|
|
return NS_OK;
|
1998-05-08 18:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* Adjusts the Starting and Ending TextPoint for a Range
|
|
|
|
*********************************************************/
|
|
|
|
void nsFrame::AdjustPointsInNewContent(nsIPresContext& aPresContext,
|
1998-10-02 01:12:39 +00:00
|
|
|
nsIRenderingContext * aRendContext,
|
1998-05-08 18:33:42 +00:00
|
|
|
nsGUIEvent * aEvent,
|
|
|
|
nsIFrame * aNewFrame) {
|
1998-12-12 19:19:48 +00:00
|
|
|
#if 0
|
1998-07-22 21:56:48 +00:00
|
|
|
PRUint32 actualOffset = 0;
|
|
|
|
|
1998-05-08 18:33:42 +00:00
|
|
|
// Get new Cursor Poition in the new content
|
1998-10-02 01:12:39 +00:00
|
|
|
PRInt32 newPos;
|
1998-12-08 18:26:06 +00:00
|
|
|
//DEBUG MJUDGE
|
1998-10-02 01:12:39 +00:00
|
|
|
|
|
|
|
GetPosition(aPresContext, aRendContext, aEvent, aNewFrame, actualOffset, newPos);
|
1998-05-08 18:33:42 +00:00
|
|
|
|
|
|
|
if (mStartSelectionPoint->IsAnchor()) {
|
|
|
|
if (newPos == mStartSelectionPoint->GetOffset()) {
|
|
|
|
mEndSelectionPoint->SetOffset(newPos);
|
|
|
|
mEndSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mSelectionRange->SetEndPoint(mEndSelectionPoint);
|
|
|
|
} else if (newPos < mStartSelectionPoint->GetOffset()) {
|
|
|
|
mEndSelectionPoint->SetOffset(mStartSelectionPoint->GetOffset());
|
|
|
|
mEndSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mStartSelectionPoint->SetOffset(newPos);
|
|
|
|
mStartSelectionPoint->SetAnchor(PR_FALSE);
|
|
|
|
mSelectionRange->SetRange(mStartSelectionPoint, mEndSelectionPoint);
|
|
|
|
} else {
|
|
|
|
mEndSelectionPoint->SetOffset(newPos);
|
|
|
|
mSelectionRange->SetEndPoint(mEndSelectionPoint);
|
|
|
|
}
|
|
|
|
} else if (mEndSelectionPoint->IsAnchor()) {
|
|
|
|
int endPos = mEndSelectionPoint->GetOffset();
|
|
|
|
if (newPos == mEndSelectionPoint->GetOffset()) {
|
|
|
|
mStartSelectionPoint->SetOffset(newPos);
|
|
|
|
mStartSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mSelectionRange->SetStartPoint(mStartSelectionPoint);
|
|
|
|
} else if (newPos > mEndSelectionPoint->GetOffset()) {
|
|
|
|
mEndSelectionPoint->SetOffset(newPos);
|
|
|
|
mEndSelectionPoint->SetAnchor(PR_FALSE);
|
|
|
|
mStartSelectionPoint->SetOffset(endPos);
|
|
|
|
mStartSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mSelectionRange->SetRange(mStartSelectionPoint, mEndSelectionPoint);
|
|
|
|
} else {
|
|
|
|
mStartSelectionPoint->SetOffset(newPos);
|
|
|
|
mSelectionRange->SetStartPoint(mStartSelectionPoint);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// [TODO] Should get here
|
|
|
|
// throw exception
|
1998-07-18 18:18:20 +00:00
|
|
|
if (SELECTION_DEBUG) printf("--\n--\n--\n--\n--\n--\n--\n Should be here. #102\n");
|
1998-05-08 18:33:42 +00:00
|
|
|
//return;
|
|
|
|
}
|
1998-12-08 18:26:06 +00:00
|
|
|
#endif //0
|
1998-05-08 18:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* Adjusts the Starting and Ending TextPoint for a Range
|
|
|
|
*********************************************************/
|
|
|
|
void nsFrame::AdjustPointsInSameContent(nsIPresContext& aPresContext,
|
1998-10-02 01:12:39 +00:00
|
|
|
nsIRenderingContext * aRendContext,
|
1998-05-08 18:33:42 +00:00
|
|
|
nsGUIEvent * aEvent) {
|
1998-12-08 18:26:06 +00:00
|
|
|
#if 0
|
1998-07-22 21:56:48 +00:00
|
|
|
PRUint32 actualOffset = 0;
|
|
|
|
|
1998-05-08 18:33:42 +00:00
|
|
|
// Get new Cursor Poition in the same content
|
1998-10-02 01:12:39 +00:00
|
|
|
PRInt32 newPos;
|
|
|
|
GetPosition(aPresContext, aRendContext, aEvent, mCurrentFrame, actualOffset, newPos);
|
1998-08-28 15:58:37 +00:00
|
|
|
//newPos += actualOffset;
|
1998-07-18 18:18:20 +00:00
|
|
|
if (SELECTION_DEBUG) printf("AdjustTextPointsInSameContent newPos: %d\n", newPos);
|
1998-05-08 18:33:42 +00:00
|
|
|
|
|
|
|
if (mStartSelectionPoint->IsAnchor()) {
|
|
|
|
if (newPos == mStartSelectionPoint->GetOffset()) {
|
|
|
|
mEndSelectionPoint->SetOffset(newPos);
|
|
|
|
mEndSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mSelectionRange->SetEndPoint(mEndSelectionPoint);
|
|
|
|
} else if (newPos < mStartSelectionPoint->GetOffset()) {
|
|
|
|
mStartSelectionPoint->SetOffset(newPos);
|
|
|
|
mStartSelectionPoint->SetAnchor(PR_FALSE);
|
|
|
|
mEndSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mSelectionRange->SetRange(mStartSelectionPoint, mEndSelectionPoint);
|
|
|
|
} else {
|
|
|
|
mEndSelectionPoint->SetAnchor(PR_FALSE);
|
|
|
|
mEndSelectionPoint->SetOffset(newPos);
|
|
|
|
mSelectionRange->SetEndPoint(mEndSelectionPoint);
|
|
|
|
}
|
|
|
|
} else if (mEndSelectionPoint->IsAnchor()) {
|
|
|
|
if (newPos == mEndSelectionPoint->GetOffset()) {
|
|
|
|
mStartSelectionPoint->SetOffset(newPos);
|
|
|
|
mStartSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mSelectionRange->SetStartPoint(mStartSelectionPoint);
|
|
|
|
} else if (newPos > mEndSelectionPoint->GetOffset()) {
|
|
|
|
mEndSelectionPoint->SetOffset(newPos);
|
|
|
|
mEndSelectionPoint->SetAnchor(PR_FALSE);
|
|
|
|
mStartSelectionPoint->SetAnchor(PR_TRUE);
|
|
|
|
mSelectionRange->SetRange(mStartSelectionPoint, mEndSelectionPoint);
|
|
|
|
} else {
|
|
|
|
mStartSelectionPoint->SetAnchor(PR_FALSE);
|
|
|
|
mStartSelectionPoint->SetOffset(newPos);
|
|
|
|
mSelectionRange->SetStartPoint(mStartSelectionPoint);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// [TODO] Should get here
|
|
|
|
// throw exception
|
1998-07-18 18:18:20 +00:00
|
|
|
if (SELECTION_DEBUG) printf("--\n--\n--\n--\n--\n--\n--\n Should be here. #101\n");
|
1998-05-08 18:33:42 +00:00
|
|
|
//return;
|
|
|
|
}
|
|
|
|
|
1998-07-18 18:18:20 +00:00
|
|
|
if (SELECTION_DEBUG) printf("Start %s End %s\n", mStartSelectionPoint->ToString(), mEndSelectionPoint->ToString());
|
1998-05-08 18:33:42 +00:00
|
|
|
//}
|
1998-12-08 18:26:06 +00:00
|
|
|
#endif //0
|
1998-05-08 18:33:42 +00:00
|
|
|
}
|
1998-04-27 16:44:52 +00:00
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHODIMP
|
1998-11-23 22:20:50 +00:00
|
|
|
nsFrame::GetCursor(nsIPresContext& aPresContext,
|
|
|
|
nsPoint& aPoint,
|
|
|
|
PRInt32& aCursor)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-11-18 05:25:26 +00:00
|
|
|
const nsStyleColor* styleColor;
|
|
|
|
GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)styleColor);
|
|
|
|
aCursor = styleColor->mCursor;
|
|
|
|
|
1999-01-14 05:16:23 +00:00
|
|
|
if ((NS_STYLE_CURSOR_AUTO == aCursor) && (nsnull != mParent)) {
|
|
|
|
mParent->GetCursor(aPresContext, aPoint, aCursor);
|
1998-11-18 02:11:54 +00:00
|
|
|
}
|
1998-11-18 05:25:26 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
|
|
|
|
{
|
|
|
|
*aFrame = this;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Resize and incremental reflow
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP
|
1999-02-10 04:17:06 +00:00
|
|
|
nsFrame::GetFrameState(nsFrameState* aResult)
|
1998-05-14 00:47:32 +00:00
|
|
|
{
|
1999-02-10 04:17:06 +00:00
|
|
|
NS_PRECONDITION(nsnull != aResult, "null OUT parameter pointer");
|
|
|
|
*aResult = mState;
|
1998-05-14 00:47:32 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP
|
1998-05-14 00:47:32 +00:00
|
|
|
nsFrame::SetFrameState(nsFrameState aNewState)
|
|
|
|
{
|
|
|
|
mState = aNewState;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-01 04:46:11 +00:00
|
|
|
// nsIHTMLReflow member functions
|
1998-05-14 00:47:32 +00:00
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP
|
1998-05-14 00:47:32 +00:00
|
|
|
nsFrame::WillReflow(nsIPresContext& aPresContext)
|
|
|
|
{
|
1998-06-25 16:33:10 +00:00
|
|
|
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
|
|
|
|
("WillReflow: oldState=%x", mState));
|
1998-05-14 00:47:32 +00:00
|
|
|
mState |= NS_FRAME_IN_REFLOW;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP
|
1998-05-14 00:47:32 +00:00
|
|
|
nsFrame::DidReflow(nsIPresContext& aPresContext,
|
|
|
|
nsDidReflowStatus aStatus)
|
|
|
|
{
|
1998-06-25 16:33:10 +00:00
|
|
|
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
|
|
|
|
("nsFrame::DidReflow: aStatus=%d", aStatus));
|
1998-05-14 00:47:32 +00:00
|
|
|
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
|
1998-05-29 02:10:12 +00:00
|
|
|
mState &= ~(NS_FRAME_IN_REFLOW | NS_FRAME_FIRST_REFLOW);
|
1998-05-28 21:55:13 +00:00
|
|
|
|
1998-10-16 20:09:32 +00:00
|
|
|
// Size and position the view if requested
|
|
|
|
if ((nsnull != mView) && (NS_FRAME_SYNC_FRAME_AND_VIEW & mState)) {
|
1998-05-28 21:55:13 +00:00
|
|
|
// Position and size view relative to its parent, not relative to our
|
|
|
|
// parent frame (our parent frame may not have a view).
|
|
|
|
nsIView* parentWithView;
|
|
|
|
nsPoint origin;
|
1999-02-10 05:38:18 +00:00
|
|
|
GetOffsetFromView(origin, &parentWithView);
|
1998-08-30 19:16:11 +00:00
|
|
|
nsIViewManager *vm;
|
|
|
|
mView->GetViewManager(vm);
|
1998-06-02 22:04:54 +00:00
|
|
|
vm->ResizeView(mView, mRect.width, mRect.height);
|
|
|
|
vm->MoveViewTo(mView, origin.x, origin.y);
|
|
|
|
NS_RELEASE(vm);
|
1998-05-28 21:55:13 +00:00
|
|
|
}
|
1998-05-14 00:47:32 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::Reflow(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
aDesiredSize.width = 0;
|
|
|
|
aDesiredSize.height = 0;
|
|
|
|
aDesiredSize.ascent = 0;
|
|
|
|
aDesiredSize.descent = 0;
|
1998-05-25 17:31:49 +00:00
|
|
|
if (nsnull != aDesiredSize.maxElementSize) {
|
|
|
|
aDesiredSize.maxElementSize->width = 0;
|
|
|
|
aDesiredSize.maxElementSize->height = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-05-12 04:17:56 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1998-10-01 04:46:11 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::FindTextRuns(nsLineLayout& aLineLayout)
|
|
|
|
{
|
|
|
|
aLineLayout.EndTextRun();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-27 16:51:21 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace)
|
|
|
|
{
|
|
|
|
aUsedSpace = 0;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::TrimTrailingWhiteSpace(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRC,
|
|
|
|
nscoord& aDeltaWidth)
|
1998-05-08 04:45:37 +00:00
|
|
|
{
|
1998-10-27 16:51:21 +00:00
|
|
|
aDeltaWidth = 0;
|
1998-05-08 04:45:37 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-30 22:11:47 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::MoveInSpaceManager(nsIPresContext& aPresContext,
|
|
|
|
nsISpaceManager* aSpaceManager,
|
|
|
|
nscoord aDeltaX, nscoord aDeltaY)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-27 16:51:21 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::ContentChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
nsISupports* aSubContent)
|
|
|
|
{
|
1999-02-12 17:45:58 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
|
1999-02-12 18:41:26 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && shell) {
|
1999-02-12 17:45:58 +00:00
|
|
|
nsIReflowCommand* reflowCmd;
|
|
|
|
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
|
|
|
|
nsIReflowCommand::ContentChanged);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
shell->AppendReflowCommand(reflowCmd);
|
|
|
|
NS_RELEASE(reflowCmd);
|
|
|
|
}
|
1999-01-22 23:07:09 +00:00
|
|
|
}
|
1999-02-12 17:45:58 +00:00
|
|
|
return rv;
|
1998-10-27 16:51:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint)
|
1998-09-18 19:53:27 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Flow member functions
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-05-22 04:54:11 +00:00
|
|
|
aIsSplittable = NS_FRAME_NOT_SPLITTABLE;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-24 04:48:08 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetPrevInFlow(nsIFrame** aPrevInFlow) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-24 04:48:08 +00:00
|
|
|
*aPrevInFlow = nsnull;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame*)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("not splittable");
|
1998-05-08 17:02:35 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-24 04:48:08 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetNextInFlow(nsIFrame** aNextInFlow) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-24 04:48:08 +00:00
|
|
|
*aNextInFlow = nsnull;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("not splittable");
|
1998-05-08 17:02:35 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::AppendToFlow(nsIFrame* aAfterFrame)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("not splittable");
|
1998-05-08 17:02:35 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::PrependToFlow(nsIFrame* aBeforeFrame)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("not splittable");
|
1998-05-08 17:02:35 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::RemoveFromFlow()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("not splittable");
|
1998-05-08 17:02:35 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::BreakFromPrevFlow()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("not splittable");
|
1998-05-08 17:02:35 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::BreakFromNextFlow()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("not splittable");
|
1998-05-08 17:02:35 +00:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Associated view object
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetView(nsIView** aView) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_PRECONDITION(nsnull != aView, "null OUT parameter pointer");
|
|
|
|
*aView = mView;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetView(nsIView* aView)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-08-28 02:52:54 +00:00
|
|
|
nsresult rv;
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
if (nsnull != aView) {
|
|
|
|
mView = aView;
|
1998-08-28 02:52:54 +00:00
|
|
|
aView->SetClientData(this);
|
|
|
|
rv = NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-08-28 02:52:54 +00:00
|
|
|
else
|
|
|
|
rv = NS_OK;
|
|
|
|
|
|
|
|
return rv;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Find the first geometric parent that has a view
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame** aParent) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_PRECONDITION(nsnull != aParent, "null OUT parameter pointer");
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-02-10 05:38:18 +00:00
|
|
|
nsIFrame* parent;
|
|
|
|
for (parent = mParent; nsnull != parent; parent->GetParent(&parent)) {
|
1998-04-17 01:41:24 +00:00
|
|
|
nsIView* parView;
|
|
|
|
|
1999-02-10 05:38:18 +00:00
|
|
|
parent->GetView(&parView);
|
1998-04-13 20:24:54 +00:00
|
|
|
if (nsnull != parView) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-02-10 05:38:18 +00:00
|
|
|
*aParent = parent;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the offset from this frame to the closest geometric parent that
|
|
|
|
// has a view. Also returns the containing view or null in case of error
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_PRECONDITION(nsnull != aView, "null OUT parameter pointer");
|
1998-04-17 01:41:24 +00:00
|
|
|
nsIFrame* frame = (nsIFrame*)this;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-02-10 05:38:18 +00:00
|
|
|
*aView = nsnull;
|
1998-04-13 20:24:54 +00:00
|
|
|
aOffset.MoveTo(0, 0);
|
|
|
|
do {
|
1998-04-17 01:41:24 +00:00
|
|
|
nsPoint origin;
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
frame->GetOrigin(origin);
|
|
|
|
aOffset += origin;
|
1999-02-10 01:36:30 +00:00
|
|
|
frame->GetParent(&frame);
|
1998-04-17 01:41:24 +00:00
|
|
|
if (nsnull != frame) {
|
|
|
|
frame->GetView(aView);
|
|
|
|
}
|
1999-02-10 05:38:18 +00:00
|
|
|
} while ((nsnull != frame) && (nsnull == *aView));
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetWindow(nsIWidget** aWindow) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_PRECONDITION(nsnull != aWindow, "null OUT parameter pointer");
|
|
|
|
|
|
|
|
nsIFrame* frame;
|
|
|
|
nsIWidget* window = nsnull;
|
|
|
|
for (frame = (nsIFrame*)this; nsnull != frame; frame->GetParentWithView(&frame)) {
|
1998-04-17 01:41:24 +00:00
|
|
|
nsIView* view;
|
|
|
|
|
1999-02-10 05:38:18 +00:00
|
|
|
frame->GetView(&view);
|
1998-04-13 20:24:54 +00:00
|
|
|
if (nsnull != view) {
|
1999-02-10 05:38:18 +00:00
|
|
|
view->GetWidget(window);
|
|
|
|
if (nsnull != window) {
|
1998-04-17 01:41:24 +00:00
|
|
|
break;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-02-10 05:38:18 +00:00
|
|
|
NS_POSTCONDITION(nsnull != window, "no window in frame tree");
|
|
|
|
*aWindow = window;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-09 05:44:13 +00:00
|
|
|
NS_IMETHODIMP
|
1999-02-10 04:17:06 +00:00
|
|
|
nsFrame::GetFrameType(nsIAtom** aType) const
|
1999-02-09 05:44:13 +00:00
|
|
|
{
|
1999-02-10 04:17:06 +00:00
|
|
|
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
|
|
|
|
*aType = nsnull;
|
1999-02-09 05:44:13 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-24 23:56:15 +00:00
|
|
|
void
|
|
|
|
nsFrame::Invalidate(const nsRect& aDamageRect,
|
|
|
|
PRBool aImmediate) const
|
1998-06-02 05:28:11 +00:00
|
|
|
{
|
1998-08-30 19:16:11 +00:00
|
|
|
nsIViewManager* viewManager = nsnull;
|
1998-06-02 05:28:11 +00:00
|
|
|
|
1998-09-24 23:56:15 +00:00
|
|
|
PRUint32 flags = aImmediate ? NS_VMREFRESH_IMMEDIATE : NS_VMREFRESH_NO_SYNC;
|
1998-06-02 05:28:11 +00:00
|
|
|
if (nsnull != mView) {
|
1998-08-30 19:16:11 +00:00
|
|
|
mView->GetViewManager(viewManager);
|
1998-09-24 23:56:15 +00:00
|
|
|
viewManager->UpdateView(mView, aDamageRect, flags);
|
1998-06-02 05:28:11 +00:00
|
|
|
|
|
|
|
} else {
|
1998-08-08 04:23:33 +00:00
|
|
|
nsRect rect(aDamageRect);
|
|
|
|
nsPoint offset;
|
|
|
|
nsIView* view;
|
1998-06-02 05:28:11 +00:00
|
|
|
|
1999-02-10 05:38:18 +00:00
|
|
|
GetOffsetFromView(offset, &view);
|
1998-08-08 04:23:33 +00:00
|
|
|
NS_ASSERTION(nsnull != view, "no view");
|
1998-06-02 05:28:11 +00:00
|
|
|
rect += offset;
|
1998-08-30 19:16:11 +00:00
|
|
|
view->GetViewManager(viewManager);
|
1998-09-24 23:56:15 +00:00
|
|
|
viewManager->UpdateView(view, rect, flags);
|
1998-06-02 05:28:11 +00:00
|
|
|
}
|
1998-08-30 19:16:11 +00:00
|
|
|
|
|
|
|
NS_IF_RELEASE(viewManager);
|
1998-06-02 05:28:11 +00:00
|
|
|
}
|
1998-05-13 22:38:09 +00:00
|
|
|
|
|
|
|
// Style sizing methods
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const
|
1998-05-13 22:38:09 +00:00
|
|
|
{
|
1998-06-05 06:09:09 +00:00
|
|
|
const nsStylePosition* position;
|
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
|
1998-05-13 22:38:09 +00:00
|
|
|
if (position->mPosition != NS_STYLE_POSITION_NORMAL) {
|
|
|
|
aBase = PR_TRUE;
|
|
|
|
}
|
|
|
|
else {
|
1998-06-05 06:09:09 +00:00
|
|
|
const nsStyleDisplay* display;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
|
1998-05-13 22:38:09 +00:00
|
|
|
if ((display->mDisplay == NS_STYLE_DISPLAY_BLOCK) ||
|
1999-01-13 06:37:31 +00:00
|
|
|
(display->mDisplay == NS_STYLE_DISPLAY_LIST_ITEM) ||
|
|
|
|
(display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL)) {
|
1998-05-13 22:38:09 +00:00
|
|
|
aBase = PR_TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aBase = PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Sibling pointer used to link together frames
|
|
|
|
|
1999-02-10 06:13:38 +00:00
|
|
|
NS_IMETHODIMP nsFrame::GetNextSibling(nsIFrame** aNextSibling) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-10 06:13:38 +00:00
|
|
|
NS_PRECONDITION(nsnull != aNextSibling, "null OUT parameter pointer");
|
|
|
|
*aNextSibling = mNextSibling;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::SetNextSibling(nsIFrame* aNextSibling)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-02-01 17:31:10 +00:00
|
|
|
NS_ASSERTION(aNextSibling != this, "attempt to create circular frame list");
|
1998-04-13 20:24:54 +00:00
|
|
|
mNextSibling = aNextSibling;
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-06-03 22:49:45 +00:00
|
|
|
// Transparency query
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::IsTransparent(PRBool& aTransparent) const
|
1998-06-03 22:49:45 +00:00
|
|
|
{
|
|
|
|
//XXX this needs to be overridden in just about every leaf class? MMP
|
|
|
|
aTransparent = PR_TRUE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-09 23:46:02 +00:00
|
|
|
NS_IMETHODIMP nsFrame::Scrolled(nsIView *aView)
|
1998-09-05 20:57:57 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-10-08 20:35:16 +00:00
|
|
|
PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
|
|
|
|
{
|
|
|
|
nsIContent* content;
|
|
|
|
PRInt32 result = -1;
|
|
|
|
|
1999-02-10 00:42:56 +00:00
|
|
|
aFrame->GetContent(&content);
|
1998-10-08 20:35:16 +00:00
|
|
|
if (nsnull != content) {
|
|
|
|
nsIContent* parentContent;
|
|
|
|
|
|
|
|
content->GetParent(parentContent);
|
|
|
|
if (nsnull != parentContent) {
|
|
|
|
parentContent->IndexOf(content, result);
|
|
|
|
NS_RELEASE(parentContent);
|
|
|
|
}
|
|
|
|
NS_RELEASE(content);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Debugging
|
1998-11-19 17:22:29 +00:00
|
|
|
NS_IMETHODIMP
|
1999-01-16 00:00:50 +00:00
|
|
|
nsFrame::List(FILE* out, PRInt32 aIndent) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-01-16 00:00:50 +00:00
|
|
|
IndentBy(out, aIndent);
|
|
|
|
ListTag(out);
|
|
|
|
if (nsnull != mView) {
|
|
|
|
fprintf(out, " [view=%p]", mView);
|
|
|
|
}
|
1999-03-05 04:22:54 +00:00
|
|
|
fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height);
|
1999-01-16 00:00:50 +00:00
|
|
|
if (0 != mState) {
|
|
|
|
fprintf(out, " [state=%08x]", mState);
|
1998-05-18 16:53:09 +00:00
|
|
|
}
|
1999-01-16 00:00:50 +00:00
|
|
|
fputs("<>\n", out);
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-11-19 17:22:29 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::GetFrameName(nsString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName("Frame", aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFrame::MakeFrameName(const char* aType, nsString& aResult) const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-11-19 17:22:29 +00:00
|
|
|
aResult = aType;
|
1998-11-12 23:03:35 +00:00
|
|
|
if (nsnull != mContent) {
|
|
|
|
nsIAtom* tag;
|
|
|
|
mContent->GetTag(tag);
|
1999-01-22 22:48:00 +00:00
|
|
|
if ((tag != nsnull) && (tag != nsLayoutAtoms::textTagName)) {
|
1998-11-19 18:51:53 +00:00
|
|
|
aResult.Append("(");
|
1998-11-12 23:03:35 +00:00
|
|
|
nsAutoString buf;
|
|
|
|
tag->ToString(buf);
|
1998-11-19 17:22:29 +00:00
|
|
|
aResult.Append(buf);
|
1998-11-12 23:03:35 +00:00
|
|
|
NS_RELEASE(tag);
|
1998-11-19 18:51:53 +00:00
|
|
|
aResult.Append(")");
|
1998-11-12 23:03:35 +00:00
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-11-19 17:22:29 +00:00
|
|
|
char buf[40];
|
1998-11-19 18:51:53 +00:00
|
|
|
PR_snprintf(buf, sizeof(buf), "(%d)", ContentIndexInContainer(this));
|
1998-11-19 17:22:29 +00:00
|
|
|
aResult.Append(buf);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-11-19 17:55:22 +00:00
|
|
|
void
|
|
|
|
nsFrame::XMLQuote(nsString& aString)
|
|
|
|
{
|
|
|
|
PRInt32 i, len = aString.Length();
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
PRUnichar ch = aString[i];
|
|
|
|
if (ch == '<') {
|
|
|
|
nsAutoString tmp("<");
|
|
|
|
aString.Cut(i, 1);
|
|
|
|
aString.Insert(tmp, i);
|
|
|
|
len += 3;
|
|
|
|
i += 3;
|
|
|
|
}
|
|
|
|
else if (ch == '>') {
|
|
|
|
nsAutoString tmp(">");
|
|
|
|
aString.Cut(i, 1);
|
|
|
|
aString.Insert(tmp, i);
|
|
|
|
len += 3;
|
|
|
|
i += 3;
|
|
|
|
}
|
1999-02-04 16:28:36 +00:00
|
|
|
else if (ch == '\"') {
|
1998-11-19 17:55:22 +00:00
|
|
|
nsAutoString tmp(""");
|
|
|
|
aString.Cut(i, 1);
|
|
|
|
aString.Insert(tmp, i);
|
|
|
|
len += 5;
|
|
|
|
i += 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-19 17:22:29 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::DumpRegressionData(FILE* out, PRInt32 aIndent)
|
|
|
|
{
|
|
|
|
IndentBy(out, aIndent);
|
1999-02-08 17:56:00 +00:00
|
|
|
fprintf(out, "<frame va=\"%ld\" type=\"", PRUptrdiff(this));
|
1998-11-19 17:22:29 +00:00
|
|
|
nsAutoString name;
|
|
|
|
GetFrameName(name);
|
1998-11-19 17:55:22 +00:00
|
|
|
XMLQuote(name);
|
1998-11-19 17:22:29 +00:00
|
|
|
fputs(name, out);
|
1999-02-08 17:56:00 +00:00
|
|
|
fprintf(out, "\" state=\"%d\" parent=\"%ld\">\n",
|
|
|
|
mState, PRUptrdiff(mParent));
|
1998-11-19 17:22:29 +00:00
|
|
|
|
|
|
|
aIndent++;
|
|
|
|
DumpBaseRegressionData(out, aIndent);
|
|
|
|
aIndent--;
|
|
|
|
|
|
|
|
IndentBy(out, aIndent);
|
|
|
|
fprintf(out, "</frame>\n");
|
1998-05-05 23:56:50 +00:00
|
|
|
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-11-19 17:22:29 +00:00
|
|
|
void
|
|
|
|
nsFrame::DumpBaseRegressionData(FILE* out, PRInt32 aIndent)
|
|
|
|
{
|
|
|
|
if (nsnull != mNextSibling) {
|
|
|
|
IndentBy(out, aIndent);
|
1999-02-08 17:56:00 +00:00
|
|
|
fprintf(out, "<next-sibling va=\"%ld\"/>\n", PRUptrdiff(mNextSibling));
|
1998-11-19 17:22:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (nsnull != mView) {
|
|
|
|
IndentBy(out, aIndent);
|
1999-02-08 17:56:00 +00:00
|
|
|
fprintf(out, "<view va=\"%ld\">\n", PRUptrdiff(mView));
|
1998-11-19 17:22:29 +00:00
|
|
|
aIndent++;
|
|
|
|
// XXX add in code to dump out view state too...
|
|
|
|
aIndent--;
|
|
|
|
IndentBy(out, aIndent);
|
|
|
|
fprintf(out, "</view>\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
IndentBy(out, aIndent);
|
1999-02-08 17:56:00 +00:00
|
|
|
fprintf(out, "<bbox x=\"%d\" y=\"%d\" w=\"%d\" h=\"%d\"/>\n",
|
1998-11-19 17:22:29 +00:00
|
|
|
mRect.x, mRect.y, mRect.width, mRect.height);
|
|
|
|
|
|
|
|
// Now dump all of the children on all of the child lists
|
|
|
|
nsIFrame* kid;
|
|
|
|
nsIAtom* list = nsnull;
|
|
|
|
PRInt32 listIndex = 0;
|
|
|
|
do {
|
1999-02-10 02:25:01 +00:00
|
|
|
nsresult rv = FirstChild(list, &kid);
|
1998-11-19 17:22:29 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && (nsnull != kid)) {
|
|
|
|
IndentBy(out, aIndent);
|
|
|
|
if (nsnull != list) {
|
|
|
|
nsAutoString listName;
|
|
|
|
list->ToString(listName);
|
|
|
|
fprintf(out, "<child-list name=\"");
|
1998-11-19 17:55:22 +00:00
|
|
|
XMLQuote(listName);
|
1998-11-19 17:22:29 +00:00
|
|
|
fputs(listName, out);
|
|
|
|
fprintf(out, "\">\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fprintf(out, "<child-list>\n");
|
|
|
|
}
|
|
|
|
aIndent++;
|
|
|
|
while (nsnull != kid) {
|
|
|
|
kid->DumpRegressionData(out, aIndent);
|
1999-02-10 06:13:38 +00:00
|
|
|
kid->GetNextSibling(&kid);
|
1998-11-19 17:22:29 +00:00
|
|
|
}
|
|
|
|
aIndent--;
|
|
|
|
IndentBy(out, aIndent);
|
|
|
|
fprintf(out, "</child-list>\n");
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(list);
|
1999-02-10 02:25:01 +00:00
|
|
|
GetAdditionalChildListName(listIndex++, &list);
|
1998-11-19 17:22:29 +00:00
|
|
|
} while (nsnull != list);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::VerifyTree() const
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1998-05-28 19:00:31 +00:00
|
|
|
NS_ASSERTION(0 == (mState & NS_FRAME_IN_REFLOW), "frame is in reflow");
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1998-04-27 16:44:52 +00:00
|
|
|
|
1999-02-16 02:42:08 +00:00
|
|
|
/*this method may.. invalidate if the state was changed or if aForceRedraw is PR_TRUE
|
|
|
|
it will not update immediately.*/
|
1998-12-14 18:34:14 +00:00
|
|
|
NS_IMETHODIMP
|
1999-03-12 00:17:14 +00:00
|
|
|
nsFrame::SetSelected(nsSelectionStruct *aSelStruct)
|
1998-12-14 18:34:14 +00:00
|
|
|
{
|
1999-03-12 00:17:14 +00:00
|
|
|
if (!aSelStruct)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
if (mSelected != (PRBool)(aSelStruct->mType & nsSelectionStruct::SELON ) || aSelStruct->mForceRedraw)
|
1998-12-14 18:34:14 +00:00
|
|
|
{
|
1999-03-12 00:17:14 +00:00
|
|
|
mSelected = aSelStruct->mType & nsSelectionStruct::SELON ;
|
1999-02-16 02:42:08 +00:00
|
|
|
|
1999-03-16 00:08:38 +00:00
|
|
|
/* nsRect rect;
|
1999-02-16 02:42:08 +00:00
|
|
|
GetRect(rect);
|
1999-03-14 01:18:47 +00:00
|
|
|
nsIFrame *frame = this;
|
|
|
|
nsIFrame *firstframe = nsnull;
|
|
|
|
while (NS_SUCCEEDED(frame->GetPrevInFlow(&frame)) && frame){
|
|
|
|
firstframe = frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (firstframe){
|
|
|
|
nsRect rect2;
|
|
|
|
firstframe->GetRect(rect2);
|
|
|
|
rect.y-= rect.y-rect2.y;
|
|
|
|
}
|
1999-03-16 00:08:38 +00:00
|
|
|
*/
|
|
|
|
ForceDrawFrame(this);//invalidate does not work in all cases.
|
|
|
|
//Invalidate(rect,PR_FALSE); //false is for not immediate
|
1998-12-14 18:34:14 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-01-22 18:58:14 +00:00
|
|
|
NS_IMETHODIMP
|
1999-03-12 00:17:14 +00:00
|
|
|
nsFrame::SetSelectedContentOffsets(nsSelectionStruct *aSS,
|
|
|
|
nsIFocusTracker *aTracker,
|
|
|
|
nsIFrame **aActualSelected)
|
1999-01-22 18:58:14 +00:00
|
|
|
{
|
1999-03-12 00:17:14 +00:00
|
|
|
if (!aActualSelected || !aSS)
|
1999-01-22 18:58:14 +00:00
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
nsIFrame *child = nsnull;
|
1999-02-10 02:25:01 +00:00
|
|
|
nsresult result = FirstChild(nsnull, &child);
|
1999-01-22 18:58:14 +00:00
|
|
|
if (NS_FAILED(result)){
|
|
|
|
*aActualSelected = this;
|
1999-03-12 00:17:14 +00:00
|
|
|
if (aSS->mAnchorOffset > 0)
|
1999-01-25 23:28:23 +00:00
|
|
|
aTracker->SetFocus(nsnull,this);
|
1999-03-12 00:17:14 +00:00
|
|
|
if (aSS->mFocusOffset > 0)
|
1999-01-25 23:28:23 +00:00
|
|
|
aTracker->SetFocus(this,nsnull);
|
1999-03-12 00:17:14 +00:00
|
|
|
return SetSelected(aSS);
|
1999-01-22 18:58:14 +00:00
|
|
|
}
|
1999-01-22 22:04:54 +00:00
|
|
|
*aActualSelected = nsnull;
|
1999-03-12 00:17:14 +00:00
|
|
|
//wont actually bother with selection here on "this" frame
|
1999-01-22 18:58:14 +00:00
|
|
|
while (child && NS_SUCCEEDED(result)){
|
1999-03-12 00:17:14 +00:00
|
|
|
result |= child->SetSelectedContentOffsets(aSS, aTracker, aActualSelected);
|
1999-01-22 22:04:54 +00:00
|
|
|
if (NS_SUCCEEDED(result) && aActualSelected)
|
|
|
|
return result; //done.
|
1999-02-10 06:13:38 +00:00
|
|
|
result |= child->GetNextSibling(&child);
|
1999-01-22 18:58:14 +00:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1998-12-14 18:34:14 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::GetSelected(PRBool *aSelected, PRInt32 *aBeginOffset, PRInt32 *aEndOffset, PRInt32 *aBeginContentOffset)
|
|
|
|
{
|
1999-01-22 18:58:14 +00:00
|
|
|
if (!aSelected )
|
1998-12-14 18:34:14 +00:00
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
*aSelected = mSelected;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-02-12 00:02:31 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::GetPointFromOffset(nsIPresContext* inPresContext, nsIRenderingContext* inRendContext, PRInt32 inOffset, nsPoint* outPoint)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(outPoint != nsnull, "Null parameter");
|
|
|
|
nsPoint bottomLeft(0, 0);
|
|
|
|
*outPoint = bottomLeft;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, PRInt32* outFrameContentOffset, nsIFrame **outChildFrame)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(outChildFrame && outFrameContentOffset, "Null parameter");
|
|
|
|
*outFrameContentOffset = 0;
|
|
|
|
*outChildFrame = this;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-01-22 18:58:14 +00:00
|
|
|
|
1999-02-02 00:23:40 +00:00
|
|
|
NS_IMETHODIMP
|
1999-02-10 18:55:25 +00:00
|
|
|
nsFrame::PeekOffset(nsSelectionAmount aAmount, nsDirection aDirection, PRInt32 aStartOffset,
|
1999-02-22 04:59:52 +00:00
|
|
|
nsIFrame **aResultFrame, PRInt32 *aFrameOffset, PRInt32 *aContentOffset,
|
|
|
|
PRBool aEatingWS)
|
1999-02-10 18:55:25 +00:00
|
|
|
{
|
|
|
|
//this will use the nsFrameTraversal as the default peek method.
|
|
|
|
//this should change to use geometry and also look to ALL the child lists
|
1999-02-23 08:10:24 +00:00
|
|
|
nsCOMPtr<nsIBidirectionalEnumerator> frameTraversal;
|
1999-02-10 18:55:25 +00:00
|
|
|
nsresult result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),LEAF,this);
|
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
1999-03-03 01:51:21 +00:00
|
|
|
nsISupports *isupports = nsnull;
|
1999-02-10 18:55:25 +00:00
|
|
|
if (aDirection == eDirNext)
|
|
|
|
result = frameTraversal->Next();
|
|
|
|
else
|
|
|
|
result = frameTraversal->Prev();
|
|
|
|
|
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
|
|
|
result = frameTraversal->CurrentItem(&isupports);
|
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
|
|
|
if (!isupports)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
//we must CAST here to an nsIFrame. nsIFrame doesnt really follow the rules
|
|
|
|
//for speed reasons
|
|
|
|
nsIFrame *newFrame = (nsIFrame *)isupports;
|
|
|
|
return newFrame->PeekOffset(aAmount, aDirection, aStartOffset, aResultFrame,
|
1999-02-22 04:59:52 +00:00
|
|
|
aFrameOffset, aContentOffset, aEatingWS);
|
1999-02-02 00:23:40 +00:00
|
|
|
}
|
|
|
|
|
1998-04-27 16:44:52 +00:00
|
|
|
//-----------------------------------------------------------------------------------
|
|
|
|
|
1998-08-03 22:22:27 +00:00
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* Refreshes each content's frame
|
|
|
|
*********************************************************/
|
1998-12-18 17:34:34 +00:00
|
|
|
static void RefreshAllContentFrames(nsIFrame * aFrame, nsIContent * aContent)
|
1998-08-03 22:22:27 +00:00
|
|
|
{
|
|
|
|
nsIContent* frameContent;
|
1999-02-10 00:42:56 +00:00
|
|
|
aFrame->GetContent(&frameContent);
|
1998-08-03 22:22:27 +00:00
|
|
|
if (frameContent == aContent) {
|
|
|
|
ForceDrawFrame((nsFrame *)aFrame);
|
|
|
|
}
|
1998-11-12 23:03:35 +00:00
|
|
|
NS_IF_RELEASE(frameContent);
|
1998-08-03 22:22:27 +00:00
|
|
|
|
1999-02-10 02:25:01 +00:00
|
|
|
aFrame->FirstChild(nsnull, &aFrame);
|
1998-08-03 22:22:27 +00:00
|
|
|
while (aFrame) {
|
|
|
|
RefreshAllContentFrames(aFrame, aContent);
|
1999-02-10 06:13:38 +00:00
|
|
|
aFrame->GetNextSibling(&aFrame);
|
1998-08-03 22:22:27 +00:00
|
|
|
}
|
1998-05-08 18:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* Refreshes each content's frame
|
|
|
|
*********************************************************/
|
1999-02-08 17:56:00 +00:00
|
|
|
#if 0
|
1998-12-18 17:34:34 +00:00
|
|
|
static void RefreshContentFrames(nsIPresContext& aPresContext,
|
1998-05-08 18:33:42 +00:00
|
|
|
nsIContent * aStartContent,
|
|
|
|
nsIContent * aEndContent)
|
|
|
|
{
|
|
|
|
//-------------------------------------
|
|
|
|
// Undraw all the current selected frames
|
|
|
|
// XXX Kludge for now
|
1998-12-29 04:45:18 +00:00
|
|
|
nsIPresShell *shell = aPresContext.GetShell();
|
|
|
|
nsIFrame *rootFrame;
|
|
|
|
|
|
|
|
shell->GetRootFrame(rootFrame);
|
1998-08-03 22:22:27 +00:00
|
|
|
|
1998-05-08 18:33:42 +00:00
|
|
|
PRBool foundStart = PR_FALSE;
|
|
|
|
for (PRInt32 i=0;i<fMax;i++) {
|
|
|
|
nsIContent * node = (nsIContent *)fContentArray[i];
|
|
|
|
if (node == aStartContent) {
|
|
|
|
foundStart = PR_TRUE;
|
1998-08-03 22:22:27 +00:00
|
|
|
//ForceDrawFrame((nsFrame *)shell->FindFrameWithContent(node));
|
|
|
|
RefreshAllContentFrames(rootFrame, node);
|
1998-05-08 18:33:42 +00:00
|
|
|
if (aStartContent == aEndContent) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (foundStart) {
|
1998-08-03 22:22:27 +00:00
|
|
|
//ForceDrawFrame((nsFrame *)shell->FindFrameWithContent(node));
|
|
|
|
RefreshAllContentFrames(rootFrame, node);
|
1998-05-08 18:33:42 +00:00
|
|
|
} else if (aEndContent == node) {
|
1998-08-03 22:22:27 +00:00
|
|
|
//ForceDrawFrame((nsFrame *)shell->FindFrameWithContent(node));
|
|
|
|
RefreshAllContentFrames(rootFrame, node);
|
1998-05-08 18:33:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1998-08-03 22:22:27 +00:00
|
|
|
//NS_RELEASE(rootFrame);
|
|
|
|
NS_RELEASE(shell);
|
1998-05-08 18:33:42 +00:00
|
|
|
//-------------------------------------
|
1998-04-27 16:44:52 +00:00
|
|
|
}
|
1999-02-08 17:56:00 +00:00
|
|
|
#endif
|
1998-04-27 16:44:52 +00:00
|
|
|
|
|
|
|
|
1998-05-08 18:33:42 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void ForceDrawFrame(nsFrame * aFrame)//, PRBool)
|
|
|
|
{
|
|
|
|
if (aFrame == nsnull) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsRect rect;
|
|
|
|
nsIView * view;
|
|
|
|
nsPoint pnt;
|
1999-02-10 05:38:18 +00:00
|
|
|
aFrame->GetOffsetFromView(pnt, &view);
|
1998-05-08 18:33:42 +00:00
|
|
|
aFrame->GetRect(rect);
|
|
|
|
rect.x = pnt.x;
|
|
|
|
rect.y = pnt.y;
|
|
|
|
if (view != nsnull) {
|
1998-08-30 19:16:11 +00:00
|
|
|
nsIViewManager * viewMgr;
|
|
|
|
view->GetViewManager(viewMgr);
|
1998-05-08 18:33:42 +00:00
|
|
|
if (viewMgr != nsnull) {
|
|
|
|
viewMgr->UpdateView(view, rect, 0);
|
1998-08-03 22:22:27 +00:00
|
|
|
NS_RELEASE(viewMgr);
|
1998-05-08 18:33:42 +00:00
|
|
|
}
|
1998-08-03 22:22:27 +00:00
|
|
|
//viewMgr->UpdateView(view, rect, NS_VMREFRESH_DOUBLE_BUFFER | NS_VMREFRESH_IMMEDIATE);
|
1998-05-08 18:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-20 16:24:13 +00:00
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
static void
|
|
|
|
GetTagName(nsFrame* aFrame, nsIContent* aContent, PRIntn aResultSize,
|
|
|
|
char* aResult)
|
|
|
|
{
|
|
|
|
char namebuf[40];
|
|
|
|
namebuf[0] = 0;
|
|
|
|
if (nsnull != aContent) {
|
1998-08-29 20:20:38 +00:00
|
|
|
nsIAtom* tag;
|
|
|
|
aContent->GetTag(tag);
|
1998-05-20 16:24:13 +00:00
|
|
|
if (nsnull != tag) {
|
|
|
|
nsAutoString tmp;
|
|
|
|
tag->ToString(tmp);
|
|
|
|
tmp.ToCString(namebuf, sizeof(namebuf));
|
|
|
|
NS_RELEASE(tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PR_snprintf(aResult, aResultSize, "%s@%p", namebuf, aFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsFrame::Trace(const char* aMethod, PRBool aEnter)
|
|
|
|
{
|
|
|
|
if (NS_FRAME_LOG_TEST(gLogModule, NS_FRAME_TRACE_CALLS)) {
|
|
|
|
char tagbuf[40];
|
|
|
|
GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
|
|
|
|
PR_LogPrint("%s: %s %s", tagbuf, aEnter ? "enter" : "exit", aMethod);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsFrame::Trace(const char* aMethod, PRBool aEnter, nsReflowStatus aStatus)
|
|
|
|
{
|
|
|
|
if (NS_FRAME_LOG_TEST(gLogModule, NS_FRAME_TRACE_CALLS)) {
|
|
|
|
char tagbuf[40];
|
|
|
|
GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
|
|
|
|
PR_LogPrint("%s: %s %s, status=%scomplete%s",
|
|
|
|
tagbuf, aEnter ? "enter" : "exit", aMethod,
|
|
|
|
NS_FRAME_IS_NOT_COMPLETE(aStatus) ? "not" : "",
|
|
|
|
(NS_FRAME_REFLOW_NEXTINFLOW & aStatus) ? "+reflow" : "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsFrame::TraceMsg(const char* aFormatString, ...)
|
|
|
|
{
|
|
|
|
if (NS_FRAME_LOG_TEST(gLogModule, NS_FRAME_TRACE_CALLS)) {
|
|
|
|
// Format arguments into a buffer
|
|
|
|
char argbuf[200];
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, aFormatString);
|
|
|
|
PR_vsnprintf(argbuf, sizeof(argbuf), aFormatString, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
char tagbuf[40];
|
|
|
|
GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
|
|
|
|
PR_LogPrint("%s: %s", tagbuf, argbuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|