зеркало из https://github.com/mozilla/gecko-dev.git
Move root element fixups to nsStyleContext so they happen before CalcDifference calls in style reresolution and we reframe less. b=245327 r+sr=bzbarsky
This commit is contained in:
Родитель
f23d4610f3
Коммит
314bd956d2
|
@ -379,6 +379,26 @@ nsStyleContext::ApplyStyleFixups(nsIPresContext* aPresContext)
|
|||
uniqueText->mTextAlign = NS_STYLE_TEXT_ALIGN_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
// CSS2.1 section 9.2.4 specifies fixups for the 'display' property of
|
||||
// the root element. We can't implement them in nsRuleNode because we
|
||||
// don't want to store all display structs that aren't 'block',
|
||||
// 'inline', or 'table' in the style context tree on the off chance
|
||||
// that the root element has its style reresolved later. 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 (!mParent) {
|
||||
if (disp->mDisplay != NS_STYLE_DISPLAY_NONE &&
|
||||
disp->mDisplay != NS_STYLE_DISPLAY_BLOCK &&
|
||||
disp->mDisplay != NS_STYLE_DISPLAY_TABLE) {
|
||||
nsStyleDisplay *mutable_display = NS_STATIC_CAST(nsStyleDisplay*,
|
||||
GetUniqueStyleData(eStyleStruct_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -3497,24 +3497,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
PRBool isBlockFrame = PR_FALSE;
|
||||
nsresult rv;
|
||||
|
||||
// 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;
|
||||
}
|
||||
// The rules from CSS 2.1, section 9.2.4, have already been applied
|
||||
// by the style system, so we can assume that display->mDisplay is
|
||||
// either NONE, BLOCK, or TABLE.
|
||||
|
||||
PRBool docElemIsTable = display->mDisplay == NS_STYLE_DISPLAY_TABLE;
|
||||
|
||||
|
|
|
@ -3497,24 +3497,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
PRBool isBlockFrame = PR_FALSE;
|
||||
nsresult rv;
|
||||
|
||||
// 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;
|
||||
}
|
||||
// The rules from CSS 2.1, section 9.2.4, have already been applied
|
||||
// by the style system, so we can assume that display->mDisplay is
|
||||
// either NONE, BLOCK, or TABLE.
|
||||
|
||||
PRBool docElemIsTable = display->mDisplay == NS_STYLE_DISPLAY_TABLE;
|
||||
|
||||
|
|
|
@ -379,6 +379,26 @@ nsStyleContext::ApplyStyleFixups(nsIPresContext* aPresContext)
|
|||
uniqueText->mTextAlign = NS_STYLE_TEXT_ALIGN_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
// CSS2.1 section 9.2.4 specifies fixups for the 'display' property of
|
||||
// the root element. We can't implement them in nsRuleNode because we
|
||||
// don't want to store all display structs that aren't 'block',
|
||||
// 'inline', or 'table' in the style context tree on the off chance
|
||||
// that the root element has its style reresolved later. 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 (!mParent) {
|
||||
if (disp->mDisplay != NS_STYLE_DISPLAY_NONE &&
|
||||
disp->mDisplay != NS_STYLE_DISPLAY_BLOCK &&
|
||||
disp->mDisplay != NS_STYLE_DISPLAY_TABLE) {
|
||||
nsStyleDisplay *mutable_display = NS_STATIC_CAST(nsStyleDisplay*,
|
||||
GetUniqueStyleData(eStyleStruct_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче