this checkin is actually bryners. Backing out the changes that seem to cause various problems

on linux. Eric is going to sit down with a linux guru tomorrow and try to figure out why these changes
were causing a problem.
This commit is contained in:
mscott%netscape.com 2000-04-13 07:43:39 +00:00
Родитель 2d39eb3359
Коммит a1512278c7
10 изменённых файлов: 176 добавлений и 331 удалений

Просмотреть файл

@ -44,7 +44,7 @@
#include "nsHTMLAtoms.h"
#include "nsXULAtoms.h"
nsBox::nsBox(nsIPresShell* aShell):mParentBox(nsnull),mNextChild(nsnull),mMouseThrough(unset)
nsBox::nsBox(nsIPresShell* aShell):mParentBox(nsnull),mNextChild(nsnull),mMouseThrough(sometimes)
{
//mX = 0;
//mY = 0;
@ -96,66 +96,36 @@ nsBox::MarkDirty(nsBoxLayoutState& aState)
state |= NS_FRAME_IS_DIRTY;
frame->SetFrameState(state);
nsCOMPtr<nsIBoxLayout> layout;
GetLayoutManager(getter_AddRefs(layout));
if (layout)
layout->BecameDirty(this, aState);
nsIFrame* parent = nsnull;
frame->GetParent(&parent);
nsCOMPtr<nsIPresShell> shell;
aState.GetPresShell(getter_AddRefs(shell));
nsIBox* parent = nsnull;
GetParentBox(&parent);
if (parent)
return parent->RelayoutDirtyChild(aState, this);
else {
nsIFrame* parent = nsnull;
frame->GetParent(&parent);
nsCOMPtr<nsIPresShell> shell;
aState.GetPresShell(getter_AddRefs(shell));
return parent->ReflowDirtyChild(shell, frame);
}
return parent->ReflowDirtyChild(shell, frame);
}
NS_IMETHODIMP
nsBox::MarkDirtyChildren(nsBoxLayoutState& aState)
{
return RelayoutDirtyChild(aState, nsnull);
}
nsFrameState state;
nsIFrame* frame;
GetFrame(&frame);
frame->GetFrameState(&state);
NS_IMETHODIMP
nsBox::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)
{
nsFrameState state;
nsIFrame* frame;
GetFrame(&frame);
frame->GetFrameState(&state);
// only reflow if we aren't already dirty.
if (state & NS_FRAME_HAS_DIRTY_CHILDREN)
return NS_OK;
// if we are not dirty mark ourselves dirty and tell our parent we are dirty too.
if (!(state & NS_FRAME_HAS_DIRTY_CHILDREN)) {
// Mark yourself as dirty and needing to be recalculated
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
frame->SetFrameState(state);
NeedsRecalc();
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
frame->SetFrameState(state);
if (aChild != nsnull) {
nsCOMPtr<nsIBoxLayout> layout;
GetLayoutManager(getter_AddRefs(layout));
if (layout)
layout->ChildBecameDirty(this, aState, aChild);
}
NeedsRecalc();
nsIFrame* parent = nsnull;
frame->GetParent(&parent);
nsCOMPtr<nsIPresShell> shell;
aState.GetPresShell(getter_AddRefs(shell));
nsIBox* parent = nsnull;
GetParentBox(&parent);
if (parent)
return parent->RelayoutDirtyChild(aState, this);
else {
nsIFrame* parent = nsnull;
frame->GetParent(&parent);
nsCOMPtr<nsIPresShell> shell;
aState.GetPresShell(getter_AddRefs(shell));
return parent->ReflowDirtyChild(shell, frame);
}
}
return NS_OK;
return parent->ReflowDirtyChild(shell, frame);
}
NS_IMETHODIMP
@ -577,7 +547,6 @@ NS_IMETHODIMP
nsBox::GetFlex(nsBoxLayoutState& aState, nscoord& aFlex)
{
aFlex = 0;
GetDefaultFlex(aFlex);
PRBool collapsed = PR_FALSE;
nsIBox::AddCSSFlex(aState, this, aFlex);
@ -1042,40 +1011,6 @@ nsBox::GetDebug(PRBool& aDebug)
return NS_OK;
}
NS_IMETHODIMP
nsBox::GetMouseThrough(PRBool& aMouseThrough)
{
switch(mMouseThrough)
{
case always:
aMouseThrough = PR_TRUE;
return NS_OK;
case never:
aMouseThrough = PR_FALSE;
return NS_OK;
case unset:
{
nsIBox* parent = nsnull;
GetParentBox(&parent);
if (parent)
return parent->GetMouseThrough(aMouseThrough);
else {
aMouseThrough = PR_FALSE;
return NS_OK;
}
}
}
return NS_ERROR_FAILURE;
}
PRBool
nsBox::GetDefaultFlex(PRInt32& aFlex)
{
aFlex = 0;
return PR_TRUE;
}
// nsISupports
NS_IMETHODIMP_(nsrefcnt)
nsBox::AddRef(void)

Просмотреть файл

@ -73,8 +73,6 @@ public:
NS_IMETHOD NeedsRecalc();
NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox);
NS_IMETHOD GetDebug(PRBool& aDebug);
NS_IMETHOD RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild);
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
// XXX Eventually these will move into nsIFrame.
// These methods are used for XBL <children>.
@ -107,11 +105,10 @@ public:
protected:
virtual PRBool GetWasCollapsed(nsBoxLayoutState& aState);
virtual void SetWasCollapsed(nsBoxLayoutState& aState, PRBool aWas);
virtual PRBool GetDefaultFlex(PRInt32& aFlex);
enum eMouseThrough {
unset,
never,
sometimes,
always
};

Просмотреть файл

@ -153,8 +153,6 @@ public:
void DrawLine(nsIRenderingContext& aRenderingContext, PRBool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2);
void FillRect(nsIRenderingContext& aRenderingContext, PRBool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height);
nsIBox* GetBoxForFrame(nsIFrame* aFrame, PRBool& aIsAdaptor);
nsBoxFrame::Halignment GetHAlign();
nsBoxFrame::Valignment GetVAlign();
@ -255,6 +253,7 @@ nsBoxFrame::~nsBoxFrame()
NS_ASSERTION(mInner == nsnull,"Error Destroy was never called on this Frame!!!");
}
NS_IMETHODIMP
nsBoxFrame::GetVAlign(Valignment& aAlign)
{
@ -282,8 +281,7 @@ nsBoxFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsresult r = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
if (r == NS_OK) {
// initialize our list of infos.
nsBoxLayoutState state(shell);
InitChildren(state, aChildList);
InitChildren(shell, aChildList);
} else {
printf("Warning add child failed!!\n");
}
@ -357,7 +355,7 @@ nsBoxFrame::Init(nsIPresContext* aPresContext,
mInner->GetDebugPref(aPresContext);
mMouseThrough = unset;
mMouseThrough = always;
if (mContent) {
nsAutoString value;
@ -581,10 +579,15 @@ nsBoxFrame::GetInitialAutoStretch(PRBool& aStretch)
NS_IMETHODIMP
nsBoxFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
{
nsCOMPtr<nsIPresContext> context;
aPresShell->GetPresContext(getter_AddRefs(context));
nsBoxLayoutState state(context);
return RelayoutDirtyChild(state, this);
// if we are not dirty mark ourselves dirty and tell our parent we are dirty too.
if (!(mState & NS_FRAME_HAS_DIRTY_CHILDREN)) {
// Mark yourself as dirty and needing to be recalculated
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
NeedsRecalc();
return mParent->ReflowDirtyChild(aPresShell, this);
}
return NS_OK;
}
NS_IMETHODIMP
@ -848,9 +851,7 @@ nsBoxFrame::Destroy(nsIPresContext* aPresContext)
// if we are root remove 1 from the debug count.
if (mState & NS_STATE_IS_ROOT)
mInner->GetDebugPref(aPresContext);
SetLayoutManager(nsnull);
// recycle the Inner via the shell's arena.
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -887,13 +888,11 @@ nsBoxFrame::SetDebug(nsBoxLayoutState& aState, PRBool aDebug)
NS_IMETHODIMP
nsBoxFrame::NeedsRecalc()
{
if (mInner) {
SizeNeedsRecalc(mInner->mPrefSize);
SizeNeedsRecalc(mInner->mMinSize);
SizeNeedsRecalc(mInner->mMaxSize);
CoordNeedsRecalc(mInner->mFlex);
CoordNeedsRecalc(mInner->mAscent);
}
SizeNeedsRecalc(mInner->mPrefSize);
SizeNeedsRecalc(mInner->mMinSize);
SizeNeedsRecalc(mInner->mMaxSize);
CoordNeedsRecalc(mInner->mFlex);
CoordNeedsRecalc(mInner->mAscent);
return NS_OK;
}
@ -911,8 +910,7 @@ nsBoxFrame::RemoveFrame(nsIPresContext* aPresContext,
SanityCheck(mFrames);
// remove child from our info list
nsBoxLayoutState state(aPresContext);
Remove(state, aOldFrame);
Remove(&aPresShell, aOldFrame);
// remove the child frame
mFrames.DestroyFrame(aPresContext, aOldFrame);
@ -920,6 +918,7 @@ nsBoxFrame::RemoveFrame(nsIPresContext* aPresContext,
SanityCheck(mFrames);
// mark us dirty and generate a reflow command
nsBoxLayoutState state(aPresContext);
MarkDirtyChildren(state);
MarkDirty(state);
return NS_OK;
@ -946,12 +945,13 @@ nsBoxFrame::InsertFrames(nsIPresContext* aPresContext,
}
// insert the frames to our info list
nsBoxLayoutState state(aPresContext);
Insert(state, aPrevFrame, aFrameList);
Insert(&aPresShell, aPrevFrame, aFrameList);
// insert the frames in out regular frame list
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
nsBoxLayoutState state(aPresContext);
// if we are in debug make sure our children are in debug as well.
if (mState & NS_STATE_CURRENTLY_IN_DEBUG)
SetDebugOnChildList(state, mFirstChild, PR_TRUE);
@ -979,12 +979,13 @@ nsBoxFrame::AppendFrames(nsIPresContext* aPresContext,
SanityCheck(mFrames);
// append them after
nsBoxLayoutState state(aPresContext);
Append(state,aFrameList);
Append(&aPresShell,aFrameList);
// append in regular frames
mFrames.AppendFrames(this, aFrameList);
nsBoxLayoutState state(aPresContext);
// if we are in debug make sure our children are in debug as well.
if (mState & NS_STATE_CURRENTLY_IN_DEBUG)
SetDebugOnChildList(state, mFirstChild, PR_TRUE);
@ -1428,132 +1429,99 @@ nsBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext,
}
}
nsIFrame *kid, *hit = nsnull;
nsPoint tmp;
FirstChild(aPresContext, nsnull, &kid);
*aFrame = nsnull;
tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y);
while (nsnull != kid) {
// have we hit a child before
PRBool haveKid = (hit != nsnull);
nsresult rv = kid->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
if (NS_SUCCEEDED(rv) && hit) {
if (!haveKid)
*aFrame = hit;
else
{
// if the kid had a child before see if this child has mouse
// though.
nsresult rv = NS_OK;
PRBool isAdaptor = PR_FALSE;
nsCOMPtr<nsIBox> box = mInner->GetBoxForFrame(hit, isAdaptor);
if (box) {
PRBool mouseThrough = PR_FALSE;
box->GetMouseThrough(mouseThrough);
// if the child says it can never mouse though ignore it.
if (!mouseThrough)
*aFrame = hit;
else {
/*
// otherwise see if it has an opaque parent.
nsIFrame* child = hit;
while(child) {
if (child == this)
break;
const nsStyleColor* color = nsnull;
child->GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)color);
PRBool transparentBG = (!color || NS_STYLE_BG_COLOR_TRANSPARENT ==
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT));
if (!transparentBG) {
*aFrame = hit;
break;
}
child->GetParent(&child);
}
*/
}
}
}
}
kid->GetNextSibling(&kid);
if (mMouseThrough == never)
{
*aFrame = this;
return NS_OK;
}
if (*aFrame) {
return NS_OK;
// This won't work.
nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aWhichLayer, PR_FALSE, aFrame);
/*
nsRect r(0,0,mRect.width, mRect.height);
// if it is not inside us fail
if (!r.Contains(aPoint)) {
return NS_ERROR_FAILURE;
}
// if no kids were hit then select us
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->IsVisible()) {
// is it inside our border, padding, and debugborder or insets?
nsMargin im(0,0,0,0);
nsBoxLayoutState state(aPresContext);
GetInset(im);
nsMargin border(0,0,0,0);
GetBorderAndPadding(border);
r.Deflate(im);
r.Deflate(border);
// no? Then it must be in our border so return us.
if (!r.Contains(aPoint)) {
*aFrame = this;
return NS_OK;
}
// ok lets look throught the children
*aFrame = nsnull;
nsIBox* child = nsnull;
GetChildBox(&child);
nsPoint tmp;
nsIFrame *frame = nsnull, *hit = nsnull;
tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y);
while(child)
{
child->GetFrame(&frame);
nsresult rv = frame->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
if (NS_SUCCEEDED(rv) && hit) {
*aFrame = hit;
}
child->GetNextBox(&child);
}
// found it.
if (hit)
return NS_OK;
*/
if (rv != NS_ERROR_FAILURE)
return rv;
// see if it is in our border, padding, or inset
nsRect r(mRect);
nsMargin m;
GetInset(m);
r.Deflate(m);
GetBorderAndPadding(m);
r.Deflate(m);
if (!r.Contains(aPoint)) {
*aFrame = this;
return NS_OK;
}
if (mMouseThrough == sometimes)
{
*aFrame = this;
return NS_OK;
}
const nsStyleColor* color = (const nsStyleColor*)
mStyleContext->GetStyleData(eStyleStruct_Color);
PRBool transparentBG = NS_STYLE_BG_COLOR_TRANSPARENT ==
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
if (!transparentBG)
{
*aFrame = this;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
nsIBox*
nsBoxFrameInner::GetBoxForFrame(nsIFrame* aFrame, PRBool& aIsAdaptor)
{
if (aFrame == nsnull)
return nsnull;
nsIBox* ibox = nsnull;
if (NS_FAILED(aFrame->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox))) {
aIsAdaptor = PR_TRUE;
// if we hit a non box. Find the box in out last container
// and clear its cache.
nsIFrame* parent = nsnull;
aFrame->GetParent(&parent);
nsIBox* parentBox = nsnull;
if (NS_FAILED(parent->QueryInterface(NS_GET_IID(nsIBox), (void**)&parentBox)))
return nsnull;
if (parentBox) {
nsIBox* start = nsnull;
parentBox->GetChildBox(&start);
while (start) {
nsIFrame* frame = nsnull;
start->GetFrame(&frame);
if (frame == aFrame) {
ibox = start;
break;
}
start->GetNextBox(&start);
}
}
}
return ibox;
}
/*
NS_IMETHODIMP
nsBoxFrame::GetMouseThrough(PRBool& aMouseThrough)
{
const nsStyleColor* color = (const nsStyleColor*)
mStyleContext->GetStyleData(eStyleStruct_Color);
PRBool transparentBG = NS_STYLE_BG_COLOR_TRANSPARENT ==
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
if (!transparentBG)
aMouseThrough = never;
else
return nsBox::GetMouseThrough(aMouseThrough);
return NS_OK;
}
*/
NS_IMETHODIMP
@ -1651,8 +1619,7 @@ nsBoxFrameInner::operator new(size_t sz, nsIPresShell* aPresShell)
void
nsBoxFrameInner::Recycle(nsIPresShell* aPresShell)
{
nsBoxLayoutState state(aPresShell);
mOuter->ClearChildren(state);
mOuter->ClearChildren(aPresShell);
delete this;
nsBoxLayoutState::RecycleFreedMemory(aPresShell, this);

Просмотреть файл

@ -90,7 +90,6 @@ public:
NS_IMETHOD GetInset(nsMargin& aInset);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD GetDebug(PRBool& aDebug);
//NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);
// ----- child and sibling operations ---
@ -161,6 +160,7 @@ public:
virtual PRBool IsHorizontal() const;
virtual ~nsBoxFrame();
virtual nsresult GetContentOf(nsIContent** aContent);

Просмотреть файл

@ -49,12 +49,6 @@ nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
mMaxElementSize = aState.mMaxElementSize;
}
nsBoxLayoutState::nsBoxLayoutState(nsIPresShell* aShell):mReflowState(nsnull), mMaxElementSize(nsnull)
{
nsCOMPtr<nsIPresContext> context;
aShell->GetPresContext(getter_AddRefs(mPresContext));
}
nsBoxLayoutState::nsBoxLayoutState(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize):mReflowState(&aReflowState),mPresContext(aPresContext),mType(Dirty)
{
mMaxElementSize = aDesiredSize.maxElementSize;
@ -124,11 +118,6 @@ nsBoxLayoutState::HandleReflow(nsIBox* aRootBox, PRBool aCoelesce)
mType = Initial;
break;
case eReflowReason_StyleChange:
printf("STYLE CHANGE REFLOW. Blowing away all box caches!!\n");
DirtyAllChildren(*this, aRootBox);
// fall through to dirty
default:
mType = Dirty;
}
@ -185,25 +174,11 @@ nsBoxLayoutState::UnWind(nsIReflowCommand* aCommand, nsIBox* aBox, PRBool aCoele
ibox->MarkDirty(*this);
if (type == nsIReflowCommand::StyleChanged) {
// could be a visiblity change. Like collapse so we need to dirty
// parent so it gets redrawn. But be carefull we
// don't want to just mark dirty that would notify the
// box and it would notify its layout manager. This would
// be really bad for grid because it would blow away
// all is cached infomation for is colums and rows. Because the
// our parent is most likely a rows or columns and it will think
// its child is getting bigger or something.
// could be a visiblity change need to dirty
// parent so it gets redrawn.
nsIBox* parent;
ibox->GetParentBox(&parent);
if (parent) {
nsFrameState parentState;
nsIFrame* parentFrame;
parent->GetFrame(&parentFrame);
parentFrame->GetFrameState(&parentState);
parentState |= NS_FRAME_IS_DIRTY;
parentFrame->SetFrameState(parentState);
}
parent->MarkDirty(*this);
DirtyAllChildren(*this, ibox);
}

Просмотреть файл

@ -53,12 +53,11 @@ public:
nsBoxLayoutState(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize);
nsBoxLayoutState(nsIPresContext* aPresContext);
nsBoxLayoutState(nsIPresShell* aShell);
nsBoxLayoutState(const nsBoxLayoutState& aState);
virtual PRBool HandleReflow(nsIBox* aRootBox, PRBool aCoalesce);
virtual nsIPresContext* GetPresContext() { return mPresContext.get(); }
virtual nsIPresContext* GetPresContext() { return mPresContext; }
virtual nsresult GetPresShell(nsIPresShell** aShell);
virtual void GetMaxElementSize(nsSize** aMaxElementSize);
@ -80,7 +79,7 @@ private:
nsIBox* GetTargetBox(nsIReflowCommand* mCommand, PRBool& aIsAdaptor);
nsIBox* GetBoxForFrame(nsIFrame* aFrame, PRBool& aIsAdaptor);
nsCOMPtr<nsIPresContext> mPresContext;
nsIPresContext* mPresContext;
const nsHTMLReflowState* mReflowState;
eBoxLayoutReason mType;
nsSize* mMaxElementSize;

Просмотреть файл

@ -89,18 +89,15 @@ nsContainerBox::GetChildCount()
}
PRInt32
nsContainerBox::CreateBoxList(nsBoxLayoutState& aState, nsIFrame* aFrameList, nsIBox*& aFirst, nsIBox*& aLast)
nsContainerBox::CreateBoxList(nsIPresShell* aPresShell, nsIFrame* aFrameList, nsIBox*& aFirst, nsIBox*& aLast)
{
nsCOMPtr<nsIPresShell> shell;
aState.GetPresShell(getter_AddRefs(shell));
PRInt32 count = 0;
if (aFrameList) {
nsIBox* ibox = nsnull;
if (NS_SUCCEEDED(aFrameList->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox)
aFirst = ibox;
else
aFirst = new (shell) nsBoxToBlockAdaptor(shell, aFrameList);
aFirst = new (aPresShell) nsBoxToBlockAdaptor(aPresShell, aFrameList);
aFirst->SetParentBox(this);
@ -114,7 +111,7 @@ nsContainerBox::CreateBoxList(nsBoxLayoutState& aState, nsIFrame* aFrameList, ns
if (NS_SUCCEEDED(aFrameList->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox)
aLast = ibox;
else
aLast = new (shell) nsBoxToBlockAdaptor(shell, aFrameList);
aLast = new (aPresShell) nsBoxToBlockAdaptor(aPresShell, aFrameList);
aLast->SetParentBox(this);
@ -220,15 +217,15 @@ nsContainerBox::GetIndexOf(nsIBox* aBox)
}
void
nsContainerBox::Remove(nsBoxLayoutState& aState, nsIFrame* aFrame)
nsContainerBox::Remove(nsIPresShell* aShell, nsIFrame* aFrame)
{
// get the info before the frame
nsIBox* prevBox = GetPrevious(aFrame);
RemoveAfter(aState, prevBox);
RemoveAfter(aShell, prevBox);
}
void
nsContainerBox::Insert(nsBoxLayoutState& aState, nsIFrame* aPrevFrame, nsIFrame* aFrameList)
nsContainerBox::Insert(nsIPresShell* aShell, nsIFrame* aPrevFrame, nsIFrame* aFrameList)
{
nsIBox* prevBox = GetBox(aPrevFrame);
//NS_ASSERTION(aPrevFrame == nsnull || prevBox,"Error! The previous frame given is not in our list!");
@ -237,15 +234,15 @@ nsContainerBox::Insert(nsBoxLayoutState& aState, nsIFrame* aPrevFrame, nsIFrame*
// if no previous frame then we are inserting in front
if (prevBox == nsnull) {
// prepend them
Prepend(aState, aFrameList);
Prepend(aShell, aFrameList);
} else {
// insert insert after previous info
InsertAfter(aState, prevBox, aFrameList);
InsertAfter(aShell, prevBox, aFrameList);
}
}
void
nsContainerBox::RemoveAfter(nsBoxLayoutState& aState, nsIBox* aPrevious)
nsContainerBox::RemoveAfter(nsIPresShell* aPresShell, nsIBox* aPrevious)
{
nsIBox* toDelete = nsnull;
@ -274,24 +271,15 @@ nsContainerBox::RemoveAfter(nsBoxLayoutState& aState, nsIBox* aPrevious)
// recycle adaptors
nsIBoxToBlockAdaptor* adaptor = nsnull;
if (NS_SUCCEEDED(toDelete->QueryInterface(NS_GET_IID(nsIBoxToBlockAdaptor), (void**)&adaptor)) && adaptor) {
nsCOMPtr<nsIPresShell> shell;
aState.GetPresShell(getter_AddRefs(shell));
adaptor->Recycle(shell);
}
if (NS_SUCCEEDED(toDelete->QueryInterface(NS_GET_IID(nsIBoxToBlockAdaptor), (void**)&adaptor)) && adaptor)
adaptor->Recycle(aPresShell);
mChildCount--;
if (mLayoutManager)
mLayoutManager->ChildrenRemoved(this, aState, toDelete);
}
void
nsContainerBox::ClearChildren(nsBoxLayoutState& aState)
nsContainerBox::ClearChildren(nsIPresShell* aShell)
{
if (mFirstChild && mLayoutManager)
mLayoutManager->ChildrenRemoved(this, aState, mFirstChild);
nsIBox* box = mFirstChild;
while(box) {
nsIBox* it = box;
@ -299,11 +287,8 @@ nsContainerBox::ClearChildren(nsBoxLayoutState& aState)
// recycle adaptors
nsIBoxToBlockAdaptor* adaptor = nsnull;
if (NS_SUCCEEDED(it->QueryInterface(NS_GET_IID(nsIBoxToBlockAdaptor), (void**)&adaptor)) && adaptor) {
nsCOMPtr<nsIPresShell> shell;
aState.GetPresShell(getter_AddRefs(shell));
adaptor->Recycle(shell);
}
if (NS_SUCCEEDED(it->QueryInterface(NS_GET_IID(nsIBoxToBlockAdaptor), (void**)&adaptor)) && adaptor)
adaptor->Recycle(aShell);
}
mFirstChild= nsnull;
@ -312,68 +297,52 @@ nsContainerBox::ClearChildren(nsBoxLayoutState& aState)
}
void
nsContainerBox::Prepend(nsBoxLayoutState& aState, nsIFrame* aList)
nsContainerBox::Prepend(nsIPresShell* aPresShell, nsIFrame* aList)
{
nsIBox* first;
nsIBox* last;
mChildCount += CreateBoxList(aState, aList, first, last);
mChildCount += CreateBoxList(aPresShell, aList, first, last);
if (!mFirstChild)
mFirstChild= mLastChild= first;
else {
last->SetNextBox(mFirstChild);
mFirstChild= first;
}
if (mLayoutManager)
mLayoutManager->ChildrenInserted(this, aState, nsnull, first);
}
void
nsContainerBox::Append(nsBoxLayoutState& aState, nsIFrame* aList)
nsContainerBox::Append(nsIPresShell* aPresShell, nsIFrame* aList)
{
nsIBox* first;
nsIBox* last;
mChildCount += CreateBoxList(aState, aList, first, last);
mChildCount += CreateBoxList(aPresShell, aList, first, last);
if (!mFirstChild)
mFirstChild= first;
else
mLastChild->SetNextBox(first);
mLastChild= last;
if (mLayoutManager)
mLayoutManager->ChildrenAppended(this, aState, first);
}
void
nsContainerBox::InsertAfter(nsBoxLayoutState& aState, nsIBox* aPrev, nsIFrame* aList)
nsContainerBox::InsertAfter(nsIPresShell* aPresShell, nsIBox* aPrev, nsIFrame* aList)
{
nsIBox* first = nsnull;
nsIBox* last = nsnull;
mChildCount += CreateBoxList(aState, aList, first, last);
mChildCount += CreateBoxList(aPresShell, aList, first, last);
nsIBox* next = nsnull;
aPrev->GetNextBox(&next);
last->SetNextBox(next);
aPrev->SetNextBox(first);
if (aPrev == mLastChild)
mLastChild = last;
if (mLayoutManager) {
mLayoutManager->ChildrenInserted(this, aState, aPrev, first);
}
}
void
nsContainerBox::InitChildren(nsBoxLayoutState& aState, nsIFrame* aList)
nsContainerBox::InitChildren(nsIPresShell* aPresShell, nsIFrame* aList)
{
ClearChildren(aState);
mChildCount += CreateBoxList(aState, aList, mFirstChild, mLastChild);
if (mLayoutManager)
mLayoutManager->ChildrenAppended(this, aState, mFirstChild);
ClearChildren(aPresShell);
mChildCount += CreateBoxList(aPresShell, aList, mFirstChild, mLastChild);
}
void

Просмотреть файл

@ -50,15 +50,15 @@ public:
virtual nsIBox* GetBox(nsIFrame* aFrame);
virtual PRInt32 GetIndexOf(nsIBox* aBox);
virtual PRInt32 GetChildCount();
virtual void ClearChildren(nsBoxLayoutState& aState);
virtual PRInt32 CreateBoxList(nsBoxLayoutState& aState, nsIFrame* aList, nsIBox*& first, nsIBox*& last);
virtual void RemoveAfter(nsBoxLayoutState& aState, nsIBox* aPrev);
virtual void Remove(nsBoxLayoutState& aState, nsIFrame* aChild);
virtual void Prepend(nsBoxLayoutState& aState, nsIFrame* aList);
virtual void Append(nsBoxLayoutState& aState, nsIFrame* aList);
virtual void Insert(nsBoxLayoutState& aState, nsIFrame* aPrevFrame, nsIFrame* aList);
virtual void InsertAfter(nsBoxLayoutState& aState, nsIBox* aPrev, nsIFrame* aList);
virtual void InitChildren(nsBoxLayoutState& aState, nsIFrame* aList);
virtual void ClearChildren(nsIPresShell* aShell);
virtual PRInt32 CreateBoxList(nsIPresShell* aShell, nsIFrame* aList, nsIBox*& first, nsIBox*& last);
virtual void RemoveAfter(nsIPresShell* aShell, nsIBox* aPrev);
virtual void Remove(nsIPresShell* aShell, nsIFrame* aChild);
virtual void Prepend(nsIPresShell* aShell, nsIFrame* aList);
virtual void Append(nsIPresShell* aShell, nsIFrame* aList);
virtual void Insert(nsIPresShell* aShell, nsIFrame* aPrevFrame, nsIFrame* aList);
virtual void InsertAfter(nsIPresShell* aShell, nsIBox* aPrev, nsIFrame* aList);
virtual void InitChildren(nsIPresShell* aShell, nsIFrame* aList);
virtual nsIBox* GetPrevious(nsIFrame* aChild);
virtual void SanityCheck(nsFrameList& aFrameList);
virtual void SetDebugOnChildList(nsBoxLayoutState& aState, nsIBox* aChild, PRBool aDebug);

Просмотреть файл

@ -98,8 +98,6 @@ public:
NS_IMETHOD Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE)=0;
NS_IMETHOD NeedsRecalc()=0;
NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox)=0;
NS_IMETHOD RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)=0;
NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough)=0;
// XXX Eventually these will move into nsIFrame.
// These methods are used for XBL <children>.

Просмотреть файл

@ -79,7 +79,7 @@ nsLeafBoxFrame::Init(nsIPresContext* aPresContext,
{
nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
mMouseThrough = unset;
mMouseThrough = sometimes;
if (mContent) {
nsAutoString value;
@ -104,8 +104,13 @@ nsLeafBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext,
if (!mRect.Contains(aPoint))
return NS_ERROR_FAILURE;
*aFrame = this;
return NS_OK;
if (mMouseThrough != never)
{
*aFrame = this;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP