Bug 445988 - no focus rings around text input boxes in fennec p=tonikitoo r=roc sr=roc

This commit is contained in:
Brad Lassey 2008-10-08 19:28:31 -04:00
parent f7b967fb13
commit add313bab4
4 changed files with 18 additions and 3 deletions

View File

@ -655,6 +655,9 @@ nsPresContext::GetUserPreferences()
nsContentUtils::GetBoolPref("browser.display.focus_ring_on_anything",
mFocusRingOnAnything);
mFocusRingStyle =
nsContentUtils::GetIntPref("browser.display.focus_ring_style",
mFocusRingStyle);
// * use fonts?
mUseDocumentFonts =
nsContentUtils::GetIntPref("browser.display.use_document_fonts") != 0;

View File

@ -373,7 +373,8 @@ public:
PRBool GetUseFocusColors() const { return mUseFocusColors; }
PRUint8 FocusRingWidth() const { return mFocusRingWidth; }
PRBool GetFocusRingOnAnything() const { return mFocusRingOnAnything; }
PRUint8 GetFocusRingStyle() const { return mFocusRingStyle; }
/**
* Set up observers so that aTargetFrame will be invalidated when
@ -893,6 +894,7 @@ protected:
unsigned mUnderlineLinks : 1;
unsigned mUseFocusColors : 1;
unsigned mFocusRingOnAnything : 1;
unsigned mFocusRingStyle : 1;
unsigned mDrawImageBackground : 1;
unsigned mDrawColorBackground : 1;
unsigned mNeverAnimate : 1;

View File

@ -2089,6 +2089,7 @@ nsresult PresShell::SetPrefFocusRules(void)
}
PRUint8 focusRingWidth = mPresContext->FocusRingWidth();
PRBool focusRingOnAnything = mPresContext->GetFocusRingOnAnything();
PRUint8 focusRingStyle = mPresContext->GetFocusRingStyle();
if ((NS_SUCCEEDED(result) && focusRingWidth != 1 && focusRingWidth <= 4 ) || focusRingOnAnything) {
PRUint32 index = 0;
@ -2097,7 +2098,10 @@ nsresult PresShell::SetPrefFocusRules(void)
strRule.AppendLiteral("*|*:link:focus, *|*:visited"); // If we only want focus rings on the normal things like links
strRule.AppendLiteral(":focus {outline: "); // For example 3px dotted WindowText (maximum 4)
strRule.AppendInt(focusRingWidth);
strRule.AppendLiteral("px dotted WindowText !important; } "); // For example 3px dotted WindowText
if (focusRingStyle == 0) // solid
strRule.AppendLiteral("px solid -moz-mac-focusring !important; -moz-outline-radius: 3px; -moz-outline-offset: 1px; } ");
else // dotted
strRule.AppendLiteral("px dotted WindowText !important; } ");
// insert the rules
result = mPrefStyleSheet->
InsertRuleInternal(strRule, sInsertPrefSheetRulesAt, &index);
@ -2108,7 +2112,10 @@ nsresult PresShell::SetPrefFocusRules(void)
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; } ");
if (focusRingStyle == 0) // solid
strRule.AppendLiteral("px solid transparent !important; } ");
else
strRule.AppendLiteral("px dotted transparent !important; } ");
result = mPrefStyleSheet->
InsertRuleInternal(strRule, sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(result, result);

View File

@ -113,6 +113,9 @@ pref("browser.display.focus_background_color", "#117722");
pref("browser.display.focus_text_color", "#ffffff");
pref("browser.display.focus_ring_width", 1);
pref("browser.display.focus_ring_on_anything", false);
// focus ring border style.
// 0 = solid border, 1 = dotted border
pref("browser.display.focus_ring_style", 1);
pref("browser.helperApps.alwaysAsk.force", false);
pref("browser.helperApps.neverAsk.saveToDisk", "");