зеркало из https://github.com/mozilla/pjs.git
Eliminated mFirstPassValid and changed code to key off the reflow
reason
This commit is contained in:
Родитель
2aed570e50
Коммит
efb1b282f7
|
@ -111,7 +111,6 @@ nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFram
|
|||
mBottomCaptions(nsnull),
|
||||
mMinCaptionWidth(0),
|
||||
mMaxCaptionWidth(0),
|
||||
mFirstPassValid(PR_FALSE),
|
||||
mDesiredSize(nsnull)
|
||||
{
|
||||
}
|
||||
|
@ -146,16 +145,6 @@ PRBool nsTableOuterFrame::NeedsReflow(const nsSize& aMaxSize)
|
|||
return result;
|
||||
}
|
||||
|
||||
PRBool nsTableOuterFrame::IsFirstPassValid()
|
||||
{
|
||||
return mFirstPassValid;
|
||||
}
|
||||
|
||||
void nsTableOuterFrame::SetFirstPassValid(PRBool aValidState)
|
||||
{
|
||||
mFirstPassValid = aValidState;
|
||||
}
|
||||
|
||||
// Recover the reflow state to what it should be if aKidFrame is about
|
||||
// to be reflowed
|
||||
nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aState,
|
||||
|
@ -349,11 +338,12 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// PreReflowCheck();
|
||||
#endif
|
||||
|
||||
// Initialize out parameter
|
||||
// Initialize out parameters
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = 0;
|
||||
aDesiredSize.maxElementSize->height = 0;
|
||||
}
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
// Initialize our local reflow state
|
||||
OuterTableReflowState state(aPresContext, aReflowState);
|
||||
|
@ -362,22 +352,25 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
IncrementalReflow(aPresContext, state, aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
} else {
|
||||
PRBool reflowMappedOK = PR_TRUE;
|
||||
PRBool isInitialReflow = PR_FALSE;
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
// Set up our kids. They're already present, on an overflow list,
|
||||
// or there are none so we'll create them now
|
||||
MoveOverflowToChildList();
|
||||
if (nsnull==mFirstChild) {
|
||||
CreateChildFrames(aPresContext);
|
||||
isInitialReflow = PR_TRUE;
|
||||
}
|
||||
if (nsnull!=mPrevInFlow && nsnull==mInnerTableFrame)
|
||||
{ // if I am a continuing frame, my inner table is my prev-in-flow's mInnerTableFrame's next-in-flow
|
||||
CreateInnerTableFrame(aPresContext);
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
// Set up our kids. They're already present, on an overflow list,
|
||||
// or there are none so we'll create them now
|
||||
MoveOverflowToChildList();
|
||||
if (nsnull==mFirstChild) {
|
||||
CreateChildFrames(aPresContext);
|
||||
}
|
||||
// XXX Add a comment on why mInnerTableFrame would be nsnull at this point?
|
||||
// You would think that the call to CreateChildFrames() would have created
|
||||
// the inner table frame...
|
||||
if (nsnull!=mPrevInFlow && nsnull==mInnerTableFrame)
|
||||
{ // if I am a continuing frame, my inner table is my prev-in-flow's mInnerTableFrame's next-in-flow
|
||||
CreateInnerTableFrame(aPresContext);
|
||||
}
|
||||
|
||||
// lay out captions pass 1
|
||||
aStatus = ResizeReflowCaptionsPass1(aPresContext, state, PR_TRUE);
|
||||
}
|
||||
|
||||
// at this point, we must have at least one child frame, and we must have an inner table frame
|
||||
NS_ASSERTION(nsnull!=mFirstChild, "no children");
|
||||
NS_ASSERTION(nsnull!=mInnerTableFrame, "no mInnerTableFrame");
|
||||
|
@ -387,14 +380,6 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// lay out captions pass 1, if necessary
|
||||
if (PR_FALSE==IsFirstPassValid())
|
||||
{
|
||||
mFirstPassValid = PR_TRUE;
|
||||
aStatus = ResizeReflowCaptionsPass1(aPresContext, state, isInitialReflow);
|
||||
|
||||
}
|
||||
|
||||
// lay out inner table, if required
|
||||
if (PR_FALSE==mInnerTableFrame->IsFirstPassValid())
|
||||
{
|
||||
|
@ -427,6 +412,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
state.innerTableMaxSize.height = aReflowState.maxSize.height;
|
||||
|
||||
// Reflow the child frames
|
||||
PRBool reflowMappedOK = PR_TRUE;
|
||||
if (nsnull != mFirstChild) {
|
||||
reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
||||
if (PR_FALSE == reflowMappedOK) {
|
||||
|
@ -1404,7 +1390,6 @@ nsTableOuterFrame::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PrepareContinuingFrame(aPresContext, aParent, aStyleContext, cf);
|
||||
cf->SetFirstPassValid(PR_TRUE);
|
||||
if (PR_TRUE==gsDebug)
|
||||
printf("nsTableOuterFrame::CCF parent = %p, this=%p, cf=%p\n", aParent, this, cf);
|
||||
aContinuingFrame = cf;
|
||||
|
|
|
@ -109,17 +109,6 @@ protected:
|
|||
*/
|
||||
virtual PRBool NeedsReflow(const nsSize& aMaxSize);
|
||||
|
||||
/** returns PR_TRUE if the data obtained from the first reflow pass
|
||||
* is cached and still valid (ie, no content or style change notifications.)
|
||||
*/
|
||||
virtual PRBool IsFirstPassValid();
|
||||
|
||||
/** setter for mFirstPassValid.
|
||||
* should be called with PR_FALSE when:
|
||||
* content changes, style changes, or context changes
|
||||
*/
|
||||
virtual void SetFirstPassValid(PRBool aValidState);
|
||||
|
||||
/** create all child frames for this table */
|
||||
virtual void CreateChildFrames(nsIPresContext* aPresContext);
|
||||
|
||||
|
@ -254,9 +243,6 @@ private:
|
|||
nsReflowMetrics mDesiredSize;
|
||||
nsSize mMaxElementSize;
|
||||
|
||||
/** we can skip the first pass on captions if mFirstPassValid is true */
|
||||
PRBool mFirstPassValid;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,6 @@ nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFram
|
|||
mBottomCaptions(nsnull),
|
||||
mMinCaptionWidth(0),
|
||||
mMaxCaptionWidth(0),
|
||||
mFirstPassValid(PR_FALSE),
|
||||
mDesiredSize(nsnull)
|
||||
{
|
||||
}
|
||||
|
@ -146,16 +145,6 @@ PRBool nsTableOuterFrame::NeedsReflow(const nsSize& aMaxSize)
|
|||
return result;
|
||||
}
|
||||
|
||||
PRBool nsTableOuterFrame::IsFirstPassValid()
|
||||
{
|
||||
return mFirstPassValid;
|
||||
}
|
||||
|
||||
void nsTableOuterFrame::SetFirstPassValid(PRBool aValidState)
|
||||
{
|
||||
mFirstPassValid = aValidState;
|
||||
}
|
||||
|
||||
// Recover the reflow state to what it should be if aKidFrame is about
|
||||
// to be reflowed
|
||||
nsresult nsTableOuterFrame::RecoverState(OuterTableReflowState& aState,
|
||||
|
@ -349,11 +338,12 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// PreReflowCheck();
|
||||
#endif
|
||||
|
||||
// Initialize out parameter
|
||||
// Initialize out parameters
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = 0;
|
||||
aDesiredSize.maxElementSize->height = 0;
|
||||
}
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
// Initialize our local reflow state
|
||||
OuterTableReflowState state(aPresContext, aReflowState);
|
||||
|
@ -362,22 +352,25 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
IncrementalReflow(aPresContext, state, aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
} else {
|
||||
PRBool reflowMappedOK = PR_TRUE;
|
||||
PRBool isInitialReflow = PR_FALSE;
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
// Set up our kids. They're already present, on an overflow list,
|
||||
// or there are none so we'll create them now
|
||||
MoveOverflowToChildList();
|
||||
if (nsnull==mFirstChild) {
|
||||
CreateChildFrames(aPresContext);
|
||||
isInitialReflow = PR_TRUE;
|
||||
}
|
||||
if (nsnull!=mPrevInFlow && nsnull==mInnerTableFrame)
|
||||
{ // if I am a continuing frame, my inner table is my prev-in-flow's mInnerTableFrame's next-in-flow
|
||||
CreateInnerTableFrame(aPresContext);
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
// Set up our kids. They're already present, on an overflow list,
|
||||
// or there are none so we'll create them now
|
||||
MoveOverflowToChildList();
|
||||
if (nsnull==mFirstChild) {
|
||||
CreateChildFrames(aPresContext);
|
||||
}
|
||||
// XXX Add a comment on why mInnerTableFrame would be nsnull at this point?
|
||||
// You would think that the call to CreateChildFrames() would have created
|
||||
// the inner table frame...
|
||||
if (nsnull!=mPrevInFlow && nsnull==mInnerTableFrame)
|
||||
{ // if I am a continuing frame, my inner table is my prev-in-flow's mInnerTableFrame's next-in-flow
|
||||
CreateInnerTableFrame(aPresContext);
|
||||
}
|
||||
|
||||
// lay out captions pass 1
|
||||
aStatus = ResizeReflowCaptionsPass1(aPresContext, state, PR_TRUE);
|
||||
}
|
||||
|
||||
// at this point, we must have at least one child frame, and we must have an inner table frame
|
||||
NS_ASSERTION(nsnull!=mFirstChild, "no children");
|
||||
NS_ASSERTION(nsnull!=mInnerTableFrame, "no mInnerTableFrame");
|
||||
|
@ -387,14 +380,6 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// lay out captions pass 1, if necessary
|
||||
if (PR_FALSE==IsFirstPassValid())
|
||||
{
|
||||
mFirstPassValid = PR_TRUE;
|
||||
aStatus = ResizeReflowCaptionsPass1(aPresContext, state, isInitialReflow);
|
||||
|
||||
}
|
||||
|
||||
// lay out inner table, if required
|
||||
if (PR_FALSE==mInnerTableFrame->IsFirstPassValid())
|
||||
{
|
||||
|
@ -427,6 +412,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
state.innerTableMaxSize.height = aReflowState.maxSize.height;
|
||||
|
||||
// Reflow the child frames
|
||||
PRBool reflowMappedOK = PR_TRUE;
|
||||
if (nsnull != mFirstChild) {
|
||||
reflowMappedOK = ReflowMappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
||||
if (PR_FALSE == reflowMappedOK) {
|
||||
|
@ -1404,7 +1390,6 @@ nsTableOuterFrame::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PrepareContinuingFrame(aPresContext, aParent, aStyleContext, cf);
|
||||
cf->SetFirstPassValid(PR_TRUE);
|
||||
if (PR_TRUE==gsDebug)
|
||||
printf("nsTableOuterFrame::CCF parent = %p, this=%p, cf=%p\n", aParent, this, cf);
|
||||
aContinuingFrame = cf;
|
||||
|
|
|
@ -109,17 +109,6 @@ protected:
|
|||
*/
|
||||
virtual PRBool NeedsReflow(const nsSize& aMaxSize);
|
||||
|
||||
/** returns PR_TRUE if the data obtained from the first reflow pass
|
||||
* is cached and still valid (ie, no content or style change notifications.)
|
||||
*/
|
||||
virtual PRBool IsFirstPassValid();
|
||||
|
||||
/** setter for mFirstPassValid.
|
||||
* should be called with PR_FALSE when:
|
||||
* content changes, style changes, or context changes
|
||||
*/
|
||||
virtual void SetFirstPassValid(PRBool aValidState);
|
||||
|
||||
/** create all child frames for this table */
|
||||
virtual void CreateChildFrames(nsIPresContext* aPresContext);
|
||||
|
||||
|
@ -254,9 +243,6 @@ private:
|
|||
nsReflowMetrics mDesiredSize;
|
||||
nsSize mMaxElementSize;
|
||||
|
||||
/** we can skip the first pass on captions if mFirstPassValid is true */
|
||||
PRBool mFirstPassValid;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче