зеркало из https://github.com/mozilla/pjs.git
Big tree improvements.
This commit is contained in:
Родитель
953c56436a
Коммит
c1ed351049
|
@ -82,6 +82,8 @@ protected:
|
|||
|
||||
PRBool CanResize(nsPoint& aPoint);
|
||||
|
||||
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext) { return NS_OK; };
|
||||
|
||||
protected:
|
||||
// Data members
|
||||
PRBool mIsHeader; // Whether or not we're a column header
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsTreeTwistyListener.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include "nsHTMLParts.h"
|
||||
|
||||
//
|
||||
// NS_NewTreeFrame
|
||||
|
@ -315,6 +319,41 @@ nsTreeFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTreeFrame::DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus)
|
||||
{
|
||||
nsresult rv = nsTableFrame::DidReflow(aPresContext, aStatus);
|
||||
if (mNeedsDirtyReflow) {
|
||||
mNeedsDirtyReflow = PR_FALSE;
|
||||
InvalidateCellMap();
|
||||
InvalidateColumnCache();
|
||||
InvalidateFirstPassCache();
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext.GetShell(getter_AddRefs(shell));
|
||||
nsFrameState frameState;
|
||||
nsIFrame* tableParentFrame;
|
||||
nsIReflowCommand* reflowCmd;
|
||||
|
||||
// Mark the table frame as dirty
|
||||
GetFrameState(&frameState);
|
||||
frameState |= NS_FRAME_IS_DIRTY;
|
||||
SetFrameState(frameState);
|
||||
|
||||
// Target the reflow comamnd at its parent frame
|
||||
GetParent(&tableParentFrame);
|
||||
rv = NS_NewHTMLReflowCommand(&reflowCmd, tableParentFrame,
|
||||
nsIReflowCommand::ReflowDirty);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Add the reflow command
|
||||
rv = shell->AppendReflowCommand(reflowCmd);
|
||||
NS_RELEASE(reflowCmd);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTreeFrame::Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
|
|
@ -62,6 +62,10 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
|
||||
void WillNeedDirtyReflow() { mNeedsDirtyReflow = PR_TRUE; };
|
||||
|
||||
protected:
|
||||
nsTreeFrame();
|
||||
|
@ -70,5 +74,6 @@ protected:
|
|||
protected: // Data Members
|
||||
PRBool mSlatedForReflow; // If set, don't waste time scheduling excess reflows.
|
||||
nsTreeTwistyListener* mTwistyListener;
|
||||
PRBool mNeedsDirtyReflow;
|
||||
|
||||
}; // class nsTreeFrame
|
||||
|
|
|
@ -711,6 +711,12 @@ nsTreeRowGroupFrame::ReflowAfterRowLayout(nsIPresContext& aPresContext,
|
|||
if (rowCount < 0)
|
||||
rowCount = 0;
|
||||
|
||||
// Our page size is the # of rows instantiated.
|
||||
PRInt32 pageRowCount;
|
||||
GetRowCount(pageRowCount);
|
||||
|
||||
rowCount -= (pageRowCount-2);
|
||||
|
||||
char ch[100];
|
||||
sprintf(ch,"%d", rowCount);
|
||||
|
||||
|
@ -840,8 +846,6 @@ nsTreeRowGroupFrame::GetFirstFrameForReflow(nsIPresContext& aPresContext)
|
|||
return mTopFrame;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// We don't have a top frame instantiated. Let's
|
||||
// try to make one.
|
||||
|
||||
|
@ -863,19 +867,20 @@ nsTreeRowGroupFrame::GetFirstFrameForReflow(nsIPresContext& aPresContext)
|
|||
|
||||
mFrameConstructor->CreateTreeWidgetContent(&aPresContext, this, nsnull, startContent,
|
||||
&mTopFrame, isAppend, PR_FALSE);
|
||||
|
||||
// XXX Can be optimized if we detect that we're appending a row.
|
||||
// Also the act of appending or inserting a row group is harmless.
|
||||
|
||||
nsTableFrame* tableFrame;
|
||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
//tableFrame->InvalidateCellMap();
|
||||
tableFrame->InvalidateColumnCache();
|
||||
nsTreeFrame* treeFrame = (nsTreeFrame*)tableFrame;
|
||||
treeFrame->WillNeedDirtyReflow();
|
||||
|
||||
//printf("Created a frame\n");
|
||||
mBottomFrame = mTopFrame;
|
||||
const nsStyleDisplay *rowDisplay;
|
||||
mTopFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)rowDisplay);
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW==rowDisplay->mDisplay) {
|
||||
((nsTableRowFrame *)mTopFrame)->InitChildren();
|
||||
}
|
||||
else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP==rowDisplay->mDisplay && mContentChain) {
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP==rowDisplay->mDisplay && mContentChain) {
|
||||
// We have just instantiated a row group, and we have a content chain. This
|
||||
// means we need to potentially pass a sub-content chain to the instantiated
|
||||
// frame, so that it can also sync up with its children.
|
||||
|
@ -883,7 +888,7 @@ nsTreeRowGroupFrame::GetFirstFrameForReflow(nsIPresContext& aPresContext)
|
|||
}
|
||||
|
||||
SetContentChain(nsnull);
|
||||
return mTopFrame;
|
||||
//return mTopFrame;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
@ -937,17 +942,15 @@ nsTreeRowGroupFrame::GetNextFrameForReflow(nsIPresContext& aPresContext, nsIFram
|
|||
}
|
||||
mFrameConstructor->CreateTreeWidgetContent(&aPresContext, this, prevFrame, nextContent,
|
||||
aResult, isAppend, PR_FALSE);
|
||||
|
||||
// XXX Can be optimized if we detect that we're appending a row to the end of the tree.
|
||||
// Also the act of appending or inserting a row group is harmless.
|
||||
|
||||
nsTableFrame* tableFrame;
|
||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
//tableFrame->InvalidateCellMap();
|
||||
tableFrame->InvalidateColumnCache();
|
||||
|
||||
//printf("Created a frame\n");
|
||||
const nsStyleDisplay *rowDisplay;
|
||||
(*aResult)->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)rowDisplay);
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW==rowDisplay->mDisplay) {
|
||||
((nsTableRowFrame *)(*aResult))->InitChildren();
|
||||
}
|
||||
nsTreeFrame* treeFrame = (nsTreeFrame*)tableFrame;
|
||||
treeFrame->WillNeedDirtyReflow();
|
||||
*aResult = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче