Bug 466626 - Make nsStyleLinkElement::ParseLinkTypes return a bitmask; r=roc

This commit is contained in:
Andrew
2011-11-20 11:13:40 +00:00
parent 47c6c43cd3
commit 09bcc33fef
7 changed files with 54 additions and 41 deletions

View File

@@ -2644,18 +2644,16 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
nsAutoString relVal;
element->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, relVal);
if (!relVal.IsEmpty()) {
// XXX seems overkill to generate this string array
nsAutoTArray<nsString, 4> linkTypes;
nsStyleLinkElement::ParseLinkTypes(relVal, linkTypes);
bool hasPrefetch = linkTypes.Contains(NS_LITERAL_STRING("prefetch"));
if (hasPrefetch || linkTypes.Contains(NS_LITERAL_STRING("next"))) {
PRUint32 linkTypes = nsStyleLinkElement::ParseLinkTypes(relVal);
bool hasPrefetch = linkTypes & PREFETCH;
if (hasPrefetch || (linkTypes & NEXT)) {
nsAutoString hrefVal;
element->GetAttr(kNameSpaceID_None, nsGkAtoms::href, hrefVal);
if (!hrefVal.IsEmpty()) {
PrefetchHref(hrefVal, element, hasPrefetch);
}
}
if (linkTypes.Contains(NS_LITERAL_STRING("dns-prefetch"))) {
if (linkTypes & DNS_PREFETCH) {
nsAutoString hrefVal;
element->GetAttr(kNameSpaceID_None, nsGkAtoms::href, hrefVal);
if (!hrefVal.IsEmpty()) {