strRule.AppendLiteral(":focus {-moz-outline: ");
strRule.AppendLiteral(":focus {outline: ");
nsresult PresShell::SetPrefFocusRules(void){  NS_ASSERTION(mPresContext,"null prescontext not allowed");  nsresult result = NS_OK;  if (!mPresContext)    result = NS_ERROR_FAILURE;  if (NS_SUCCEEDED(result) && !mPrefStyleSheet)    result = CreatePreferenceStyleSheet();  if (NS_SUCCEEDED(result)) {    NS_ASSERTION(mPrefStyleSheet, "prefstylesheet should not be null");    // get the DOM interface to the stylesheet    nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet,&result));    if (NS_SUCCEEDED(result)) {      if (mPresContext->GetUseFocusColors()) {        nscolor focusBackground(mPresContext->FocusBackgroundColor());        nscolor focusText(mPresContext->FocusTextColor());        // insert a rule to make focus the preferred color        PRUint32 index = 0;        nsAutoString strRule, strColor;        ///////////////////////////////////////////////////////////////        // - focus: '*:focus        ColorToString(focusText,strColor);        strRule.AppendLiteral("*:focus,*:focus>font {color: ");        strRule.Append(strColor);        strRule.AppendLiteral(" !important; background-color: ");        ColorToString(focusBackground,strColor);        strRule.Append(strColor);        strRule.AppendLiteral(" !important; } ");        // insert the rules        result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);      }      PRUint8 focusRingWidth = mPresContext->FocusRingWidth();      PRBool focusRingOnAnything = mPresContext->GetFocusRingOnAnything();      if ((NS_SUCCEEDED(result) && focusRingWidth != 1 && focusRingWidth <= 4 ) || focusRingOnAnything) {        PRUint32 index = 0;        nsAutoString strRule;        if (!focusRingOnAnything)          strRule.AppendLiteral("*|*:link:focus, *|*:visited");    // If we only want focus rings on the normal things like links        strRule.AppendLiteral(":focus {-moz-outline: ");     // For example 3px dotted WindowText (maximum 4)        strRule.AppendInt(focusRingWidth);        strRule.AppendLiteral("px dotted WindowText !important; } ");     // For example 3px dotted WindowText        // insert the rules        result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);        NS_ENSURE_SUCCESS(result, result);        if (focusRingWidth != 1) {          // If the focus ring width is different from the default, fix buttons with rings          strRule.AssignLiteral("button::-moz-focus-inner, input[type=\"reset\"]::-moz-focus-inner,");          strRule.AppendLiteral("input[type=\"button\"]::-moz-focus-inner, ");          strRule.AppendLiteral("input[type=\"submit\"]::-moz-focus-inner { padding: 1px 2px 1px 2px; border: ");          strRule.AppendInt(focusRingWidth);          strRule.AppendLiteral("px dotted transparent !important; } ");          result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);          NS_ENSURE_SUCCESS(result, result);                    strRule.AssignLiteral("button:focus::-moz-focus-inner, input[type=\"reset\"]:focus::-moz-focus-inner,");          strRule.AppendLiteral("input[type=\"button\"]:focus::-moz-focus-inner, input[type=\"submit\"]:focus::-moz-focus-inner {");          strRule.AppendLiteral("border-color: ButtonText !important; }");          result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);        }      }    }  }  return result;}