Turn DetermineFrameType into InitFrameType. b=225911 r+sr=bzbarsky

This commit is contained in:
dbaron%dbaron.org 2003-11-17 00:35:17 +00:00
Родитель 2ca83605da
Коммит e852c24b41
4 изменённых файлов: 30 добавлений и 44 удалений

Просмотреть файл

@ -362,7 +362,7 @@ struct nsHTMLReflowState {
static PRBool UseComputedHeight();
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame);
void InitFrameType();
void ComputeContainingBlockRectangle(nsIPresContext* aPresContext,
const nsHTMLReflowState* aContainingBlockRS,
@ -416,9 +416,6 @@ protected:
const nsStyleCoord& aCoord,
nscoord& aResult);
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame,
const nsStyleDisplay* aDisplay);
// Computes margin values from the specified margin style information, and
// fills in the mComputedMargin member
void ComputeMargin(nscoord aContainingBlockWidth,

Просмотреть файл

@ -333,7 +333,7 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext,
mStylePadding = frame->GetStylePadding();
mStyleText = frame->GetStyleText();
mFrameType = DetermineFrameType(frame, mStyleDisplay);
InitFrameType();
InitCBReflowState();
InitConstraints(aPresContext, aContainingBlockWidth, aContainingBlockHeight, aBorder, aPadding);
}
@ -375,34 +375,29 @@ nsHTMLReflowState::GetContainingBlockContentWidth(const nsHTMLReflowState* aPare
return rs->mComputedWidth;
}
nsCSSFrameType
nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame)
{
const nsStyleDisplay* styleDisplay = aFrame->GetStyleDisplay();
return DetermineFrameType(aFrame, styleDisplay);
}
nsCSSFrameType
nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame,
const nsStyleDisplay* aDisplay)
void
nsHTMLReflowState::InitFrameType()
{
const nsStyleDisplay *disp = mStyleDisplay;
nsCSSFrameType frameType;
// Section 9.7 of the CSS2 spec indicates that absolute position
// takes precedence over float which takes precedence over display.
// Make sure the frame was actually moved out of the flow, and don't
// just assume what the style says
if (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (aDisplay->IsAbsolutelyPositioned()) {
// XXXldb nsRuleNode::ComputeDisplayData should take care of this, right?
if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (disp->IsAbsolutelyPositioned()) {
frameType = NS_CSS_FRAME_TYPE_ABSOLUTE;
}
else if (NS_STYLE_FLOAT_NONE != aDisplay->mFloats) {
else {
NS_ASSERTION(NS_STYLE_FLOAT_NONE != disp->mFloats,
"unknown out of flow frame type");
frameType = NS_CSS_FRAME_TYPE_FLOATING;
}
// XXXldb UMR in this case (else, else) we don't initialize frameType
}
else {
switch (aDisplay->mDisplay) {
switch (disp->mDisplay) {
case NS_STYLE_DISPLAY_BLOCK:
case NS_STYLE_DISPLAY_LIST_ITEM:
case NS_STYLE_DISPLAY_TABLE:
@ -443,11 +438,11 @@ nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame,
}
// See if the frame is replaced
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) {
if (frame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) {
frameType = NS_FRAME_REPLACED(frameType);
}
return frameType;
mFrameType = frameType;
}
void
@ -2149,6 +2144,7 @@ nsHTMLReflowState::CalculateBlockSideMargins(nscoord aAvailWidth,
nscoord availMarginSpace = aAvailWidth - aComputedWidth -
mComputedBorderPadding.left - mComputedBorderPadding.right;
// XXXldb Why are tables special?
if ((mStyleDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE) ||
(mStyleDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_CAPTION)) {
// Special rules for tables. In general, tables will stick to the

Просмотреть файл

@ -362,7 +362,7 @@ struct nsHTMLReflowState {
static PRBool UseComputedHeight();
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame);
void InitFrameType();
void ComputeContainingBlockRectangle(nsIPresContext* aPresContext,
const nsHTMLReflowState* aContainingBlockRS,
@ -416,9 +416,6 @@ protected:
const nsStyleCoord& aCoord,
nscoord& aResult);
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame,
const nsStyleDisplay* aDisplay);
// Computes margin values from the specified margin style information, and
// fills in the mComputedMargin member
void ComputeMargin(nscoord aContainingBlockWidth,

Просмотреть файл

@ -333,7 +333,7 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext,
mStylePadding = frame->GetStylePadding();
mStyleText = frame->GetStyleText();
mFrameType = DetermineFrameType(frame, mStyleDisplay);
InitFrameType();
InitCBReflowState();
InitConstraints(aPresContext, aContainingBlockWidth, aContainingBlockHeight, aBorder, aPadding);
}
@ -375,34 +375,29 @@ nsHTMLReflowState::GetContainingBlockContentWidth(const nsHTMLReflowState* aPare
return rs->mComputedWidth;
}
nsCSSFrameType
nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame)
{
const nsStyleDisplay* styleDisplay = aFrame->GetStyleDisplay();
return DetermineFrameType(aFrame, styleDisplay);
}
nsCSSFrameType
nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame,
const nsStyleDisplay* aDisplay)
void
nsHTMLReflowState::InitFrameType()
{
const nsStyleDisplay *disp = mStyleDisplay;
nsCSSFrameType frameType;
// Section 9.7 of the CSS2 spec indicates that absolute position
// takes precedence over float which takes precedence over display.
// Make sure the frame was actually moved out of the flow, and don't
// just assume what the style says
if (aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (aDisplay->IsAbsolutelyPositioned()) {
// XXXldb nsRuleNode::ComputeDisplayData should take care of this, right?
if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
if (disp->IsAbsolutelyPositioned()) {
frameType = NS_CSS_FRAME_TYPE_ABSOLUTE;
}
else if (NS_STYLE_FLOAT_NONE != aDisplay->mFloats) {
else {
NS_ASSERTION(NS_STYLE_FLOAT_NONE != disp->mFloats,
"unknown out of flow frame type");
frameType = NS_CSS_FRAME_TYPE_FLOATING;
}
// XXXldb UMR in this case (else, else) we don't initialize frameType
}
else {
switch (aDisplay->mDisplay) {
switch (disp->mDisplay) {
case NS_STYLE_DISPLAY_BLOCK:
case NS_STYLE_DISPLAY_LIST_ITEM:
case NS_STYLE_DISPLAY_TABLE:
@ -443,11 +438,11 @@ nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame,
}
// See if the frame is replaced
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) {
if (frame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) {
frameType = NS_FRAME_REPLACED(frameType);
}
return frameType;
mFrameType = frameType;
}
void
@ -2149,6 +2144,7 @@ nsHTMLReflowState::CalculateBlockSideMargins(nscoord aAvailWidth,
nscoord availMarginSpace = aAvailWidth - aComputedWidth -
mComputedBorderPadding.left - mComputedBorderPadding.right;
// XXXldb Why are tables special?
if ((mStyleDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE) ||
(mStyleDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_CAPTION)) {
// Special rules for tables. In general, tables will stick to the