Remove pointless null checks that are extremely unlikely to fail. (Bug 156716) r+sr=bzbarsky

This commit is contained in:
L. David Baron 2008-07-26 09:14:48 -07:00
Родитель b8715023f7
Коммит 907424839d
1 изменённых файлов: 30 добавлений и 85 удалений

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

@ -651,13 +651,6 @@ nsStyleSet::ResolveStyleFor(nsIContent* aContent,
"content must be element");
if (aContent && presContext) {
if (mRuleProcessors[eAgentSheet] ||
mRuleProcessors[ePresHintSheet] ||
mRuleProcessors[eUserSheet] ||
mRuleProcessors[eHTMLPresHintSheet] ||
mRuleProcessors[eDocSheet] ||
mRuleProcessors[eStyleAttrSheet] ||
mRuleProcessors[eOverrideSheet]) {
ElementRuleProcessorData data(presContext, aContent, mRuleWalker);
FileRules(EnumRulesMatching, &data);
result = GetContext(presContext, aParentContext, nsnull).get();
@ -665,7 +658,6 @@ nsStyleSet::ResolveStyleFor(nsIContent* aContent,
// Now reset the walker back to the root of the tree.
mRuleWalker->Reset();
}
}
return result;
}
@ -678,14 +670,6 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext, const nsCOMArra
nsPresContext *presContext = PresContext();
if (presContext) {
if (mRuleProcessors[eAgentSheet] ||
mRuleProcessors[ePresHintSheet] ||
mRuleProcessors[eUserSheet] ||
mRuleProcessors[eHTMLPresHintSheet] ||
mRuleProcessors[eDocSheet] ||
mRuleProcessors[eStyleAttrSheet] ||
mRuleProcessors[eOverrideSheet]) {
mRuleWalker->SetLevel(eDocSheet, PR_FALSE);
for (PRInt32 i = 0; i < rules.Count(); i++) {
mRuleWalker->Forward(rules.ObjectAt(i));
@ -695,7 +679,6 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext, const nsCOMArra
// Now reset the walker back to the root of the tree.
mRuleWalker->Reset();
}
}
return result;
}
@ -706,18 +689,10 @@ nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
nsPresContext *presContext = PresContext();
if (presContext) {
if (mRuleProcessors[eAgentSheet] ||
mRuleProcessors[ePresHintSheet] ||
mRuleProcessors[eUserSheet] ||
mRuleProcessors[eHTMLPresHintSheet] ||
mRuleProcessors[eDocSheet] ||
mRuleProcessors[eStyleAttrSheet] ||
mRuleProcessors[eOverrideSheet]) {
result = GetContext(presContext, aParentContext,
nsCSSAnonBoxes::mozNonElement).get();
NS_ASSERTION(mRuleWalker->AtRoot(), "rule walker must be at root");
}
}
return result;
}
@ -756,13 +731,6 @@ nsStyleSet::ResolvePseudoStyleFor(nsIContent* aParentContent,
"aPseudoTag must be pseudo-element or anonymous box");
if (aPseudoTag && presContext) {
if (mRuleProcessors[eAgentSheet] ||
mRuleProcessors[ePresHintSheet] ||
mRuleProcessors[eUserSheet] ||
mRuleProcessors[eHTMLPresHintSheet] ||
mRuleProcessors[eDocSheet] ||
mRuleProcessors[eStyleAttrSheet] ||
mRuleProcessors[eOverrideSheet]) {
PseudoRuleProcessorData data(presContext, aParentContent, aPseudoTag,
aComparator, mRuleWalker);
FileRules(EnumPseudoRulesMatching, &data);
@ -772,7 +740,6 @@ nsStyleSet::ResolvePseudoStyleFor(nsIContent* aParentContent,
// Now reset the walker back to the root of the tree.
mRuleWalker->Reset();
}
}
return result;
}
@ -801,13 +768,6 @@ nsStyleSet::ProbePseudoStyleFor(nsIContent* aParentContent,
"aPseudoTag must be pseudo-element or anonymous box");
if (aPseudoTag && presContext) {
if (mRuleProcessors[eAgentSheet] ||
mRuleProcessors[ePresHintSheet] ||
mRuleProcessors[eUserSheet] ||
mRuleProcessors[eHTMLPresHintSheet] ||
mRuleProcessors[eDocSheet] ||
mRuleProcessors[eStyleAttrSheet] ||
mRuleProcessors[eOverrideSheet]) {
PseudoRuleProcessorData data(presContext, aParentContent, aPseudoTag,
nsnull, mRuleWalker);
FileRules(EnumPseudoRulesMatching, &data);
@ -818,7 +778,6 @@ nsStyleSet::ProbePseudoStyleFor(nsIContent* aParentContent,
// Now reset the walker back to the root of the tree.
mRuleWalker->Reset();
}
}
// For :before and :after pseudo-elements, having display: none or no
// 'content' property is equivalent to not having the pseudo-element
@ -954,14 +913,7 @@ nsStyleSet::HasStateDependentStyle(nsPresContext* aPresContext,
{
nsReStyleHint result = nsReStyleHint(0);
if (aContent->IsNodeOfType(nsINode::eELEMENT) &&
(mRuleProcessors[eAgentSheet] ||
mRuleProcessors[ePresHintSheet] ||
mRuleProcessors[eUserSheet] ||
mRuleProcessors[eHTMLPresHintSheet] ||
mRuleProcessors[eDocSheet] ||
mRuleProcessors[eStyleAttrSheet] ||
mRuleProcessors[eOverrideSheet])) {
if (aContent->IsNodeOfType(nsINode::eELEMENT)) {
StatefulData data(aPresContext, aContent, aStateMask);
WalkRuleProcessors(SheetHasStatefulStyle, &data);
result = data.mHint;
@ -1001,14 +953,7 @@ nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
{
nsReStyleHint result = nsReStyleHint(0);
if (aContent->IsNodeOfType(nsINode::eELEMENT) &&
(mRuleProcessors[eAgentSheet] ||
mRuleProcessors[ePresHintSheet] ||
mRuleProcessors[eUserSheet] ||
mRuleProcessors[eHTMLPresHintSheet] ||
mRuleProcessors[eDocSheet] ||
mRuleProcessors[eStyleAttrSheet] ||
mRuleProcessors[eOverrideSheet])) {
if (aContent->IsNodeOfType(nsINode::eELEMENT)) {
AttributeData data(aPresContext, aContent, aAttribute, aModType,
aStateMask);
WalkRuleProcessors(SheetHasAttributeStyle, &data);