Bug 591341 - Add color keywords for default text and background colors. r=dbaron

This commit is contained in:
Florian Quèze 2011-03-30 11:28:05 +02:00
parent 76d5e4370d
commit 821b553af9
7 changed files with 45 additions and 4 deletions

View File

@ -235,10 +235,12 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#endif
// See nsStyleColor
#define NS_COLOR_MOZ_HYPERLINKTEXT -1
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -2
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -3
#define NS_COLOR_CURRENTCOLOR -4
#define NS_COLOR_CURRENTCOLOR -1
#define NS_COLOR_MOZ_DEFAULT_COLOR -2
#define NS_COLOR_MOZ_DEFAULT_BACKGROUND_COLOR -3
#define NS_COLOR_MOZ_HYPERLINKTEXT -4
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -5
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -6
// See nsStyleBackground
#define NS_STYLE_BG_ATTACHMENT_SCROLL 0

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>-moz-default-background-color and -moz-default-color (bug 591341); reference</title>
</head>
<body>
Test -moz-default-background-color and -moz-default-color (bug 591341).
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>-moz-default-background-color and -moz-default-color (bug 591341)</title>
<style type="text/css">
body {
color: green;
color: -moz-default-color;
background-color: red;
background-color: -moz-default-background-color;
}
</style>
</head>
<body>
Test -moz-default-background-color and -moz-default-color (bug 591341).
</body>
</html>

View File

@ -108,6 +108,9 @@ fails-if(!Android) == background-size-zoom-repeat.html background-size-zoom-repe
fails == background-size-no-intrinsic-width-image.html background-size-no-intrinsic-width-image-ref.html
fails == background-size-no-intrinsic-height-image.html background-size-no-intrinsic-height-image-ref.html
# -moz-default-background-color and -moz-default-color (bug 591341)
== background-moz-default-background-color.html background-moz-default-background-color-ref.html
== fixed-bg-with-transform-outside-viewport-1.html fixed-bg-with-transform-outside-viewport-ref.html
HTTP == root-background-1.html root-background-ref.html

View File

@ -88,6 +88,8 @@ CSS_KEY(-moz-combobox, _moz_combobox)
CSS_KEY(-moz-comboboxtext, _moz_comboboxtext)
CSS_KEY(-moz-block-height, _moz_block_height)
CSS_KEY(-moz-deck, _moz_deck)
CSS_KEY(-moz-default-background-color, _moz_default_background_color)
CSS_KEY(-moz-default-color, _moz_default_color)
CSS_KEY(-moz-desktop, _moz_desktop)
CSS_KEY(-moz-devanagari, _moz_devanagari)
CSS_KEY(-moz-dialog, _moz_dialog)

View File

@ -734,6 +734,8 @@ const PRInt32 nsCSSProps::kColorKTable[] = {
eCSSKeyword__moz_eventreerow, nsILookAndFeel::eColor__moz_eventreerow,
eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field,
eCSSKeyword__moz_fieldtext, nsILookAndFeel::eColor__moz_fieldtext,
eCSSKeyword__moz_default_background_color, NS_COLOR_MOZ_DEFAULT_BACKGROUND_COLOR,
eCSSKeyword__moz_default_color, NS_COLOR_MOZ_DEFAULT_COLOR,
eCSSKeyword__moz_dialog, nsILookAndFeel::eColor__moz_dialog,
eCSSKeyword__moz_dialogtext, nsILookAndFeel::eColor__moz_dialogtext,
eCSSKeyword__moz_dragtargetzone, nsILookAndFeel::eColor__moz_dragtargetzone,

View File

@ -759,6 +759,12 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor,
aCanStoreInRuleTree = PR_FALSE;
aResult = aContext->GetStyleColor()->mColor;
break;
case NS_COLOR_MOZ_DEFAULT_COLOR:
aResult = aPresContext->DefaultColor();
break;
case NS_COLOR_MOZ_DEFAULT_BACKGROUND_COLOR:
aResult = aPresContext->DefaultBackgroundColor();
break;
default:
NS_NOTREACHED("Should never have an unknown negative colorID.");
break;