rv = NS_NewStringUnicharInputStream(&uin, new nsString(content)); if (NS_OK != rv) { return rv; }
rv = NS_NewStringUnicharInputStream(getter_AddRefs(uin), new nsString(content)); if (NS_OK != rv) { return rv; }
HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode){  nsresult rv = NS_OK;  nsIHTMLContent* parent = nsnull;    if(mCurrentContext!=nsnull) {    parent=mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;  }  if(parent!=nsnull) {    // Create content object    nsIHTMLContent* element = nsnull;    nsCOMPtr<nsINodeInfo> nodeInfo;    mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::style, nsnull,                                  kNameSpaceID_None,                                  *getter_AddRefs(nodeInfo));    rv = NS_CreateHTMLElement(&element, nodeInfo, PR_FALSE);    if (NS_SUCCEEDED(rv)) {      PRInt32 id;      mDocument->GetAndIncrementContentID(&id);          element->SetContentID(id);      // Add in the attributes and add the style content object to the      // head container.      element->SetDocument(mDocument, PR_FALSE, PR_TRUE);      rv = AddAttributes(aNode, element);      if (NS_FAILED(rv)) {        NS_RELEASE(element);        return rv;      }      parent->AppendChildTo(element, PR_FALSE, PR_FALSE);    }    if(!mInsideNoXXXTag && NS_SUCCEEDED(rv)) {      PRInt32 i, count = aNode.GetAttributeCount();      nsAutoString src;      nsAutoString title;       nsAutoString type;       nsAutoString media;       for (i = 0; i < count; i++) {        nsAutoString key(aNode.GetKeyAt(i));        if (key.EqualsIgnoreCase("src")) {          GetAttributeValueAt(aNode, i, src);          src.StripWhitespace();        }        else if (key.EqualsIgnoreCase("title")) {          GetAttributeValueAt(aNode, i, title);          title.CompressWhitespace();        }        else if (key.EqualsIgnoreCase("type")) {          GetAttributeValueAt(aNode, i, type);          type.StripWhitespace();        }        else if (key.EqualsIgnoreCase("media")) {          GetAttributeValueAt(aNode, i, media);          media.ToLowerCase(); // HTML4.0 spec is inconsistent, make it case INSENSITIVE        }      }      nsAutoString  mimeType;      nsAutoString  params;      nsStyleLinkElement::SplitMimeType(type, mimeType, params);      PRBool blockParser = kBlockByDefault;      if (mimeType.IsEmpty() || mimeType.Equals(NS_LITERAL_STRING("text/css"))) {         if (!title.IsEmpty()) {  // possibly preferred sheet          nsAutoString preferredStyle;          mDocument->GetHeaderData(nsHTMLAtoms::headerDefaultStyle, preferredStyle);          if (preferredStyle.IsEmpty()) {            mDocument->SetHeaderData(nsHTMLAtoms::headerDefaultStyle, title);          }        }        // The skipped content contains the inline style data        const nsString& content = aNode.GetSkippedContent();        PRBool doneLoading = PR_FALSE;        nsIUnicharInputStream* uin = nsnull;        if (src.IsEmpty()) {          // Create a text node holding the content          nsIContent* text;          rv = NS_NewTextNode(&text);          if (NS_OK == rv) {            nsIDOMText* tc;            rv = text->QueryInterface(NS_GET_IID(nsIDOMText), (void**)&tc);            if (NS_OK == rv) {              tc->SetData(content);              NS_RELEASE(tc);            }            element->AppendChildTo(text, PR_FALSE, PR_FALSE);            text->SetDocument(mDocument, PR_FALSE, PR_TRUE);            NS_RELEASE(text);          }          // 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, kNameSpaceID_Unknown,                                           mStyleSheetCount++,                                            ((blockParser) ? mParser : nsnull),                                           doneLoading, this);          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          nsIURI* url = nsnull;          {            rv = NS_NewURI(&url, src, mDocumentBaseURL);          }          if (NS_OK != rv) {            return rv;          }          rv = mCSSLoader->LoadStyleLink(element, url, title, media, kNameSpaceID_Unknown,                                         mStyleSheetCount++,                                          ((blockParser) ? mParser : nsnull),                                          doneLoading, this);          NS_RELEASE(url);        }        if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) {          rv = NS_ERROR_HTMLPARSER_BLOCK;        }      }//if (mimeType.IsEmpty() || mimeType.Equals(NS_LITERAL_STRING("text/css")))    }//if(!mInsideNoXXXTag && NS_SUCCEEDED(rv))    NS_RELEASE(element);  }//if(parent!=nsnull)  return rv;}