Changed splittable enum to be bit flags

This commit is contained in:
troy 1998-05-22 04:54:11 +00:00
parent a476e5c2cd
commit 6204c78831
26 changed files with 128 additions and 94 deletions

View File

@ -75,9 +75,14 @@ enum nsReflowReason {
eReflowReason_Resize // general request to determine a desired size
};
/**
* Reflow state passed to a frame during reflow.
*
* @see #Reflow()
*/
struct nsReflowState {
nsReflowReason reason; // the reason for the reflow
nsReflowCommand& reflowCommand; // only used for incremental changes
// nsReflowCommand& reflowCommand; // only used for incremental changes
nsSize maxSize; // the available space in which to reflow
};
@ -113,6 +118,33 @@ typedef PRUint32 nsReflowStatus;
//----------------------------------------------------------------------
/**
* Indication of how the frame can be split. This is used when doing runaround
* of floaters, and when pulling up child frames from a next-in-flow.
*
* The choices are splittable, not splittable at all, and splittable in
* a non-rectangular fashion. This last type only applies to block-level
* elements, and indicates whether splitting can be used when doing runaround.
* If you can split across page boundaries, but you expect each continuing
* frame to be the same width then return frSplittable and not
* frSplittableNonRectangular.
*
* @see #IsSplittable()
*/
typedef PRUint32 nsSplittableType;
#define NS_FRAME_NOT_SPLITTABLE 0 // Note: not a bit!
#define NS_FRAME_SPLITTABLE 0x1
#define NS_FRAME_SPLITTABLE_NON_RECTANGULAR 0x3
#define NS_FRAME_IS_SPLITTABLE(type)\
(0 != ((type) & NS_FRAME_SPLITTABLE))
#define NS_FRAME_IS_NOT_SPLITTABLE(type)\
(0 == ((type) & NS_FRAME_SPLITTABLE))
//----------------------------------------------------------------------
/**
* Frame state bits. Any bits not listed here are reserved for future
* extensions, but must be stored by the frames.
@ -445,25 +477,10 @@ public:
NS_IMETHOD GetReflowMetrics(nsIPresContext* aPresContext,
nsReflowMetrics& aMetrics) = 0;
/**
* Indication of how the frame can be split. This is used when doing runaround
* of floaters, and when pulling up child frames from a next-in-flow.
*
* The choices are splittable, not splittable at all, and splittable in
* a non-rectangular fashion. This last type only applies to block-level
* elements, and indicates whether splitting can be used when doing runaround.
* If you can split across page boundaries, but you expect each continuing
* frame to be the same width then return frSplittable and not
* frSplittableNonRectangular.
*
* @see #IsSplittable()
*/
enum SplittableType {NotSplittable = 0, Splittable = 1, SplittableNonRectangular = 3};
/**
* Return how your frame can be split.
*/
NS_IMETHOD IsSplittable(SplittableType& aIsSplittable) const = 0;
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const = 0;
/**
* Flow member functions. CreateContinuingFrame() is responsible for

View File

@ -1120,9 +1120,9 @@ NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext* aPresContext,
// Flow member functions
NS_METHOD nsFrame::IsSplittable(SplittableType& aIsSplittable) const
NS_METHOD nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = NotSplittable;
aIsSplittable = NS_FRAME_NOT_SPLITTABLE;
return NS_OK;
}

View File

@ -178,7 +178,7 @@ public:
nsReflowMetrics& aMetrics);
// Flow member functions
NS_IMETHOD IsSplittable(SplittableType& aIsSplittable) const;
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aParent,
nsIStyleContext* aStyleContext,

View File

@ -34,9 +34,9 @@ nsSplittableFrame::~nsSplittableFrame()
// Flow member functions
NS_METHOD nsSplittableFrame::IsSplittable(SplittableType& aIsSplittable) const
NS_METHOD nsSplittableFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = Splittable;
aIsSplittable = NS_FRAME_SPLITTABLE;
return NS_OK;
}

View File

@ -26,7 +26,7 @@ class nsSplittableFrame : public nsFrame
public:
// CreateContinuingFrame() does the default behavior of using the
// content delegate to create a new frame
NS_IMETHOD IsSplittable(SplittableType& aIsSplittable) const;
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aParent,
nsIStyleContext* aStyleContext,

View File

@ -243,9 +243,9 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsBlockFrame::IsSplittable(SplittableType& aIsSplittable) const
nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = SplittableNonRectangular;
aIsSplittable = NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
return NS_OK;
}

View File

@ -179,7 +179,7 @@ public:
PRInt32 aIndexInParent);
NS_IMETHOD GetReflowMetrics(nsIPresContext* aPresContext,
nsReflowMetrics& aMetrics);
NS_IMETHOD IsSplittable(SplittableType& aIsSplittable) const;
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aParent,
nsIStyleContext* aStyleContext,

View File

@ -243,9 +243,9 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsBlockFrame::IsSplittable(SplittableType& aIsSplittable) const
nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = SplittableNonRectangular;
aIsSplittable = NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
return NS_OK;
}

View File

@ -243,9 +243,9 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsBlockFrame::IsSplittable(SplittableType& aIsSplittable) const
nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = SplittableNonRectangular;
aIsSplittable = NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
return NS_OK;
}

View File

@ -75,9 +75,14 @@ enum nsReflowReason {
eReflowReason_Resize // general request to determine a desired size
};
/**
* Reflow state passed to a frame during reflow.
*
* @see #Reflow()
*/
struct nsReflowState {
nsReflowReason reason; // the reason for the reflow
nsReflowCommand& reflowCommand; // only used for incremental changes
// nsReflowCommand& reflowCommand; // only used for incremental changes
nsSize maxSize; // the available space in which to reflow
};
@ -113,6 +118,33 @@ typedef PRUint32 nsReflowStatus;
//----------------------------------------------------------------------
/**
* Indication of how the frame can be split. This is used when doing runaround
* of floaters, and when pulling up child frames from a next-in-flow.
*
* The choices are splittable, not splittable at all, and splittable in
* a non-rectangular fashion. This last type only applies to block-level
* elements, and indicates whether splitting can be used when doing runaround.
* If you can split across page boundaries, but you expect each continuing
* frame to be the same width then return frSplittable and not
* frSplittableNonRectangular.
*
* @see #IsSplittable()
*/
typedef PRUint32 nsSplittableType;
#define NS_FRAME_NOT_SPLITTABLE 0 // Note: not a bit!
#define NS_FRAME_SPLITTABLE 0x1
#define NS_FRAME_SPLITTABLE_NON_RECTANGULAR 0x3
#define NS_FRAME_IS_SPLITTABLE(type)\
(0 != ((type) & NS_FRAME_SPLITTABLE))
#define NS_FRAME_IS_NOT_SPLITTABLE(type)\
(0 == ((type) & NS_FRAME_SPLITTABLE))
//----------------------------------------------------------------------
/**
* Frame state bits. Any bits not listed here are reserved for future
* extensions, but must be stored by the frames.
@ -445,25 +477,10 @@ public:
NS_IMETHOD GetReflowMetrics(nsIPresContext* aPresContext,
nsReflowMetrics& aMetrics) = 0;
/**
* Indication of how the frame can be split. This is used when doing runaround
* of floaters, and when pulling up child frames from a next-in-flow.
*
* The choices are splittable, not splittable at all, and splittable in
* a non-rectangular fashion. This last type only applies to block-level
* elements, and indicates whether splitting can be used when doing runaround.
* If you can split across page boundaries, but you expect each continuing
* frame to be the same width then return frSplittable and not
* frSplittableNonRectangular.
*
* @see #IsSplittable()
*/
enum SplittableType {NotSplittable = 0, Splittable = 1, SplittableNonRectangular = 3};
/**
* Return how your frame can be split.
*/
NS_IMETHOD IsSplittable(SplittableType& aIsSplittable) const = 0;
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const = 0;
/**
* Flow member functions. CreateContinuingFrame() is responsible for

View File

@ -388,13 +388,13 @@ PRBool nsInlineFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.width > aState.availSize.width) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -374,11 +374,11 @@ nsLineLayout::ReflowMappedChild()
// If we need the max-element size and we are splittable then we
// have to reflow to get it.
nsIFrame::SplittableType splits;
nsSplittableType splits;
mKidFrame->IsSplittable(splits);
#if 0
if (nsnull != mMaxElementSizePointer) {
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsLineLayout::ReflowMappedChild: need max-element-size"));
return ReflowChild(nsnull);
@ -390,7 +390,7 @@ nsLineLayout::ReflowMappedChild()
// here to properly handle reflow avoidance. To do that properly we
// really need a first-rate protocol here (WillPlace?
// CanAvoidReflow?) that gets the frame involved.
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsLineLayout::ReflowMappedChild: splittable hack"));
return ReflowChild(nsnull);
@ -413,7 +413,7 @@ nsLineLayout::ReflowMappedChild()
return ReflowChild(nsnull);
}
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
// XXX a next-in-flow propogated dirty-bit eliminates this code
// The splittable frame has not yet been reflowed. This means
@ -530,7 +530,7 @@ nsLineLayout::ReflowMappedChild()
// The child doesn't fit as is; if it's splittable then reflow it
// otherwise return break-before status so that the non-splittable
// child is pushed to the next line.
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsLineLayout::ReflowMappedChild: can't directly fit"));
return ReflowChild(nsnull);

View File

@ -243,9 +243,9 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsBlockFrame::IsSplittable(SplittableType& aIsSplittable) const
nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = SplittableNonRectangular;
aIsSplittable = NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
return NS_OK;
}

View File

@ -179,7 +179,7 @@ public:
PRInt32 aIndexInParent);
NS_IMETHOD GetReflowMetrics(nsIPresContext* aPresContext,
nsReflowMetrics& aMetrics);
NS_IMETHOD IsSplittable(SplittableType& aIsSplittable) const;
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
nsIFrame* aParent,
nsIStyleContext* aStyleContext,

View File

@ -243,9 +243,9 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsBlockFrame::IsSplittable(SplittableType& aIsSplittable) const
nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = SplittableNonRectangular;
aIsSplittable = NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
return NS_OK;
}

View File

@ -243,9 +243,9 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
NS_METHOD
nsBlockFrame::IsSplittable(SplittableType& aIsSplittable) const
nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const
{
aIsSplittable = SplittableNonRectangular;
aIsSplittable = NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
return NS_OK;
}

View File

@ -388,13 +388,13 @@ PRBool nsInlineFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.width > aState.availSize.width) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -374,11 +374,11 @@ nsLineLayout::ReflowMappedChild()
// If we need the max-element size and we are splittable then we
// have to reflow to get it.
nsIFrame::SplittableType splits;
nsSplittableType splits;
mKidFrame->IsSplittable(splits);
#if 0
if (nsnull != mMaxElementSizePointer) {
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsLineLayout::ReflowMappedChild: need max-element-size"));
return ReflowChild(nsnull);
@ -390,7 +390,7 @@ nsLineLayout::ReflowMappedChild()
// here to properly handle reflow avoidance. To do that properly we
// really need a first-rate protocol here (WillPlace?
// CanAvoidReflow?) that gets the frame involved.
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsLineLayout::ReflowMappedChild: splittable hack"));
return ReflowChild(nsnull);
@ -413,7 +413,7 @@ nsLineLayout::ReflowMappedChild()
return ReflowChild(nsnull);
}
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
// XXX a next-in-flow propogated dirty-bit eliminates this code
// The splittable frame has not yet been reflowed. This means
@ -530,7 +530,7 @@ nsLineLayout::ReflowMappedChild()
// The child doesn't fit as is; if it's splittable then reflow it
// otherwise return break-before status so that the non-splittable
// child is pushed to the next line.
if (nsIFrame::NotSplittable != splits) {
if (NS_FRAME_IS_SPLITTABLE(splits)) {
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
("nsLineLayout::ReflowMappedChild: can't directly fit"));
return ReflowChild(nsnull);

View File

@ -1219,13 +1219,13 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.height > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -688,14 +688,14 @@ PRBool nsTableOuterFrame::PullUpChildren( nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.width > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -604,14 +604,14 @@ PRBool nsTableRowFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.height > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -519,13 +519,13 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.height > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -1219,13 +1219,13 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.height > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -688,14 +688,14 @@ PRBool nsTableOuterFrame::PullUpChildren( nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.width > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -604,14 +604,14 @@ PRBool nsTableRowFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.height > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;

View File

@ -519,13 +519,13 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// See if the child fits in the available space. If it fits or
// it's splittable then reflow it. The reason we can't just move
// it is that we still need ascent/descent information
nsSize kidFrameSize;
SplittableType kidIsSplittable;
nsSize kidFrameSize;
nsSplittableType kidIsSplittable;
kidFrame->GetSize(kidFrameSize);
kidFrame->IsSplittable(kidIsSplittable);
if ((kidFrameSize.height > aState.availSize.height) &&
(kidIsSplittable == NotSplittable)) {
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;