diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 722f0529d38..cea8c63a1c1 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -1050,8 +1050,8 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData) sheet->GetTitle(title); if (!title.IsEmpty()) { // if sheet has title PRBool disabled = (aData.IsEmpty() || - Compare(title, aData, - nsCaseInsensitiveStringComparator()) != 0); + !title.Equals(aData, + nsCaseInsensitiveStringComparator())); SetStyleSheetDisabledState(sheet, disabled); } } diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index b69cb929477..ea527ab844b 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -839,23 +839,23 @@ nsGenericElement::InternalIsSupported(const nsAReadableString& aFeature, *aReturn = PR_FALSE; nsAutoString feature(aFeature); - if (!Compare(feature, NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) || - !Compare(feature, NS_LITERAL_STRING("HTML"), nsCaseInsensitiveStringComparator())) { + if (feature.Equals(NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) || + feature.Equals(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 (!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())) { + } 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())) { if (aVersion.IsEmpty() || aVersion.Equals(NS_LITERAL_STRING("2.0"))) { *aReturn = PR_TRUE; } diff --git a/mozilla/content/base/src/nsHTMLValue.cpp b/mozilla/content/base/src/nsHTMLValue.cpp index 48e1b765f2f..3ed6e80a11f 100644 --- a/mozilla/content/base/src/nsHTMLValue.cpp +++ b/mozilla/content/base/src/nsHTMLValue.cpp @@ -172,9 +172,8 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const } } else if (nsnull != aOther.mValue.mString) { - return 0 == Compare(nsDependentString(mValue.mString), - nsDependentString(aOther.mValue.mString), - nsCaseInsensitiveStringComparator()); + return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString), + nsCaseInsensitiveStringComparator()); } } else if (eHTMLUnit_ISupports == mUnit) { diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index 5f3ce60390f..ab2f9c370ba 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -398,8 +398,8 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::suppress) { - if (Compare(aValue,NS_LITERAL_STRING("true"), - nsCaseInsensitiveStringComparator())) { + if (!aValue.Equals(NS_LITERAL_STRING("true"), + nsCaseInsensitiveStringComparator())) { aResult.SetEmptyValue(); // XXX? shouldn't just leave "true" return NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index 637231f9907..0e3269ef279 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -212,7 +212,7 @@ nsHTMLButtonElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAutoString value(aValue); if (aName == nsHTMLAtoms::disabled && - !Compare(value, NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) { + value.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) { return UnsetAttr(aNameSpaceID, aName, aNotify); } diff --git a/mozilla/content/html/style/src/nsCSSDeclaration.cpp b/mozilla/content/html/style/src/nsCSSDeclaration.cpp index a04f0fd9a59..20675c406d1 100644 --- a/mozilla/content/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/content/html/style/src/nsCSSDeclaration.cpp @@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString, AppendValueToString(eCSSProperty_background_x_position, backgroundXValue); AppendValueToString(eCSSProperty_background_y_position, backgroundYValue); aString.Append(backgroundYValue); - if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) { + if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) { // the two values are different aString.Append(PRUnichar(' ')); aString.Append(backgroundXValue); diff --git a/mozilla/content/html/style/src/nsCSSLoader.cpp b/mozilla/content/html/style/src/nsCSSLoader.cpp index 6a6b7dc2d6d..d3d482f1aca 100644 --- a/mozilla/content/html/style/src/nsCSSLoader.cpp +++ b/mozilla/content/html/style/src/nsCSSLoader.cpp @@ -638,9 +638,8 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader, } } if (mLoader->mNavQuirkMode || - Compare(contentType, - NS_LITERAL_CSTRING("text/css"), - nsCaseInsensitiveCStringComparator()) == 0 || + contentType.Equals(NS_LITERAL_CSTRING("text/css"), + nsCaseInsensitiveCStringComparator()) || contentType.IsEmpty()) { /* * First determine the charset (if one is indicated) diff --git a/mozilla/content/html/style/src/nsCSSStruct.cpp b/mozilla/content/html/style/src/nsCSSStruct.cpp index a04f0fd9a59..20675c406d1 100644 --- a/mozilla/content/html/style/src/nsCSSStruct.cpp +++ b/mozilla/content/html/style/src/nsCSSStruct.cpp @@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString, AppendValueToString(eCSSProperty_background_x_position, backgroundXValue); AppendValueToString(eCSSProperty_background_y_position, backgroundYValue); aString.Append(backgroundYValue); - if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) { + if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) { // the two values are different aString.Append(PRUnichar(' ')); aString.Append(backgroundXValue); diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index 3cce72167e6..952aad603de 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -201,9 +201,8 @@ PRBool AtomKey_base::Equals(const nsHashKey* aKey) const const PRUnichar *theirStr = nsnull; theirAtom->GetUnicode(&theirStr); - return Compare(nsDependentString(myStr), - nsDependentString(theirStr), - nsCaseInsensitiveStringComparator()) == 0; + return nsDependentString(myStr).Equals(nsDependentString(theirStr), + nsCaseInsensitiveStringComparator()); } @@ -3352,9 +3351,8 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue, } } else { - if (!Compare(nsDependentString(value), - nsDependentString(start), - nsCaseInsensitiveStringComparator())) { + if (nsDependentString(value).Equals(nsDependentString(start), + nsCaseInsensitiveStringComparator())) { return PR_TRUE; } } @@ -3648,9 +3646,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, break; } if (isCaseSensitive) - result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3662,9 +3660,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, result = localFalse; } else { if (isCaseSensitive) - result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3676,9 +3674,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, result = localFalse; } else { if (isCaseSensitive) - result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3718,8 +3716,8 @@ static PRBool SelectorMatches(RuleProcessorData &data, const PRUnichar* id2Str; IDList->mAtom->GetUnicode(&id2Str); nsDependentString id2(id2Str); - if (localTrue == - (Compare(id1, id2, nsCaseInsensitiveStringComparator()) != 0)) { + if (localTrue != + id1.Equals(id2, nsCaseInsensitiveStringComparator())) { result = PR_FALSE; break; } diff --git a/mozilla/content/html/style/src/nsHTMLAttributes.cpp b/mozilla/content/html/style/src/nsHTMLAttributes.cpp index 1a412dc09b0..2c329015a74 100644 --- a/mozilla/content/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/content/html/style/src/nsHTMLAttributes.cpp @@ -1447,7 +1447,7 @@ HTMLAttributesImpl::HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const const PRUnichar* class2Buf; classList->mAtom->GetUnicode(&class2Buf); nsDependentString class2(class2Buf); - if (Compare(class1, class2, nsCaseInsensitiveStringComparator()) == 0) + if (class1.Equals(class2, nsCaseInsensitiveStringComparator())) return NS_OK; classList = classList->mNext; } while (classList); diff --git a/mozilla/content/shared/src/nsHTMLValue.cpp b/mozilla/content/shared/src/nsHTMLValue.cpp index 48e1b765f2f..3ed6e80a11f 100644 --- a/mozilla/content/shared/src/nsHTMLValue.cpp +++ b/mozilla/content/shared/src/nsHTMLValue.cpp @@ -172,9 +172,8 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const } } else if (nsnull != aOther.mValue.mString) { - return 0 == Compare(nsDependentString(mValue.mString), - nsDependentString(aOther.mValue.mString), - nsCaseInsensitiveStringComparator()); + return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString), + nsCaseInsensitiveStringComparator()); } } else if (eHTMLUnit_ISupports == mUnit) { diff --git a/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp b/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp index 8756b7ccda1..7e31d38625d 100644 --- a/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/mozilla/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -852,16 +852,17 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement, mEventName = getter_AddRefs(NS_NewAtom(event)); if (aPhase) { - if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("capturing")) == 0) + const nsDependentString phase(aPhase); + if (phase.Equals(NS_LITERAL_STRING("capturing"))) mPhase = NS_PHASE_CAPTURING; - else if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("target")) == 0) + else if (phase.Equals(NS_LITERAL_STRING("target"))) mPhase = NS_PHASE_TARGET; } // Button and clickcount apply only to XBL handlers and don't apply to XUL key // handlers. - nsAutoString button(aButton); - nsAutoString clickcount(aClickCount); + const nsDependentString button(aButton); + const nsDependentString clickcount(aClickCount); if (!button.IsEmpty()) mDetail = button.First() - '0'; if (!clickcount.IsEmpty()) diff --git a/mozilla/content/xul/document/src/nsXULContentSink.cpp b/mozilla/content/xul/document/src/nsXULContentSink.cpp index aec6bc8438f..abe16b6b227 100644 --- a/mozilla/content/xul/document/src/nsXULContentSink.cpp +++ b/mozilla/content/xul/document/src/nsXULContentSink.cpp @@ -1444,10 +1444,12 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes, nsAutoString src; while (*aAttributes) { const nsDependentString key(aAttributes[0]); - if (Compare(key, NS_LITERAL_STRING("src"),nsCaseInsensitiveStringComparator()) == 0) { + if (key.Equals(NS_LITERAL_STRING("src"), + nsCaseInsensitiveStringComparator())) { src.Assign(aAttributes[1]); } - else if (Compare(key, NS_LITERAL_STRING("type"),nsCaseInsensitiveStringComparator()) == 0) { + else if (key.Equals(NS_LITERAL_STRING("type"), + nsCaseInsensitiveStringComparator())) { nsAutoString type(aAttributes[1]); nsAutoString mimeType; nsAutoString params; @@ -1473,7 +1475,8 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes, jsVersionString = JS_VersionToString(jsVersion); } } - else if (Compare(key, NS_LITERAL_STRING("language"),nsCaseInsensitiveStringComparator()) == 0) { + else if (key.Equals(NS_LITERAL_STRING("language"), + nsCaseInsensitiveStringComparator())) { nsAutoString lang(aAttributes[1]); isJavaScript = nsParserUtils::IsJavaScriptLanguage(lang, &jsVersionString); } diff --git a/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp b/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp index b11bcd2b4d6..e58c5b0a1a6 100644 --- a/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp +++ b/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp @@ -92,9 +92,8 @@ ChangeCSSInlineStyleTxn::ValueIncludes(const nsAReadableString &aValueList, cons } } else { - if (!Compare(nsDependentString(value), - nsDependentString(start), - nsCaseInsensitiveStringComparator())) { + if (nsDependentString(value).Equals(nsDependentString(start), + nsCaseInsensitiveStringComparator())) { result = PR_TRUE; break; } @@ -370,8 +369,9 @@ ChangeCSSInlineStyleTxn::AcceptsMoreThanOneValue(nsIAtom *aCSSProperty) NS_IMETHODIMP ChangeCSSInlineStyleTxn::AddValueToMultivalueProperty(nsAWritableString & aValues, const nsAReadableString & aNewValue) { - if (!aValues.Length() - || !Compare(aValues, NS_LITERAL_STRING("none"), nsCaseInsensitiveStringComparator())) { + if (aValues.IsEmpty() + || aValues.Equals(NS_LITERAL_STRING("none"), + nsCaseInsensitiveStringComparator())) { // the list of values is empty of the value is 'none' aValues.Assign(aNewValue); } diff --git a/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp b/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp index 3e6632db933..a78614f7628 100644 --- a/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -1179,7 +1179,8 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode, if (!htmlValueString.Equals(NS_LITERAL_STRING(""))) { nsAutoString leftHTMLValue; htmlValueString.Left(leftHTMLValue, 5); - aIsSet = PRBool(!Compare(leftHTMLValue, leftCSSValue, nsCaseInsensitiveStringComparator())); + aIsSet = leftHTMLValue.Equals(leftCSSValue, + nsCaseInsensitiveStringComparator()); } else { aIsSet = (leftCSSValue.Equals(NS_LITERAL_STRING("times")) || @@ -1202,7 +1203,8 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode, } if (!htmlValueString.Equals(NS_LITERAL_STRING(""))) { - if (!Compare(htmlValueString, valueString, nsCaseInsensitiveStringComparator())) { + if (htmlValueString.Equals(valueString, + nsCaseInsensitiveStringComparator())) { aIsSet = PR_TRUE; } } diff --git a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp index 8b5cb5b0a48..09d7f982535 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp @@ -2436,7 +2436,7 @@ nsHTMLEditRules::WillMakeList(nsISelection *aSelection, nsAutoString itemType; if (aItemType) itemType = *aItemType; - else if (!Compare(*aListType,NS_LITERAL_STRING("dl"),nsCaseInsensitiveStringComparator())) + else if (aListType->Equals(NS_LITERAL_STRING("dl"),nsCaseInsensitiveStringComparator())) itemType.Assign(NS_LITERAL_STRING("dd")); else itemType.Assign(NS_LITERAL_STRING("li")); @@ -6079,7 +6079,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsAReadab else if (IsInlineNode(curNode)) { // if curNode is a non editable, drop it if we are going to
- if (!Compare(tString,NS_LITERAL_STRING("pre"),nsCaseInsensitiveStringComparator())
+ if (tString.Equals(NS_LITERAL_STRING("pre"),nsCaseInsensitiveStringComparator())
&& (!mHTMLEditor->IsEditable(curNode)))
continue; // do nothing to this block
diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp
index 1a4a9cb386c..99294508016 100644
--- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp
@@ -2459,7 +2459,7 @@ nsHTMLEditor::RemoveList(const nsAReadableString& aListType)
if (!selection) return NS_ERROR_NULL_POINTER;
nsTextRulesInfo ruleInfo(nsTextEditRules::kRemoveList);
- if (!Compare(aListType,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()))
+ if (aListType.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()))
ruleInfo.bOrdered = PR_TRUE;
else ruleInfo.bOrdered = PR_FALSE;
res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
@@ -2582,7 +2582,7 @@ nsHTMLEditor::Indent(const nsAReadableString& aIndent)
PRBool cancel, handled;
PRInt32 theAction = nsTextEditRules::kIndent;
PRInt32 opID = kOpIndent;
- if (!Compare(aIndent,NS_LITERAL_STRING("outdent"),nsCaseInsensitiveStringComparator()))
+ if (aIndent.Equals(NS_LITERAL_STRING("outdent"),nsCaseInsensitiveStringComparator()))
{
theAction = nsTextEditRules::kOutdent;
opID = kOpOutdent;
@@ -3569,7 +3569,8 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
{
nsAutoString href;
if (NS_SUCCEEDED(anchor->GetHref(href)))
- if (Compare(Substring(href, 0, 5), NS_LITERAL_STRING("file:"), nsCaseInsensitiveStringComparator()) == 0)
+ if (Substring(href, 0, 5).Equals(NS_LITERAL_STRING("file:"),
+ nsCaseInsensitiveStringComparator()))
(*aNodeList)->AppendElement(node);
}
}
@@ -3861,20 +3862,20 @@ PRBool
nsHTMLEditor::TagCanContainTag(const nsAReadableString& aParentTag, const nsAReadableString& aChildTag)
{
// COtherDTD gives some unwanted results. We override them here.
- if (!Compare(aParentTag,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
- !Compare(aParentTag,NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator()))
+ if (aParentTag.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
+ aParentTag.Equals(NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator()))
{
// if parent is a list and tag is also a list, say "yes".
// This is because the editor does sublists illegally for now.
- if (!Compare(aChildTag,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
- !Compare(aChildTag,NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator()))
+ if (aChildTag.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
+ aChildTag.Equals(NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator()))
return PR_TRUE;
}
- if (!Compare(aParentTag,NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
+ if (aParentTag.Equals(NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
{
// list items cant contain list items
- if (!Compare(aChildTag,NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
+ if (aChildTag.Equals(NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
return PR_FALSE;
}
diff --git a/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp b/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp
index 82d5a4d7200..0ea49f6d656 100644
--- a/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp
+++ b/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp
@@ -715,7 +715,7 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
}
if ( aProperty == nsIEditProperty::font && // or node is big or small and we are setting font size
(NodeIsType(aNode, nsIEditProperty::big) || NodeIsType(aNode, nsIEditProperty::small)) &&
- !Compare(*aAttribute,NS_LITERAL_STRING("size"),nsCaseInsensitiveStringComparator()))
+ aAttribute->Equals(NS_LITERAL_STRING("size"),nsCaseInsensitiveStringComparator()))
{
res = RemoveContainer(aNode); // if we are setting font size, remove any nested bigs and smalls
}
@@ -741,10 +741,10 @@ PRBool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
if (!attrName) continue; // ooops
attrName->ToString(attrString);
// if it's the attribute we know about, keep looking
- if (!Compare(attrString,*aAttribute,nsCaseInsensitiveStringComparator())) continue;
+ if (attrString.Equals(*aAttribute,nsCaseInsensitiveStringComparator())) continue;
// if it's a special _moz... attribute, keep looking
attrString.Left(tmp,4);
- if (!Compare(tmp,NS_LITERAL_STRING("_moz"),nsCaseInsensitiveStringComparator())) continue;
+ if (tmp.Equals(NS_LITERAL_STRING("_moz"),nsCaseInsensitiveStringComparator())) continue;
// otherwise, it's another attribute, so return false
return PR_FALSE;
}
@@ -798,7 +798,7 @@ PRBool nsHTMLEditor::HasAttrVal(nsIDOMNode *aNode,
attNode->GetValue(attrVal);
// do values match?
- if (!Compare(attrVal,*aValue,nsCaseInsensitiveStringComparator())) return PR_TRUE;
+ if (attrVal.Equals(*aValue,nsCaseInsensitiveStringComparator())) return PR_TRUE;
return PR_FALSE;
}
diff --git a/mozilla/editor/libeditor/text/nsAOLCiter.cpp b/mozilla/editor/libeditor/text/nsAOLCiter.cpp
index a00a98f26c9..259a50dcbe0 100644
--- a/mozilla/editor/libeditor/text/nsAOLCiter.cpp
+++ b/mozilla/editor/libeditor/text/nsAOLCiter.cpp
@@ -107,7 +107,7 @@ nsAOLCiter::StripCites(const nsAReadableString& aInString, nsAWritableString& aO
nsReadingIterator iter,enditer;
aInString.BeginReading(iter);
aInString.EndReading(enditer);
- if (!Compare(Substring(aInString,0,2),NS_LITERAL_STRING(">>")))
+ if (Substring(aInString,0,2).Equals(NS_LITERAL_STRING(">>")))
{
iter.advance(2);
while (nsCRT::IsAsciiSpace(*iter))
diff --git a/mozilla/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/mozilla/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
index 13b1a48d4af..2cafc426f7e 100644
--- a/mozilla/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
+++ b/mozilla/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
@@ -1467,27 +1467,27 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
element->GetTagName(tag);
// Test what kind of element we're dealing with here
- if (!Compare(tag, NS_LITERAL_STRING("img"), nsCaseInsensitiveStringComparator()))
+ if (tag.Equals(NS_LITERAL_STRING("img"), nsCaseInsensitiveStringComparator()))
{
flags |= nsIContextMenuListener::CONTEXT_IMAGE;
targetDOMnode = node;
// if we see an image, keep searching for a possible anchor
}
- else if (!Compare(tag, NS_LITERAL_STRING("input"), nsCaseInsensitiveStringComparator()))
+ else if (tag.Equals(NS_LITERAL_STRING("input"), nsCaseInsensitiveStringComparator()))
{
// INPUT element - button, combo, checkbox, text etc.
flags |= nsIContextMenuListener::CONTEXT_INPUT;
targetDOMnode = node;
break; // exit do-while
}
- else if (!Compare(tag, NS_LITERAL_STRING("textarea"), nsCaseInsensitiveStringComparator()))
+ else if (tag.Equals(NS_LITERAL_STRING("textarea"), nsCaseInsensitiveStringComparator()))
{
// text area
flags |= nsIContextMenuListener::CONTEXT_TEXT;
targetDOMnode = node;
break; // exit do-while
}
- else if (!Compare(tag, NS_LITERAL_STRING("html"), nsCaseInsensitiveStringComparator()))
+ else if (tag.Equals(NS_LITERAL_STRING("html"), nsCaseInsensitiveStringComparator()))
{
// only care about this if no other context was found.
if (!flags) {
@@ -1509,8 +1509,7 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
if (attributes)
{
nsCOMPtr hrefNode;
- nsAutoString href(NS_LITERAL_STRING("href"));
- attributes->GetNamedItem(href, getter_AddRefs(hrefNode));
+ attributes->GetNamedItem(NS_LITERAL_STRING("href"), getter_AddRefs(hrefNode));
if (hrefNode)
{
flags |= nsIContextMenuListener::CONTEXT_LINK;
diff --git a/mozilla/embedding/tests/mfcembed/PrintSetupDialog.cpp b/mozilla/embedding/tests/mfcembed/PrintSetupDialog.cpp
index 4deb399124c..93d0b513ddd 100644
--- a/mozilla/embedding/tests/mfcembed/PrintSetupDialog.cpp
+++ b/mozilla/embedding/tests/mfcembed/PrintSetupDialog.cpp
@@ -183,7 +183,7 @@ int CPrintSetupDialog::GetPaperSizeIndexFromData(short aUnit, double aW, double
int CPrintSetupDialog::GetPaperSizeIndex(const CString& aStr)
{
for (int i=0;iGetType(type);
if (NS_SUCCEEDED(rv)) {
- if (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator()) == 0) {
+ if (type.Equals(NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator())) {
passwordCount++;
}
}
@@ -449,8 +449,11 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
nsAutoString type;
rv = inputElement->GetType(type);
if (NS_SUCCEEDED(rv)) {
- if ((type.IsEmpty()) || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0) ||
- (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator()) == 0)) {
+ if (type.IsEmpty() ||
+ type.Equals(NS_LITERAL_STRING("text"),
+ nsCaseInsensitiveStringComparator()) ||
+ type.Equals(NS_LITERAL_STRING("password"),
+ nsCaseInsensitiveStringComparator())) {
nsAutoString field;
rv = inputElement->GetName(field);
if (NS_SUCCEEDED(rv)) {
diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp
index 7a65cc99159..798504bc794 100644
--- a/mozilla/extensions/wallet/src/wallet.cpp
+++ b/mozilla/extensions/wallet/src/wallet.cpp
@@ -1960,14 +1960,16 @@ wallet_StepForwardOrBack
if (goForward) {
if (NS_SUCCEEDED(result) &&
(type.IsEmpty() ||
- (Compare(type, NS_LITERAL_STRING("text"),
- nsCaseInsensitiveStringComparator()) == 0))) {
+ type.Equals(NS_LITERAL_STRING("text"),
+ nsCaseInsensitiveStringComparator()))) {
/* at element and it's type is either "text" or is missing ("text" by default) */
atInputOrSelect = PR_TRUE;
return;
}
} else {
- if (NS_SUCCEEDED(result) && (Compare(type, NS_LITERAL_STRING("hidden"), nsCaseInsensitiveStringComparator()) != 0)) {
+ if (NS_SUCCEEDED(result) &&
+ !type.Equals(NS_LITERAL_STRING("hidden"),
+ nsCaseInsensitiveStringComparator())) {
/* at element and it's type is not "hidden" */
atInputOrSelect = PR_TRUE;
return;
@@ -2402,7 +2404,10 @@ wallet_GetPrefills(
if ((NS_SUCCEEDED(result)) && (nsnull != inputElement)) {
nsAutoString type;
result = inputElement->GetType(type);
- if ((NS_SUCCEEDED(result)) && ((type.IsEmpty()) || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0))) {
+ if (NS_SUCCEEDED(result) &&
+ (type.IsEmpty() ||
+ type.Equals(NS_LITERAL_STRING("text"),
+ nsCaseInsensitiveStringComparator()))) {
nsAutoString field;
result = inputElement->GetName(field);
if (NS_SUCCEEDED(result)) {
@@ -3636,8 +3641,10 @@ wallet_CaptureInputElement(nsIDOMNode* elementNode, nsIDocument* doc) {
/* it's an input element */
nsAutoString type;
result = inputElement->GetType(type);
- if ((NS_SUCCEEDED(result)) &&
- (type.IsEmpty() || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0))) {
+ if (NS_SUCCEEDED(result) &&
+ (type.IsEmpty() ||
+ type.Equals(NS_LITERAL_STRING("text"),
+ nsCaseInsensitiveStringComparator()))) {
nsAutoString field;
result = inputElement->GetName(field);
if (NS_SUCCEEDED(result)) {
@@ -3992,8 +3999,8 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) {
rv = inputElement->GetType(type);
if (NS_SUCCEEDED(rv)) {
- PRBool isText = (type.IsEmpty() || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator())==0));
- PRBool isPassword = (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator())==0);
+ PRBool isText = (type.IsEmpty() || type.Equals(NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()));
+ PRBool isPassword = type.Equals(NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator());
// don't save password if field was left blank
if (isPassword) {
diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp
index 3c5474218f0..e424a0e72bc 100644
--- a/mozilla/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/htmlparser/src/CNavDTD.cpp
@@ -1013,12 +1013,12 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
if(theCount) {
PRInt32 theIndex=0;
for(theIndex=0;theIndexGetStringValue());
- if(Compare(theStr, NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator()) != 0) {
+ if(!theStr.Equals(NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator())) {
PRUnichar theChar=theStr.CharAt(0);
if((nsCRT::IsAsciiDigit(theChar)) || ('X'==theChar) || ('x'==theChar)){
theStr.Assign(NS_LITERAL_STRING("#") + theStr);
diff --git a/mozilla/intl/chardet/src/nsMetaCharsetObserver.cpp b/mozilla/intl/chardet/src/nsMetaCharsetObserver.cpp
index 74073789e6a..cb2e5cbf006 100644
--- a/mozilla/intl/chardet/src/nsMetaCharsetObserver.cpp
+++ b/mozilla/intl/chardet/src/nsMetaCharsetObserver.cpp
@@ -106,7 +106,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
const PRUnichar* valueArray[])
{
- if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("META"), nsCaseInsensitiveStringComparator()))
+ if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("META"),
+ nsCaseInsensitiveStringComparator()))
return NS_ERROR_ILLEGAL_VALUE;
else
return Notify(aDocumentID, numOfAttributes, nameArray, valueArray);
@@ -147,8 +148,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
const PRUnichar* aTag,
const nsStringArray* keys, const nsStringArray* values)
{
- if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("META"),
- nsCaseInsensitiveStringComparator()))
+ if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("META"),
+ nsCaseInsensitiveStringComparator()))
return NS_ERROR_ILLEGAL_VALUE;
else
return Notify(aWebShell, aChannel, keys, values);
@@ -215,17 +216,14 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
while(IS_SPACE_CHARS(*keyStr))
keyStr++;
- if(0 == Compare(Substring(keyStr, keyStr+10),
- NS_LITERAL_STRING("HTTP-EQUIV"),
- nsCaseInsensitiveStringComparator()))
+ if(Substring(keyStr, keyStr+10).Equals(NS_LITERAL_STRING("HTTP-EQUIV"),
+ nsCaseInsensitiveStringComparator()))
httpEquivValue = values->StringAt(i)->get();
- else if(0 == Compare(Substring(keyStr, keyStr+7),
- NS_LITERAL_STRING("content"),
- nsCaseInsensitiveStringComparator()))
+ else if(Substring(keyStr, keyStr+7).Equals(NS_LITERAL_STRING("content"),
+ nsCaseInsensitiveStringComparator()))
contentValue = values->StringAt(i)->get();
- else if (0 == Compare(Substring(keyStr, keyStr+7),
- NS_LITERAL_STRING("charset"),
- nsCaseInsensitiveStringComparator()))
+ else if (Substring(keyStr, keyStr+7).Equals(NS_LITERAL_STRING("charset"),
+ nsCaseInsensitiveStringComparator()))
charsetValue = values->StringAt(i)->get();
}
NS_NAMED_LITERAL_STRING(contenttype, "Content-Type");
@@ -241,26 +239,26 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
if(
// first try unquoted strings
- ((0==Compare(Substring(httpEquivValue,httpEquivValue+contenttype.Length()),
- contenttype,
- nsCaseInsensitiveStringComparator())) ||
+ ((Substring(httpEquivValue,
+ httpEquivValue+contenttype.Length()).Equals(contenttype,
+ nsCaseInsensitiveStringComparator())) ||
// now try "quoted" or 'quoted' strings
(( (httpEquivValue[0]=='\'') ||
(httpEquivValue[0]=='\"') ) &&
- (0==Compare(Substring(httpEquivValue+1, httpEquivValue+1+contenttype.Length()),
- contenttype,
- nsCaseInsensitiveStringComparator()))
+ (Substring(httpEquivValue+1,
+ httpEquivValue+1+contenttype.Length()).Equals(contenttype,
+ nsCaseInsensitiveStringComparator()))
)) &&
// first try unquoted strings
- ((0==Compare(Substring(contentValue,contentValue+texthtml.Length()),
- texthtml,
- nsCaseInsensitiveStringComparator())) ||
+ ((Substring(contentValue,
+ contentValue+texthtml.Length()).Equals(texthtml,
+ nsCaseInsensitiveStringComparator())) ||
// now try "quoted" or 'quoted' strings
(((contentValue[0]=='\'') ||
(contentValue[0]=='\"'))&&
- (0==Compare(Substring(contentValue+1, contentValue+1+texthtml.Length()),
- texthtml,
- nsCaseInsensitiveStringComparator()))
+ (Substring(contentValue+1,
+ contentValue+1+texthtml.Length()).Equals(texthtml,
+ nsCaseInsensitiveStringComparator()))
))
)
{
@@ -352,8 +350,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::GetCharsetFromCompatibilityTag(
// e.g.
PRInt32 numOfAttributes = keys->Count();
if ((numOfAttributes >= 3) &&
- (0 == Compare(*keys->StringAt(0), NS_LITERAL_STRING("charset"),
- nsCaseInsensitiveStringComparator())))
+ (keys->StringAt(0)->Equals(NS_LITERAL_STRING("charset"),
+ nsCaseInsensitiveStringComparator())))
{
nsAutoString srcStr((values->StringAt(numOfAttributes-2))->get());
PRInt32 err;
diff --git a/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp b/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp
index fa12c04a90c..aa437feccc1 100644
--- a/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp
+++ b/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp
@@ -94,8 +94,8 @@ NS_IMETHODIMP nsXMLEncodingObserver::Notify(
const PRUnichar* nameArray[],
const PRUnichar* valueArray[])
{
- if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("?XML"),
- nsCaseInsensitiveStringComparator()))
+ if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("?XML"),
+ nsCaseInsensitiveStringComparator()))
return NS_ERROR_ILLEGAL_VALUE;
else
return Notify(aDocumentID, numOfAttributes, nameArray, valueArray);
@@ -143,8 +143,8 @@ NS_IMETHODIMP nsXMLEncodingObserver::Notify(
} else if(0==nsCRT::strcmp(nameArray[i], NS_LITERAL_STRING("charsetSource").get())) {
bGotCurrentCharsetSource = PR_TRUE;
charsetSourceStr = valueArray[i];
- } else if(0==Compare(nsDependentString(nameArray[i]), NS_LITERAL_STRING("encoding"),
- nsCaseInsensitiveStringComparator())) {
+ } else if(nsDependentString(nameArray[i]).Equals(NS_LITERAL_STRING("encoding"),
+ nsCaseInsensitiveStringComparator())) {
bGotEncoding = PR_TRUE;
encoding = valueArray[i];
}
diff --git a/mozilla/intl/locale/src/unix/nsCollationUnix.cpp b/mozilla/intl/locale/src/unix/nsCollationUnix.cpp
index a73e33c6a6a..392e0420ca4 100644
--- a/mozilla/intl/locale/src/unix/nsCollationUnix.cpp
+++ b/mozilla/intl/locale/src/unix/nsCollationUnix.cpp
@@ -96,7 +96,9 @@ nsresult nsCollationUnix::Initialize(nsILocale* locale)
PRUnichar *prefValue;
res = prefs->GetLocalizedUnicharPref("intl.collationOption", &prefValue);
if (NS_SUCCEEDED(res)) {
- mUseCodePointOrder = (Compare(nsDependentString(prefValue), NS_LITERAL_STRING("useCodePointOrder"), nsCaseInsensitiveStringComparator())==0);
+ mUseCodePointOrder =
+ nsDependentString(prefValue).Equals(NS_LITERAL_STRING("useCodePointOrder"),
+ nsCaseInsensitiveStringComparator());
nsMemory::Free(prefValue);
}
}
diff --git a/mozilla/intl/uconv/src/nsCharsetAliasImp.cpp b/mozilla/intl/uconv/src/nsCharsetAliasImp.cpp
index a2a479348b6..813c572f8ab 100644
--- a/mozilla/intl/uconv/src/nsCharsetAliasImp.cpp
+++ b/mozilla/intl/uconv/src/nsCharsetAliasImp.cpp
@@ -127,7 +127,7 @@ NS_IMETHODIMP nsCharsetAlias2::Equals(const nsAReadableString& aCharset1, const
{
nsresult res = NS_OK;
- if(Compare(aCharset1, aCharset2, nsCaseInsensitiveStringComparator()) == 0) {
+ if(aCharset1.Equals(aCharset2, nsCaseInsensitiveStringComparator())) {
*oResult = PR_TRUE;
return res;
}
diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp
index 87477451ebd..bccbd6cf1a6 100644
--- a/mozilla/layout/generic/nsObjectFrame.cpp
+++ b/mozilla/layout/generic/nsObjectFrame.cpp
@@ -1462,10 +1462,10 @@ nsObjectFrame::IsHidden() const
// not to hide the