Testing performance impact of backout of part of patch from bug 115289.

See bug 123947 for details.
This commit is contained in:
bzbarsky%mit.edu 2002-02-09 16:10:51 +00:00
Родитель 89c06838f1
Коммит 7fbffdf125
17 изменённых файлов: 73 добавлений и 68 удалений

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

@ -1071,8 +1071,8 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData)
sheet->GetTitle(title);
if (!title.IsEmpty()) { // if sheet has title
PRBool disabled = (aData.IsEmpty() ||
!title.Equals(aData,
nsCaseInsensitiveStringComparator()));
Compare(title, aData,
nsCaseInsensitiveStringComparator()) != 0);
SetStyleSheetDisabledState(sheet, disabled);
}
}

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

@ -839,23 +839,23 @@ nsGenericElement::InternalIsSupported(const nsAReadableString& aFeature,
*aReturn = PR_FALSE;
nsAutoString feature(aFeature);
if (feature.Equals(NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("HTML"), nsCaseInsensitiveStringComparator())) {
if (!Compare(feature, NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("HTML"), nsCaseInsensitiveStringComparator())) {
if (aVersion.IsEmpty() ||
aVersion.Equals(NS_LITERAL_STRING("1.0")) ||
aVersion.Equals(NS_LITERAL_STRING("2.0"))) {
*aReturn = PR_TRUE;
}
} else if (feature.Equals(NS_LITERAL_STRING("Views"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("StyleSheets"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("CSS"), nsCaseInsensitiveStringComparator()) ||
// feature.Equals(NS_LITERAL_STRING("CSS2"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("Events"), nsCaseInsensitiveStringComparator()) ||
// feature.Equals(NS_LITERAL_STRING("UIEvents"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("MouseEvents"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("MouseScrollEvents"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("HTMLEvents"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(NS_LITERAL_STRING("Range"), nsCaseInsensitiveStringComparator())) {
} else if (!Compare(feature, NS_LITERAL_STRING("Views"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("StyleSheets"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("CSS"), nsCaseInsensitiveStringComparator()) ||
// !Compare(feature, NS_LITERAL_STRING("CSS2"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("Events"), nsCaseInsensitiveStringComparator()) ||
// !Compare(feature, NS_LITERAL_STRING("UIEvents"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("MouseEvents"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("MouseScrollEvents"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("HTMLEvents"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("Range"), nsCaseInsensitiveStringComparator())) {
if (aVersion.IsEmpty() || aVersion.Equals(NS_LITERAL_STRING("2.0"))) {
*aReturn = PR_TRUE;
}

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

@ -172,8 +172,9 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const
}
}
else if (nsnull != aOther.mValue.mString) {
return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
return 0 == Compare(nsDependentString(mValue.mString),
nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
}
}
else if (eHTMLUnit_ISupports == mUnit) {

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

@ -398,8 +398,8 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::suppress) {
if (!aValue.Equals(NS_LITERAL_STRING("true"),
nsCaseInsensitiveStringComparator())) {
if (Compare(aValue,NS_LITERAL_STRING("true"),
nsCaseInsensitiveStringComparator())) {
aResult.SetEmptyValue(); // XXX? shouldn't just leave "true"
return NS_CONTENT_ATTR_HAS_VALUE;
}

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

@ -212,7 +212,7 @@ nsHTMLButtonElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAutoString value(aValue);
if (aName == nsHTMLAtoms::disabled &&
value.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) {
!Compare(value, NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) {
return UnsetAttr(aNameSpaceID, aName, aNotify);
}

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

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

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

@ -638,8 +638,9 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
}
}
if (mLoader->mNavQuirkMode ||
contentType.Equals(NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) ||
Compare(contentType,
NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) == 0 ||
contentType.IsEmpty()) {
/*
* First determine the charset (if one is indicated)

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

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

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

@ -201,8 +201,9 @@ PRBool AtomKey_base::Equals(const nsHashKey* aKey) const
const PRUnichar *theirStr = nsnull;
theirAtom->GetUnicode(&theirStr);
return nsDependentString(myStr).Equals(nsDependentString(theirStr),
nsCaseInsensitiveStringComparator());
return Compare(nsDependentString(myStr),
nsDependentString(theirStr),
nsCaseInsensitiveStringComparator()) == 0;
}
@ -3351,8 +3352,9 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
}
}
else {
if (nsDependentString(value).Equals(nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
if (!Compare(nsDependentString(value),
nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
return PR_TRUE;
}
}
@ -3646,9 +3648,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
break;
}
if (isCaseSensitive)
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3660,9 +3662,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3674,9 +3676,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3716,8 +3718,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
const PRUnichar* id2Str;
IDList->mAtom->GetUnicode(&id2Str);
nsDependentString id2(id2Str);
if (localTrue !=
id1.Equals(id2, nsCaseInsensitiveStringComparator())) {
if (localTrue ==
(Compare(id1, id2, nsCaseInsensitiveStringComparator()) != 0)) {
result = PR_FALSE;
break;
}

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

@ -1447,7 +1447,7 @@ HTMLAttributesImpl::HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const
const PRUnichar* class2Buf;
classList->mAtom->GetUnicode(&class2Buf);
nsDependentString class2(class2Buf);
if (class1.Equals(class2, nsCaseInsensitiveStringComparator()))
if (Compare(class1, class2, nsCaseInsensitiveStringComparator()) == 0)
return NS_OK;
classList = classList->mNext;
} while (classList);

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

@ -172,8 +172,9 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const
}
}
else if (nsnull != aOther.mValue.mString) {
return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
return 0 == Compare(nsDependentString(mValue.mString),
nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
}
}
else if (eHTMLUnit_ISupports == mUnit) {

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

@ -852,20 +852,20 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
mEventName = getter_AddRefs(NS_NewAtom(event));
if (aPhase) {
const nsDependentString phase(aPhase);
if (phase.Equals(NS_LITERAL_STRING("capturing")))
if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("capturing")) == 0)
mPhase = NS_PHASE_CAPTURING;
else if (phase.Equals(NS_LITERAL_STRING("target")))
else if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("target")) == 0)
mPhase = NS_PHASE_TARGET;
}
// Button and clickcount apply only to XBL handlers and don't apply to XUL key
// handlers.
if (aButton && *aButton)
mDetail = *aButton - '0';
if (aClickCount && *aClickCount)
mMisc = *aClickCount - '0';
nsAutoString button(aButton);
nsAutoString clickcount(aClickCount);
if (!button.IsEmpty())
mDetail = button.First() - '0';
if (!clickcount.IsEmpty())
mMisc = clickcount.First() - '0';
// Modifiers are supported by both types of handlers (XUL and XBL).
nsAutoString modifiers(aModifiers);

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

@ -1444,12 +1444,10 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
nsAutoString src;
while (*aAttributes) {
const nsDependentString key(aAttributes[0]);
if (key.Equals(NS_LITERAL_STRING("src"),
nsCaseInsensitiveStringComparator())) {
if (Compare(key, NS_LITERAL_STRING("src"),nsCaseInsensitiveStringComparator()) == 0) {
src.Assign(aAttributes[1]);
}
else if (key.Equals(NS_LITERAL_STRING("type"),
nsCaseInsensitiveStringComparator())) {
else if (Compare(key, NS_LITERAL_STRING("type"),nsCaseInsensitiveStringComparator()) == 0) {
nsAutoString type(aAttributes[1]);
nsAutoString mimeType;
nsAutoString params;
@ -1475,8 +1473,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
jsVersionString = JS_VersionToString(jsVersion);
}
}
else if (key.Equals(NS_LITERAL_STRING("language"),
nsCaseInsensitiveStringComparator())) {
else if (Compare(key, NS_LITERAL_STRING("language"),nsCaseInsensitiveStringComparator()) == 0) {
nsAutoString lang(aAttributes[1]);
isJavaScript = nsParserUtils::IsJavaScriptLanguage(lang, &jsVersionString);
}

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

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

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

@ -638,8 +638,9 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
}
}
if (mLoader->mNavQuirkMode ||
contentType.Equals(NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) ||
Compare(contentType,
NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) == 0 ||
contentType.IsEmpty()) {
/*
* First determine the charset (if one is indicated)

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

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

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

@ -201,8 +201,9 @@ PRBool AtomKey_base::Equals(const nsHashKey* aKey) const
const PRUnichar *theirStr = nsnull;
theirAtom->GetUnicode(&theirStr);
return nsDependentString(myStr).Equals(nsDependentString(theirStr),
nsCaseInsensitiveStringComparator());
return Compare(nsDependentString(myStr),
nsDependentString(theirStr),
nsCaseInsensitiveStringComparator()) == 0;
}
@ -3351,8 +3352,9 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
}
}
else {
if (nsDependentString(value).Equals(nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
if (!Compare(nsDependentString(value),
nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
return PR_TRUE;
}
}
@ -3646,9 +3648,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
break;
}
if (isCaseSensitive)
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3660,9 +3662,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3674,9 +3676,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3716,8 +3718,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
const PRUnichar* id2Str;
IDList->mAtom->GetUnicode(&id2Str);
nsDependentString id2(id2Str);
if (localTrue !=
id1.Equals(id2, nsCaseInsensitiveStringComparator())) {
if (localTrue ==
(Compare(id1, id2, nsCaseInsensitiveStringComparator()) != 0)) {
result = PR_FALSE;
break;
}