Fix two problems with display fixups. b=231787 r+sr=bzbarsky

This commit is contained in:
dbaron%dbaron.org 2004-01-22 21:34:04 +00:00
Родитель 013afa2b28
Коммит f3af1a7aef
4 изменённых файлов: 36 добавлений и 34 удалений

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

@ -2585,19 +2585,6 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
// style context.
aContext->SetStyle(eStyleStruct_Display, display);
else {
// We were fully specified and can therefore be cached right on the rule node.
if (!aHighestNode->mStyleData.mResetData)
aHighestNode->mStyleData.mResetData = new (mPresContext) nsResetStyleData;
aHighestNode->mStyleData.mResetData->mDisplayData = display;
// Propagate the bit down.
PropagateDependentBit(NS_STYLE_INHERIT_BIT(Display), aHighestNode);
}
// CSS2 specified fixups:
if (generatedContent) {
// According to CSS2 section 12.1, :before and :after
@ -2613,6 +2600,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
PRUint8 displayValue = display->mDisplay;
if (displayValue != NS_STYLE_DISPLAY_NONE &&
displayValue != NS_STYLE_DISPLAY_INLINE) {
inherited = PR_TRUE;
if (parentDisplay->IsBlockLevel()) {
// If the subject of the selector is a block-level element,
// allowed values are 'none', 'inline', 'block', and 'marker'.
@ -2629,7 +2617,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mDisplay = NS_STYLE_DISPLAY_INLINE;
}
}
}
}
else if (display->mDisplay != NS_STYLE_DISPLAY_NONE) {
// CSS2 9.7 specifies display type corrections dealing with 'float'
// and 'position'. Since generated content can't be floated or
@ -2662,6 +2650,19 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
// style context.
aContext->SetStyle(eStyleStruct_Display, display);
else {
// We were fully specified and can therefore be cached right on the rule node.
if (!aHighestNode->mStyleData.mResetData)
aHighestNode->mStyleData.mResetData = new (mPresContext) nsResetStyleData;
aHighestNode->mStyleData.mResetData->mDisplayData = display;
// Propagate the bit down.
PropagateDependentBit(NS_STYLE_INHERIT_BIT(Display), aHighestNode);
}
return display;
}

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

@ -3311,9 +3311,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
}
}
PRBool docElemIsTable = IsTableRelated(display->mDisplay, PR_FALSE);
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
PRBool isScrollable = IsScrollable(aPresContext, display);
@ -3348,6 +3345,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
PRBool isBlockFrame = PR_FALSE;
nsresult rv;
PRBool docElemIsTable = display->mDisplay == NS_STYLE_DISPLAY_TABLE ||
display->mDisplay == NS_STYLE_DISPLAY_INLINE_TABLE;
if (docElemIsTable) {
// if the document is a table then just populate it.
rv = ConstructDocElementTableFrame(aPresShell, aPresContext, aDocElement,

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

@ -3311,9 +3311,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
}
}
PRBool docElemIsTable = IsTableRelated(display->mDisplay, PR_FALSE);
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
PRBool isScrollable = IsScrollable(aPresContext, display);
@ -3348,6 +3345,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
PRBool isBlockFrame = PR_FALSE;
nsresult rv;
PRBool docElemIsTable = display->mDisplay == NS_STYLE_DISPLAY_TABLE ||
display->mDisplay == NS_STYLE_DISPLAY_INLINE_TABLE;
if (docElemIsTable) {
// if the document is a table then just populate it.
rv = ConstructDocElementTableFrame(aPresShell, aPresContext, aDocElement,

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

@ -2585,19 +2585,6 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
// style context.
aContext->SetStyle(eStyleStruct_Display, display);
else {
// We were fully specified and can therefore be cached right on the rule node.
if (!aHighestNode->mStyleData.mResetData)
aHighestNode->mStyleData.mResetData = new (mPresContext) nsResetStyleData;
aHighestNode->mStyleData.mResetData->mDisplayData = display;
// Propagate the bit down.
PropagateDependentBit(NS_STYLE_INHERIT_BIT(Display), aHighestNode);
}
// CSS2 specified fixups:
if (generatedContent) {
// According to CSS2 section 12.1, :before and :after
@ -2613,6 +2600,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
PRUint8 displayValue = display->mDisplay;
if (displayValue != NS_STYLE_DISPLAY_NONE &&
displayValue != NS_STYLE_DISPLAY_INLINE) {
inherited = PR_TRUE;
if (parentDisplay->IsBlockLevel()) {
// If the subject of the selector is a block-level element,
// allowed values are 'none', 'inline', 'block', and 'marker'.
@ -2629,7 +2617,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
display->mDisplay = NS_STYLE_DISPLAY_INLINE;
}
}
}
}
else if (display->mDisplay != NS_STYLE_DISPLAY_NONE) {
// CSS2 9.7 specifies display type corrections dealing with 'float'
// and 'position'. Since generated content can't be floated or
@ -2662,6 +2650,19 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
}
}
if (inherited)
// We inherited, and therefore can't be cached in the rule node. We have to be put right on the
// style context.
aContext->SetStyle(eStyleStruct_Display, display);
else {
// We were fully specified and can therefore be cached right on the rule node.
if (!aHighestNode->mStyleData.mResetData)
aHighestNode->mStyleData.mResetData = new (mPresContext) nsResetStyleData;
aHighestNode->mStyleData.mResetData->mDisplayData = display;
// Propagate the bit down.
PropagateDependentBit(NS_STYLE_INHERIT_BIT(Display), aHighestNode);
}
return display;
}