Add pref for the default :active styling. Bug 142163, patch by

mats.palmgren@bredband.net (Mats Palmgren), r=bzbarsky/sr=dbaron on the
layout/xpfe parts of the patch, r=glazou/sr=bzbarsky on the editor part,
moa=neil on the prefwindow changes.
This commit is contained in:
bzbarsky%mit.edu 2003-10-15 01:56:12 +00:00
Родитель 8963533a51
Коммит 7e19a9767b
29 изменённых файлов: 250 добавлений и 232 удалений

Просмотреть файл

@ -365,6 +365,11 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor,
result = PR_TRUE; result = PR_TRUE;
} }
break; break;
case NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT:
if (NS_SUCCEEDED(aPresContext->GetDefaultActiveLinkColor(&aResult))) {
result = PR_TRUE;
}
break;
default: default:
NS_NOTREACHED("Should never have an unknown negative colorID."); NS_NOTREACHED("Should never have an unknown negative colorID.");
break; break;

Просмотреть файл

@ -411,7 +411,7 @@ nsHTMLBodyElement::Set##func_(const nsAString& aColor) \
} }
NS_IMPL_HTMLBODY_COLOR_ATTR(vlink, VLink, VisitedLinkColor) NS_IMPL_HTMLBODY_COLOR_ATTR(vlink, VLink, VisitedLinkColor)
NS_IMPL_HTMLBODY_COLOR_ATTR(alink, ALink, LinkColor) NS_IMPL_HTMLBODY_COLOR_ATTR(alink, ALink, ActiveLinkColor)
NS_IMPL_HTMLBODY_COLOR_ATTR(link, Link, LinkColor) NS_IMPL_HTMLBODY_COLOR_ATTR(link, Link, LinkColor)
// XXX Should text check the body frame's style struct for color, // XXX Should text check the body frame's style struct for color,
// like we do for bgColor? // like we do for bgColor?

Просмотреть файл

@ -66,6 +66,7 @@
// OUTPUT_CLASS=nsCSSKeywords // OUTPUT_CLASS=nsCSSKeywords
// MACRO_NAME=CSS_KEY // MACRO_NAME=CSS_KEY
CSS_KEY(-moz-activehyperlinktext, _moz_activehyperlinktext)
CSS_KEY(-moz-alias, _moz_alias) CSS_KEY(-moz-alias, _moz_alias)
CSS_KEY(-moz-all, _moz_all) CSS_KEY(-moz-all, _moz_all)
CSS_KEY(-moz-anchor-decoration, _moz_anchor_decoration) CSS_KEY(-moz-anchor-decoration, _moz_anchor_decoration)

Просмотреть файл

@ -352,6 +352,7 @@ const PRInt32 nsCSSProps::kColorKTable[] = {
eCSSKeyword_window, nsILookAndFeel::eColor_window, eCSSKeyword_window, nsILookAndFeel::eColor_window,
eCSSKeyword_windowframe, nsILookAndFeel::eColor_windowframe, eCSSKeyword_windowframe, nsILookAndFeel::eColor_windowframe,
eCSSKeyword_windowtext, nsILookAndFeel::eColor_windowtext, eCSSKeyword_windowtext, nsILookAndFeel::eColor_windowtext,
eCSSKeyword__moz_activehyperlinktext, NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT,
eCSSKeyword__moz_buttondefault, nsILookAndFeel::eColor__moz_buttondefault, eCSSKeyword__moz_buttondefault, nsILookAndFeel::eColor__moz_buttondefault,
eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field, eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field,
eCSSKeyword__moz_fieldtext, nsILookAndFeel::eColor__moz_fieldtext, eCSSKeyword__moz_fieldtext, nsILookAndFeel::eColor__moz_fieldtext,

Просмотреть файл

@ -1537,7 +1537,7 @@ function EditorSelectColor(colorType, mouseEvent)
editor.setAttribute(bodyelement, "link", defColors.LinkColor); editor.setAttribute(bodyelement, "link", defColors.LinkColor);
if (!bodyelement.getAttribute("alink")) if (!bodyelement.getAttribute("alink"))
editor.setAttribute(bodyelement, "alink", defColors.LinkColor); editor.setAttribute(bodyelement, "alink", defColors.ActiveLinkColor);
if (!bodyelement.getAttribute("vlink")) if (!bodyelement.getAttribute("vlink"))
editor.setAttribute(bodyelement, "vlink", defColors.VisitedLinkColor); editor.setAttribute(bodyelement, "vlink", defColors.VisitedLinkColor);

Просмотреть файл

@ -594,7 +594,7 @@ function SaveFilePickerDirectory(filePicker, fileType)
function GetDefaultBrowserColors() function GetDefaultBrowserColors()
{ {
var prefs = GetPrefs(); var prefs = GetPrefs();
var colors = { TextColor:0, BackgroundColor:0, LinkColor:0, VisitedLinkColor:0 }; var colors = { TextColor:0, BackgroundColor:0, LinkColor:0, ActiveLinkColor:0 , VisitedLinkColor:0 };
var useSysColors = false; var useSysColors = false;
try { useSysColors = prefs.getBoolPref("browser.display.use_system_colors"); } catch (e) {} try { useSysColors = prefs.getBoolPref("browser.display.use_system_colors"); } catch (e) {}
@ -612,6 +612,7 @@ function GetDefaultBrowserColors()
colors.BackgroundColor = "window"; colors.BackgroundColor = "window";
colors.LinkColor = prefs.getCharPref("browser.anchor_color"); colors.LinkColor = prefs.getCharPref("browser.anchor_color");
colors.ActiveLinkColor = prefs.getCharPref("browser.active_color");
colors.VisitedLinkColor = prefs.getCharPref("browser.visited_color"); colors.VisitedLinkColor = prefs.getCharPref("browser.visited_color");
return colors; return colors;

Просмотреть файл

@ -75,8 +75,7 @@ function Startup()
// Use author's browser pref colors passed into dialog // Use author's browser pref colors passed into dialog
defaultTextColor = browserColors.TextColor; defaultTextColor = browserColors.TextColor;
defaultLinkColor = browserColors.LinkColor; defaultLinkColor = browserColors.LinkColor;
// Note: Browser doesn't store a value for ActiveLinkColor defaultActiveColor = browserColors.ActiveLinkColor;
defaultActiveColor = defaultLinkColor;
defaultVisitedColor = browserColors.VisitedLinkColor; defaultVisitedColor = browserColors.VisitedLinkColor;
defaultBackgroundColor= browserColors.BackgroundColor; defaultBackgroundColor= browserColors.BackgroundColor;

Просмотреть файл

@ -104,8 +104,7 @@ function Startup()
// Use author's browser pref colors passed into dialog // Use author's browser pref colors passed into dialog
defaultTextColor = browserColors.TextColor; defaultTextColor = browserColors.TextColor;
defaultLinkColor = browserColors.LinkColor; defaultLinkColor = browserColors.LinkColor;
// Note: Browser doesn't store a value for ActiveLinkColor defaultActiveColor = browserColors.ActiveLinkColor;
defaultActiveColor = defaultLinkColor;
defaultVisitedColor = browserColors.VisitedLinkColor; defaultVisitedColor = browserColors.VisitedLinkColor;
defaultBackgroundColor= browserColors.BackgroundColor; defaultBackgroundColor= browserColors.BackgroundColor;
} }

Просмотреть файл

@ -16,6 +16,8 @@
<!ENTITY links "Link colors"> <!ENTITY links "Link colors">
<!ENTITY linkColor.label "Unvisited Links:"> <!ENTITY linkColor.label "Unvisited Links:">
<!ENTITY linkColor.accesskey "l"> <!ENTITY linkColor.accesskey "l">
<!ENTITY activeLinkColor.label "Active Links:">
<!ENTITY activeLinkColor.accesskey "c">
<!ENTITY visitedLinkColor.label "Visited Links:"> <!ENTITY visitedLinkColor.label "Visited Links:">
<!ENTITY visitedLinkColor.accesskey "v"> <!ENTITY visitedLinkColor.accesskey "v">
<!-- LOCALIZATION NOTE (someProvColors): This is the start of a sentence and will be followed by the following radio buttons. --> <!-- LOCALIZATION NOTE (someProvColors): This is the start of a sentence and will be followed by the following radio buttons. -->

Просмотреть файл

@ -16,6 +16,8 @@
<!ENTITY links "Link colors"> <!ENTITY links "Link colors">
<!ENTITY linkColor.label "Unvisited Links:"> <!ENTITY linkColor.label "Unvisited Links:">
<!ENTITY linkColor.accesskey "l"> <!ENTITY linkColor.accesskey "l">
<!ENTITY activeLinkColor.label "Active Links:">
<!ENTITY activeLinkColor.accesskey "c">
<!ENTITY visitedLinkColor.label "Visited Links:"> <!ENTITY visitedLinkColor.label "Visited Links:">
<!ENTITY visitedLinkColor.accesskey "v"> <!ENTITY visitedLinkColor.accesskey "v">
<!-- LOCALIZATION NOTE (someProvColors): This is the start of a sentence and will be followed by the following radio buttons. --> <!-- LOCALIZATION NOTE (someProvColors): This is the start of a sentence and will be followed by the following radio buttons. -->

Просмотреть файл

@ -184,8 +184,9 @@ nsPresContext::nsPresContext()
// the minimum font-size is unconstrained by default // the minimum font-size is unconstrained by default
mMinimumFontSize = 0; mMinimumFontSize = 0;
mLinkColor = NS_RGB(0x33, 0x33, 0xFF); mLinkColor = NS_RGB(0x00, 0x00, 0xEE);
mVisitedLinkColor = NS_RGB(0x66, 0x00, 0xCC); mActiveLinkColor = NS_RGB(0xEE, 0x00, 0x00);
mVisitedLinkColor = NS_RGB(0x55, 0x1A, 0x8B);
mUnderlineLinks = PR_TRUE; mUnderlineLinks = PR_TRUE;
mUseFocusColors = PR_FALSE; mUseFocusColors = PR_FALSE;
@ -222,6 +223,7 @@ nsPresContext::~nsPresContext()
mPrefs->UnregisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.active_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this);
@ -470,6 +472,9 @@ nsPresContext::GetUserPreferences()
if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.anchor_color", getter_Copies(colorStr)))) { if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.anchor_color", getter_Copies(colorStr)))) {
mLinkColor = MakeColorPref(colorStr); mLinkColor = MakeColorPref(colorStr);
} }
if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.active_color", getter_Copies(colorStr)))) {
mActiveLinkColor = MakeColorPref(colorStr);
}
if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.visited_color", getter_Copies(colorStr)))) { if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.visited_color", getter_Copies(colorStr)))) {
mVisitedLinkColor = MakeColorPref(colorStr); mVisitedLinkColor = MakeColorPref(colorStr);
} }
@ -637,6 +642,7 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext)
mPrefs->RegisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.active_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this);
@ -1160,6 +1166,14 @@ nsPresContext::GetDefaultLinkColor(nscolor* aColor)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsPresContext::GetDefaultActiveLinkColor(nscolor* aColor)
{
NS_PRECONDITION(aColor, "null out param");
*aColor = mActiveLinkColor;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsPresContext::GetDefaultVisitedLinkColor(nscolor* aColor) nsPresContext::GetDefaultVisitedLinkColor(nscolor* aColor)
{ {
@ -1232,6 +1246,13 @@ nsPresContext::SetDefaultLinkColor(nscolor aColor)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsPresContext::SetDefaultActiveLinkColor(nscolor aColor)
{
mActiveLinkColor = aColor;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsPresContext::SetDefaultVisitedLinkColor(nscolor aColor) nsPresContext::SetDefaultVisitedLinkColor(nscolor aColor)
{ {

Просмотреть файл

@ -298,6 +298,7 @@ public:
NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultActiveLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor) = 0; NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor) = 0;
NS_IMETHOD GetFocusTextColor(nscolor* aColor) = 0; NS_IMETHOD GetFocusTextColor(nscolor* aColor) = 0;
@ -309,6 +310,7 @@ public:
NS_IMETHOD SetDefaultColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultActiveLinkColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0;
/** /**

Просмотреть файл

@ -2352,114 +2352,87 @@ PresShell::SetPrefNoScriptRule()
nsresult PresShell::SetPrefLinkRules(void) nsresult PresShell::SetPrefLinkRules(void)
{ {
NS_ASSERTION(mPresContext,"null prescontext not allowed"); NS_ASSERTION(mPresContext,"null prescontext not allowed");
if (mPresContext) { if (!mPresContext) {
nsresult result = NS_OK;
if (!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)) {
#ifdef DEBUG_attinasi
printf(" - Creating rules for link and visited colors\n");
#endif
// support default link colors:
// this means the link colors need to be overridable,
// which they are if we put them in the agent stylesheet,
// though if using an override sheet this will cause authors grief still
// In the agent stylesheet, they are !important when we are ignoring document colors
//
// XXX: Do active links and visited links get another color?
// They are red in the html.css rules, but there is no pref for their color.
nscolor linkColor, visitedColor;
result = mPresContext->GetDefaultLinkColor(&linkColor);
if (NS_SUCCEEDED(result)) {
result = mPresContext->GetDefaultVisitedLinkColor(&visitedColor);
}
if (NS_SUCCEEDED(result)) {
// insert a rule to make links the preferred color
PRUint32 index = 0;
nsAutoString strColor;
PRBool useDocColors = PR_TRUE;
// see if we need to create the rules first
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
///////////////////////////////////////////////////////////////
// - links: '*|*:link {color: #RRGGBB [!important];}'
ColorToString(linkColor,strColor);
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:link{color:") +
strColor +
ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(result, result);
///////////////////////////////////////////////////////////////
// - visited links '*|*:visited {color: #RRGGBB [!important];}'
ColorToString(visitedColor,strColor);
// insert the rule
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:visited{color:") +
strColor +
ruleClose,
sInsertPrefSheetRulesAt, &index);
///////////////////////////////////////////////////////////////
// - active links '*|*:-moz-any-link {color: red [!important];}'
// This has to be here (i.e. we can't just rely on the rule in the UA stylesheet)
// because this entire stylesheet is at the user level (not UA level) and so
// the two rules above override the rule in the UA stylesheet regardless of the
// weights of the respective rules.
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link:active{color:red") +
ruleClose,
sInsertPrefSheetRulesAt, &index);
}
if (NS_SUCCEEDED(result)) {
PRBool underlineLinks = PR_TRUE;
result = mPresContext->GetCachedBoolPref(kPresContext_UnderlineLinks,underlineLinks);
if (NS_SUCCEEDED(result)) {
// create a rule for underline: on or off
PRUint32 index = 0;
nsAutoString strRule;
if (underlineLinks) {
// create a rule to make underlining happen
// ':link, :visited {text-decoration:[underline|none];}'
// no need for important, we want these to be overridable
// NOTE: these must go in the agent stylesheet or they cannot be
// overridden by authors
#ifdef DEBUG_attinasi
printf (" - Creating rules for enabling link underlines\n");
#endif
// make a rule to make text-decoration: underline happen for links
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:underline}"));
} else {
#ifdef DEBUG_attinasi
printf (" - Creating rules for disabling link underlines\n");
#endif
// make a rule to make text-decoration: none happen for links
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:none}"));
}
// ...now insert the rule
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
}
}
}
}
return result;
} else {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsresult rv = NS_OK;
if (!mPrefStyleSheet) {
rv = CreatePreferenceStyleSheet();
NS_ENSURE_SUCCESS(rv, rv);
}
NS_ASSERTION(mPrefStyleSheet, "prefstylesheet should not be null");
// get the DOM interface to the stylesheet
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// support default link colors:
// this means the link colors need to be overridable,
// which they are if we put them in the agent stylesheet,
// though if using an override sheet this will cause authors grief still
// In the agent stylesheet, they are !important when we are ignoring document colors
nscolor linkColor, activeColor, visitedColor;
rv = mPresContext->GetDefaultLinkColor(&linkColor);
NS_ENSURE_SUCCESS(rv, rv);
rv = mPresContext->GetDefaultActiveLinkColor(&activeColor);
NS_ENSURE_SUCCESS(rv, rv);
rv = mPresContext->GetDefaultVisitedLinkColor(&visitedColor);
NS_ENSURE_SUCCESS(rv, rv);
PRBool useDocColors = PR_TRUE;
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
PRUint32 index = 0;
nsAutoString strColor;
// insert a rule to color links: '*|*:link {color: #RRGGBB [!important];}'
ColorToString(linkColor, strColor);
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:link{color:") +
strColor + ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(rv, rv);
// - visited links: '*|*:visited {color: #RRGGBB [!important];}'
ColorToString(visitedColor, strColor);
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:visited{color:") +
strColor + ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(rv, rv);
// - active links: '*|*:-moz-any-link:active {color: #RRGGBB [!important];}'
ColorToString(activeColor, strColor);
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link:active{color:") +
strColor + ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(rv, rv);
PRBool underlineLinks = PR_TRUE;
rv = mPresContext->GetCachedBoolPref(kPresContext_UnderlineLinks, underlineLinks);
NS_ENSURE_SUCCESS(rv, rv);
if (underlineLinks) {
// create a rule to make underlining happen
// '*|*:-moz-any-link {text-decoration:[underline|none];}'
// no need for important, we want these to be overridable
// NOTE: these must go in the agent stylesheet or they cannot be
// overridden by authors
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:underline}"),
sInsertPrefSheetRulesAt, &index);
} else {
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:none}"),
sInsertPrefSheetRulesAt, &index);
}
return rv;
} }
nsresult PresShell::SetPrefFocusRules(void) nsresult PresShell::SetPrefFocusRules(void)

Просмотреть файл

@ -196,6 +196,7 @@
// See nsStyleColor // See nsStyleColor
#define NS_COLOR_MOZ_HYPERLINKTEXT -1 #define NS_COLOR_MOZ_HYPERLINKTEXT -1
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -2 #define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -2
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -3
// See nsStyleBackground // See nsStyleBackground
#define NS_STYLE_BG_COLOR_TRANSPARENT 0x01 #define NS_STYLE_BG_COLOR_TRANSPARENT 0x01

Просмотреть файл

@ -298,6 +298,7 @@ public:
NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultActiveLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor) = 0; NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor) = 0;
NS_IMETHOD GetFocusTextColor(nscolor* aColor) = 0; NS_IMETHOD GetFocusTextColor(nscolor* aColor) = 0;
@ -309,6 +310,7 @@ public:
NS_IMETHOD SetDefaultColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultActiveLinkColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0;
/** /**

Просмотреть файл

@ -298,6 +298,7 @@ public:
NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultActiveLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0; NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0;
NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor) = 0; NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor) = 0;
NS_IMETHOD GetFocusTextColor(nscolor* aColor) = 0; NS_IMETHOD GetFocusTextColor(nscolor* aColor) = 0;
@ -309,6 +310,7 @@ public:
NS_IMETHOD SetDefaultColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultActiveLinkColor(nscolor aColor) = 0;
NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0; NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0;
/** /**

Просмотреть файл

@ -196,6 +196,7 @@
// See nsStyleColor // See nsStyleColor
#define NS_COLOR_MOZ_HYPERLINKTEXT -1 #define NS_COLOR_MOZ_HYPERLINKTEXT -1
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -2 #define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -2
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -3
// See nsStyleBackground // See nsStyleBackground
#define NS_STYLE_BG_COLOR_TRANSPARENT 0x01 #define NS_STYLE_BG_COLOR_TRANSPARENT 0x01

Просмотреть файл

@ -184,8 +184,9 @@ nsPresContext::nsPresContext()
// the minimum font-size is unconstrained by default // the minimum font-size is unconstrained by default
mMinimumFontSize = 0; mMinimumFontSize = 0;
mLinkColor = NS_RGB(0x33, 0x33, 0xFF); mLinkColor = NS_RGB(0x00, 0x00, 0xEE);
mVisitedLinkColor = NS_RGB(0x66, 0x00, 0xCC); mActiveLinkColor = NS_RGB(0xEE, 0x00, 0x00);
mVisitedLinkColor = NS_RGB(0x55, 0x1A, 0x8B);
mUnderlineLinks = PR_TRUE; mUnderlineLinks = PR_TRUE;
mUseFocusColors = PR_FALSE; mUseFocusColors = PR_FALSE;
@ -222,6 +223,7 @@ nsPresContext::~nsPresContext()
mPrefs->UnregisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.active_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->UnregisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->UnregisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this);
@ -470,6 +472,9 @@ nsPresContext::GetUserPreferences()
if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.anchor_color", getter_Copies(colorStr)))) { if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.anchor_color", getter_Copies(colorStr)))) {
mLinkColor = MakeColorPref(colorStr); mLinkColor = MakeColorPref(colorStr);
} }
if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.active_color", getter_Copies(colorStr)))) {
mActiveLinkColor = MakeColorPref(colorStr);
}
if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.visited_color", getter_Copies(colorStr)))) { if (NS_SUCCEEDED(mPrefs->CopyCharPref("browser.visited_color", getter_Copies(colorStr)))) {
mVisitedLinkColor = MakeColorPref(colorStr); mVisitedLinkColor = MakeColorPref(colorStr);
} }
@ -637,6 +642,7 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext)
mPrefs->RegisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.display.", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.underline_anchors", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.anchor_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.active_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("browser.visited_color", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("network.image.imageBehavior", nsPresContext::PrefChangedCallback, (void*)this);
mPrefs->RegisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this); mPrefs->RegisterCallback("image.animation_mode", nsPresContext::PrefChangedCallback, (void*)this);
@ -1160,6 +1166,14 @@ nsPresContext::GetDefaultLinkColor(nscolor* aColor)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsPresContext::GetDefaultActiveLinkColor(nscolor* aColor)
{
NS_PRECONDITION(aColor, "null out param");
*aColor = mActiveLinkColor;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsPresContext::GetDefaultVisitedLinkColor(nscolor* aColor) nsPresContext::GetDefaultVisitedLinkColor(nscolor* aColor)
{ {
@ -1232,6 +1246,13 @@ nsPresContext::SetDefaultLinkColor(nscolor aColor)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsPresContext::SetDefaultActiveLinkColor(nscolor aColor)
{
mActiveLinkColor = aColor;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsPresContext::SetDefaultVisitedLinkColor(nscolor aColor) nsPresContext::SetDefaultVisitedLinkColor(nscolor aColor)
{ {

Просмотреть файл

@ -121,6 +121,7 @@ public:
NS_IMETHOD GetDefaultColor(nscolor* aColor); NS_IMETHOD GetDefaultColor(nscolor* aColor);
NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor); NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor);
NS_IMETHOD GetDefaultLinkColor(nscolor* aColor); NS_IMETHOD GetDefaultLinkColor(nscolor* aColor);
NS_IMETHOD GetDefaultActiveLinkColor(nscolor* aColor);
NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor); NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor);
NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor); NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor);
@ -131,6 +132,7 @@ public:
NS_IMETHOD SetDefaultColor(nscolor aColor); NS_IMETHOD SetDefaultColor(nscolor aColor);
NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor); NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor);
NS_IMETHOD SetDefaultLinkColor(nscolor aColor); NS_IMETHOD SetDefaultLinkColor(nscolor aColor);
NS_IMETHOD SetDefaultActiveLinkColor(nscolor aColor);
NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor); NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor);
NS_IMETHOD LoadImage(nsIURI* aURL, NS_IMETHOD LoadImage(nsIURI* aURL,
@ -240,6 +242,7 @@ protected:
nscolor mDefaultColor; // set in GetUserPrefs nscolor mDefaultColor; // set in GetUserPrefs
nscolor mDefaultBackgroundColor; // set in GetUserPrefs nscolor mDefaultBackgroundColor; // set in GetUserPrefs
nscolor mLinkColor; // set in GetUserPrefs nscolor mLinkColor; // set in GetUserPrefs
nscolor mActiveLinkColor; // set in GetUserPrefs
nscolor mVisitedLinkColor; // set in GetUserPrefs nscolor mVisitedLinkColor; // set in GetUserPrefs
nscolor mFocusTextColor; // set in GetUserPrefs nscolor mFocusTextColor; // set in GetUserPrefs
nscolor mFocusBackgroundColor; // set in GetUserPrefs nscolor mFocusBackgroundColor; // set in GetUserPrefs

Просмотреть файл

@ -2352,114 +2352,87 @@ PresShell::SetPrefNoScriptRule()
nsresult PresShell::SetPrefLinkRules(void) nsresult PresShell::SetPrefLinkRules(void)
{ {
NS_ASSERTION(mPresContext,"null prescontext not allowed"); NS_ASSERTION(mPresContext,"null prescontext not allowed");
if (mPresContext) { if (!mPresContext) {
nsresult result = NS_OK;
if (!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)) {
#ifdef DEBUG_attinasi
printf(" - Creating rules for link and visited colors\n");
#endif
// support default link colors:
// this means the link colors need to be overridable,
// which they are if we put them in the agent stylesheet,
// though if using an override sheet this will cause authors grief still
// In the agent stylesheet, they are !important when we are ignoring document colors
//
// XXX: Do active links and visited links get another color?
// They are red in the html.css rules, but there is no pref for their color.
nscolor linkColor, visitedColor;
result = mPresContext->GetDefaultLinkColor(&linkColor);
if (NS_SUCCEEDED(result)) {
result = mPresContext->GetDefaultVisitedLinkColor(&visitedColor);
}
if (NS_SUCCEEDED(result)) {
// insert a rule to make links the preferred color
PRUint32 index = 0;
nsAutoString strColor;
PRBool useDocColors = PR_TRUE;
// see if we need to create the rules first
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
///////////////////////////////////////////////////////////////
// - links: '*|*:link {color: #RRGGBB [!important];}'
ColorToString(linkColor,strColor);
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:link{color:") +
strColor +
ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(result, result);
///////////////////////////////////////////////////////////////
// - visited links '*|*:visited {color: #RRGGBB [!important];}'
ColorToString(visitedColor,strColor);
// insert the rule
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:visited{color:") +
strColor +
ruleClose,
sInsertPrefSheetRulesAt, &index);
///////////////////////////////////////////////////////////////
// - active links '*|*:-moz-any-link {color: red [!important];}'
// This has to be here (i.e. we can't just rely on the rule in the UA stylesheet)
// because this entire stylesheet is at the user level (not UA level) and so
// the two rules above override the rule in the UA stylesheet regardless of the
// weights of the respective rules.
result = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link:active{color:red") +
ruleClose,
sInsertPrefSheetRulesAt, &index);
}
if (NS_SUCCEEDED(result)) {
PRBool underlineLinks = PR_TRUE;
result = mPresContext->GetCachedBoolPref(kPresContext_UnderlineLinks,underlineLinks);
if (NS_SUCCEEDED(result)) {
// create a rule for underline: on or off
PRUint32 index = 0;
nsAutoString strRule;
if (underlineLinks) {
// create a rule to make underlining happen
// ':link, :visited {text-decoration:[underline|none];}'
// no need for important, we want these to be overridable
// NOTE: these must go in the agent stylesheet or they cannot be
// overridden by authors
#ifdef DEBUG_attinasi
printf (" - Creating rules for enabling link underlines\n");
#endif
// make a rule to make text-decoration: underline happen for links
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:underline}"));
} else {
#ifdef DEBUG_attinasi
printf (" - Creating rules for disabling link underlines\n");
#endif
// make a rule to make text-decoration: none happen for links
strRule.Append(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:none}"));
}
// ...now insert the rule
result = sheet->InsertRule(strRule, sInsertPrefSheetRulesAt, &index);
}
}
}
}
return result;
} else {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsresult rv = NS_OK;
if (!mPrefStyleSheet) {
rv = CreatePreferenceStyleSheet();
NS_ENSURE_SUCCESS(rv, rv);
}
NS_ASSERTION(mPrefStyleSheet, "prefstylesheet should not be null");
// get the DOM interface to the stylesheet
nsCOMPtr<nsIDOMCSSStyleSheet> sheet(do_QueryInterface(mPrefStyleSheet, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// support default link colors:
// this means the link colors need to be overridable,
// which they are if we put them in the agent stylesheet,
// though if using an override sheet this will cause authors grief still
// In the agent stylesheet, they are !important when we are ignoring document colors
nscolor linkColor, activeColor, visitedColor;
rv = mPresContext->GetDefaultLinkColor(&linkColor);
NS_ENSURE_SUCCESS(rv, rv);
rv = mPresContext->GetDefaultActiveLinkColor(&activeColor);
NS_ENSURE_SUCCESS(rv, rv);
rv = mPresContext->GetDefaultVisitedLinkColor(&visitedColor);
NS_ENSURE_SUCCESS(rv, rv);
PRBool useDocColors = PR_TRUE;
mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors);
NS_NAMED_LITERAL_STRING(notImportantStr, "}");
NS_NAMED_LITERAL_STRING(importantStr, "!important}");
const nsAString& ruleClose = useDocColors ? notImportantStr : importantStr;
PRUint32 index = 0;
nsAutoString strColor;
// insert a rule to color links: '*|*:link {color: #RRGGBB [!important];}'
ColorToString(linkColor, strColor);
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:link{color:") +
strColor + ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(rv, rv);
// - visited links: '*|*:visited {color: #RRGGBB [!important];}'
ColorToString(visitedColor, strColor);
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:visited{color:") +
strColor + ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(rv, rv);
// - active links: '*|*:-moz-any-link:active {color: #RRGGBB [!important];}'
ColorToString(activeColor, strColor);
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link:active{color:") +
strColor + ruleClose,
sInsertPrefSheetRulesAt, &index);
NS_ENSURE_SUCCESS(rv, rv);
PRBool underlineLinks = PR_TRUE;
rv = mPresContext->GetCachedBoolPref(kPresContext_UnderlineLinks, underlineLinks);
NS_ENSURE_SUCCESS(rv, rv);
if (underlineLinks) {
// create a rule to make underlining happen
// '*|*:-moz-any-link {text-decoration:[underline|none];}'
// no need for important, we want these to be overridable
// NOTE: these must go in the agent stylesheet or they cannot be
// overridden by authors
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:underline}"),
sInsertPrefSheetRulesAt, &index);
} else {
rv = sheet->InsertRule(NS_LITERAL_STRING("*|*:-moz-any-link{text-decoration:none}"),
sInsertPrefSheetRulesAt, &index);
}
return rv;
} }
nsresult PresShell::SetPrefFocusRules(void) nsresult PresShell::SetPrefFocusRules(void)

Просмотреть файл

@ -116,10 +116,6 @@
-moz-user-focus: normal; -moz-user-focus: normal;
} }
*|*:-moz-any-link:active {
color: red;
}
*|*:-moz-any-link:focus { *|*:-moz-any-link:focus {
-moz-outline: 1px dotted invert; -moz-outline: 1px dotted invert;
} }

Просмотреть файл

@ -66,6 +66,7 @@
// OUTPUT_CLASS=nsCSSKeywords // OUTPUT_CLASS=nsCSSKeywords
// MACRO_NAME=CSS_KEY // MACRO_NAME=CSS_KEY
CSS_KEY(-moz-activehyperlinktext, _moz_activehyperlinktext)
CSS_KEY(-moz-alias, _moz_alias) CSS_KEY(-moz-alias, _moz_alias)
CSS_KEY(-moz-all, _moz_all) CSS_KEY(-moz-all, _moz_all)
CSS_KEY(-moz-anchor-decoration, _moz_anchor_decoration) CSS_KEY(-moz-anchor-decoration, _moz_anchor_decoration)

Просмотреть файл

@ -352,6 +352,7 @@ const PRInt32 nsCSSProps::kColorKTable[] = {
eCSSKeyword_window, nsILookAndFeel::eColor_window, eCSSKeyword_window, nsILookAndFeel::eColor_window,
eCSSKeyword_windowframe, nsILookAndFeel::eColor_windowframe, eCSSKeyword_windowframe, nsILookAndFeel::eColor_windowframe,
eCSSKeyword_windowtext, nsILookAndFeel::eColor_windowtext, eCSSKeyword_windowtext, nsILookAndFeel::eColor_windowtext,
eCSSKeyword__moz_activehyperlinktext, NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT,
eCSSKeyword__moz_buttondefault, nsILookAndFeel::eColor__moz_buttondefault, eCSSKeyword__moz_buttondefault, nsILookAndFeel::eColor__moz_buttondefault,
eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field, eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field,
eCSSKeyword__moz_fieldtext, nsILookAndFeel::eColor__moz_fieldtext, eCSSKeyword__moz_fieldtext, nsILookAndFeel::eColor__moz_fieldtext,

Просмотреть файл

@ -365,6 +365,11 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor,
result = PR_TRUE; result = PR_TRUE;
} }
break; break;
case NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT:
if (NS_SUCCEEDED(aPresContext->GetDefaultActiveLinkColor(&aResult))) {
result = PR_TRUE;
}
break;
default: default:
NS_NOTREACHED("Should never have an unknown negative colorID."); NS_NOTREACHED("Should never have an unknown negative colorID.");
break; break;

Просмотреть файл

@ -116,10 +116,6 @@
-moz-user-focus: normal; -moz-user-focus: normal;
} }
*|*:-moz-any-link:active {
color: red;
}
*|*:-moz-any-link:focus { *|*:-moz-any-link:focus {
-moz-outline: 1px dotted invert; -moz-outline: 1px dotted invert;
} }

Просмотреть файл

@ -90,6 +90,7 @@ pref("browser.display.force_inline_alttext", false); // true = force ALT text fo
pref("browser.display.normal_lineheight_calc_control", 2); pref("browser.display.normal_lineheight_calc_control", 2);
pref("browser.display.show_image_placeholders", true); // true = show image placeholders while image is loaded and when image is broken pref("browser.display.show_image_placeholders", true); // true = show image placeholders while image is loaded and when image is broken
pref("browser.anchor_color", "#0000EE"); pref("browser.anchor_color", "#0000EE");
pref("browser.active_color", "#EE0000");
pref("browser.visited_color", "#551A8B"); pref("browser.visited_color", "#551A8B");
pref("browser.underline_anchors", true); pref("browser.underline_anchors", true);
pref("browser.blink_allowed", true); pref("browser.blink_allowed", true);

Просмотреть файл

@ -33,6 +33,7 @@ function setColorWell(aPicker)
getColorFromWellAndSetValue("foregroundtextmenu"); getColorFromWellAndSetValue("foregroundtextmenu");
getColorFromWellAndSetValue("backgroundmenu"); getColorFromWellAndSetValue("backgroundmenu");
getColorFromWellAndSetValue("unvisitedlinkmenu"); getColorFromWellAndSetValue("unvisitedlinkmenu");
getColorFromWellAndSetValue("activelinkmenu");
getColorFromWellAndSetValue("visitedlinkmenu"); getColorFromWellAndSetValue("visitedlinkmenu");
return true; return true;

Просмотреть файл

@ -33,7 +33,7 @@
<script type="application/x-javascript"> <script type="application/x-javascript">
<![CDATA[ <![CDATA[
var _elementIDs = ["foregroundText", "background", "browserUseSystemColors", "unvisitedLinks", "visitedLinks", "browserUnderlineAnchors", "browserUseDocumentColors"]; var _elementIDs = ["foregroundText", "background", "browserUseSystemColors", "unvisitedLinks", "activeLinks", "visitedLinks", "browserUnderlineAnchors", "browserUseDocumentColors"];
]]> ]]>
</script> </script>
@ -69,6 +69,12 @@
<colorpicker type="button" id="unvisitedlinkmenu" palettename="standard" onchange="setColorWell(this)"/> <colorpicker type="button" id="unvisitedlinkmenu" palettename="standard" onchange="setColorWell(this)"/>
<data id="unvisitedLinks" preftype="string" prefstring="browser.anchor_color" prefattribute="value" wsm_attributes="value"/> <data id="unvisitedLinks" preftype="string" prefstring="browser.anchor_color" prefattribute="value" wsm_attributes="value"/>
</hbox> </hbox>
<hbox align="center" style="margin-top: 5px">
<label value="&activeLinkColor.label;" accesskey="&activeLinkColor.accesskey;" control="activelinkmenu"/>
<spacer flex="1"/>
<colorpicker type="button" id="activelinkmenu" palettename="standard" onchange="setColorWell(this)"/>
<data id="activeLinks" preftype="string" prefstring="browser.active_color" prefattribute="value" wsm_attributes="value"/>
</hbox>
<hbox align="center" style="margin-top: 5px"> <hbox align="center" style="margin-top: 5px">
<label value="&visitedLinkColor.label;" accesskey="&visitedLinkColor.accesskey;" control="visitedlinkmenu"/> <label value="&visitedLinkColor.label;" accesskey="&visitedLinkColor.accesskey;" control="visitedlinkmenu"/>
<spacer flex="1"/> <spacer flex="1"/>

Просмотреть файл

@ -15,6 +15,8 @@
<!ENTITY links "Link Colors"> <!ENTITY links "Link Colors">
<!ENTITY linkColor.label "Unvisited Links:"> <!ENTITY linkColor.label "Unvisited Links:">
<!ENTITY linkColor.accesskey "l"> <!ENTITY linkColor.accesskey "l">
<!ENTITY activeLinkColor.label "Active Links:">
<!ENTITY activeLinkColor.accesskey "c">
<!ENTITY visitedLinkColor.label "Visited Links:"> <!ENTITY visitedLinkColor.label "Visited Links:">
<!ENTITY visitedLinkColor.accesskey "v"> <!ENTITY visitedLinkColor.accesskey "v">
<!-- LOCALIZATION NOTE (someProvColors): This is the start of a sentence and will be followed by the following radio buttons. --> <!-- LOCALIZATION NOTE (someProvColors): This is the start of a sentence and will be followed by the following radio buttons. -->