GetAttributeValueAt(aNode, index, media, sco);
GetAttributeValueAt(aNode, index, media, sco); media.ToLowerCase();
HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode){  nsresult rv = NS_OK;  PRInt32 index, count = aNode.GetAttributeCount();  nsAutoString src;  nsAutoString title;   nsAutoString type;   nsAutoString media;   nsIScriptContextOwner* sco = mDocument->GetScriptContextOwner();  for (index = 0; index < count; index++) {    const nsString& key = aNode.GetKeyAt(index);    if (key.EqualsIgnoreCase("src")) {      GetAttributeValueAt(aNode, index, src, sco);      src.StripWhitespace();    }    else if (key.EqualsIgnoreCase("title")) {      GetAttributeValueAt(aNode, index, title, sco);      title.CompressWhitespace();    }    else if (key.EqualsIgnoreCase("type")) {      GetAttributeValueAt(aNode, index, type, sco);      type.StripWhitespace();    }    else if (key.EqualsIgnoreCase("media")) {      GetAttributeValueAt(aNode, index, media, sco);  // case sensative    }  }  // Create content object  nsAutoString tag("STYLE");  nsIHTMLContent* element = nsnull;  rv = NS_CreateHTMLElement(&element, tag);  if (NS_SUCCEEDED(rv)) {    // Add in the attributes and add the style content object to the    // head container.    element->SetDocument(mDocument, PR_FALSE);    rv = AddAttributes(aNode, element, sco);    if (NS_FAILED(rv)) {      NS_RELEASE(element);      return rv;    }    mHead->AppendChildTo(element, PR_FALSE);  }  else {    NS_IF_RELEASE(sco);    return rv;  }  NS_IF_RELEASE(sco);  if ((0 == type.Length()) || type.EqualsIgnoreCase("text/css")) {     // The skipped content contains the inline style data    const nsString& content = aNode.GetSkippedContent();    PRBool doneLoading = PR_FALSE;    nsIUnicharInputStream* uin = nsnull;    if (0 == src.Length()) {      // Create a string to hold the data and wrap it up in a unicode      // input stream.      rv = NS_NewStringUnicharInputStream(&uin, new nsString(content));      if (NS_OK != rv) {        return rv;      }      // Now that we have a url and a unicode input stream, parse the      // style sheet.      rv = mCSSLoader->LoadInlineStyle(element, uin, title, media,                                        mStyleSheetCount++, mParser,                                       doneLoading);      NS_RELEASE(uin);    }     else {      // src with immediate style data doesn't add up      // XXX what does nav do?      // Use the SRC attribute value to load the URL      nsIURL* url = nsnull;      nsIURLGroup* urlGroup = nsnull;      mDocumentBaseURL->GetURLGroup(&urlGroup);      if (urlGroup) {        rv = urlGroup->CreateURL(&url, mDocumentBaseURL, src, nsnull);        NS_RELEASE(urlGroup);      }      else {        rv = NS_NewURL(&url, src, mDocumentBaseURL);      }      if (NS_OK != rv) {        return rv;      }      rv = mCSSLoader->LoadStyleLink(element, url, title, media,                                      mStyleSheetCount++,                                      mParser, doneLoading);      NS_RELEASE(url);    }    if (NS_SUCCEEDED(rv) && (! doneLoading)) {      rv = NS_ERROR_HTMLPARSER_BLOCK;    }  }  NS_RELEASE(element);  return rv;}