From cc452efb5b2165ca22f4dec469cf2fcd7da3f911 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Sun, 26 May 2002 17:07:07 +0000 Subject: [PATCH] Fix FindPrimaryFrameFor regression: when previous sibling is out-of-flow, start search from previous sibling's placeholder. b=145224 sr=waterson r=bzbarsky git-svn-id: svn://10.0.0.236/trunk@122188 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 17 ++++++++++++++--- .../html/style/src/nsCSSFrameConstructor.cpp | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 48e5d83105a..cbef1342416 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -11790,9 +11790,20 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, #ifdef NOISY_FINDFRAME printf(" hint frame is %p\n", aHint->mPrimaryFrameForPrevSibling); #endif - kidFrame = aHint->mPrimaryFrameForPrevSibling; // start with the primary frame for aContent's previous sibling - if (kidFrame) { // if we have this - kidFrame->GetNextSibling(&kidFrame); // then use the next sibling frame as our starting point + // start with the primary frame for aContent's previous sibling + kidFrame = aHint->mPrimaryFrameForPrevSibling; + // But if it's out of flow, start from its placeholder. + if (kidFrame) { + nsFrameState kidState; + kidFrame->GetFrameState(&kidState); + if (kidState & NS_FRAME_OUT_OF_FLOW) { + aFrameManager->GetPlaceholderFrameFor(kidFrame, &kidFrame); + } + } + + if (kidFrame) { + // then use the next sibling frame as our starting point + kidFrame->GetNextSibling(&kidFrame); if (!kidFrame) { // the hint frame had no next frame. try the next-in-flow fo the parent of the hint frame // if there is one diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 48e5d83105a..cbef1342416 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -11790,9 +11790,20 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, #ifdef NOISY_FINDFRAME printf(" hint frame is %p\n", aHint->mPrimaryFrameForPrevSibling); #endif - kidFrame = aHint->mPrimaryFrameForPrevSibling; // start with the primary frame for aContent's previous sibling - if (kidFrame) { // if we have this - kidFrame->GetNextSibling(&kidFrame); // then use the next sibling frame as our starting point + // start with the primary frame for aContent's previous sibling + kidFrame = aHint->mPrimaryFrameForPrevSibling; + // But if it's out of flow, start from its placeholder. + if (kidFrame) { + nsFrameState kidState; + kidFrame->GetFrameState(&kidState); + if (kidState & NS_FRAME_OUT_OF_FLOW) { + aFrameManager->GetPlaceholderFrameFor(kidFrame, &kidFrame); + } + } + + if (kidFrame) { + // then use the next sibling frame as our starting point + kidFrame->GetNextSibling(&kidFrame); if (!kidFrame) { // the hint frame had no next frame. try the next-in-flow fo the parent of the hint frame // if there is one