2183 nsCOMPtr<nsIPrefBranch> prefBranch =
2184 do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
2185 if (NS_SUCCEEDED(rv) && prefBranch)
2186 prefBranch->GetBoolPref("editor.quotesPreformatted", "esInPre);
2220 if (NS_SUCCEEDED(rv) && preNode)
2221 {
2222 // Add an attribute on the pre node so we'll know it's a quotation.
2223 // Do this after the insertion, so that
2224 nsCOMPtr<nsIDOMElement> preElement (do_QueryInterface(preNode));
2225 if (preElement)
2226 {
2227 preElement->SetAttribute(NS_LITERAL_STRING("_moz_quote"),
2228 NS_LITERAL_STRING("true"));
2229 if (quotesInPre)
2230 {
2231 // set style to not have unwanted vertical margins
2232 preElement->SetAttribute(NS_LITERAL_STRING("style"),
2233 NS_LITERAL_STRING("margin: 0 0 0 0px;"));
2234 }
2235 else
2236 {
2237 // turn off wrapping on spans
2238 preElement->SetAttribute(NS_LITERAL_STRING("style"),
2239 NS_LITERAL_STRING("white-space: pre;"));
2240 }
2241 }
2242
2243 // and set the selection inside it:
2244 selection->Collapse(preNode, 0);
2245 }