Bug 492931 - Part 1a: Change to ASCII case conversion in content/ where appropriate. r=sicking

This commit is contained in:
Emanuel Hoogeveen 2012-02-29 19:31:45 -05:00
parent 961a9eae32
commit a59e8cb2be
13 changed files with 32 additions and 33 deletions

View File

@ -714,7 +714,7 @@ nsAttrValue::GetEnumString(nsAString& aResult, bool aRealTag) const
if (table->value == val) {
aResult.AssignASCII(table->tag);
if (!aRealTag && allEnumBits & NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER) {
ToUpperCase(aResult);
nsContentUtils::ASCIIToUpper(aResult);
}
return;
}
@ -1316,7 +1316,7 @@ nsAttrValue::ParseEnumValue(const nsAString& aValue,
if (!equals) {
nsAutoString tag;
tag.AssignASCII(tableEntry->tag);
ToUpperCase(tag);
nsContentUtils::ASCIIToUpper(tag);
if ((equals = tag.Equals(aValue))) {
value |= NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER;
}

View File

@ -617,8 +617,9 @@ nsContentSink::ProcessLinkHeader(nsIContent* aElement,
if (media.IsEmpty()) {
media = value;
// HTML4.0 spec is inconsistent, make it case INSENSITIVE
ToLowerCase(media);
// The HTML5 spec is formulated in terms of the CSS3 spec,
// which specifies that media queries are case insensitive.
nsContentUtils::ASCIIToLower(media);
}
} else if (attr.LowerCaseEqualsLiteral("anchor")) {
if (anchor.IsEmpty()) {
@ -757,7 +758,7 @@ nsContentSink::ProcessMETATag(nsIContent* aContent)
nsAutoString result;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
if (!result.IsEmpty()) {
ToLowerCase(header);
nsContentUtils::ASCIIToLower(header);
nsCOMPtr<nsIAtom> fieldAtom(do_GetAtom(header));
rv = ProcessHeaderData(fieldAtom, result, aContent);
}
@ -769,7 +770,7 @@ nsContentSink::ProcessMETATag(nsIContent* aContent)
nsAutoString result;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
if (!result.IsEmpty()) {
ToLowerCase(result);
nsContentUtils::ASCIIToLower(result);
mDocument->SetHeaderData(nsGkAtoms::handheldFriendly, result);
}
}

View File

@ -211,10 +211,9 @@ nsDOMAttribute::GetNameAtom(nsIContent* aContent)
aContent->IsInHTMLDocument() &&
aContent->IsHTML()) {
nsAutoString name;
mNodeInfo->NameAtom()->ToString(name);
nsAutoString lower;
ToLowerCase(name, lower);
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(lower);
mNodeInfo->GetName(name);
nsContentUtils::ASCIIToLower(name);
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(name);
nameAtom.swap(result);
} else {
nsCOMPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();

View File

@ -335,9 +335,7 @@ nsDOMAttributeMap::SetNamedItemInternal(nsIDOMNode *aNode,
else {
if (mContent->IsInHTMLDocument() &&
mContent->IsHTML()) {
nsAutoString lower;
ToLowerCase(name, lower);
name = lower;
nsContentUtils::ASCIIToLower(name);
}
rv = mContent->NodeInfo()->NodeInfoManager()->

View File

@ -4423,7 +4423,7 @@ nsDocument::CreateElement(const nsAString& aTagName,
bool needsLowercase = IsHTML() && !IsLowercaseASCII(aTagName);
nsAutoString lcTagName;
if (needsLowercase) {
ToLowerCase(aTagName, lcTagName);
nsContentUtils::ASCIIToLower(aTagName, lcTagName);
}
rv = CreateElem(needsLowercase ? lcTagName : aTagName,

View File

@ -185,7 +185,7 @@ PRUint32 nsStyleLinkElement::ParseLinkTypes(const nsAString& aTypes)
while (current != done) {
if (nsContentUtils::IsHTMLWhitespace(*current)) {
if (inString) {
ToLowerCase(Substring(start, current), subString);
nsContentUtils::ASCIIToLower(Substring(start, current), subString);
linkMask |= ToLinkMask(subString);
inString = false;
}
@ -199,8 +199,8 @@ PRUint32 nsStyleLinkElement::ParseLinkTypes(const nsAString& aTypes)
++current;
}
if (inString) {
ToLowerCase(Substring(start, current), subString);
linkMask |= ToLinkMask(subString);
nsContentUtils::ASCIIToLower(Substring(start, current), subString);
linkMask |= ToLinkMask(subString);
}
return linkMask;
}

View File

@ -2489,7 +2489,7 @@ nsresult
nsGenericHTMLElement::SetContentEditable(const nsAString& aContentEditable)
{
nsString contentEditable;
ToLowerCase(aContentEditable, contentEditable);
nsContentUtils::ASCIIToLower(aContentEditable, contentEditable);
if (contentEditable.EqualsLiteral("inherit")) {
UnsetAttr(kNameSpaceID_None, nsGkAtoms::contenteditable, true);

View File

@ -433,7 +433,9 @@ nsHTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
}
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
ToLowerCase(aMedia); // HTML4.0 spec is inconsistent, make it case INSENSITIVE
// The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
// that media queries should be ASCII lowercased during serialization.
nsContentUtils::ASCIIToLower(aMedia);
nsAutoString mimeType;
nsAutoString notUsed;

View File

@ -340,7 +340,9 @@ nsHTMLStyleElement::GetStyleSheetInfo(nsAString& aTitle,
aTitle.Assign(title);
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
ToLowerCase(aMedia); // HTML4.0 spec is inconsistent, make it case INSENSITIVE
// The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
// that media queries should be ASCII lowercased during serialization.
nsContentUtils::ASCIIToLower(aMedia);
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);

View File

@ -1361,7 +1361,7 @@ nsHTMLDocument::Open(const nsAString& aContentTypeOrUrl,
contentType.AssignLiteral("text/html");
if (aOptionalArgCount > 0) {
nsAutoString type;
ToLowerCase(aContentTypeOrUrl, type);
nsContentUtils::ASCIIToLower(aContentTypeOrUrl, type);
nsCAutoString actualType, dummy;
NS_ParseContentType(NS_ConvertUTF16toUTF8(type), actualType, dummy);
if (!actualType.EqualsLiteral("text/html") &&

View File

@ -337,9 +337,9 @@ nsSVGStyleElement::GetStyleSheetInfo(nsAString& aTitle,
aTitle.Assign(title);
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
// SVG spec refers to the HTML4.0 spec which is inconsistent, make it
// case INSENSITIVE
ToLowerCase(aMedia);
// The SVG spec is formulated in terms of the CSS2 spec,
// which specifies that media queries are case insensitive.
nsContentUtils::ASCIIToLower(aMedia);
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
if (aType.IsEmpty()) {

View File

@ -932,21 +932,18 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
if (!key.IsEmpty()) {
if (mKeyMask == 0)
mKeyMask = cAllModifiers;
ToLowerCase(key);
nsContentUtils::ASCIIToLower(key);
// We have a charcode.
mMisc = 1;
mDetail = key[0];
const PRUint8 GTK2Modifiers = cShift | cControl | cShiftMask | cControlMask;
if ((mKeyMask & GTK2Modifiers) == GTK2Modifiers &&
modifiers.First() != PRUnichar(',') &&
(mDetail == 'u' || mDetail == 'U'))
modifiers.First() != PRUnichar(',') && mDetail == 'u')
ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "GTK2Conflict");
const PRUint8 WinModifiers = cControl | cAlt | cControlMask | cAltMask;
if ((mKeyMask & WinModifiers) == WinModifiers &&
modifiers.First() != PRUnichar(',') &&
(('A' <= mDetail && mDetail <= 'Z') ||
('a' <= mDetail && mDetail <= 'z')))
modifiers.First() != PRUnichar(',') && ('a' <= mDetail && mDetail <= 'z'))
ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "WinConflict");
}
else {

View File

@ -160,7 +160,7 @@ txMozillaXMLOutput::attribute(nsIAtom* aPrefix,
if (mOpenedElementIsHTML && aNsID == kNameSpaceID_None) {
nsAutoString lnameStr;
ToLowerCase(aLocalName, lnameStr);
TX_ToLowerCase(aLocalName, lnameStr);
lname = do_GetAtom(lnameStr);
}
else {
@ -499,7 +499,7 @@ txMozillaXMLOutput::startElement(nsIAtom* aPrefix,
nsId = kNameSpaceID_XHTML;
nsAutoString lnameStr;
ToLowerCase(aLocalName, lnameStr);
TX_ToLowerCase(aLocalName, lnameStr);
lname = do_GetAtom(lnameStr);
}
else {
@ -802,7 +802,7 @@ txMozillaXMLOutput::endHTMLElement(nsIContent* aElement)
nsAutoString value;
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
if (!value.IsEmpty()) {
ToLowerCase(httpEquiv);
nsContentUtils::ASCIIToLower(httpEquiv);
nsCOMPtr<nsIAtom> header = do_GetAtom(httpEquiv);
processHTTPEquiv(header, value);
}