From 9731c74c2c940b588704cb9982699f2c17060399 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Tue, 23 Feb 1999 19:32:00 +0000 Subject: [PATCH] Compute minimum-line-height and store it into the inline-reflow context git-svn-id: svn://10.0.0.236/trunk@21629 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 12 +++++++++++- mozilla/layout/generic/nsBlockReflowState.cpp | 12 +++++++++++- mozilla/layout/generic/nsBlockReflowState.h | 12 +++++++++++- mozilla/layout/html/base/src/nsBlockFrame.cpp | 12 +++++++++++- mozilla/layout/html/base/src/nsBlockReflowState.cpp | 12 +++++++++++- mozilla/layout/html/base/src/nsBlockReflowState.h | 12 +++++++++++- 6 files changed, 66 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 1d2a6c006af..d835c6f8467 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -243,6 +243,8 @@ public: nsBlockBandData mCurrentBand; nsRect mAvailSpaceRect; + + nscoord mMinLineHeight; }; // XXX This is vile. Make it go away @@ -852,11 +854,19 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, } lineLayout->Init(&state); - // Prepare inline-reflow engine + // Prepare inline-reflow engine. Note that we will almost always use + // the inline reflow engine so this setup is not wasted work: + // because most content has compressed white-space in it, we will + // use the inline reflow engine to get rid of it. nsInlineReflow inlineReflow(*lineLayout, state, this, PR_TRUE); state.mInlineReflow = &inlineReflow; lineLayout->PushInline(&inlineReflow); + // Compute the blocks minimum line-height the first time that its + // needed (which is now). + nscoord minLineHeight = state.CalcLineHeight(aPresContext, this); + inlineReflow.SetMinLineHeight(minLineHeight); + nsresult rv = NS_OK; nsIFrame* target; switch (state.reason) { diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 1d2a6c006af..d835c6f8467 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -243,6 +243,8 @@ public: nsBlockBandData mCurrentBand; nsRect mAvailSpaceRect; + + nscoord mMinLineHeight; }; // XXX This is vile. Make it go away @@ -852,11 +854,19 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, } lineLayout->Init(&state); - // Prepare inline-reflow engine + // Prepare inline-reflow engine. Note that we will almost always use + // the inline reflow engine so this setup is not wasted work: + // because most content has compressed white-space in it, we will + // use the inline reflow engine to get rid of it. nsInlineReflow inlineReflow(*lineLayout, state, this, PR_TRUE); state.mInlineReflow = &inlineReflow; lineLayout->PushInline(&inlineReflow); + // Compute the blocks minimum line-height the first time that its + // needed (which is now). + nscoord minLineHeight = state.CalcLineHeight(aPresContext, this); + inlineReflow.SetMinLineHeight(minLineHeight); + nsresult rv = NS_OK; nsIFrame* target; switch (state.reason) { diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 1d2a6c006af..d835c6f8467 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -243,6 +243,8 @@ public: nsBlockBandData mCurrentBand; nsRect mAvailSpaceRect; + + nscoord mMinLineHeight; }; // XXX This is vile. Make it go away @@ -852,11 +854,19 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, } lineLayout->Init(&state); - // Prepare inline-reflow engine + // Prepare inline-reflow engine. Note that we will almost always use + // the inline reflow engine so this setup is not wasted work: + // because most content has compressed white-space in it, we will + // use the inline reflow engine to get rid of it. nsInlineReflow inlineReflow(*lineLayout, state, this, PR_TRUE); state.mInlineReflow = &inlineReflow; lineLayout->PushInline(&inlineReflow); + // Compute the blocks minimum line-height the first time that its + // needed (which is now). + nscoord minLineHeight = state.CalcLineHeight(aPresContext, this); + inlineReflow.SetMinLineHeight(minLineHeight); + nsresult rv = NS_OK; nsIFrame* target; switch (state.reason) { diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 1d2a6c006af..d835c6f8467 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -243,6 +243,8 @@ public: nsBlockBandData mCurrentBand; nsRect mAvailSpaceRect; + + nscoord mMinLineHeight; }; // XXX This is vile. Make it go away @@ -852,11 +854,19 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, } lineLayout->Init(&state); - // Prepare inline-reflow engine + // Prepare inline-reflow engine. Note that we will almost always use + // the inline reflow engine so this setup is not wasted work: + // because most content has compressed white-space in it, we will + // use the inline reflow engine to get rid of it. nsInlineReflow inlineReflow(*lineLayout, state, this, PR_TRUE); state.mInlineReflow = &inlineReflow; lineLayout->PushInline(&inlineReflow); + // Compute the blocks minimum line-height the first time that its + // needed (which is now). + nscoord minLineHeight = state.CalcLineHeight(aPresContext, this); + inlineReflow.SetMinLineHeight(minLineHeight); + nsresult rv = NS_OK; nsIFrame* target; switch (state.reason) { diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 1d2a6c006af..d835c6f8467 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -243,6 +243,8 @@ public: nsBlockBandData mCurrentBand; nsRect mAvailSpaceRect; + + nscoord mMinLineHeight; }; // XXX This is vile. Make it go away @@ -852,11 +854,19 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, } lineLayout->Init(&state); - // Prepare inline-reflow engine + // Prepare inline-reflow engine. Note that we will almost always use + // the inline reflow engine so this setup is not wasted work: + // because most content has compressed white-space in it, we will + // use the inline reflow engine to get rid of it. nsInlineReflow inlineReflow(*lineLayout, state, this, PR_TRUE); state.mInlineReflow = &inlineReflow; lineLayout->PushInline(&inlineReflow); + // Compute the blocks minimum line-height the first time that its + // needed (which is now). + nscoord minLineHeight = state.CalcLineHeight(aPresContext, this); + inlineReflow.SetMinLineHeight(minLineHeight); + nsresult rv = NS_OK; nsIFrame* target; switch (state.reason) { diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 1d2a6c006af..d835c6f8467 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -243,6 +243,8 @@ public: nsBlockBandData mCurrentBand; nsRect mAvailSpaceRect; + + nscoord mMinLineHeight; }; // XXX This is vile. Make it go away @@ -852,11 +854,19 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, } lineLayout->Init(&state); - // Prepare inline-reflow engine + // Prepare inline-reflow engine. Note that we will almost always use + // the inline reflow engine so this setup is not wasted work: + // because most content has compressed white-space in it, we will + // use the inline reflow engine to get rid of it. nsInlineReflow inlineReflow(*lineLayout, state, this, PR_TRUE); state.mInlineReflow = &inlineReflow; lineLayout->PushInline(&inlineReflow); + // Compute the blocks minimum line-height the first time that its + // needed (which is now). + nscoord minLineHeight = state.CalcLineHeight(aPresContext, this); + inlineReflow.SetMinLineHeight(minLineHeight); + nsresult rv = NS_OK; nsIFrame* target; switch (state.reason) {