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

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

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

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

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

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

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