From c83c90fb24d60b149ff63a37a852d4623fc92892 Mon Sep 17 00:00:00 2001
From: "kipp%netscape.com" <kipp%netscape.com>
Date: Wed, 21 Apr 1999 19:59:40 +0000
Subject: [PATCH] Fixed FindNextSibling to return the first-in-flow not the
 last in flow

---
 layout/base/nsCSSFrameConstructor.cpp           | 12 ++++++------
 layout/html/style/src/nsCSSFrameConstructor.cpp | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index 1aa5564775c8..3fe2393fe0f9 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3766,14 +3766,14 @@ FindNextSibling(nsIPresShell* aPresShell,
     aPresShell->GetPrimaryFrameFor(nextContent, &nextSibling);
 
     if (nsnull != nextSibling) {
-      // The frame may have a next-in-flow. Get the last-in-flow
-      nsIFrame* nextInFlow;
+      // The frame may have a next-in-flow. Get the first-in-flow
+      nsIFrame* prevInFlow;
       do {
-        nextSibling->GetNextInFlow(&nextInFlow);
-        if (nsnull != nextInFlow) {
-          nextSibling = nextInFlow;
+        nextSibling->GetPrevInFlow(&prevInFlow);
+        if (nsnull != prevInFlow) {
+          nextSibling = prevInFlow;
         }
-      } while (nsnull != nextInFlow);
+      } while (nsnull != prevInFlow);
 
       // Did we really get the *right* frame?
       const nsStyleDisplay* display;
diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp
index 1aa5564775c8..3fe2393fe0f9 100644
--- a/layout/html/style/src/nsCSSFrameConstructor.cpp
+++ b/layout/html/style/src/nsCSSFrameConstructor.cpp
@@ -3766,14 +3766,14 @@ FindNextSibling(nsIPresShell* aPresShell,
     aPresShell->GetPrimaryFrameFor(nextContent, &nextSibling);
 
     if (nsnull != nextSibling) {
-      // The frame may have a next-in-flow. Get the last-in-flow
-      nsIFrame* nextInFlow;
+      // The frame may have a next-in-flow. Get the first-in-flow
+      nsIFrame* prevInFlow;
       do {
-        nextSibling->GetNextInFlow(&nextInFlow);
-        if (nsnull != nextInFlow) {
-          nextSibling = nextInFlow;
+        nextSibling->GetPrevInFlow(&prevInFlow);
+        if (nsnull != prevInFlow) {
+          nextSibling = prevInFlow;
         }
-      } while (nsnull != nextInFlow);
+      } while (nsnull != prevInFlow);
 
       // Did we really get the *right* frame?
       const nsStyleDisplay* display;