Make relatively positioned elements matter to their parents only at the original position by switching the order of computing the combined rect and computing relative positioning. b=4519 r=buster@netscape.com sr=waterson@netscape.com

git-svn-id: svn://10.0.0.236/trunk@83437 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu
2000-12-09 04:04:17 +00:00
parent 386f135d01
commit 613ce7eae3
2 changed files with 26 additions and 18 deletions

View File

@@ -18,6 +18,7 @@
* Rights Reserved.
*
* Contributor(s):
* David Baron <dbaron@fas.harvard.edu>
*/
#include "nsBlockReflowContext.h"
#include "nsLineLayout.h"
@@ -737,15 +738,6 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
mMetrics.height);
// Apply CSS relative positioning to update x,y coordinates
const nsStylePosition* stylePos;
mFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&)stylePos);
if (NS_STYLE_POSITION_RELATIVE == stylePos->mPosition) {
x += aComputedOffsets.left;
y += aComputedOffsets.top;
}
// Compute combined-rect in callers coordinate system. The value
// returned in the reflow metrics is relative to the child
// frame.
@@ -754,6 +746,18 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
aCombinedRect.width = mMetrics.mOverflowArea.width;
aCombinedRect.height = mMetrics.mOverflowArea.height;
// Apply CSS relative positioning to update x,y coordinates
// Note that this must be done after changing aCombinedRect
// since relatively positioned elements should act as if they
// were at their original position.
const nsStylePosition* stylePos;
mFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&)stylePos);
if (NS_STYLE_POSITION_RELATIVE == stylePos->mPosition) {
x += aComputedOffsets.left;
y += aComputedOffsets.top;
}
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0);

View File

@@ -18,6 +18,7 @@
* Rights Reserved.
*
* Contributor(s):
* David Baron <dbaron@fas.harvard.edu>
*/
#include "nsBlockReflowContext.h"
#include "nsLineLayout.h"
@@ -737,15 +738,6 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
mMetrics.height);
// Apply CSS relative positioning to update x,y coordinates
const nsStylePosition* stylePos;
mFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&)stylePos);
if (NS_STYLE_POSITION_RELATIVE == stylePos->mPosition) {
x += aComputedOffsets.left;
y += aComputedOffsets.top;
}
// Compute combined-rect in callers coordinate system. The value
// returned in the reflow metrics is relative to the child
// frame.
@@ -754,6 +746,18 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
aCombinedRect.width = mMetrics.mOverflowArea.width;
aCombinedRect.height = mMetrics.mOverflowArea.height;
// Apply CSS relative positioning to update x,y coordinates
// Note that this must be done after changing aCombinedRect
// since relatively positioned elements should act as if they
// were at their original position.
const nsStylePosition* stylePos;
mFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&)stylePos);
if (NS_STYLE_POSITION_RELATIVE == stylePos->mPosition) {
x += aComputedOffsets.left;
y += aComputedOffsets.top;
}
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0);