зеркало из https://github.com/mozilla/gecko-dev.git
Removed mFirstContentOffset, LastContentOffset, and mLastContentIsComplete
from nsContainerFrame
This commit is contained in:
Родитель
eebc822b38
Коммит
b31a3f0a5f
|
@ -37,8 +37,7 @@
|
|||
#endif
|
||||
|
||||
nsContainerFrame::nsContainerFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||
: nsSplittableFrame(aContent, aParent),
|
||||
mLastContentIsComplete(PR_TRUE)
|
||||
: nsSplittableFrame(aContent, aParent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -102,15 +101,6 @@ nsContainerFrame::PrepareContinuingFrame(nsIPresContext& aPresContext,
|
|||
{
|
||||
// Append the continuing frame to the flow
|
||||
aContFrame->AppendToFlow(this);
|
||||
|
||||
// Initialize it's content offsets. Note that we assume for now that
|
||||
// the continuingFrame will map the remainder of the content and
|
||||
// that therefore mLastContentIsComplete will be true.
|
||||
PRInt32 nextOffset = NextChildOffset();
|
||||
aContFrame->mFirstContentOffset = nextOffset;
|
||||
aContFrame->mLastContentOffset = nextOffset;
|
||||
aContFrame->mLastContentIsComplete = PR_TRUE;
|
||||
|
||||
aContFrame->SetStyleContext(&aPresContext, aStyleContext);
|
||||
}
|
||||
|
||||
|
@ -288,72 +278,6 @@ NS_METHOD nsContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Managing content mapping
|
||||
|
||||
// Get the offset for the next child content, i.e. the child after the
|
||||
// last child that fit in us
|
||||
PRInt32 nsContainerFrame::NextChildOffset() const
|
||||
{
|
||||
PRInt32 result;
|
||||
if (mChildCount > 0) {
|
||||
result = mLastContentOffset;
|
||||
if (mLastContentIsComplete) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = mFirstContentOffset;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the first content offset based on the first child frame.
|
||||
*/
|
||||
void nsContainerFrame::SetFirstContentOffset(const nsIFrame* aFirstChild)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aFirstChild, "bad argument");
|
||||
NS_PRECONDITION(IsChild(aFirstChild), "bad geometric parent");
|
||||
|
||||
if (ChildIsPseudoFrame(aFirstChild)) {
|
||||
nsContainerFrame* pseudoFrame = (nsContainerFrame*)aFirstChild;
|
||||
mFirstContentOffset = pseudoFrame->mFirstContentOffset;
|
||||
} else {
|
||||
// XXX TROY Change API to pass in content index if possible...
|
||||
aFirstChild->GetContentIndex(mFirstContentOffset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the last content offset based on the last child frame. If the last
|
||||
* child is a pseudo frame then it sets mLastContentIsComplete to be the same
|
||||
* as the last child's mLastContentIsComplete
|
||||
*/
|
||||
void nsContainerFrame::SetLastContentOffset(const nsIFrame* aLastChild)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aLastChild, "bad argument");
|
||||
NS_PRECONDITION(IsChild(aLastChild), "bad geometric parent");
|
||||
|
||||
if (ChildIsPseudoFrame(aLastChild)) {
|
||||
nsContainerFrame* pseudoFrame = (nsContainerFrame*)aLastChild;
|
||||
mLastContentOffset = pseudoFrame->mLastContentOffset;
|
||||
#ifdef NS_DEBUG
|
||||
pseudoFrame->VerifyLastIsComplete();
|
||||
#endif
|
||||
mLastContentIsComplete = pseudoFrame->mLastContentIsComplete;
|
||||
} else {
|
||||
// XXX TROY Change API to pass in content index if possible...
|
||||
aLastChild->GetContentIndex(mLastContentOffset);
|
||||
}
|
||||
#ifdef NS_DEBUG
|
||||
if (mLastContentOffset < mFirstContentOffset) {
|
||||
DumpTree();
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(mLastContentOffset >= mFirstContentOffset, "unexpected content mapping");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Pseudo frame related
|
||||
|
||||
|
@ -487,16 +411,6 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame*
|
|||
// Take the next-in-flow out of the parent's child list
|
||||
if (parent->mFirstChild == nextInFlow) {
|
||||
nextInFlow->GetNextSibling(parent->mFirstChild);
|
||||
if (nsnull != parent->mFirstChild) {
|
||||
parent->SetFirstContentOffset(parent->mFirstChild);
|
||||
if (parent->IsPseudoFrame()) {
|
||||
// Tell the parent's parent to update its content offsets
|
||||
nsContainerFrame* pp = (nsContainerFrame*) parent->mGeometricParent;
|
||||
pp->PropagateContentOffsets(parent, parent->mFirstContentOffset,
|
||||
parent->mLastContentOffset,
|
||||
parent->mLastContentIsComplete);
|
||||
}
|
||||
}
|
||||
|
||||
// When a parent loses it's last child and that last child is a
|
||||
// pseudo-frame then the parent's content offsets are now wrong.
|
||||
|
@ -538,33 +452,6 @@ void nsContainerFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsContainerFrame::PropagateContentOffsets(nsIFrame* aChild,
|
||||
PRInt32 aFirstContentOffset,
|
||||
PRInt32 aLastContentOffset,
|
||||
PRBool aLastContentIsComplete)
|
||||
{
|
||||
NS_PRECONDITION(ChildIsPseudoFrame(aChild), "not a pseudo frame");
|
||||
|
||||
// First update our offsets
|
||||
if (mFirstChild == aChild) {
|
||||
mFirstContentOffset = aFirstContentOffset;
|
||||
}
|
||||
nsIFrame* lastChild = LastFrame(mFirstChild);
|
||||
if (lastChild == aChild) {
|
||||
mLastContentOffset = aLastContentOffset;
|
||||
mLastContentIsComplete = aLastContentIsComplete;
|
||||
}
|
||||
|
||||
// If we are a pseudo-frame then we need to update our parent
|
||||
if (IsPseudoFrame()) {
|
||||
nsContainerFrame* parent = (nsContainerFrame*) mGeometricParent;
|
||||
parent->PropagateContentOffsets(this, mFirstContentOffset,
|
||||
mLastContentOffset,
|
||||
mLastContentIsComplete);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Push aFromChild and its next siblings to the next-in-flow. Change the
|
||||
* geometric parent of each frame that's pushed. If there is no next-in-flow
|
||||
|
@ -644,34 +531,8 @@ void nsContainerFrame::PushChildren(nsIFrame* aFromChild,
|
|||
// Prepend the frames to our next-in-flow's child list
|
||||
lastChild->SetNextSibling(nextInFlow->mFirstChild);
|
||||
nextInFlow->mFirstChild = aFromChild;
|
||||
|
||||
// Update our next-in-flow's first content offset and child count
|
||||
nextInFlow->SetFirstContentOffset(aFromChild);
|
||||
if (0 == nextInFlow->mChildCount) {
|
||||
nextInFlow->SetLastContentOffset(lastChild);
|
||||
// If the child is pseudo-frame then SetLastContentOffset will
|
||||
// have updated the next-in-flow's mLastContentIsComplete flag,
|
||||
// otherwise we have to do it.
|
||||
if (!nextInFlow->ChildIsPseudoFrame(lastChild)) {
|
||||
nsIFrame* lastChildNextInFlow;
|
||||
|
||||
lastChild->GetNextInFlow(lastChildNextInFlow);
|
||||
nextInFlow->mLastContentIsComplete = (nsnull == lastChildNextInFlow);
|
||||
}
|
||||
}
|
||||
nextInFlow->mChildCount += numChildren;
|
||||
|
||||
// If the next-in-flow is being used as a pseudo frame then we need
|
||||
// to propagate the content offsets upwards to its parent frame
|
||||
if (nextInFlow->IsPseudoFrame()) {
|
||||
nsContainerFrame* parent = (nsContainerFrame*)
|
||||
nextInFlow->mGeometricParent;
|
||||
parent->PropagateContentOffsets(nextInFlow,
|
||||
nextInFlow->mFirstContentOffset,
|
||||
nextInFlow->mLastContentOffset,
|
||||
nextInFlow->mLastContentIsComplete);
|
||||
}
|
||||
|
||||
#ifdef NOISY
|
||||
ListTag(stdout);
|
||||
printf(": push kids done (childCount=%d)\n", mChildCount);
|
||||
|
@ -770,87 +631,6 @@ void nsContainerFrame::AppendChildren(nsIFrame* aChild, PRBool aSetParent)
|
|||
f->SetGeometricParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Update our content mapping
|
||||
if (mFirstChild == aChild) {
|
||||
SetFirstContentOffset(mFirstChild);
|
||||
}
|
||||
SetLastContentOffset(lastChild);
|
||||
if (!ChildIsPseudoFrame(lastChild)) {
|
||||
nsIFrame* nextInFlow;
|
||||
|
||||
lastChild->GetNextInFlow(nextInFlow);
|
||||
mLastContentIsComplete = (nsnull == nextInFlow);
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
VerifyLastIsComplete();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after pulling-up children from the next-in-flow. Adjusts the first
|
||||
* content offset of all the empty next-in-flows
|
||||
*
|
||||
* It's an error to call this function if all of the next-in-flow frames
|
||||
* are empty.
|
||||
*
|
||||
* @return PR_TRUE if successful and PR_FALSE if all the next-in-flows are
|
||||
* empty
|
||||
*/
|
||||
void nsContainerFrame::AdjustOffsetOfEmptyNextInFlows()
|
||||
{
|
||||
// If the first next-in-flow is not empty then the caller drained
|
||||
// more than one next-in-flow and then pushed back into it's
|
||||
// immediate next-in-flow.
|
||||
nsContainerFrame* nextInFlow = (nsContainerFrame*)mNextInFlow;
|
||||
PRInt32 nextOffset;
|
||||
if ((nsnull != nextInFlow) && (nsnull != nextInFlow->mFirstChild)) {
|
||||
// Use the offset from this frame's first next-in-flow (because
|
||||
// it's not empty) to propagate into the next next-in-flow (and
|
||||
// onward if necessary)
|
||||
nextOffset = nextInFlow->NextChildOffset();
|
||||
|
||||
// Use next next-in-flow
|
||||
nextInFlow = (nsContainerFrame*) nextInFlow->mNextInFlow;
|
||||
|
||||
// When this happens, there *must* be a next next-in-flow and the
|
||||
// next next-in-flow must be empty.
|
||||
NS_ASSERTION(nsnull != nextInFlow, "bad adjust offsets");
|
||||
NS_ASSERTION(nsnull == nextInFlow->mFirstChild, "bad adjust offsets");
|
||||
} else {
|
||||
// Use our offset (since our next-in-flow is empty) to propagate
|
||||
// into our empty next-in-flows
|
||||
nextOffset = NextChildOffset();
|
||||
}
|
||||
|
||||
while (nsnull != nextInFlow) {
|
||||
if (nsnull == nextInFlow->mFirstChild) {
|
||||
NS_ASSERTION(nextInFlow->IsEmpty(), "bad state");
|
||||
nextInFlow->mFirstContentOffset = nextOffset;
|
||||
// If the next-in-flow is a pseudo-frame then we need to have it
|
||||
// update it's parents offsets too.
|
||||
if (nextInFlow->IsPseudoFrame()) {
|
||||
nsContainerFrame* parent = (nsContainerFrame*)
|
||||
nextInFlow->mGeometricParent;
|
||||
parent->PropagateContentOffsets(nextInFlow,
|
||||
nextInFlow->mFirstContentOffset,
|
||||
nextInFlow->mLastContentOffset,
|
||||
nextInFlow->mLastContentIsComplete);
|
||||
}
|
||||
} else {
|
||||
// We found a non-empty frame. Verify that its first content offset
|
||||
// is correct
|
||||
NS_ASSERTION(nextInFlow->mFirstContentOffset == nextOffset, "bad first content offset");
|
||||
return;
|
||||
}
|
||||
|
||||
nextInFlow = (nsContainerFrame*)nextInFlow->mNextInFlow;
|
||||
}
|
||||
|
||||
// Make sure that all the next-in-flows weren't empty
|
||||
NS_ASSERTION(nsnull != ((nsContainerFrame*)mNextInFlow)->mFirstChild,
|
||||
"Every next-in-flow is empty!");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -878,9 +658,6 @@ NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil
|
|||
fprintf(out, " [view=%p]", view);
|
||||
}
|
||||
|
||||
// Output the first/last content offset
|
||||
fprintf(out, "[%d,%d,%c] ", mFirstContentOffset, mLastContentOffset,
|
||||
(mLastContentIsComplete ? 'T' : 'F'));
|
||||
if (nsnull != mPrevInFlow) {
|
||||
fprintf(out, "prev-in-flow=%p ", mPrevInFlow);
|
||||
}
|
||||
|
@ -952,73 +729,6 @@ NS_METHOD nsContainerFrame::VerifyTree() const
|
|||
}
|
||||
VERIFY_ASSERT(nsnull == mOverflowList, "bad overflow list");
|
||||
|
||||
// Make sure our content offsets are sane
|
||||
VERIFY_ASSERT(mFirstContentOffset <= mLastContentOffset, "bad offsets");
|
||||
|
||||
// Verify child content offsets and index-in-parents
|
||||
PRInt32 offset = mFirstContentOffset;
|
||||
nsIFrame* child = mFirstChild;
|
||||
while (nsnull != child) {
|
||||
// Make sure that the child's tree is valid
|
||||
child->VerifyTree();
|
||||
|
||||
// Make sure child's index-in-parent is correct
|
||||
if (ChildIsPseudoFrame(child)) {
|
||||
nsContainerFrame* pseudo = (nsContainerFrame*) child;
|
||||
if (pseudo == mFirstChild) {
|
||||
VERIFY_ASSERT(pseudo->mFirstContentOffset == offset,
|
||||
"bad pseudo first content offset");
|
||||
}
|
||||
if (pseudo == lastChild) {
|
||||
VERIFY_ASSERT(pseudo->mFirstContentOffset == offset,
|
||||
"bad pseudo first content offset");
|
||||
VERIFY_ASSERT(pseudo->mLastContentOffset == mLastContentOffset,
|
||||
"bad pseudo last content offset");
|
||||
VERIFY_ASSERT(pseudo->mLastContentIsComplete == mLastContentIsComplete,
|
||||
"bad pseudo last content is complete");
|
||||
}
|
||||
|
||||
offset = pseudo->mLastContentOffset;
|
||||
if (pseudo->mLastContentIsComplete) {
|
||||
offset++;
|
||||
}
|
||||
} else {
|
||||
PRInt32 indexInParent;
|
||||
|
||||
child->GetContentIndex(indexInParent);
|
||||
VERIFY_ASSERT(offset == indexInParent, "bad child offset");
|
||||
|
||||
nsIFrame* nextInFlow;
|
||||
child->GetNextInFlow(nextInFlow);
|
||||
if (nsnull == nextInFlow) {
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
child->GetNextSibling(child);
|
||||
}
|
||||
|
||||
// Verify that our last content offset is correct
|
||||
if (0 != mChildCount) {
|
||||
if (mLastContentIsComplete) {
|
||||
VERIFY_ASSERT(offset == mLastContentOffset + 1, "bad last offset");
|
||||
} else {
|
||||
VERIFY_ASSERT(offset == mLastContentOffset, "bad last offset");
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that our flow blocks offsets are all correct
|
||||
if (nsnull == mPrevInFlow) {
|
||||
PRInt32 nextOffset = NextChildOffset();
|
||||
nsContainerFrame* nextInFlow = (nsContainerFrame*) mNextInFlow;
|
||||
while (nsnull != nextInFlow) {
|
||||
VERIFY_ASSERT(0 != nextInFlow->mChildCount, "empty next-in-flow");
|
||||
VERIFY_ASSERT(nextInFlow->GetFirstContentOffset() == nextOffset,
|
||||
"bad next-in-flow first offset");
|
||||
nextOffset = nextInFlow->NextChildOffset();
|
||||
nextInFlow = (nsContainerFrame*) nextInFlow->mNextInFlow;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1069,19 +779,6 @@ PRBool nsContainerFrame::IsChild(const nsIFrame* aChild) const
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// XXX Turn back on once all frame code has been changed to always add
|
||||
// a child frame to the sibling list before reflowing the child. Right now
|
||||
// that's not true for inline and column when reflowing unmapped children...
|
||||
#if 0
|
||||
// Check that aChild is in our sibling list
|
||||
PRInt32 index;
|
||||
|
||||
IndexOf(aChild, index);
|
||||
if (-1 == index) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1117,46 +814,6 @@ void nsContainerFrame::DumpTree() const
|
|||
root->List();
|
||||
}
|
||||
|
||||
void nsContainerFrame::CheckContentOffsets()
|
||||
{
|
||||
NS_PRECONDITION(nsnull != mFirstChild, "null first child");
|
||||
|
||||
// Verify that our first content offset is correct
|
||||
if (ChildIsPseudoFrame(mFirstChild)) {
|
||||
nsContainerFrame* pseudoFrame = (nsContainerFrame*)mFirstChild;
|
||||
|
||||
if (pseudoFrame->GetFirstContentOffset() != mFirstContentOffset) {
|
||||
DumpTree();
|
||||
}
|
||||
NS_ASSERTION(pseudoFrame->GetFirstContentOffset() == mFirstContentOffset,
|
||||
"bad first content offset");
|
||||
} else {
|
||||
PRInt32 indexInParent;
|
||||
|
||||
mFirstChild->GetContentIndex(indexInParent);
|
||||
if (indexInParent != mFirstContentOffset) {
|
||||
DumpTree();
|
||||
}
|
||||
|
||||
NS_ASSERTION(indexInParent == mFirstContentOffset, "bad first content offset");
|
||||
}
|
||||
|
||||
// Verify that our last content offset is correct
|
||||
nsIFrame* lastChild = LastFrame(mFirstChild);
|
||||
if (ChildIsPseudoFrame(lastChild)) {
|
||||
nsContainerFrame* pseudoFrame = (nsContainerFrame*)lastChild;
|
||||
|
||||
NS_ASSERTION(pseudoFrame->GetLastContentOffset() == mLastContentOffset,
|
||||
"bad last content offset");
|
||||
|
||||
} else {
|
||||
PRInt32 indexInParent;
|
||||
|
||||
lastChild->GetContentIndex(indexInParent);
|
||||
NS_ASSERTION(indexInParent == mLastContentOffset, "bad last content offset");
|
||||
}
|
||||
}
|
||||
|
||||
void nsContainerFrame::PreReflowCheck()
|
||||
{
|
||||
// XXX CONSTRUCTION
|
||||
|
@ -1211,98 +868,4 @@ PRBool nsContainerFrame::IsEmpty()
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void nsContainerFrame::CheckNextInFlowOffsets()
|
||||
{
|
||||
// We have to be in a safe state before we can even consider
|
||||
// checking our next-in-flows state.
|
||||
if (!SafeToCheckLastContentOffset(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32 nextOffset = NextChildOffset();
|
||||
nsContainerFrame* nextInFlow = (nsContainerFrame*)mNextInFlow;
|
||||
while (nsnull != nextInFlow) {
|
||||
if (!SafeToCheckLastContentOffset(nextInFlow)) {
|
||||
return;
|
||||
}
|
||||
#ifdef NS_DEBUG
|
||||
if (nextInFlow->GetFirstContentOffset() != nextOffset) {
|
||||
DumpTree();
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(nextInFlow->GetFirstContentOffset() == nextOffset,
|
||||
"bad next-in-flow first offset");
|
||||
// Verify the content offsets are in sync with the first/last child
|
||||
nextInFlow->CheckContentOffsets();
|
||||
nextOffset = nextInFlow->NextChildOffset();
|
||||
|
||||
// Move to the next-in-flow
|
||||
nextInFlow = (nsContainerFrame*)nextInFlow->mNextInFlow;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsContainerFrame::SafeToCheckLastContentOffset(nsContainerFrame* aContainer)
|
||||
{
|
||||
if (0 == aContainer->mChildCount) {
|
||||
// We can't use the last content offset on an empty frame
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (nsnull != aContainer->mOverflowList) {
|
||||
// If a frame has an overflow list then it's last content offset
|
||||
// cannot be used for assertion checks (because it's not done
|
||||
// being reflowed).
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIFrame* lastChild = LastFrame(aContainer->mFirstChild);
|
||||
if (aContainer->ChildIsPseudoFrame(lastChild)) {
|
||||
// If the containers last child is a pseudo-frame then the
|
||||
// containers last content offset is determined by the child. Ask
|
||||
// the child if it's safe to use the last content offset.
|
||||
return SafeToCheckLastContentOffset((nsContainerFrame*)lastChild);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void nsContainerFrame::VerifyLastIsComplete() const
|
||||
{
|
||||
if (nsnull == mFirstChild) {
|
||||
// If we have no children, our mLastContentIsComplete doesn't mean
|
||||
// anything
|
||||
return;
|
||||
}
|
||||
if (nsnull != mOverflowList) {
|
||||
// If we can an overflow list then our mLastContentIsComplete and
|
||||
// mLastContentOffset are un-verifyable because a reflow is in
|
||||
// process.
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* lastKid = LastFrame(mFirstChild);
|
||||
if (ChildIsPseudoFrame(lastKid)) {
|
||||
// When my last child is a pseudo-frame it means that our
|
||||
// mLastContentIsComplete is a copy of it's.
|
||||
nsContainerFrame* pseudoFrame = (nsContainerFrame*) lastKid;
|
||||
NS_ASSERTION(mLastContentIsComplete == pseudoFrame->mLastContentIsComplete,
|
||||
"bad mLastContentIsComplete");
|
||||
} else {
|
||||
// If my last child has a next-in-flow then our
|
||||
// mLastContentIsComplete must be false (because our last child is
|
||||
// obviously not complete)
|
||||
nsIFrame* lastKidNextInFlow;
|
||||
|
||||
lastKid->GetNextInFlow(lastKidNextInFlow);
|
||||
if (nsnull != lastKidNextInFlow) {
|
||||
if (mLastContentIsComplete) {
|
||||
DumpTree();
|
||||
}
|
||||
NS_ASSERTION(mLastContentIsComplete == PR_FALSE, "bad mLastContentIsComplete");
|
||||
} else {
|
||||
// We don't know what state our mLastContentIsComplete should be in.
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -138,25 +138,6 @@ public:
|
|||
// IndexOf() returns -1 if the frame is not in the child list.
|
||||
NS_IMETHOD FirstChild(nsIFrame*& aFirstChild) const;
|
||||
|
||||
// Access functions for starting and end content offsets. These reflect the
|
||||
// range of content mapped by the frame.
|
||||
//
|
||||
// If the container is empty (has no children) the last content offset is
|
||||
// undefined
|
||||
PRInt32 GetFirstContentOffset() const {return mFirstContentOffset;}
|
||||
void SetFirstContentOffset(PRInt32 aOffset) {mFirstContentOffset = aOffset;}
|
||||
PRInt32 GetLastContentOffset() const {return mLastContentOffset;}
|
||||
void SetLastContentOffset(PRInt32 aOffset) {mLastContentOffset = aOffset;}
|
||||
|
||||
/** return PR_TRUE if the last mapped child is complete */
|
||||
PRBool GetLastContentIsComplete() const {return mLastContentIsComplete;}
|
||||
/** set the state indicating whether the last mapped child is complete */
|
||||
void SetLastContentIsComplete(PRBool aLIC) {mLastContentIsComplete = aLIC;}
|
||||
|
||||
// Get the offset for the next child content, i.e. the child after the
|
||||
// last child that fit in us
|
||||
PRInt32 NextChildOffset() const;
|
||||
|
||||
// Returns true if this frame is being used a pseudo frame
|
||||
PRBool IsPseudoFrame() const;
|
||||
|
||||
|
@ -165,20 +146,6 @@ public:
|
|||
NS_IMETHOD ListTag(FILE* out = stdout) const;
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
|
||||
/**
|
||||
* When aChild's content mapping offsets change and the child is a
|
||||
* pseudo-frame (meaning that it is mapping content on the behalf of its
|
||||
* geometric parent) then the geometric needs to have its content
|
||||
* mapping offsets updated. This method is used to do just that. The
|
||||
* object is responsible for updating its content mapping offsets and
|
||||
* then if it is a pseudo-frame propogating the update upwards to its
|
||||
* parent.
|
||||
*/
|
||||
virtual void PropagateContentOffsets(nsIFrame* aChild,
|
||||
PRInt32 aFirstContentOffset,
|
||||
PRInt32 aLastContentOffset,
|
||||
PRBool aLastContentIsComplete);
|
||||
|
||||
/**
|
||||
* Return the number of children in the sibling list, starting at aChild.
|
||||
* Returns zero if aChild is nsnull.
|
||||
|
@ -275,15 +242,6 @@ protected:
|
|||
void PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling,
|
||||
PRBool aNextInFlowsLastChildIsComplete);
|
||||
|
||||
/**
|
||||
* Called after pulling-up children from the next-in-flow. Adjusts the first
|
||||
* content offset of all the empty next-in-flows
|
||||
*
|
||||
* It's an error to call this function if all of the next-in-flow frames
|
||||
* are empty.
|
||||
*/
|
||||
void AdjustOffsetOfEmptyNextInFlows();
|
||||
|
||||
/**
|
||||
* Append child list starting at aChild to this frame's child list. Used for
|
||||
* processing of the overflow list.
|
||||
|
@ -330,48 +288,12 @@ protected:
|
|||
*/
|
||||
void PostReflowCheck(nsReflowStatus aStatus);
|
||||
|
||||
void CheckNextInFlowOffsets();
|
||||
|
||||
PRBool IsEmpty();
|
||||
|
||||
PRBool SafeToCheckLastContentOffset(nsContainerFrame* nextInFlow);
|
||||
|
||||
/**
|
||||
* Verify that our mLastContentIsComplete flag is set correctly.
|
||||
*/
|
||||
void VerifyLastIsComplete() const;
|
||||
#endif
|
||||
|
||||
nsIFrame* mFirstChild;
|
||||
PRInt32 mChildCount;
|
||||
PRInt32 mFirstContentOffset; // index of first child we map
|
||||
PRInt32 mLastContentOffset; // index of last child we map
|
||||
PRBool mLastContentIsComplete;
|
||||
nsIFrame* mOverflowList;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Sets the first content offset based on the first child frame.
|
||||
* @deprecated
|
||||
*/
|
||||
void SetFirstContentOffset(const nsIFrame* aFirstChild);
|
||||
|
||||
/**
|
||||
* Sets the last content offset based on the last child frame. If the last
|
||||
* child is a pseudo frame then it sets mLastContentIsComplete to be the same
|
||||
* as the last child's mLastContentIsComplete
|
||||
* @deprecated
|
||||
*/
|
||||
void SetLastContentOffset(const nsIFrame* aLastChild);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* Helper function to verify that the first/last content offsets
|
||||
* are correct. Note: this call will blow up if you have no
|
||||
* children.
|
||||
*/
|
||||
void CheckContentOffsets();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsContainerFrame_h___ */
|
||||
|
|
|
@ -1,682 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nscoord.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Helper functions
|
||||
|
||||
// Compute the number of frames in the list
|
||||
static PRInt32
|
||||
LengthOf(nsIFrame* aChildList)
|
||||
{
|
||||
PRInt32 result = 0;
|
||||
|
||||
while (nsnull != aChildList) {
|
||||
aChildList->GetNextSibling(aChildList);
|
||||
result++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
class SimpleContent : public nsIContent {
|
||||
public:
|
||||
SimpleContent();
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument*& adoc) const {
|
||||
adoc = mDocument;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument) {
|
||||
mDocument = aDocument;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const {
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetParent(nsIContent* aParent) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const {
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const {
|
||||
aResult = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const {
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const {
|
||||
aResult = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify){
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) {
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const {
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetAttribute(const nsString& aName,const nsString& aValue,
|
||||
PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aRet) const {
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext& aPresContext, nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
nsIDocument* mDocument;
|
||||
};
|
||||
|
||||
SimpleContent::SimpleContent()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(SimpleContent, kIContentIID);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
class SimpleContainer : public nsContainerFrame
|
||||
{
|
||||
public:
|
||||
SimpleContainer(nsIContent* aContent);
|
||||
|
||||
void SetFirstChild(nsIFrame* aChild, PRInt32 aChildCount);
|
||||
nsIFrame* GetOverflowList() {return mOverflowList;}
|
||||
void SetOverflowList(nsIFrame* aChildList) {mOverflowList = aChildList;}
|
||||
|
||||
// Allow public access to protected member functions
|
||||
void PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling, PRBool aLastIsComplete);
|
||||
PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild);
|
||||
};
|
||||
|
||||
SimpleContainer::SimpleContainer(nsIContent* aContent)
|
||||
: nsContainerFrame(aContent, nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
// Sets mFirstChild and mChildCount, but not mContentOffset, mContentLength,
|
||||
// or mLastContentIsComplete
|
||||
void SimpleContainer::SetFirstChild(nsIFrame* aChild, PRInt32 aChildCount)
|
||||
{
|
||||
mFirstChild = aChild;
|
||||
mChildCount = aChildCount;
|
||||
NS_ASSERTION(LengthOf(mFirstChild) == aChildCount, "bad child count argument");
|
||||
}
|
||||
|
||||
void SimpleContainer::PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling, PRBool aLastIsComplete)
|
||||
{
|
||||
nsContainerFrame::PushChildren(aFromChild, aPrevSibling, aLastIsComplete);
|
||||
}
|
||||
|
||||
PRBool SimpleContainer::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild)
|
||||
{
|
||||
return nsContainerFrame::DeleteChildsNextInFlow(aPresContext, aChild);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
class SimpleSplittableFrame : public nsSplittableFrame {
|
||||
public:
|
||||
SimpleSplittableFrame(nsIContent* aContent, nsIFrame* aParent);
|
||||
};
|
||||
|
||||
SimpleSplittableFrame::SimpleSplittableFrame(nsIContent* aContent,
|
||||
nsIFrame* aParent)
|
||||
: nsSplittableFrame(aContent, aParent)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
// Basic test of the child enumeration member functions
|
||||
static PRBool
|
||||
TestChildEnumeration()
|
||||
{
|
||||
// Create a simple test container
|
||||
SimpleContent* content = new SimpleContent;
|
||||
SimpleContainer* f = new SimpleContainer(content);
|
||||
|
||||
// Add three child frames
|
||||
SimpleContent* childContent = new SimpleContent();
|
||||
nsFrame* c1;
|
||||
nsFrame* c2;
|
||||
nsFrame* c3;
|
||||
|
||||
nsFrame::NewFrame((nsIFrame**)&c1, childContent, f);
|
||||
nsFrame::NewFrame((nsIFrame**)&c2, childContent, f);
|
||||
nsFrame::NewFrame((nsIFrame**)&c3, childContent, f);
|
||||
|
||||
c1->SetNextSibling(c2);
|
||||
c2->SetNextSibling(c3);
|
||||
f->SetFirstChild(c1, 3);
|
||||
f->SetLastContentOffset(2);
|
||||
|
||||
// Test first member function
|
||||
nsIFrame* child;
|
||||
f->FirstChild(child);
|
||||
if (child != c1) {
|
||||
printf("ChildEnumeration: wrong first child\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
// Test the push children method
|
||||
//
|
||||
// This tests the following:
|
||||
// 1. pushing children to the overflow list when there's no next-in-flow
|
||||
// 2. pushing to a next-in-flow that's empty
|
||||
// 3. pushing to a next-in-flow that isn't empty
|
||||
static PRBool
|
||||
TestPushChildren()
|
||||
{
|
||||
// Create a simple test container
|
||||
SimpleContent* content = new SimpleContent;
|
||||
SimpleContainer* f = new SimpleContainer(content);
|
||||
|
||||
// Add five child frames
|
||||
SimpleContent* childContent = new SimpleContent;
|
||||
nsFrame* c1;
|
||||
nsFrame* c2;
|
||||
nsFrame* c3;
|
||||
nsFrame* c4;
|
||||
nsFrame* c5;
|
||||
|
||||
nsFrame::NewFrame((nsIFrame**)&c1, childContent, f);
|
||||
nsFrame::NewFrame((nsIFrame**)&c2, childContent, f);
|
||||
nsFrame::NewFrame((nsIFrame**)&c3, childContent, f);
|
||||
nsFrame::NewFrame((nsIFrame**)&c4, childContent, f);
|
||||
nsFrame::NewFrame((nsIFrame**)&c5, childContent, f);
|
||||
|
||||
c1->SetNextSibling(c2);
|
||||
c2->SetNextSibling(c3);
|
||||
c3->SetNextSibling(c4);
|
||||
c4->SetNextSibling(c5);
|
||||
f->SetFirstChild(c1, 5);
|
||||
f->SetLastContentOffset(4);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #1
|
||||
|
||||
// Push the last two children. Since there's no next-in-flow the children
|
||||
// should be placed on the overflow list
|
||||
f->PushChildren(c4, c3, PR_TRUE);
|
||||
|
||||
// Verify that the next sibling pointer of c3 has been cleared
|
||||
nsIFrame* nextSibling;
|
||||
c3->GetNextSibling(nextSibling);
|
||||
if (nsnull != nextSibling) {
|
||||
printf("PushChildren: sibling pointer isn't null\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify that there are two frames on the overflow list
|
||||
nsIFrame* overflowList = f->GetOverflowList();
|
||||
if ((nsnull == overflowList) || (LengthOf(overflowList) != 2)) {
|
||||
printf("PushChildren: bad overflow list\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// and that the children on the overflow still have the same geometric parent
|
||||
while (nsnull != overflowList) {
|
||||
nsIFrame* parent;
|
||||
|
||||
overflowList->GetGeometricParent(parent);
|
||||
if (f != parent) {
|
||||
printf("PushChildren: bad geometric parent\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
overflowList->GetNextSibling(overflowList);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #2
|
||||
|
||||
// Link the overflow list back into the child list
|
||||
c3->SetNextSibling(f->GetOverflowList());
|
||||
f->SetOverflowList(nsnull);
|
||||
|
||||
// Create a continuing frame
|
||||
SimpleContainer* f1 = new SimpleContainer(content);
|
||||
|
||||
// Link it into the flow
|
||||
f->SetNextInFlow(f1);
|
||||
f1->SetPrevInFlow(f);
|
||||
|
||||
// Push the last two children to the next-in-flow which is empty.
|
||||
f->PushChildren(c4, c3, PR_TRUE);
|
||||
|
||||
// Verify the content offsets are correct
|
||||
if (f1->GetFirstContentOffset() != 3) {
|
||||
printf("PushChildren: continuing frame bad first content offset\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (f1->GetLastContentOffset() != 4) {
|
||||
printf("PushChildren: continuing frame bad last content offset\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify that the first child is correct
|
||||
nsIFrame* firstChild;
|
||||
f1->FirstChild(firstChild);
|
||||
if (c4 != firstChild) {
|
||||
printf("PushChildren: continuing frame first child is wrong\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify that the next sibling pointer of c3 has been cleared
|
||||
c3->GetNextSibling(nextSibling);
|
||||
if (nsnull != nextSibling) {
|
||||
printf("PushChildren: sibling pointer isn't null\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify that the geometric parent and content parent have been changed
|
||||
f1->FirstChild(firstChild);
|
||||
while (nsnull != firstChild) {
|
||||
nsIFrame* parent;
|
||||
firstChild->GetGeometricParent(parent);
|
||||
if (f1 != parent) {
|
||||
printf("PushChildren: bad geometric parent\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
firstChild->GetContentParent(parent);
|
||||
if (f1 != parent) {
|
||||
printf("PushChildren: bad content parent\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
firstChild->GetNextSibling(firstChild);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #3
|
||||
|
||||
// Test pushing two children to a next-in-flow that already has children
|
||||
f->PushChildren(c2, c1, PR_TRUE);
|
||||
|
||||
// Verify the content offset/length are correct
|
||||
if (f1->GetFirstContentOffset() != 1) {
|
||||
printf("PushChildren: continuing frame bad first content offset\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (f1->GetLastContentOffset() != 4) {
|
||||
printf("PushChildren: continuing frame bad last content offset\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify that the first child is correct
|
||||
f1->FirstChild(firstChild);
|
||||
if (c2 != firstChild) {
|
||||
printf("PushChildren: continuing frame first child is wrong\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify that c3 points to c4
|
||||
c3->GetNextSibling(nextSibling);
|
||||
if (c4 != nextSibling) {
|
||||
printf("PushChildren: bad sibling pointers\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
// Test the delete child's next-in-flow method
|
||||
//
|
||||
// This tests the following:
|
||||
// 1. one next-in-flow in same geometric parent
|
||||
// a) next-in-flow is parent's last child
|
||||
// b) next-in-flow is not the parent's last child
|
||||
// 2. one next-in-flow in different geometric parents
|
||||
// a) next-in-flow is parent's first and last child
|
||||
// b) next-in-flow is not the parent's last child
|
||||
// 3. multiple next-in-flow frames
|
||||
static PRBool
|
||||
TestDeleteChildsNext()
|
||||
{
|
||||
// Create two simple test containers
|
||||
SimpleContent* content = new SimpleContent;
|
||||
SimpleContainer* f = new SimpleContainer(content);
|
||||
|
||||
// Create two child frames
|
||||
SimpleContent* childContent = new SimpleContent;
|
||||
nsFrame* c1 = new SimpleSplittableFrame(childContent, f);
|
||||
nsFrame* c11 = new SimpleSplittableFrame(childContent, f);
|
||||
nsIPresContext *context;
|
||||
|
||||
NS_NewGalleyContext(&context);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #1a
|
||||
|
||||
// Make the child frames siblings and in the same flow
|
||||
c1->SetNextSibling(c11);
|
||||
c11->AppendToFlow(c1);
|
||||
f->SetFirstChild(c1, 2);
|
||||
|
||||
// Delete the next-in-flow
|
||||
f->DeleteChildsNextInFlow(*context, c1);
|
||||
|
||||
// Verify the sibling pointer is null
|
||||
nsIFrame* nextSibling;
|
||||
c1->GetNextSibling(nextSibling);
|
||||
if (nsnull != nextSibling) {
|
||||
printf("DeleteNextInFlow: bad sibling pointer (#1a):\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the next-in-flow pointer is null
|
||||
nsIFrame* nextInFlow;
|
||||
c1->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
printf("DeleteNextInFlow: bad next-in-flow (#1a)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the first/last content offsets are still 0
|
||||
if ((f->GetFirstContentOffset() != 0) || (f->GetLastContentOffset() != 0)) {
|
||||
printf("DeleteNextInFlow: bad content mapping (#1a)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #2a
|
||||
|
||||
// Create a second container frame
|
||||
SimpleContainer* f1 = new SimpleContainer(content);
|
||||
|
||||
// Re-create the continuing child frame
|
||||
c11 = new SimpleSplittableFrame(childContent, f1);
|
||||
|
||||
// Put the first child in the first container and the continuing child frame in
|
||||
// the second container
|
||||
c11->AppendToFlow(c1);
|
||||
f->SetFirstChild(c1, 1);
|
||||
f->SetLastContentOffset(0);
|
||||
f1->SetFirstChild(c11, 1);
|
||||
|
||||
// Link the containers together
|
||||
f1->AppendToFlow(f);
|
||||
|
||||
// Delete the next-in-flow
|
||||
f->DeleteChildsNextInFlow(*context, c1);
|
||||
|
||||
// Verify that the second container frame is empty
|
||||
nsIFrame* firstChild;
|
||||
f1->FirstChild(firstChild);
|
||||
if (firstChild != nsnull) {
|
||||
printf("DeleteNextInFlow: continuing frame not empty (#2a)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the next-in-flow pointer is null
|
||||
c1->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
printf("DeleteNextInFlow: bad next-in-flow (#1b)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #1b
|
||||
|
||||
// Re-create the continuing child frame
|
||||
c11 = new SimpleSplittableFrame(childContent, f);
|
||||
|
||||
// Create a third child frame
|
||||
nsFrame* c2 = new SimpleSplittableFrame(childContent, f);
|
||||
|
||||
c1->SetNextSibling(c11);
|
||||
c11->AppendToFlow(c1);
|
||||
c11->SetNextSibling(c2);
|
||||
f->SetFirstChild(c1, 3);
|
||||
f->SetLastContentOffset(1);
|
||||
|
||||
// Delete the next-in-flow
|
||||
f->DeleteChildsNextInFlow(*context, c1);
|
||||
|
||||
// Verify the sibling pointer is correct
|
||||
c1->GetNextSibling(nextSibling);
|
||||
if (nextSibling != c2) {
|
||||
printf("DeleteNextInFlow: bad sibling pointer (#1b):\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the next-in-flow pointer is correct
|
||||
c1->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
printf("DeleteNextInFlow: bad next-in-flow (#1b)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the first/last content offsets are correct
|
||||
if ((f->GetFirstContentOffset() != 0) || (f->GetLastContentOffset() != 1)) {
|
||||
printf("DeleteNextInFlow: bad content mapping (#1a)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #2b
|
||||
|
||||
// Re-create the continuing frame and the third child frame
|
||||
c11 = new SimpleSplittableFrame(childContent, f1);
|
||||
c2 = new SimpleSplittableFrame(childContent, f1);
|
||||
|
||||
// Put the first child in the first container, and the continuing child frame
|
||||
// and the third frame in the second container
|
||||
c1->SetNextSibling(nsnull);
|
||||
c11->AppendToFlow(c1);
|
||||
f->SetFirstChild(c1, 1);
|
||||
f->SetLastContentOffset(0);
|
||||
|
||||
c11->SetNextSibling(c2);
|
||||
f1->SetFirstChild(c11, 2);
|
||||
f1->SetFirstContentOffset(0);
|
||||
f1->SetLastContentOffset(1);
|
||||
|
||||
// Link the containers together
|
||||
f1->AppendToFlow(f);
|
||||
|
||||
// Delete the next-in-flow
|
||||
f->DeleteChildsNextInFlow(*context, c1);
|
||||
|
||||
// Verify the next-in-flow pointer is null
|
||||
c1->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
printf("DeleteNextInFlow: bad next-in-flow (#2b)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify that the second container's first child is correct
|
||||
f1->FirstChild(firstChild);
|
||||
if (firstChild != c2) {
|
||||
printf("DeleteNextInFlow: continuing frame bad first child (#2b)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the second container's first content offset
|
||||
if (f1->GetFirstContentOffset() != 1) {
|
||||
printf("DeleteNextInFlow: continuing frame bad first content offset (#2b): %d\n",
|
||||
f1->GetFirstContentOffset());
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// #3
|
||||
|
||||
// Re-create the continuing frame and the third child frame
|
||||
c11 = new SimpleSplittableFrame(childContent, f);
|
||||
c2 = new SimpleSplittableFrame(childContent, f);
|
||||
|
||||
// Create a second continuing frame
|
||||
SimpleSplittableFrame* c12 = new SimpleSplittableFrame(childContent, f);
|
||||
|
||||
// Put all the child frames in the first container
|
||||
c1->SetNextSibling(c11);
|
||||
c11->SetNextSibling(c12);
|
||||
c12->SetNextSibling(c2);
|
||||
c11->AppendToFlow(c1);
|
||||
c12->AppendToFlow(c11);
|
||||
f->SetFirstChild(c1, 4);
|
||||
f->SetLastContentOffset(1);
|
||||
|
||||
// Delete the next-in-flow
|
||||
f->DeleteChildsNextInFlow(*context, c1);
|
||||
|
||||
// Verify the next-in-flow pointer is null
|
||||
c1->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
printf("DeleteNextInFlow: bad next-in-flow (#3)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// and the last content offset is still correct
|
||||
if (f->GetLastContentOffset() != 1) {
|
||||
printf("DeleteNextInFlow: bad last content offset (#3): %d\n", f->GetLastContentOffset());
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the sibling list is correct
|
||||
c1->GetNextSibling(nextSibling);
|
||||
if (nextSibling != c2) {
|
||||
printf("DeleteNextInFlow: bad sibling list (#3)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
c2->GetNextSibling(nextSibling);
|
||||
if (nextSibling != nsnull) {
|
||||
printf("DeleteNextInFlow: bad sibling list (#3)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Verify the next-in-flow pointer is null
|
||||
c1->GetNextInFlow(nextInFlow);
|
||||
if (nsnull != nextInFlow) {
|
||||
printf("DeleteNextInFlow: bad next-in-flow (#3)\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(context);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
// Test the container frame being used as a pseudo frame
|
||||
static PRBool
|
||||
TestAsPseudo()
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Test the child frame enumeration member functions
|
||||
if (!TestChildEnumeration()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Test the push children method
|
||||
if (!TestPushChildren()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Test the push children method
|
||||
if (!TestDeleteChildsNext()) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Test being used as a pseudo frame
|
||||
if (!TestAsPseudo()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -18,9 +18,8 @@
|
|||
DEPTH=..\..\..
|
||||
|
||||
MAKE_OBJ_TYPE = EXE
|
||||
PROG1 = .\$(OBJDIR)\TestContainerFrame.exe
|
||||
PROG2 = .\$(OBJDIR)\TestSpaceManager.exe
|
||||
PROGRAMS = $(PROG1) $(PROG2)
|
||||
PROG1 = .\$(OBJDIR)\TestSpaceManager.exe
|
||||
PROGRAMS = $(PROG1)
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I..\src
|
||||
LLIBS= \
|
||||
|
@ -36,7 +35,6 @@ include <$(DEPTH)\layout\config\rules.mak>
|
|||
|
||||
install:: $(PROGRAMS)
|
||||
$(MAKE_INSTALL) $(PROG1) $(DIST)\bin
|
||||
$(MAKE_INSTALL) $(PROG2) $(DIST)\bin
|
||||
|
||||
# Move this into config/obj.inc when it's allowed
|
||||
.cpp{.\$(OBJDIR)\}.exe:
|
||||
|
@ -54,5 +52,4 @@ install:: $(PROGRAMS)
|
|||
$(CURDIR)$(*B).cpp
|
||||
<<KEEP
|
||||
|
||||
$(PROG1): $(OBJDIR) TestContainerFrame.cpp
|
||||
$(PROG2): $(OBJDIR) TestSpaceManager.cpp
|
||||
$(PROG1): $(OBJDIR) TestSpaceManager.cpp
|
||||
|
|
|
@ -204,17 +204,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
|||
// Take the frame away; Note that we also have to take away any
|
||||
// continuations so we loop here until deadFrame is nsnull.
|
||||
while (nsnull != deadFrame) {
|
||||
// If the last frame for the flow is the frame we are deleting
|
||||
// then the flow will become complete.
|
||||
if (!flow->mLastContentIsComplete) {
|
||||
nsIFrame* firstChild;
|
||||
flow->FirstChild(firstChild);
|
||||
nsIFrame* lastFrame = LastFrame(firstChild);
|
||||
if (lastFrame == deadFrame) {
|
||||
flow->mLastContentIsComplete = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove frame from sibling list
|
||||
nsIFrame* nextSib;
|
||||
deadFrame->GetNextSibling(nextSib);
|
||||
|
@ -230,7 +219,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
|||
// removed from flow (because only the children that follow the
|
||||
// deletion need renumbering).
|
||||
flow->mChildCount--;
|
||||
flow->mLastContentOffset--;
|
||||
|
||||
// Break frame out of its flow and then destroy it
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -250,17 +238,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
|||
}
|
||||
}
|
||||
|
||||
// Repair any remaining next-in-flows content offsets; these are the
|
||||
// next-in-flows the follow the last flow container that contained
|
||||
// one of the deadFrame's. Therefore both content offsets need
|
||||
// updating (because all the children are following the deletion).
|
||||
flow = (nsHTMLContainerFrame*) flow->mNextInFlow;
|
||||
while (nsnull != flow) {
|
||||
flow->mFirstContentOffset--;
|
||||
flow->mLastContentOffset--;
|
||||
flow = (nsHTMLContainerFrame*) flow->mNextInFlow;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -697,11 +697,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow,
|
|||
// Take the frame away from the next-in-flow. Update it's first
|
||||
// content offset.
|
||||
kidFrame->GetNextSibling(aNextInFlow->mFirstChild);
|
||||
if (nsnull != aNextInFlow->mFirstChild) {
|
||||
PRInt32 contentIndex;
|
||||
aNextInFlow->mFirstChild->GetContentIndex(contentIndex);
|
||||
aNextInFlow->SetFirstContentOffset(contentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Now give the frame to this container
|
||||
|
@ -715,9 +710,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow,
|
|||
// Add the frame on our list
|
||||
if (nsnull == aLastChild) {
|
||||
mFirstChild = kidFrame;
|
||||
PRInt32 contentIndex;
|
||||
kidFrame->GetContentIndex(contentIndex);
|
||||
SetFirstContentOffset(contentIndex);
|
||||
} else {
|
||||
NS_ASSERTION(IsLastChild(aLastChild), "bad last child");
|
||||
aLastChild->SetNextSibling(kidFrame);
|
||||
|
|
|
@ -340,22 +340,6 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_METHOD nsBodyFrame::ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent)
|
||||
{
|
||||
NS_ASSERTION(mContent == aContainer, "bad content-inserted target");
|
||||
|
||||
// Pass along the notification to our pseudo frame that maps all the content
|
||||
return mFirstChild->ContentInserted(aShell, aPresContext, aContainer,
|
||||
aChild, aIndexInParent);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_METHOD nsBodyFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -602,30 +586,6 @@ void nsBodyFrame::AddFrame(nsIFrame* aFrame)
|
|||
mChildCount++;
|
||||
}
|
||||
|
||||
void
|
||||
nsBodyFrame::PropagateContentOffsets(nsIFrame* aChild,
|
||||
PRInt32 aFirstContentOffset,
|
||||
PRInt32 aLastContentOffset,
|
||||
PRBool aLastContentIsComplete)
|
||||
{
|
||||
NS_PRECONDITION(ChildIsPseudoFrame(aChild), "not a pseudo frame");
|
||||
|
||||
// First update our offsets
|
||||
if (mFirstChild == aChild) {
|
||||
mFirstContentOffset = aFirstContentOffset;
|
||||
mLastContentOffset = aLastContentOffset;
|
||||
mLastContentIsComplete = aLastContentIsComplete;
|
||||
}
|
||||
|
||||
// If we are a pseudo-frame then we need to update our parent
|
||||
if (IsPseudoFrame()) {
|
||||
nsContainerFrame* parent = (nsContainerFrame*) mGeometricParent;
|
||||
parent->PropagateContentOffsets(this, mFirstContentOffset,
|
||||
mLastContentOffset,
|
||||
mLastContentIsComplete);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Event handling
|
||||
|
||||
|
@ -1062,10 +1022,7 @@ NS_METHOD nsBodyFrame::VerifyTree() const
|
|||
}
|
||||
NS_ASSERTION(nsnull == mOverflowList, "bad overflow list");
|
||||
|
||||
// Make sure our content offsets are sane
|
||||
NS_ASSERTION(mFirstContentOffset <= mLastContentOffset, "bad offsets");
|
||||
|
||||
// Verify child content offsets
|
||||
// Verify the child's tree is valid
|
||||
nsIFrame* child = mFirstChild;
|
||||
while (nsnull != child) {
|
||||
// Make sure that the child's tree is valid
|
||||
|
@ -1073,18 +1030,6 @@ NS_METHOD nsBodyFrame::VerifyTree() const
|
|||
child->GetNextSibling(child);
|
||||
}
|
||||
|
||||
// Make sure that our flow blocks offsets are all correct
|
||||
if (nsnull == mPrevInFlow) {
|
||||
PRInt32 nextOffset = NextChildOffset();
|
||||
nsBodyFrame* nextInFlow = (nsBodyFrame*) mNextInFlow;
|
||||
while (nsnull != nextInFlow) {
|
||||
NS_ASSERTION(0 != nextInFlow->mChildCount, "empty next-in-flow");
|
||||
NS_ASSERTION(nextInFlow->GetFirstContentOffset() == nextOffset,
|
||||
"bad next-in-flow first offset");
|
||||
nextOffset = nextInFlow->NextChildOffset();
|
||||
nextInFlow = (nsBodyFrame*) nextInFlow->mNextInFlow;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -45,19 +45,6 @@ public:
|
|||
const nsReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
NS_IMETHOD ContentAppended(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer);
|
||||
|
||||
NS_IMETHOD ContentInserted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD ContentDeleted(nsIPresShell* aShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
|
@ -92,11 +79,13 @@ public:
|
|||
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
|
||||
#if 0
|
||||
// nsContainerFrame
|
||||
virtual void PropagateContentOffsets(nsIFrame* aChild,
|
||||
PRInt32 aFirstContentOffset,
|
||||
PRInt32 aLastContentOffset,
|
||||
PRBool aLastContentIsComplete);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
PRBool mIsPseudoFrame;
|
||||
|
|
|
@ -204,17 +204,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
|||
// Take the frame away; Note that we also have to take away any
|
||||
// continuations so we loop here until deadFrame is nsnull.
|
||||
while (nsnull != deadFrame) {
|
||||
// If the last frame for the flow is the frame we are deleting
|
||||
// then the flow will become complete.
|
||||
if (!flow->mLastContentIsComplete) {
|
||||
nsIFrame* firstChild;
|
||||
flow->FirstChild(firstChild);
|
||||
nsIFrame* lastFrame = LastFrame(firstChild);
|
||||
if (lastFrame == deadFrame) {
|
||||
flow->mLastContentIsComplete = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove frame from sibling list
|
||||
nsIFrame* nextSib;
|
||||
deadFrame->GetNextSibling(nextSib);
|
||||
|
@ -230,7 +219,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
|||
// removed from flow (because only the children that follow the
|
||||
// deletion need renumbering).
|
||||
flow->mChildCount--;
|
||||
flow->mLastContentOffset--;
|
||||
|
||||
// Break frame out of its flow and then destroy it
|
||||
nsIFrame* nextInFlow;
|
||||
|
@ -250,17 +238,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
|||
}
|
||||
}
|
||||
|
||||
// Repair any remaining next-in-flows content offsets; these are the
|
||||
// next-in-flows the follow the last flow container that contained
|
||||
// one of the deadFrame's. Therefore both content offsets need
|
||||
// updating (because all the children are following the deletion).
|
||||
flow = (nsHTMLContainerFrame*) flow->mNextInFlow;
|
||||
while (nsnull != flow) {
|
||||
flow->mFirstContentOffset--;
|
||||
flow->mLastContentOffset--;
|
||||
flow = (nsHTMLContainerFrame*) flow->mNextInFlow;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -697,11 +697,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow,
|
|||
// Take the frame away from the next-in-flow. Update it's first
|
||||
// content offset.
|
||||
kidFrame->GetNextSibling(aNextInFlow->mFirstChild);
|
||||
if (nsnull != aNextInFlow->mFirstChild) {
|
||||
PRInt32 contentIndex;
|
||||
aNextInFlow->mFirstChild->GetContentIndex(contentIndex);
|
||||
aNextInFlow->SetFirstContentOffset(contentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Now give the frame to this container
|
||||
|
@ -715,9 +710,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow,
|
|||
// Add the frame on our list
|
||||
if (nsnull == aLastChild) {
|
||||
mFirstChild = kidFrame;
|
||||
PRInt32 contentIndex;
|
||||
kidFrame->GetContentIndex(contentIndex);
|
||||
SetFirstContentOffset(contentIndex);
|
||||
} else {
|
||||
NS_ASSERTION(IsLastChild(aLastChild), "bad last child");
|
||||
aLastChild->SetNextSibling(kidFrame);
|
||||
|
|
|
@ -62,7 +62,6 @@ nsScrollBodyFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
|||
// Yes. Create the first page frame
|
||||
mFirstChild = new nsPageFrame(mContent, this);/* XXX mContent won't work here */
|
||||
mChildCount = 1;
|
||||
mLastContentOffset = mFirstContentOffset;
|
||||
} else {
|
||||
if (nsnull != mContent) {
|
||||
#if 0
|
||||
|
@ -83,7 +82,6 @@ nsScrollBodyFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
|||
#else
|
||||
nsBodyFrame::NewFrame(&mFirstChild, mContent, this);
|
||||
mChildCount = 1;
|
||||
mLastContentOffset = mFirstContentOffset;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1778,12 +1778,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
|||
// Any space left?
|
||||
PRInt32 numKids;
|
||||
mContent->ChildCount(numKids);
|
||||
if (state.availSize.height <= 0) {
|
||||
// No space left. Don't try to pull-up children or reflow unmapped
|
||||
if (NextChildOffset() < numKids) {
|
||||
status = NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
} else if (NextChildOffset() < numKids) {
|
||||
if (state.availSize.height > 0) {
|
||||
// Try and pull-up some children from a next-in-flow
|
||||
if (!PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// We were unable to pull-up all the existing frames from the
|
||||
|
|
|
@ -528,28 +528,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
|
|||
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
|
||||
}
|
||||
|
||||
// We need to make sure the first content offset is correct for any empty
|
||||
// next-in-flow frames (frames where we pulled up all the child frames)
|
||||
nextInFlow = (nsTableRowGroupFrame*)mNextInFlow;
|
||||
if ((nsnull != nextInFlow) && (nsnull == nextInFlow->mFirstChild)) {
|
||||
// We have at least one empty frame. Did we succesfully pull up all the
|
||||
// child frames?
|
||||
if (PR_FALSE == result) {
|
||||
// No, so we need to adjust the first content offset of all the empty
|
||||
// frames
|
||||
AdjustOffsetOfEmptyNextInFlows();
|
||||
#ifdef NS_DEBUG
|
||||
} else {
|
||||
// Yes, we successfully pulled up all the child frames which means all
|
||||
// the next-in-flows must be empty. Do a sanity check
|
||||
while (nsnull != nextInFlow) {
|
||||
NS_ASSERTION(nsnull == nextInFlow->mFirstChild, "non-empty next-in-flow");
|
||||
nextInFlow->GetNextInFlow((nsIFrame*&)nextInFlow);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -836,12 +814,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
// Any space left?
|
||||
PRInt32 numKids;
|
||||
mContent->ChildCount(numKids);
|
||||
if (state.availSize.height <= 0) {
|
||||
// No space left. Don't try to pull-up children or reflow unmapped
|
||||
if (NextChildOffset() < numKids) {
|
||||
aStatus = NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
} else if (NextChildOffset() < numKids) {
|
||||
if (state.availSize.height > 0) {
|
||||
// Try and pull-up some children from a next-in-flow
|
||||
if (!PullUpChildren(&aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// We were unable to pull-up all the existing frames from the
|
||||
|
|
|
@ -1778,12 +1778,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
|||
// Any space left?
|
||||
PRInt32 numKids;
|
||||
mContent->ChildCount(numKids);
|
||||
if (state.availSize.height <= 0) {
|
||||
// No space left. Don't try to pull-up children or reflow unmapped
|
||||
if (NextChildOffset() < numKids) {
|
||||
status = NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
} else if (NextChildOffset() < numKids) {
|
||||
if (state.availSize.height > 0) {
|
||||
// Try and pull-up some children from a next-in-flow
|
||||
if (!PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// We were unable to pull-up all the existing frames from the
|
||||
|
|
|
@ -528,28 +528,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
|
|||
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
|
||||
}
|
||||
|
||||
// We need to make sure the first content offset is correct for any empty
|
||||
// next-in-flow frames (frames where we pulled up all the child frames)
|
||||
nextInFlow = (nsTableRowGroupFrame*)mNextInFlow;
|
||||
if ((nsnull != nextInFlow) && (nsnull == nextInFlow->mFirstChild)) {
|
||||
// We have at least one empty frame. Did we succesfully pull up all the
|
||||
// child frames?
|
||||
if (PR_FALSE == result) {
|
||||
// No, so we need to adjust the first content offset of all the empty
|
||||
// frames
|
||||
AdjustOffsetOfEmptyNextInFlows();
|
||||
#ifdef NS_DEBUG
|
||||
} else {
|
||||
// Yes, we successfully pulled up all the child frames which means all
|
||||
// the next-in-flows must be empty. Do a sanity check
|
||||
while (nsnull != nextInFlow) {
|
||||
NS_ASSERTION(nsnull == nextInFlow->mFirstChild, "non-empty next-in-flow");
|
||||
nextInFlow->GetNextInFlow((nsIFrame*&)nextInFlow);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -836,12 +814,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
// Any space left?
|
||||
PRInt32 numKids;
|
||||
mContent->ChildCount(numKids);
|
||||
if (state.availSize.height <= 0) {
|
||||
// No space left. Don't try to pull-up children or reflow unmapped
|
||||
if (NextChildOffset() < numKids) {
|
||||
aStatus = NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
} else if (NextChildOffset() < numKids) {
|
||||
if (state.availSize.height > 0) {
|
||||
// Try and pull-up some children from a next-in-flow
|
||||
if (!PullUpChildren(&aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// We were unable to pull-up all the existing frames from the
|
||||
|
|
Загрузка…
Ссылка в новой задаче