Bug 1717873 - Move link color styles to ua.css. r=morgan

We expose these via CSS system colors, so this way we don't need to
rebuild the preference sheet when the link color is different.

Differential Revision: https://phabricator.services.mozilla.com/D120677
This commit is contained in:
Emilio Cobos Álvarez 2021-07-24 12:05:30 +00:00
parent 6c225e7975
commit 38cb903038
3 changed files with 14 additions and 13 deletions

View File

@ -137,9 +137,9 @@ async function userAgentStylesVisible(inspector, view) {
);
ok(
uaRules.some(rule => {
return rule.matchedSelectors.includes("*|*:link");
return rule.matchedSelectors.includes(":link");
}),
"There is a rule for *|*:link"
"There is a rule for :link"
);
ok(
uaRules.some(rule => {

View File

@ -589,17 +589,6 @@ void GlobalStyleSheetCache::BuildPreferenceSheet(
"@namespace svg url(http://www.w3.org/2000/svg);\n");
// Rules for link styling.
nscolor linkColor = aPrefs.mLinkColor;
nscolor activeColor = aPrefs.mActiveLinkColor;
nscolor visitedColor = aPrefs.mVisitedLinkColor;
sheetText.AppendPrintf(
"*|*:link { color: #%02x%02x%02x; }\n"
"*|*:any-link:active { color: #%02x%02x%02x; }\n"
"*|*:visited { color: #%02x%02x%02x; }\n",
NS_GET_R_G_B(linkColor), NS_GET_R_G_B(activeColor),
NS_GET_R_G_B(visitedColor));
bool underlineLinks = aPrefs.mUnderlineLinks;
sheetText.AppendPrintf("*|*:any-link%s { text-decoration: %s; }\n",
underlineLinks ? ":not(svg|a)" : "",

View File

@ -150,6 +150,18 @@
cursor: pointer;
}
:link {
color: LinkText;
}
:any-link:active {
color: ActiveText;
}
:visited {
color: VisitedText;
}
:focus-visible {
/* Don't specify the outline-color, we should always use initial value. */
outline: 1px dotted;