Make sure proper computed values for root element display fixups end up in the style data so that other code looking at the style data doesn't break. b=233480 r+sr=bzbarsky

This commit is contained in:
dbaron%dbaron.org 2004-02-09 06:56:24 +00:00
parent 952d32ee39
commit 4b1b971ac8
2 changed files with 40 additions and 4 deletions

View File

@ -3357,8 +3357,26 @@ 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;
// CSS2.1 section 9.2.4 specifies fixups for the 'display' property
// of the root element. We can't implement them in nsRuleNode because
// it doesn't (and shouldn't, for nodes that can have siblings) know
// the content node. So do them here if needed, by changing the style
// data, so that other code doesn't get confused by looking at the style
// data.
if (display->mDisplay != NS_STYLE_DISPLAY_NONE &&
display->mDisplay != NS_STYLE_DISPLAY_BLOCK &&
display->mDisplay != NS_STYLE_DISPLAY_TABLE) {
nsStyleDisplay *mutable_display = NS_STATIC_CAST(nsStyleDisplay*,
styleContext->GetUniqueStyleData(eStyleStruct_Display));
display = mutable_display;
if (mutable_display->mDisplay == NS_STYLE_DISPLAY_INLINE_TABLE)
mutable_display->mDisplay = NS_STYLE_DISPLAY_TABLE;
else
mutable_display->mDisplay = NS_STYLE_DISPLAY_BLOCK;
}
PRBool docElemIsTable = display->mDisplay == NS_STYLE_DISPLAY_TABLE;
if (docElemIsTable) {
// if the document is a table then just populate it.

View File

@ -3357,8 +3357,26 @@ 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;
// CSS2.1 section 9.2.4 specifies fixups for the 'display' property
// of the root element. We can't implement them in nsRuleNode because
// it doesn't (and shouldn't, for nodes that can have siblings) know
// the content node. So do them here if needed, by changing the style
// data, so that other code doesn't get confused by looking at the style
// data.
if (display->mDisplay != NS_STYLE_DISPLAY_NONE &&
display->mDisplay != NS_STYLE_DISPLAY_BLOCK &&
display->mDisplay != NS_STYLE_DISPLAY_TABLE) {
nsStyleDisplay *mutable_display = NS_STATIC_CAST(nsStyleDisplay*,
styleContext->GetUniqueStyleData(eStyleStruct_Display));
display = mutable_display;
if (mutable_display->mDisplay == NS_STYLE_DISPLAY_INLINE_TABLE)
mutable_display->mDisplay = NS_STYLE_DISPLAY_TABLE;
else
mutable_display->mDisplay = NS_STYLE_DISPLAY_BLOCK;
}
PRBool docElemIsTable = display->mDisplay == NS_STYLE_DISPLAY_TABLE;
if (docElemIsTable) {
// if the document is a table then just populate it.