changing troys generated content SUB iterator with changes that he sent me personally. these will allow us to have iterators over generated tables or just plain before or after nodes.

git-svn-id: svn://10.0.0.236/trunk@64721 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mjudge%netscape.com 2000-03-31 07:22:38 +00:00
parent 868ea2e09e
commit 30a7d8a091
2 changed files with 48 additions and 12 deletions

View File

@ -19,7 +19,7 @@
*
* Contributor(s):
*/
#define PL_ARENA_CONST_ALIGN_MASK 3
#include "nsIPresShell.h"
#include "nsISpaceManager.h"
@ -2772,8 +2772,11 @@ GetFirstChildFrame(nsIPresContext* aPresContext,
// Get the first child frame
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
// If the child frame is a pseudo-frame, then return its first child
if (childFrame && IsPseudoFrame(childFrame, aContent)) {
// If the child frame is a pseudo-frame, then return its first child.
// Note that the frame we create for the generated content is also a
// pseudo-frame and so don't drill down in that case
if (childFrame && IsPseudoFrame(childFrame, aContent) &&
!IsGeneratedContentFrame(childFrame)) {
return GetFirstChildFrame(aPresContext, childFrame, aContent);
}
@ -2794,7 +2797,7 @@ GetLastChildFrame(nsIPresContext* aPresContext,
lastInFlow->GetNextInFlow(&aFrame);
}
// Get the first child frame
// Get the last child frame
nsIFrame* firstChildFrame;
lastInFlow->FirstChild(aPresContext, nsnull, &firstChildFrame);
if (firstChildFrame) {
@ -2803,8 +2806,23 @@ GetLastChildFrame(nsIPresContext* aPresContext,
NS_ASSERTION(lastChildFrame, "unexpected error");
// If the last child frame is a pseudo-frame, then return its last child
if (lastChildFrame && IsPseudoFrame(lastChildFrame, aContent)) {
// Get the frame's first-in-flow. This matters in case the frame has
// been continuted across multiple lines
while (PR_TRUE) {
nsIFrame* prevInFlow;
lastChildFrame->GetPrevInFlow(&prevInFlow);
if (prevInFlow) {
lastChildFrame = prevInFlow;
} else {
break;
}
}
// If the last child frame is a pseudo-frame, then return its last child.
// Note that the frame we create for the generated content is also a
// pseudo-frame and so don't drill down in that case
if (lastChildFrame && IsPseudoFrame(lastChildFrame, aContent) &&
!IsGeneratedContentFrame(lastChildFrame)) {
return GetLastChildFrame(aPresContext, lastChildFrame, aContent);
}

View File

@ -19,7 +19,7 @@
*
* Contributor(s):
*/
#define PL_ARENA_CONST_ALIGN_MASK 3
#include "nsIPresShell.h"
#include "nsISpaceManager.h"
@ -2772,8 +2772,11 @@ GetFirstChildFrame(nsIPresContext* aPresContext,
// Get the first child frame
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
// If the child frame is a pseudo-frame, then return its first child
if (childFrame && IsPseudoFrame(childFrame, aContent)) {
// If the child frame is a pseudo-frame, then return its first child.
// Note that the frame we create for the generated content is also a
// pseudo-frame and so don't drill down in that case
if (childFrame && IsPseudoFrame(childFrame, aContent) &&
!IsGeneratedContentFrame(childFrame)) {
return GetFirstChildFrame(aPresContext, childFrame, aContent);
}
@ -2794,7 +2797,7 @@ GetLastChildFrame(nsIPresContext* aPresContext,
lastInFlow->GetNextInFlow(&aFrame);
}
// Get the first child frame
// Get the last child frame
nsIFrame* firstChildFrame;
lastInFlow->FirstChild(aPresContext, nsnull, &firstChildFrame);
if (firstChildFrame) {
@ -2803,8 +2806,23 @@ GetLastChildFrame(nsIPresContext* aPresContext,
NS_ASSERTION(lastChildFrame, "unexpected error");
// If the last child frame is a pseudo-frame, then return its last child
if (lastChildFrame && IsPseudoFrame(lastChildFrame, aContent)) {
// Get the frame's first-in-flow. This matters in case the frame has
// been continuted across multiple lines
while (PR_TRUE) {
nsIFrame* prevInFlow;
lastChildFrame->GetPrevInFlow(&prevInFlow);
if (prevInFlow) {
lastChildFrame = prevInFlow;
} else {
break;
}
}
// If the last child frame is a pseudo-frame, then return its last child.
// Note that the frame we create for the generated content is also a
// pseudo-frame and so don't drill down in that case
if (lastChildFrame && IsPseudoFrame(lastChildFrame, aContent) &&
!IsGeneratedContentFrame(lastChildFrame)) {
return GetLastChildFrame(aPresContext, lastChildFrame, aContent);
}