From d74bad509fdc7d7b0a856a373cfc0dacd7a3f896 Mon Sep 17 00:00:00 2001 From: Emanuel Hoogeveen Date: Wed, 29 Feb 2012 19:32:13 -0500 Subject: [PATCH] Bug 492931 - Part 1b: Change to ASCII case conversion in content/ where appropriate. r=sicking --- content/base/src/nsDOMAttribute.cpp | 7 +++--- .../html/content/src/nsGenericHTMLElement.cpp | 23 ++++++++++--------- content/xslt/src/base/txStringUtils.h | 4 +--- content/xslt/src/xpath/txExprParser.cpp | 2 +- .../src/xpath/txMozillaXPathTreeWalker.cpp | 2 +- content/xslt/src/xslt/txMozillaXMLOutput.cpp | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp index 6e8f52fe641..77d13ae228b 100644 --- a/content/base/src/nsDOMAttribute.cpp +++ b/content/base/src/nsDOMAttribute.cpp @@ -210,10 +210,11 @@ nsDOMAttribute::GetNameAtom(nsIContent* aContent) mNodeInfo->NamespaceID() == kNameSpaceID_None && aContent->IsInHTMLDocument() && aContent->IsHTML()) { - nsAutoString name; + nsString name; mNodeInfo->GetName(name); - nsContentUtils::ASCIIToLower(name); - nsCOMPtr nameAtom = do_GetAtom(name); + nsAutoString lowercaseName; + nsContentUtils::ASCIIToLower(name, lowercaseName); + nsCOMPtr nameAtom = do_GetAtom(lowercaseName); nameAtom.swap(result); } else { nsCOMPtr nameAtom = mNodeInfo->NameAtom(); diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 0ef219ce376..55f14b51d03 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2488,24 +2488,25 @@ nsGenericHTMLElement::GetContentEditable(nsAString& aContentEditable) nsresult nsGenericHTMLElement::SetContentEditable(const nsAString& aContentEditable) { - nsString contentEditable; - nsContentUtils::ASCIIToLower(aContentEditable, contentEditable); - - if (contentEditable.EqualsLiteral("inherit")) { + if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "inherit")) { UnsetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, true); return NS_OK; } - if (!contentEditable.EqualsLiteral("true") && - !contentEditable.EqualsLiteral("false")) { - return NS_ERROR_DOM_SYNTAX_ERR; + if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "true")) { + SetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, NS_LITERAL_STRING("true"), true); + + return NS_OK; + } + + if (nsContentUtils::EqualsLiteralIgnoreASCIICase(aContentEditable, "false")) { + SetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, NS_LITERAL_STRING("false"), true); + + return NS_OK; } - SetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, contentEditable, - true); - - return NS_OK; + return NS_ERROR_DOM_SYNTAX_ERR; } nsresult diff --git a/content/xslt/src/base/txStringUtils.h b/content/xslt/src/base/txStringUtils.h index fe0b0e9c5c9..262396d9172 100644 --- a/content/xslt/src/base/txStringUtils.h +++ b/content/xslt/src/base/txStringUtils.h @@ -44,8 +44,6 @@ #include "nsIAtom.h" #include "nsUnicharUtils.h" -#define TX_ToLowerCase ToLowerCase - typedef nsCaseInsensitiveStringComparator txCaseInsensitiveStringComparator; /** @@ -62,7 +60,7 @@ TX_ToLowerCaseAtom(nsIAtom* aAtom) { nsAutoString str; aAtom->ToString(str); - TX_ToLowerCase(str); + nsContentUtils::ASCIIToLower(str); return do_GetAtom(str); } diff --git a/content/xslt/src/xpath/txExprParser.cpp b/content/xslt/src/xpath/txExprParser.cpp index d9c970b6db4..7f901b1869e 100644 --- a/content/xslt/src/xpath/txExprParser.cpp +++ b/content/xslt/src/xpath/txExprParser.cpp @@ -938,7 +938,7 @@ txExprParser::resolveQName(const nsAString& aQName, *aPrefix = 0; if (aIsNameTest && aContext->caseInsensitiveNameTests()) { nsAutoString lcname; - TX_ToLowerCase(aQName, lcname); + nsContentUtils::ASCIIToLower(aQName, lcname); *aLocalName = NS_NewAtom(lcname); } else { diff --git a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp index 91331748bca..14353352335 100644 --- a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp +++ b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp @@ -453,7 +453,7 @@ txXPathNodeUtils::getLocalName(const txXPathNode& aNode, nsAString& aLocalName) // Check for html if (aNode.Content()->NodeInfo()->NamespaceEquals(kNameSpaceID_None) && aNode.Content()->IsHTML()) { - ToUpperCase(aLocalName); + nsContentUtils::ASCIIToUpper(aLocalName); } } diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.cpp b/content/xslt/src/xslt/txMozillaXMLOutput.cpp index 000bd3494ba..77ac3533655 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp +++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp @@ -160,7 +160,7 @@ txMozillaXMLOutput::attribute(nsIAtom* aPrefix, if (mOpenedElementIsHTML && aNsID == kNameSpaceID_None) { nsAutoString lnameStr; - TX_ToLowerCase(aLocalName, lnameStr); + nsContentUtils::ASCIIToLower(aLocalName, lnameStr); lname = do_GetAtom(lnameStr); } else { @@ -499,7 +499,7 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix, nsId = kNameSpaceID_XHTML; nsAutoString lnameStr; - TX_ToLowerCase(aLocalName, lnameStr); + nsContentUtils::ASCIIToLower(aLocalName, lnameStr); lname = do_GetAtom(lnameStr); } else {