зеркало из https://github.com/mozilla/gecko-dev.git
Moved space manager to block frame and changed it the space manager is
temporary only during the reflow process r=kipp@netscape.com
This commit is contained in:
Родитель
d2d24c96ac
Коммит
cdf2c77595
|
@ -55,11 +55,6 @@ nsAreaFrame::nsAreaFrame()
|
|||
{
|
||||
}
|
||||
|
||||
nsAreaFrame::~nsAreaFrame()
|
||||
{
|
||||
NS_IF_RELEASE(mSpaceManager);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
|
@ -80,30 +75,6 @@ nsAreaFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIFrame
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAreaFrame::Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Let the block frame do its initialization
|
||||
rv = nsBlockFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
// Create a space manager if requested
|
||||
if (0 == (mFlags & NS_AREA_NO_SPACE_MGR)) {
|
||||
mSpaceManager = new nsSpaceManager(this);
|
||||
if (!mSpaceManager) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(mSpaceManager);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAreaFrame::Destroy(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -223,6 +194,7 @@ nsAreaFrame::Paint(nsIPresContext& aPresContext,
|
|||
nsresult rv = nsBlockFrame::Paint(aPresContext, aRenderingContext,
|
||||
aDirtyRect, aWhichLayer);
|
||||
|
||||
#if 0
|
||||
if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) {
|
||||
// Render the bands in the spacemanager
|
||||
nsISpaceManager* sm = mSpaceManager;
|
||||
|
@ -266,6 +238,9 @@ nsAreaFrame::Paint(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
return rv;
|
||||
#else
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -295,18 +270,6 @@ nsAreaFrame::GetPositionedInfo(nscoord& aXMost, nscoord& aYMost) const
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAreaFrame::GetSpaceManager(nsISpaceManager** aSpaceManagerResult)
|
||||
{
|
||||
if (!aSpaceManagerResult) {
|
||||
NS_WARNING("null ptr");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aSpaceManagerResult = mSpaceManager;
|
||||
NS_IF_ADDREF(mSpaceManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
CalculateContainingBlock(const nsHTMLReflowState& aReflowState,
|
||||
nscoord aFrameWidth,
|
||||
|
@ -378,16 +341,7 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
// If we have a space manager, then set it in the reflow state
|
||||
if (nsnull != mSpaceManager) {
|
||||
// Modify the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = mSpaceManager;
|
||||
|
||||
// Clear the spacemanager's regions
|
||||
mSpaceManager->ClearRegions();
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
if (mSpaceManager) {
|
||||
|
@ -396,11 +350,13 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
mSpaceManager->List(stdout);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Let the block frame do its reflow first
|
||||
rv = nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
#if 0
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
if (mSpaceManager) {
|
||||
|
@ -409,6 +365,7 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
mSpaceManager->List(stdout);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (mFlags & NS_AREA_WRAP_SIZE) {
|
||||
|
@ -547,14 +504,6 @@ nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
|
|||
nsBlockFrame::SizeOf(aHandler, aResult);
|
||||
*aResult += sizeof(*this) - sizeof(nsBlockFrame);
|
||||
|
||||
// Add in space taken up by the space manager
|
||||
if (mSpaceManager) {
|
||||
PRUint32 spaceManagerSize;
|
||||
|
||||
mSpaceManager->SizeOf(aHandler, &spaceManagerSize);
|
||||
aHandler->AddSize(nsLayoutAtoms::spaceManager, spaceManagerSize);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define nsAreaFrame_h___
|
||||
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsISpaceManager.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
|
@ -50,12 +49,6 @@ public:
|
|||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD Destroy(nsIPresContext& aPresContext);
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
|
||||
|
@ -111,14 +104,10 @@ public:
|
|||
// nsIAreaFrame
|
||||
NS_IMETHOD GetPositionedInfo(nscoord& aXMost, nscoord& aYMost) const;
|
||||
|
||||
NS_IMETHOD GetSpaceManager(nsISpaceManager** aSpaceManagerResult);
|
||||
|
||||
protected:
|
||||
nsAreaFrame();
|
||||
virtual ~nsAreaFrame();
|
||||
|
||||
private:
|
||||
nsSpaceManager* mSpaceManager;
|
||||
nsAbsoluteContainingBlock mAbsoluteContainer;
|
||||
nsRect mCombinedArea;
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsIFrameSelection.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsSpaceManager.h"
|
||||
|
||||
#define MAX_LINE_COUNT 50000
|
||||
|
||||
|
@ -1226,6 +1226,21 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Should we create a space manager?
|
||||
nsCOMPtr<nsISpaceManager> spaceManager;
|
||||
if (mFlags & NS_BLOCK_SPACE_MGR) {
|
||||
nsSpaceManager* rawPtr = new nsSpaceManager(this);
|
||||
if (!rawPtr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
spaceManager = do_QueryInterface(rawPtr);
|
||||
|
||||
// Set the space manager in the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = spaceManager.get();
|
||||
}
|
||||
|
||||
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
|
||||
if (NS_BLOCK_MARGIN_ROOT & mFlags) {
|
||||
state.mIsTopMarginRoot = PR_TRUE;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsIFrameSelection.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsSpaceManager.h"
|
||||
|
||||
#define MAX_LINE_COUNT 50000
|
||||
|
||||
|
@ -1226,6 +1226,21 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Should we create a space manager?
|
||||
nsCOMPtr<nsISpaceManager> spaceManager;
|
||||
if (mFlags & NS_BLOCK_SPACE_MGR) {
|
||||
nsSpaceManager* rawPtr = new nsSpaceManager(this);
|
||||
if (!rawPtr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
spaceManager = do_QueryInterface(rawPtr);
|
||||
|
||||
// Set the space manager in the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = spaceManager.get();
|
||||
}
|
||||
|
||||
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
|
||||
if (NS_BLOCK_MARGIN_ROOT & mFlags) {
|
||||
state.mIsTopMarginRoot = PR_TRUE;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsIFrameSelection.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsSpaceManager.h"
|
||||
|
||||
#define MAX_LINE_COUNT 50000
|
||||
|
||||
|
@ -1226,6 +1226,21 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Should we create a space manager?
|
||||
nsCOMPtr<nsISpaceManager> spaceManager;
|
||||
if (mFlags & NS_BLOCK_SPACE_MGR) {
|
||||
nsSpaceManager* rawPtr = new nsSpaceManager(this);
|
||||
if (!rawPtr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
spaceManager = do_QueryInterface(rawPtr);
|
||||
|
||||
// Set the space manager in the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = spaceManager.get();
|
||||
}
|
||||
|
||||
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
|
||||
if (NS_BLOCK_MARGIN_ROOT & mFlags) {
|
||||
state.mIsTopMarginRoot = PR_TRUE;
|
||||
|
|
|
@ -245,7 +245,7 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
|||
#define NS_BLOCK_NO_AUTO_MARGINS 0x2
|
||||
#define NS_BLOCK_MARGIN_ROOT 0x4
|
||||
#define NS_BLOCK_DOCUMENT_ROOT 0x8
|
||||
#define NS_AREA_NO_SPACE_MGR 0x10
|
||||
#define NS_BLOCK_SPACE_MGR 0x10
|
||||
#define NS_AREA_WRAP_SIZE 0x20
|
||||
|
||||
// Special Generated Content Frame
|
||||
|
@ -266,32 +266,32 @@ extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
|
|||
|
||||
// These AreaFrame's shrink wrap around their contents
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is the document root and is a margin root for
|
||||
// margin collapsing.
|
||||
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is a margin root, but does not shrink wrap
|
||||
inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_MARGIN_ROOT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame shrink wraps
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SHRINK_WRAP);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_SHRINK_WRAP);
|
||||
}
|
||||
|
||||
// This type of AreaFrame doesn't use its own space manager and
|
||||
// doesn't shrink wrap.
|
||||
inline nsresult NS_NewRelativeItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_NO_SPACE_MGR);
|
||||
return NS_NewAreaFrame(aNewFrame);
|
||||
}
|
||||
|
||||
extern nsresult NS_NewBRFrame(nsIFrame** aNewFrame);
|
||||
|
|
|
@ -55,11 +55,6 @@ nsAreaFrame::nsAreaFrame()
|
|||
{
|
||||
}
|
||||
|
||||
nsAreaFrame::~nsAreaFrame()
|
||||
{
|
||||
NS_IF_RELEASE(mSpaceManager);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
|
@ -80,30 +75,6 @@ nsAreaFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIFrame
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAreaFrame::Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Let the block frame do its initialization
|
||||
rv = nsBlockFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
// Create a space manager if requested
|
||||
if (0 == (mFlags & NS_AREA_NO_SPACE_MGR)) {
|
||||
mSpaceManager = new nsSpaceManager(this);
|
||||
if (!mSpaceManager) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(mSpaceManager);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAreaFrame::Destroy(nsIPresContext& aPresContext)
|
||||
{
|
||||
|
@ -223,6 +194,7 @@ nsAreaFrame::Paint(nsIPresContext& aPresContext,
|
|||
nsresult rv = nsBlockFrame::Paint(aPresContext, aRenderingContext,
|
||||
aDirtyRect, aWhichLayer);
|
||||
|
||||
#if 0
|
||||
if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) {
|
||||
// Render the bands in the spacemanager
|
||||
nsISpaceManager* sm = mSpaceManager;
|
||||
|
@ -266,6 +238,9 @@ nsAreaFrame::Paint(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
return rv;
|
||||
#else
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -295,18 +270,6 @@ nsAreaFrame::GetPositionedInfo(nscoord& aXMost, nscoord& aYMost) const
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAreaFrame::GetSpaceManager(nsISpaceManager** aSpaceManagerResult)
|
||||
{
|
||||
if (!aSpaceManagerResult) {
|
||||
NS_WARNING("null ptr");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aSpaceManagerResult = mSpaceManager;
|
||||
NS_IF_ADDREF(mSpaceManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
CalculateContainingBlock(const nsHTMLReflowState& aReflowState,
|
||||
nscoord aFrameWidth,
|
||||
|
@ -378,16 +341,7 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
// If we have a space manager, then set it in the reflow state
|
||||
if (nsnull != mSpaceManager) {
|
||||
// Modify the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = mSpaceManager;
|
||||
|
||||
// Clear the spacemanager's regions
|
||||
mSpaceManager->ClearRegions();
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
if (mSpaceManager) {
|
||||
|
@ -396,11 +350,13 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
mSpaceManager->List(stdout);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Let the block frame do its reflow first
|
||||
rv = nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
#if 0
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||
if (mSpaceManager) {
|
||||
|
@ -409,6 +365,7 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
mSpaceManager->List(stdout);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (mFlags & NS_AREA_WRAP_SIZE) {
|
||||
|
@ -547,14 +504,6 @@ nsAreaFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
|
|||
nsBlockFrame::SizeOf(aHandler, aResult);
|
||||
*aResult += sizeof(*this) - sizeof(nsBlockFrame);
|
||||
|
||||
// Add in space taken up by the space manager
|
||||
if (mSpaceManager) {
|
||||
PRUint32 spaceManagerSize;
|
||||
|
||||
mSpaceManager->SizeOf(aHandler, &spaceManagerSize);
|
||||
aHandler->AddSize(nsLayoutAtoms::spaceManager, spaceManagerSize);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define nsAreaFrame_h___
|
||||
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsISpaceManager.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
|
@ -50,12 +49,6 @@ public:
|
|||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
// nsIFrame
|
||||
NS_IMETHOD Init(nsIPresContext& aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD Destroy(nsIPresContext& aPresContext);
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
|
||||
|
@ -111,14 +104,10 @@ public:
|
|||
// nsIAreaFrame
|
||||
NS_IMETHOD GetPositionedInfo(nscoord& aXMost, nscoord& aYMost) const;
|
||||
|
||||
NS_IMETHOD GetSpaceManager(nsISpaceManager** aSpaceManagerResult);
|
||||
|
||||
protected:
|
||||
nsAreaFrame();
|
||||
virtual ~nsAreaFrame();
|
||||
|
||||
private:
|
||||
nsSpaceManager* mSpaceManager;
|
||||
nsAbsoluteContainingBlock mAbsoluteContainer;
|
||||
nsRect mCombinedArea;
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsIFrameSelection.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsSpaceManager.h"
|
||||
|
||||
#define MAX_LINE_COUNT 50000
|
||||
|
||||
|
@ -1226,6 +1226,21 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Should we create a space manager?
|
||||
nsCOMPtr<nsISpaceManager> spaceManager;
|
||||
if (mFlags & NS_BLOCK_SPACE_MGR) {
|
||||
nsSpaceManager* rawPtr = new nsSpaceManager(this);
|
||||
if (!rawPtr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
spaceManager = do_QueryInterface(rawPtr);
|
||||
|
||||
// Set the space manager in the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = spaceManager.get();
|
||||
}
|
||||
|
||||
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
|
||||
if (NS_BLOCK_MARGIN_ROOT & mFlags) {
|
||||
state.mIsTopMarginRoot = PR_TRUE;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsIFrameSelection.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsSpaceManager.h"
|
||||
|
||||
#define MAX_LINE_COUNT 50000
|
||||
|
||||
|
@ -1226,6 +1226,21 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Should we create a space manager?
|
||||
nsCOMPtr<nsISpaceManager> spaceManager;
|
||||
if (mFlags & NS_BLOCK_SPACE_MGR) {
|
||||
nsSpaceManager* rawPtr = new nsSpaceManager(this);
|
||||
if (!rawPtr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
spaceManager = do_QueryInterface(rawPtr);
|
||||
|
||||
// Set the space manager in the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = spaceManager.get();
|
||||
}
|
||||
|
||||
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
|
||||
if (NS_BLOCK_MARGIN_ROOT & mFlags) {
|
||||
state.mIsTopMarginRoot = PR_TRUE;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsIFrameSelection.h"
|
||||
#include "nsIAreaFrame.h"
|
||||
#include "nsSpaceManager.h"
|
||||
|
||||
#define MAX_LINE_COUNT 50000
|
||||
|
||||
|
@ -1226,6 +1226,21 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Should we create a space manager?
|
||||
nsCOMPtr<nsISpaceManager> spaceManager;
|
||||
if (mFlags & NS_BLOCK_SPACE_MGR) {
|
||||
nsSpaceManager* rawPtr = new nsSpaceManager(this);
|
||||
if (!rawPtr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
spaceManager = do_QueryInterface(rawPtr);
|
||||
|
||||
// Set the space manager in the existing reflow state
|
||||
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
||||
reflowState.mSpaceManager = spaceManager.get();
|
||||
}
|
||||
|
||||
nsBlockReflowState state(aReflowState, &aPresContext, this, aMetrics);
|
||||
if (NS_BLOCK_MARGIN_ROOT & mFlags) {
|
||||
state.mIsTopMarginRoot = PR_TRUE;
|
||||
|
|
|
@ -245,7 +245,7 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
|||
#define NS_BLOCK_NO_AUTO_MARGINS 0x2
|
||||
#define NS_BLOCK_MARGIN_ROOT 0x4
|
||||
#define NS_BLOCK_DOCUMENT_ROOT 0x8
|
||||
#define NS_AREA_NO_SPACE_MGR 0x10
|
||||
#define NS_BLOCK_SPACE_MGR 0x10
|
||||
#define NS_AREA_WRAP_SIZE 0x20
|
||||
|
||||
// Special Generated Content Frame
|
||||
|
@ -266,32 +266,32 @@ extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
|
|||
|
||||
// These AreaFrame's shrink wrap around their contents
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is the document root and is a margin root for
|
||||
// margin collapsing.
|
||||
inline nsresult NS_NewDocumentElementFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_DOCUMENT_ROOT|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is a margin root, but does not shrink wrap
|
||||
inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_MARGIN_ROOT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
||||
// This type of AreaFrame shrink wraps
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SHRINK_WRAP);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_BLOCK_SPACE_MGR|NS_BLOCK_SHRINK_WRAP);
|
||||
}
|
||||
|
||||
// This type of AreaFrame doesn't use its own space manager and
|
||||
// doesn't shrink wrap.
|
||||
inline nsresult NS_NewRelativeItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_NO_SPACE_MGR);
|
||||
return NS_NewAreaFrame(aNewFrame);
|
||||
}
|
||||
|
||||
extern nsresult NS_NewBRFrame(nsIFrame** aNewFrame);
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
#include "nsIFrame.h"
|
||||
|
||||
class nsISpaceManager;
|
||||
|
||||
// 7327a0a0-bc8d-11d1-8539-00a02468fab6
|
||||
#define NS_IAREAFRAME_IID \
|
||||
{ 0xa6cf90de, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
@ -38,8 +36,6 @@ public:
|
|||
* elements
|
||||
*/
|
||||
NS_IMETHOD GetPositionedInfo(nscoord& aXMost, nscoord& aYMost) const = 0;
|
||||
|
||||
NS_IMETHOD GetSpaceManager(nsISpaceManager** aSpaceManagerResult) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIAreaFrame_h___ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче