From bfddc50483298c5628d7c109dfa70458a760386d Mon Sep 17 00:00:00 2001 From: troy Date: Thu, 7 May 1998 05:25:08 +0000 Subject: [PATCH] Work on getting floaters working again git-svn-id: svn://10.0.0.236/trunk@1219 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 19 +++++++++---------- mozilla/layout/generic/nsBlockReflowState.cpp | 19 +++++++++---------- mozilla/layout/generic/nsBlockReflowState.h | 19 +++++++++---------- mozilla/layout/generic/nsLineLayout.cpp | 4 ++-- mozilla/layout/html/base/src/nsBlockFrame.cpp | 19 +++++++++---------- .../html/base/src/nsBlockReflowState.cpp | 19 +++++++++---------- .../layout/html/base/src/nsBlockReflowState.h | 19 +++++++++---------- mozilla/layout/html/base/src/nsLineLayout.cpp | 4 ++-- 8 files changed, 58 insertions(+), 64 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 9abeb08a3d0..15bb73ed01c 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, { // If the floater is the left-most non-zero size child frame then insert // it before the current line; otherwise add it to the below-current-line - // todo list and we'll handle it when we flush out the line + // todo list, and we'll handle it when we flush out the line if (IsLeftMostChild(aPlaceholder)) { nsISpaceManager* sm = aState.mSpaceManager; // Get the type of floater - nsIStyleContextPtr styleContext; - aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); - nsStyleDisplay* floaterDisplay = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* floaterDisplay; + aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay); // Commit some space in the space manager and adjust our current // band of available space. @@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, } } +// XXX It's unclear what coordinate space aY is in. Is it relative to the +// upper-left origin of the containing block, or relative to aState.mY? void nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nscoord aY) @@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, GetAvailableSpace(aState, aY); // Get the type of floater - nsIStyleContextPtr styleContext; - floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); - nsStyleDisplay* sd = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* sd; + floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd); floater->GetRect(region); - region.y = bd->availSpace.y; + // XXX GetAvailableSpace() is translating availSpace by aState.mY... + region.y = bd->availSpace.y - aState.mY; if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { region.x = bd->availSpace.x; } else { diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 9abeb08a3d0..15bb73ed01c 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, { // If the floater is the left-most non-zero size child frame then insert // it before the current line; otherwise add it to the below-current-line - // todo list and we'll handle it when we flush out the line + // todo list, and we'll handle it when we flush out the line if (IsLeftMostChild(aPlaceholder)) { nsISpaceManager* sm = aState.mSpaceManager; // Get the type of floater - nsIStyleContextPtr styleContext; - aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); - nsStyleDisplay* floaterDisplay = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* floaterDisplay; + aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay); // Commit some space in the space manager and adjust our current // band of available space. @@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, } } +// XXX It's unclear what coordinate space aY is in. Is it relative to the +// upper-left origin of the containing block, or relative to aState.mY? void nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nscoord aY) @@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, GetAvailableSpace(aState, aY); // Get the type of floater - nsIStyleContextPtr styleContext; - floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); - nsStyleDisplay* sd = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* sd; + floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd); floater->GetRect(region); - region.y = bd->availSpace.y; + // XXX GetAvailableSpace() is translating availSpace by aState.mY... + region.y = bd->availSpace.y - aState.mY; if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { region.x = bd->availSpace.x; } else { diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 9abeb08a3d0..15bb73ed01c 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, { // If the floater is the left-most non-zero size child frame then insert // it before the current line; otherwise add it to the below-current-line - // todo list and we'll handle it when we flush out the line + // todo list, and we'll handle it when we flush out the line if (IsLeftMostChild(aPlaceholder)) { nsISpaceManager* sm = aState.mSpaceManager; // Get the type of floater - nsIStyleContextPtr styleContext; - aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); - nsStyleDisplay* floaterDisplay = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* floaterDisplay; + aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay); // Commit some space in the space manager and adjust our current // band of available space. @@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, } } +// XXX It's unclear what coordinate space aY is in. Is it relative to the +// upper-left origin of the containing block, or relative to aState.mY? void nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nscoord aY) @@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, GetAvailableSpace(aState, aY); // Get the type of floater - nsIStyleContextPtr styleContext; - floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); - nsStyleDisplay* sd = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* sd; + floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd); floater->GetRect(region); - region.y = bd->availSpace.y; + // XXX GetAvailableSpace() is translating availSpace by aState.mY... + region.y = bd->availSpace.y - aState.mY; if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { region.x = bd->availSpace.x; } else { diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 65d5361cd0f..ebc7b86ce64 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -414,11 +414,11 @@ nsLineLayout::ReflowChild() mReflowResult = NS_LINE_LAYOUT_REFLOW_RESULT_NOT_AWARE; nscoord dx = mReflowData.mX + kidSpacing->mMargin.left; if (isBlock) { - mSpaceManager->Translate(dx, 0); + mSpaceManager->Translate(dx, mY); rv = mBlock->ReflowBlockChild(mKidFrame, mPresContext, mSpaceManager, kidAvailSize, kidRect, kidMaxElementSize, kidReflowStatus); - mSpaceManager->Translate(-dx, 0); + mSpaceManager->Translate(-dx, -mY); kidRect.x = dx; kidRect.y = mY; kidSize.width = kidRect.width; diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 9abeb08a3d0..15bb73ed01c 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, { // If the floater is the left-most non-zero size child frame then insert // it before the current line; otherwise add it to the below-current-line - // todo list and we'll handle it when we flush out the line + // todo list, and we'll handle it when we flush out the line if (IsLeftMostChild(aPlaceholder)) { nsISpaceManager* sm = aState.mSpaceManager; // Get the type of floater - nsIStyleContextPtr styleContext; - aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); - nsStyleDisplay* floaterDisplay = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* floaterDisplay; + aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay); // Commit some space in the space manager and adjust our current // band of available space. @@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, } } +// XXX It's unclear what coordinate space aY is in. Is it relative to the +// upper-left origin of the containing block, or relative to aState.mY? void nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nscoord aY) @@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, GetAvailableSpace(aState, aY); // Get the type of floater - nsIStyleContextPtr styleContext; - floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); - nsStyleDisplay* sd = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* sd; + floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd); floater->GetRect(region); - region.y = bd->availSpace.y; + // XXX GetAvailableSpace() is translating availSpace by aState.mY... + region.y = bd->availSpace.y - aState.mY; if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { region.x = bd->availSpace.x; } else { diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 9abeb08a3d0..15bb73ed01c 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, { // If the floater is the left-most non-zero size child frame then insert // it before the current line; otherwise add it to the below-current-line - // todo list and we'll handle it when we flush out the line + // todo list, and we'll handle it when we flush out the line if (IsLeftMostChild(aPlaceholder)) { nsISpaceManager* sm = aState.mSpaceManager; // Get the type of floater - nsIStyleContextPtr styleContext; - aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); - nsStyleDisplay* floaterDisplay = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* floaterDisplay; + aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay); // Commit some space in the space manager and adjust our current // band of available space. @@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, } } +// XXX It's unclear what coordinate space aY is in. Is it relative to the +// upper-left origin of the containing block, or relative to aState.mY? void nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nscoord aY) @@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, GetAvailableSpace(aState, aY); // Get the type of floater - nsIStyleContextPtr styleContext; - floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); - nsStyleDisplay* sd = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* sd; + floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd); floater->GetRect(region); - region.y = bd->availSpace.y; + // XXX GetAvailableSpace() is translating availSpace by aState.mY... + region.y = bd->availSpace.y - aState.mY; if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { region.x = bd->availSpace.x; } else { diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 9abeb08a3d0..15bb73ed01c 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -1386,15 +1386,13 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, { // If the floater is the left-most non-zero size child frame then insert // it before the current line; otherwise add it to the below-current-line - // todo list and we'll handle it when we flush out the line + // todo list, and we'll handle it when we flush out the line if (IsLeftMostChild(aPlaceholder)) { nsISpaceManager* sm = aState.mSpaceManager; // Get the type of floater - nsIStyleContextPtr styleContext; - aFloater->GetStyleContext(aPresContext, styleContext.AssignRef()); - nsStyleDisplay* floaterDisplay = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* floaterDisplay; + aFloater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)floaterDisplay); // Commit some space in the space manager and adjust our current // band of available space. @@ -1432,6 +1430,8 @@ nsBlockFrame::PlaceFloater(nsIPresContext* aPresContext, } } +// XXX It's unclear what coordinate space aY is in. Is it relative to the +// upper-left origin of the containing block, or relative to aState.mY? void nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, nscoord aY) @@ -1452,13 +1452,12 @@ nsBlockFrame::PlaceBelowCurrentLineFloaters(nsBlockReflowState& aState, GetAvailableSpace(aState, aY); // Get the type of floater - nsIStyleContextPtr styleContext; - floater->GetStyleContext(aState.mPresContext, styleContext.AssignRef()); - nsStyleDisplay* sd = (nsStyleDisplay*) - styleContext->GetData(kStyleDisplaySID); + nsStyleDisplay* sd; + floater->GetStyleData(kStyleDisplaySID, (nsStyleStruct*&)sd); floater->GetRect(region); - region.y = bd->availSpace.y; + // XXX GetAvailableSpace() is translating availSpace by aState.mY... + region.y = bd->availSpace.y - aState.mY; if (NS_STYLE_FLOAT_LEFT == sd->mFloats) { region.x = bd->availSpace.x; } else { diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 65d5361cd0f..ebc7b86ce64 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -414,11 +414,11 @@ nsLineLayout::ReflowChild() mReflowResult = NS_LINE_LAYOUT_REFLOW_RESULT_NOT_AWARE; nscoord dx = mReflowData.mX + kidSpacing->mMargin.left; if (isBlock) { - mSpaceManager->Translate(dx, 0); + mSpaceManager->Translate(dx, mY); rv = mBlock->ReflowBlockChild(mKidFrame, mPresContext, mSpaceManager, kidAvailSize, kidRect, kidMaxElementSize, kidReflowStatus); - mSpaceManager->Translate(-dx, 0); + mSpaceManager->Translate(-dx, -mY); kidRect.x = dx; kidRect.y = mY; kidSize.width = kidRect.width;