зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1554433 - Move system colors to values::specified::color. r=xidorn
This should be an idempotent patch. The way to come up with this patch has been: * Run the first script attached to the bug and pipe it to xclip, then paste it in color.rs * Add the relevant #[derive] annotations and remove the color.mako.rs definition. * Reorder the values to match the ColorID definition, on which some widget prefs and caching stuff relies on. * Manually port some documentation from nsLookAndFeel.h * Run `rg 'eColorID_' | cut -d : -f 1 | sort | uniq >files` * Run the second script attached to the bug. * Manually fix usage of `LAST_COLOR` (adding the `End` variant), and adding casts to integer as needed. * Add an static assert so that people remember to update the prefs, rather than a comment on the definition :) Differential Revision: https://phabricator.services.mozilla.com/D32610 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9d68555b48
Коммит
810916db16
|
@ -230,8 +230,8 @@ void nsListControlFrame::PaintFocus(DrawTarget* aDrawTarget, nsPoint aPt) {
|
|||
|
||||
// set up back stop colors and then ask L&F service for the real colors
|
||||
nscolor color = LookAndFeel::GetColor(
|
||||
lastItemIsSelected ? LookAndFeel::eColorID_WidgetSelectForeground
|
||||
: LookAndFeel::eColorID_WidgetSelectBackground);
|
||||
lastItemIsSelected ? LookAndFeel::ColorID::WidgetSelectForeground
|
||||
: LookAndFeel::ColorID::WidgetSelectBackground);
|
||||
|
||||
nsCSSRendering::PaintFocus(presContext, aDrawTarget, fRect, color);
|
||||
}
|
||||
|
|
|
@ -2229,11 +2229,11 @@ Color nsDisplaySelectionOverlay::ComputeColor() const {
|
|||
return ComputeColorFromSelectionStyle(*style);
|
||||
}
|
||||
if (mSelectionValue == nsISelectionController::SELECTION_ON) {
|
||||
colorID = LookAndFeel::eColorID_TextSelectBackground;
|
||||
colorID = LookAndFeel::ColorID::TextSelectBackground;
|
||||
} else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
|
||||
colorID = LookAndFeel::eColorID_TextSelectBackgroundAttention;
|
||||
colorID = LookAndFeel::ColorID::TextSelectBackgroundAttention;
|
||||
} else {
|
||||
colorID = LookAndFeel::eColorID_TextSelectBackgroundDisabled;
|
||||
colorID = LookAndFeel::ColorID::TextSelectBackgroundDisabled;
|
||||
}
|
||||
|
||||
return ApplyTransparencyIfNecessary(
|
||||
|
|
|
@ -1371,16 +1371,16 @@ void nsHTMLFramesetBorderFrame::PaintBorder(DrawTarget* aDrawTarget,
|
|||
if (widthInPixels <= 0) return;
|
||||
|
||||
ColorPattern bgColor(ToDeviceColor(LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_WidgetBackground, NS_RGB(200, 200, 200))));
|
||||
LookAndFeel::ColorID::WidgetBackground, NS_RGB(200, 200, 200))));
|
||||
|
||||
ColorPattern fgColor(ToDeviceColor(LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_WidgetForeground, NS_RGB(0, 0, 0))));
|
||||
LookAndFeel::ColorID::WidgetForeground, NS_RGB(0, 0, 0))));
|
||||
|
||||
ColorPattern hltColor(ToDeviceColor(LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_Widget3DHighlight, NS_RGB(255, 255, 255))));
|
||||
LookAndFeel::ColorID::Widget3DHighlight, NS_RGB(255, 255, 255))));
|
||||
|
||||
ColorPattern sdwColor(ToDeviceColor(LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_Widget3DShadow, NS_RGB(128, 128, 128))));
|
||||
LookAndFeel::ColorID::Widget3DShadow, NS_RGB(128, 128, 128))));
|
||||
|
||||
ColorPattern color(ToDeviceColor(NS_RGB(255, 255, 255))); // default to white
|
||||
if (mVisibility) {
|
||||
|
|
|
@ -3903,9 +3903,9 @@ void nsTextPaintStyle::GetHighlightColors(nscolor* aForeColor,
|
|||
|
||||
if (!customColors) {
|
||||
nscolor backColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightBackground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextHighlightBackground);
|
||||
nscolor foreColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextHighlightForeground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextHighlightForeground);
|
||||
EnsureSufficientContrast(&foreColor, &backColor);
|
||||
*aForeColor = foreColor;
|
||||
*aBackColor = backColor;
|
||||
|
@ -4037,9 +4037,9 @@ void nsTextPaintStyle::InitCommonColors() {
|
|||
mFrameBackgroundColor = NS_ComposeColors(defaultBgColor, bgColor);
|
||||
|
||||
mSystemFieldForegroundColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID__moz_fieldtext);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::MozFieldtext);
|
||||
mSystemFieldBackgroundColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID__moz_field);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::MozField);
|
||||
|
||||
if (bgFrame->IsThemed()) {
|
||||
// Assume a native widget has sufficient contrast always
|
||||
|
@ -4052,11 +4052,11 @@ void nsTextPaintStyle::InitCommonColors() {
|
|||
"default background color is not opaque");
|
||||
|
||||
nscolor defaultWindowBackgroundColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::WindowBackground);
|
||||
nscolor selectionTextColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground);
|
||||
nscolor selectionBGColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground);
|
||||
|
||||
mSufficientContrast = std::min(
|
||||
std::min(NS_SUFFICIENT_LUMINOSITY_DIFFERENCE,
|
||||
|
@ -4104,16 +4104,16 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() {
|
|||
}
|
||||
|
||||
nscolor selectionBGColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground);
|
||||
|
||||
if (selectionStatus == nsISelectionController::SELECTION_ATTENTION) {
|
||||
mSelectionBGColor = LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_TextSelectBackgroundAttention);
|
||||
LookAndFeel::ColorID::TextSelectBackgroundAttention);
|
||||
mSelectionBGColor =
|
||||
EnsureDifferentColors(mSelectionBGColor, selectionBGColor);
|
||||
} else if (selectionStatus != nsISelectionController::SELECTION_ON) {
|
||||
mSelectionBGColor = LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_TextSelectBackgroundDisabled);
|
||||
LookAndFeel::ColorID::TextSelectBackgroundDisabled);
|
||||
mSelectionBGColor =
|
||||
EnsureDifferentColors(mSelectionBGColor, selectionBGColor);
|
||||
} else {
|
||||
|
@ -4121,7 +4121,7 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() {
|
|||
}
|
||||
|
||||
mSelectionTextColor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground);
|
||||
|
||||
if (mResolveColors) {
|
||||
// On MacOS X, only the background color gets set,
|
||||
|
@ -4142,7 +4142,7 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() {
|
|||
&nsStyleText::mWebkitTextFillColor);
|
||||
if (frameColor == mSelectionBGColor) {
|
||||
mSelectionTextColor = LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_TextSelectForegroundCustom);
|
||||
LookAndFeel::ColorID::TextSelectForegroundCustom);
|
||||
}
|
||||
} else {
|
||||
EnsureSufficientContrast(&mSelectionTextColor, &mSelectionBGColor);
|
||||
|
@ -4167,28 +4167,28 @@ struct StyleIDs {
|
|||
LookAndFeel::FloatID mLineRelativeSize;
|
||||
};
|
||||
static StyleIDs SelectionStyleIDs[] = {
|
||||
{LookAndFeel::eColorID_IMERawInputForeground,
|
||||
LookAndFeel::eColorID_IMERawInputBackground,
|
||||
LookAndFeel::eColorID_IMERawInputUnderline,
|
||||
{LookAndFeel::ColorID::IMERawInputForeground,
|
||||
LookAndFeel::ColorID::IMERawInputBackground,
|
||||
LookAndFeel::ColorID::IMERawInputUnderline,
|
||||
LookAndFeel::eIntID_IMERawInputUnderlineStyle,
|
||||
LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
|
||||
{LookAndFeel::eColorID_IMESelectedRawTextForeground,
|
||||
LookAndFeel::eColorID_IMESelectedRawTextBackground,
|
||||
LookAndFeel::eColorID_IMESelectedRawTextUnderline,
|
||||
{LookAndFeel::ColorID::IMESelectedRawTextForeground,
|
||||
LookAndFeel::ColorID::IMESelectedRawTextBackground,
|
||||
LookAndFeel::ColorID::IMESelectedRawTextUnderline,
|
||||
LookAndFeel::eIntID_IMESelectedRawTextUnderlineStyle,
|
||||
LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
|
||||
{LookAndFeel::eColorID_IMEConvertedTextForeground,
|
||||
LookAndFeel::eColorID_IMEConvertedTextBackground,
|
||||
LookAndFeel::eColorID_IMEConvertedTextUnderline,
|
||||
{LookAndFeel::ColorID::IMEConvertedTextForeground,
|
||||
LookAndFeel::ColorID::IMEConvertedTextBackground,
|
||||
LookAndFeel::ColorID::IMEConvertedTextUnderline,
|
||||
LookAndFeel::eIntID_IMEConvertedTextUnderlineStyle,
|
||||
LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
|
||||
{LookAndFeel::eColorID_IMESelectedConvertedTextForeground,
|
||||
LookAndFeel::eColorID_IMESelectedConvertedTextBackground,
|
||||
LookAndFeel::eColorID_IMESelectedConvertedTextUnderline,
|
||||
{LookAndFeel::ColorID::IMESelectedConvertedTextForeground,
|
||||
LookAndFeel::ColorID::IMESelectedConvertedTextBackground,
|
||||
LookAndFeel::ColorID::IMESelectedConvertedTextUnderline,
|
||||
LookAndFeel::eIntID_IMESelectedConvertedTextUnderline,
|
||||
LookAndFeel::eFloatID_IMEUnderlineRelativeSize},
|
||||
{LookAndFeel::eColorID_LAST_COLOR, LookAndFeel::eColorID_LAST_COLOR,
|
||||
LookAndFeel::eColorID_SpellCheckerUnderline,
|
||||
{LookAndFeel::ColorID::End, LookAndFeel::ColorID::End,
|
||||
LookAndFeel::ColorID::SpellCheckerUnderline,
|
||||
LookAndFeel::eIntID_SpellCheckerUnderlineStyle,
|
||||
LookAndFeel::eFloatID_SpellCheckerUnderlineRelativeSize}};
|
||||
|
||||
|
@ -4200,12 +4200,12 @@ void nsTextPaintStyle::InitSelectionStyle(int32_t aIndex) {
|
|||
StyleIDs* styleIDs = &SelectionStyleIDs[aIndex];
|
||||
|
||||
nscolor foreColor, backColor;
|
||||
if (styleIDs->mForeground == LookAndFeel::eColorID_LAST_COLOR) {
|
||||
if (styleIDs->mForeground == LookAndFeel::ColorID::End) {
|
||||
foreColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
} else {
|
||||
foreColor = LookAndFeel::GetColor(styleIDs->mForeground);
|
||||
}
|
||||
if (styleIDs->mBackground == LookAndFeel::eColorID_LAST_COLOR) {
|
||||
if (styleIDs->mBackground == LookAndFeel::ColorID::End) {
|
||||
backColor = NS_TRANSPARENT;
|
||||
} else {
|
||||
backColor = LookAndFeel::GetColor(styleIDs->mBackground);
|
||||
|
|
|
@ -1709,7 +1709,7 @@ void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
|
|||
*drawTarget);
|
||||
// get color to use for selection from the look&feel object
|
||||
nscolor bgColor = LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_TextSelectBackground, NS_RGB(0, 0, 0));
|
||||
LookAndFeel::ColorID::TextSelectBackground, NS_RGB(0, 0, 0));
|
||||
drawTarget->FillRect(rect, ColorPattern(ToDeviceColor(bgColor)));
|
||||
}
|
||||
|
||||
|
@ -1897,7 +1897,7 @@ void nsMathMLChar::PaintForeground(nsIFrame* aForFrame,
|
|||
&nsStyleText::mWebkitTextFillColor);
|
||||
if (aIsSelected) {
|
||||
// get color to use for selection from the look&feel object
|
||||
fgColor = LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
|
||||
fgColor = LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground,
|
||||
fgColor);
|
||||
}
|
||||
aRenderingContext.SetColor(Color::FromABGR(fgColor));
|
||||
|
|
|
@ -62,17 +62,17 @@ void PreferenceSheet::Prefs::Load(bool aIsChrome) {
|
|||
|
||||
if (nsContentUtils::UseStandinsForNativeColors()) {
|
||||
mDefaultColor = LookAndFeel::GetColorUsingStandins(
|
||||
LookAndFeel::eColorID_windowtext, mDefaultColor);
|
||||
LookAndFeel::ColorID::Windowtext, mDefaultColor);
|
||||
mDefaultBackgroundColor = LookAndFeel::GetColorUsingStandins(
|
||||
LookAndFeel::eColorID_window, mDefaultBackgroundColor);
|
||||
LookAndFeel::ColorID::Window, mDefaultBackgroundColor);
|
||||
} else if (usePrefColors) {
|
||||
GetColor("browser.display.background_color", mDefaultBackgroundColor);
|
||||
GetColor("browser.display.foreground_color", mDefaultColor);
|
||||
} else {
|
||||
mDefaultColor = LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_WindowForeground, mDefaultColor);
|
||||
LookAndFeel::ColorID::WindowForeground, mDefaultColor);
|
||||
mDefaultBackgroundColor = LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_WindowBackground, mDefaultBackgroundColor);
|
||||
LookAndFeel::ColorID::WindowBackground, mDefaultBackgroundColor);
|
||||
}
|
||||
|
||||
GetColor("browser.anchor_color", mLinkColor);
|
||||
|
|
|
@ -476,6 +476,7 @@ cbindgen-types = [
|
|||
{ gecko = "StyleGenericFontFamily", servo = "values::computed::font::GenericFontFamily" },
|
||||
{ gecko = "StyleFontFamilyNameSyntax", servo = "values::computed::font::FontFamilyNameSyntax" },
|
||||
{ gecko = "StyleGenericColor", servo = "values::generics::color::Color" },
|
||||
{ gecko = "StyleSystemColor", servo = "values::specified::color::SystemColor" },
|
||||
{ gecko = "StyleGenericColorOrAuto", servo = "values::generics::color::ColorOrAuto" },
|
||||
{ gecko = "StyleGenericScrollbarColor", servo = "values::generics::ui::ScrollbarColor" },
|
||||
{ gecko = "StyleRGBA", servo = "cssparser::RGBA" },
|
||||
|
|
|
@ -281,7 +281,7 @@ void nsTableCellFrame::DecorateForSelection(DrawTarget* aDrawTarget,
|
|||
bordercolor = NS_RGB(176, 176, 176); // disabled color
|
||||
} else {
|
||||
bordercolor =
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground);
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground);
|
||||
}
|
||||
nscoord threePx = nsPresContext::CSSPixelsToAppUnits(3);
|
||||
if ((mRect.width > threePx) && (mRect.height > threePx)) {
|
||||
|
|
|
@ -17,114 +17,3 @@ ${helpers.predefined_type(
|
|||
ignored_when_colors_disabled="True",
|
||||
spec="https://drafts.csswg.org/css-color/#color",
|
||||
)}
|
||||
|
||||
// FIXME(#15973): Add servo support for system colors
|
||||
//
|
||||
// FIXME(emilio): Move outside of mako.
|
||||
% if product == "gecko":
|
||||
pub mod system_colors {
|
||||
<%
|
||||
# These are actually parsed. See nsCSSProps::kColorKTable
|
||||
system_colors = """activeborder activecaption appworkspace background buttonface
|
||||
buttonhighlight buttonshadow buttontext captiontext graytext highlight
|
||||
highlighttext inactiveborder inactivecaption inactivecaptiontext
|
||||
infobackground infotext menu menutext scrollbar threeddarkshadow
|
||||
threedface threedhighlight threedlightshadow threedshadow window
|
||||
windowframe windowtext -moz-buttondefault -moz-buttonhoverface
|
||||
-moz-buttonhovertext -moz-cellhighlight -moz-cellhighlighttext
|
||||
-moz-eventreerow -moz-field -moz-fieldtext -moz-dialog -moz-dialogtext
|
||||
-moz-dragtargetzone -moz-gtk-info-bar-text -moz-html-cellhighlight
|
||||
-moz-html-cellhighlighttext -moz-mac-buttonactivetext
|
||||
-moz-gtk-buttonactivetext
|
||||
-moz-mac-chrome-active -moz-mac-chrome-inactive
|
||||
-moz-mac-defaultbuttontext -moz-mac-focusring -moz-mac-menuselect
|
||||
-moz-mac-menushadow -moz-mac-menutextdisable -moz-mac-menutextselect
|
||||
-moz-mac-disabledtoolbartext -moz-mac-secondaryhighlight
|
||||
-moz-mac-vibrancy-light -moz-mac-vibrancy-dark
|
||||
-moz-mac-vibrant-titlebar-light -moz-mac-vibrant-titlebar-dark
|
||||
-moz-mac-menupopup
|
||||
-moz-mac-menuitem -moz-mac-active-menuitem -moz-mac-source-list
|
||||
-moz-mac-source-list-selection -moz-mac-active-source-list-selection
|
||||
-moz-mac-tooltip
|
||||
-moz-menuhover -moz-menuhovertext -moz-menubartext -moz-menubarhovertext
|
||||
-moz-oddtreerow -moz-win-mediatext -moz-win-communicationstext
|
||||
-moz-win-accentcolor -moz-win-accentcolortext
|
||||
-moz-nativehyperlinktext -moz-comboboxtext -moz-combobox""".split()
|
||||
|
||||
# These are not parsed but must be serialized
|
||||
# They are only ever set directly by Gecko
|
||||
extra_colors = """WindowBackground WindowForeground WidgetBackground WidgetForeground
|
||||
WidgetSelectBackground WidgetSelectForeground Widget3DHighlight Widget3DShadow
|
||||
TextBackground TextForeground TextSelectBackground TextSelectForeground
|
||||
TextSelectForegroundCustom TextSelectBackgroundDisabled TextSelectBackgroundAttention
|
||||
TextHighlightBackground TextHighlightForeground IMERawInputBackground
|
||||
IMERawInputForeground IMERawInputUnderline IMESelectedRawTextBackground
|
||||
IMESelectedRawTextForeground IMESelectedRawTextUnderline
|
||||
IMEConvertedTextBackground IMEConvertedTextForeground IMEConvertedTextUnderline
|
||||
IMESelectedConvertedTextBackground IMESelectedConvertedTextForeground
|
||||
IMESelectedConvertedTextUnderline SpellCheckerUnderline""".split()
|
||||
%>
|
||||
use crate::gecko_bindings::bindings::Gecko_GetLookAndFeelSystemColor;
|
||||
use crate::gecko_bindings::structs::root::mozilla::LookAndFeel_ColorID;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use to_shmem::impl_trivial_to_shmem;
|
||||
use crate::values::computed::{Context, ToComputedValue};
|
||||
|
||||
pub type SystemColor = LookAndFeel_ColorID;
|
||||
|
||||
// It's hard to implement MallocSizeOf for LookAndFeel_ColorID because it
|
||||
// is a bindgen type. So we implement it on the typedef instead.
|
||||
malloc_size_of_is_0!(SystemColor);
|
||||
|
||||
impl_trivial_to_shmem!(SystemColor);
|
||||
|
||||
impl ToCss for SystemColor {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
let s = match *self {
|
||||
% for color in system_colors + extra_colors:
|
||||
LookAndFeel_ColorID::eColorID_${to_rust_ident(color)} => "${color}",
|
||||
% endfor
|
||||
LookAndFeel_ColorID::eColorID_LAST_COLOR => unreachable!(),
|
||||
};
|
||||
dest.write_str(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToComputedValue for SystemColor {
|
||||
type ComputedValue = u32; // nscolor
|
||||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, cx: &Context) -> Self::ComputedValue {
|
||||
unsafe {
|
||||
Gecko_GetLookAndFeelSystemColor(
|
||||
*self as i32,
|
||||
cx.device().document(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_computed_value(_: &Self::ComputedValue) -> Self {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
impl SystemColor {
|
||||
pub fn from_ident<'i, 't>(ident: &str) -> Result<Self, ()> {
|
||||
ascii_case_insensitive_phf_map! {
|
||||
color_name -> SystemColor = {
|
||||
% for color in system_colors:
|
||||
"${color}" => LookAndFeel_ColorID::eColorID_${to_rust_ident(color)},
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
|
||||
color_name(ident).cloned().ok_or(())
|
||||
}
|
||||
}
|
||||
}
|
||||
% endif
|
||||
|
|
|
@ -8,8 +8,6 @@ use super::AllowQuirks;
|
|||
#[cfg(feature = "gecko")]
|
||||
use crate::gecko_bindings::structs::nscolor;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::properties::longhands::system_colors::SystemColor;
|
||||
use crate::values::computed::{Color as ComputedColor, Context, ToComputedValue};
|
||||
use crate::values::generics::color::{Color as GenericColor, ColorOrAuto as GenericColorOrAuto};
|
||||
use crate::values::specified::calc::CalcNode;
|
||||
|
@ -35,7 +33,6 @@ pub enum Color {
|
|||
},
|
||||
/// A complex color value from computed value
|
||||
Complex(ComputedColor),
|
||||
|
||||
/// A system color
|
||||
#[cfg(feature = "gecko")]
|
||||
System(SystemColor),
|
||||
|
@ -47,6 +44,215 @@ pub enum Color {
|
|||
InheritFromBodyQuirk,
|
||||
}
|
||||
|
||||
/// System colors.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg(feature = "gecko")]
|
||||
#[derive(Copy, Clone, Debug, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
|
||||
#[repr(u8)]
|
||||
pub enum SystemColor {
|
||||
#[css(skip)]
|
||||
WindowBackground,
|
||||
#[css(skip)]
|
||||
WindowForeground,
|
||||
#[css(skip)]
|
||||
WidgetBackground,
|
||||
#[css(skip)]
|
||||
WidgetForeground,
|
||||
#[css(skip)]
|
||||
WidgetSelectBackground,
|
||||
#[css(skip)]
|
||||
WidgetSelectForeground,
|
||||
#[css(skip)]
|
||||
Widget3DHighlight,
|
||||
#[css(skip)]
|
||||
Widget3DShadow,
|
||||
#[css(skip)]
|
||||
TextBackground,
|
||||
#[css(skip)]
|
||||
TextForeground,
|
||||
#[css(skip)]
|
||||
TextSelectBackground,
|
||||
#[css(skip)]
|
||||
TextSelectForeground,
|
||||
#[css(skip)]
|
||||
TextSelectForegroundCustom,
|
||||
#[css(skip)]
|
||||
TextSelectBackgroundDisabled,
|
||||
#[css(skip)]
|
||||
TextSelectBackgroundAttention,
|
||||
#[css(skip)]
|
||||
TextHighlightBackground,
|
||||
#[css(skip)]
|
||||
TextHighlightForeground,
|
||||
#[css(skip)]
|
||||
IMERawInputBackground,
|
||||
#[css(skip)]
|
||||
IMERawInputForeground,
|
||||
#[css(skip)]
|
||||
IMERawInputUnderline,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextBackground,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextForeground,
|
||||
#[css(skip)]
|
||||
IMESelectedRawTextUnderline,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextBackground,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextForeground,
|
||||
#[css(skip)]
|
||||
IMEConvertedTextUnderline,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextBackground,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextForeground,
|
||||
#[css(skip)]
|
||||
IMESelectedConvertedTextUnderline,
|
||||
#[css(skip)]
|
||||
SpellCheckerUnderline,
|
||||
Activeborder,
|
||||
Activecaption,
|
||||
Appworkspace,
|
||||
Background,
|
||||
Buttonface,
|
||||
Buttonhighlight,
|
||||
Buttonshadow,
|
||||
Buttontext,
|
||||
Captiontext,
|
||||
Graytext,
|
||||
Highlight,
|
||||
Highlighttext,
|
||||
Inactiveborder,
|
||||
Inactivecaption,
|
||||
Inactivecaptiontext,
|
||||
Infobackground,
|
||||
Infotext,
|
||||
Menu,
|
||||
Menutext,
|
||||
Scrollbar,
|
||||
Threeddarkshadow,
|
||||
Threedface,
|
||||
Threedhighlight,
|
||||
Threedlightshadow,
|
||||
Threedshadow,
|
||||
Window,
|
||||
Windowframe,
|
||||
Windowtext,
|
||||
MozButtondefault,
|
||||
MozField,
|
||||
MozFieldtext,
|
||||
MozDialog,
|
||||
MozDialogtext,
|
||||
/// Used to highlight valid regions to drop something onto.
|
||||
MozDragtargetzone,
|
||||
/// Used for selected but not focused cell backgrounds.
|
||||
MozCellhighlight,
|
||||
/// Used for selected but not focused cell text.
|
||||
MozCellhighlighttext,
|
||||
/// Used for selected but not focused html cell backgrounds.
|
||||
MozHtmlCellhighlight,
|
||||
/// Used for selected but not focused html cell text.
|
||||
MozHtmlCellhighlighttext,
|
||||
/// Used to button text background when hovered.
|
||||
MozButtonhoverface,
|
||||
/// Used to button text color when hovered.
|
||||
MozButtonhovertext,
|
||||
/// Used for menu item backgrounds when hovered.
|
||||
MozMenuhover,
|
||||
/// Used for menu item text when hovered.
|
||||
MozMenuhovertext,
|
||||
/// Used for menubar item text.
|
||||
MozMenubartext,
|
||||
/// Used for menubar item text when hovered.
|
||||
MozMenubarhovertext,
|
||||
|
||||
/// On platforms where these colors are the same as -moz-field, use
|
||||
/// -moz-fieldtext as foreground color
|
||||
MozEventreerow,
|
||||
MozOddtreerow,
|
||||
|
||||
/// Used for button text when pressed.
|
||||
MozGtkButtonactivetext,
|
||||
|
||||
/// Used for button text when pressed.
|
||||
MozMacButtonactivetext,
|
||||
/// Background color of chrome toolbars in active windows.
|
||||
MozMacChromeActive,
|
||||
/// Background color of chrome toolbars in inactive windows.
|
||||
MozMacChromeInactive,
|
||||
/// Foreground color of default buttons.
|
||||
MozMacDefaultbuttontext,
|
||||
/// Ring color around text fields and lists.
|
||||
MozMacFocusring,
|
||||
/// Color used when mouse is over a menu item.
|
||||
MozMacMenuselect,
|
||||
/// Color used to do shadows on menu items.
|
||||
MozMacMenushadow,
|
||||
/// Color used to display text for disabled menu items.
|
||||
MozMacMenutextdisable,
|
||||
/// Color used to display text while mouse is over a menu item.
|
||||
MozMacMenutextselect,
|
||||
/// Text color of disabled text on toolbars.
|
||||
MozMacDisabledtoolbartext,
|
||||
/// Inactive light hightlight
|
||||
MozMacSecondaryhighlight,
|
||||
|
||||
/// Font smoothing background colors needed by the Mac OS X theme, based on
|
||||
/// -moz-appearance names.
|
||||
MozMacVibrancyLight,
|
||||
MozMacVibrancyDark,
|
||||
MozMacVibrantTitlebarLight,
|
||||
MozMacVibrantTitlebarDark,
|
||||
MozMacMenupopup,
|
||||
MozMacMenuitem,
|
||||
MozMacActiveMenuitem,
|
||||
MozMacSourceList,
|
||||
MozMacSourceListSelection,
|
||||
MozMacActiveSourceListSelection,
|
||||
MozMacTooltip,
|
||||
|
||||
/// Accent color for title bar.
|
||||
MozWinAccentcolor,
|
||||
/// Color from drawing text over the accent color.
|
||||
MozWinAccentcolortext,
|
||||
/// Media rebar text.
|
||||
MozWinMediatext,
|
||||
/// Communications rebar text.
|
||||
MozWinCommunicationstext,
|
||||
|
||||
/// Hyperlink color extracted from the system, not affected by the
|
||||
/// browser.anchor_color user pref.
|
||||
///
|
||||
/// There is no OS-specified safe background color for this text, but it is
|
||||
/// used regularly within Windows and the Gnome DE on Dialog and Window
|
||||
/// colors.
|
||||
MozNativehyperlinktext,
|
||||
|
||||
/// Combobox widgets
|
||||
MozComboboxtext,
|
||||
MozCombobox,
|
||||
|
||||
MozGtkInfoBarText,
|
||||
|
||||
#[css(skip)]
|
||||
End, // Just for array-indexing purposes.
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl SystemColor {
|
||||
#[inline]
|
||||
fn compute(&self, cx: &Context) -> ComputedColor {
|
||||
use crate::gecko_bindings::bindings;
|
||||
unsafe {
|
||||
convert_nscolor_to_computedcolor(bindings::Gecko_GetLookAndFeelSystemColor(
|
||||
*self as i32,
|
||||
cx.device().document(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
mod gecko {
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
|
||||
|
@ -340,32 +546,29 @@ impl Color {
|
|||
/// If `context` is `None`, and the specified color requires data from
|
||||
/// the context to resolve, then `None` is returned.
|
||||
pub fn to_computed_color(&self, _context: Option<&Context>) -> Option<ComputedColor> {
|
||||
match *self {
|
||||
Color::CurrentColor => Some(ComputedColor::currentcolor()),
|
||||
Color::Numeric { ref parsed, .. } => Some(ComputedColor::rgba(*parsed)),
|
||||
Color::Complex(ref complex) => Some(*complex),
|
||||
Some(match *self {
|
||||
Color::CurrentColor => ComputedColor::currentcolor(),
|
||||
Color::Numeric { ref parsed, .. } => ComputedColor::rgba(*parsed),
|
||||
Color::Complex(ref complex) => *complex,
|
||||
#[cfg(feature = "gecko")]
|
||||
Color::System(system) => _context
|
||||
.map(|context| convert_nscolor_to_computedcolor(system.to_computed_value(context))),
|
||||
Color::System(system) => system.compute(_context?),
|
||||
#[cfg(feature = "gecko")]
|
||||
Color::Special(special) => {
|
||||
use self::gecko::SpecialColorKeyword as Keyword;
|
||||
_context.map(|context| {
|
||||
let prefs = context.device().pref_sheet_prefs();
|
||||
convert_nscolor_to_computedcolor(match special {
|
||||
Keyword::MozDefaultColor => prefs.mDefaultColor,
|
||||
Keyword::MozDefaultBackgroundColor => prefs.mDefaultBackgroundColor,
|
||||
Keyword::MozHyperlinktext => prefs.mLinkColor,
|
||||
Keyword::MozActivehyperlinktext => prefs.mActiveLinkColor,
|
||||
Keyword::MozVisitedhyperlinktext => prefs.mVisitedLinkColor,
|
||||
})
|
||||
let prefs = _context?.device().pref_sheet_prefs();
|
||||
convert_nscolor_to_computedcolor(match special {
|
||||
Keyword::MozDefaultColor => prefs.mDefaultColor,
|
||||
Keyword::MozDefaultBackgroundColor => prefs.mDefaultBackgroundColor,
|
||||
Keyword::MozHyperlinktext => prefs.mLinkColor,
|
||||
Keyword::MozActivehyperlinktext => prefs.mActiveLinkColor,
|
||||
Keyword::MozVisitedhyperlinktext => prefs.mVisitedLinkColor,
|
||||
})
|
||||
},
|
||||
#[cfg(feature = "gecko")]
|
||||
Color::InheritFromBodyQuirk => {
|
||||
_context.map(|context| ComputedColor::rgba(context.device().body_text_color()))
|
||||
ComputedColor::rgba(_context?.device().body_text_color())
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ include = [
|
|||
"ScrollbarColor",
|
||||
"Color",
|
||||
"ColorOrAuto",
|
||||
"SystemColor",
|
||||
"GradientItem",
|
||||
"VerticalAlign",
|
||||
"BasicShape",
|
||||
|
|
|
@ -124,7 +124,7 @@ already_AddRefed<nsWebBrowser> nsWebBrowser::Create(
|
|||
browser->SetDocShell(docShell);
|
||||
|
||||
// get the system default window background colour
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground,
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::WindowBackground,
|
||||
&browser->mBackgroundColor);
|
||||
|
||||
// HACK ALERT - this registration registers the nsDocShellTreeOwner as a
|
||||
|
|
|
@ -26,186 +26,11 @@ struct LookAndFeelInt {
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
enum class StyleSystemColor : uint8_t;
|
||||
|
||||
class LookAndFeel {
|
||||
public:
|
||||
// When modifying this list, also modify nsXPLookAndFeel::sColorPrefs
|
||||
// in widget/xpwidgts/nsXPLookAndFeel.cpp.
|
||||
enum ColorID : uint8_t {
|
||||
|
||||
// WARNING : NO NEGATIVE VALUE IN THIS ENUMERATION
|
||||
// see patch in bug 57757 for more information
|
||||
|
||||
eColorID_WindowBackground,
|
||||
eColorID_WindowForeground,
|
||||
eColorID_WidgetBackground,
|
||||
eColorID_WidgetForeground,
|
||||
eColorID_WidgetSelectBackground,
|
||||
eColorID_WidgetSelectForeground,
|
||||
eColorID_Widget3DHighlight,
|
||||
eColorID_Widget3DShadow,
|
||||
eColorID_TextBackground,
|
||||
eColorID_TextForeground,
|
||||
eColorID_TextSelectBackground,
|
||||
eColorID_TextSelectForeground,
|
||||
eColorID_TextSelectForegroundCustom,
|
||||
eColorID_TextSelectBackgroundDisabled,
|
||||
eColorID_TextSelectBackgroundAttention,
|
||||
eColorID_TextHighlightBackground,
|
||||
eColorID_TextHighlightForeground,
|
||||
|
||||
eColorID_IMERawInputBackground,
|
||||
eColorID_IMERawInputForeground,
|
||||
eColorID_IMERawInputUnderline,
|
||||
eColorID_IMESelectedRawTextBackground,
|
||||
eColorID_IMESelectedRawTextForeground,
|
||||
eColorID_IMESelectedRawTextUnderline,
|
||||
eColorID_IMEConvertedTextBackground,
|
||||
eColorID_IMEConvertedTextForeground,
|
||||
eColorID_IMEConvertedTextUnderline,
|
||||
eColorID_IMESelectedConvertedTextBackground,
|
||||
eColorID_IMESelectedConvertedTextForeground,
|
||||
eColorID_IMESelectedConvertedTextUnderline,
|
||||
|
||||
eColorID_SpellCheckerUnderline,
|
||||
|
||||
// New CSS 2 color definitions
|
||||
eColorID_activeborder,
|
||||
eColorID_activecaption,
|
||||
eColorID_appworkspace,
|
||||
eColorID_background,
|
||||
eColorID_buttonface,
|
||||
eColorID_buttonhighlight,
|
||||
eColorID_buttonshadow,
|
||||
eColorID_buttontext,
|
||||
eColorID_captiontext,
|
||||
eColorID_graytext,
|
||||
eColorID_highlight,
|
||||
eColorID_highlighttext,
|
||||
eColorID_inactiveborder,
|
||||
eColorID_inactivecaption,
|
||||
eColorID_inactivecaptiontext,
|
||||
eColorID_infobackground,
|
||||
eColorID_infotext,
|
||||
eColorID_menu,
|
||||
eColorID_menutext,
|
||||
eColorID_scrollbar,
|
||||
eColorID_threeddarkshadow,
|
||||
eColorID_threedface,
|
||||
eColorID_threedhighlight,
|
||||
eColorID_threedlightshadow,
|
||||
eColorID_threedshadow,
|
||||
eColorID_window,
|
||||
eColorID_windowframe,
|
||||
eColorID_windowtext,
|
||||
|
||||
eColorID__moz_buttondefault,
|
||||
// Colors which will hopefully become CSS3
|
||||
eColorID__moz_field,
|
||||
eColorID__moz_fieldtext,
|
||||
eColorID__moz_dialog,
|
||||
eColorID__moz_dialogtext,
|
||||
// used to highlight valid regions to drop something onto
|
||||
eColorID__moz_dragtargetzone,
|
||||
|
||||
// used to cell text background, selected but not focus.
|
||||
// It is not necessarily a system color, but it is
|
||||
// distinct from -moz-appearance: listbox; and Highlight
|
||||
eColorID__moz_cellhighlight,
|
||||
// used to cell text, selected but not focus
|
||||
eColorID__moz_cellhighlighttext,
|
||||
// used to html select cell text background, selected but not focus
|
||||
eColorID__moz_html_cellhighlight,
|
||||
// used to html select cell text, selected but not focus
|
||||
eColorID__moz_html_cellhighlighttext,
|
||||
// used to button text background, when mouse is over
|
||||
eColorID__moz_buttonhoverface,
|
||||
// used to button text, when mouse is over
|
||||
eColorID__moz_buttonhovertext,
|
||||
// used to menu item background, when mouse is over
|
||||
eColorID__moz_menuhover,
|
||||
// used to menu item text, when mouse is over
|
||||
eColorID__moz_menuhovertext,
|
||||
// used to menu bar item text
|
||||
eColorID__moz_menubartext,
|
||||
// used to menu bar item text, when mouse is over
|
||||
eColorID__moz_menubarhovertext,
|
||||
// On platforms where these colors are the same as
|
||||
// -moz-field, use -moz-fieldtext as foreground color
|
||||
eColorID__moz_eventreerow,
|
||||
eColorID__moz_oddtreerow,
|
||||
|
||||
// colors needed by the Linux Gtk theme
|
||||
|
||||
// used to button text, when button is pressed
|
||||
eColorID__moz_gtk_buttonactivetext,
|
||||
|
||||
// colors needed by the Mac OS X theme
|
||||
|
||||
// foreground color of :hover:active buttons
|
||||
eColorID__moz_mac_buttonactivetext,
|
||||
// background color of chrome toolbars in active windows
|
||||
eColorID__moz_mac_chrome_active,
|
||||
// background color of chrome toolbars in inactive windows
|
||||
eColorID__moz_mac_chrome_inactive,
|
||||
// foreground color of default buttons
|
||||
eColorID__moz_mac_defaultbuttontext,
|
||||
// ring around text fields and lists
|
||||
eColorID__moz_mac_focusring,
|
||||
// colour used when mouse is over a menu item
|
||||
eColorID__moz_mac_menuselect,
|
||||
// colour used to do shadows on menu items
|
||||
eColorID__moz_mac_menushadow,
|
||||
// color used to display text for disabled menu items
|
||||
eColorID__moz_mac_menutextdisable,
|
||||
// colour used to display text while mouse is over a menu item
|
||||
eColorID__moz_mac_menutextselect,
|
||||
// text color of disabled text on toolbars
|
||||
eColorID__moz_mac_disabledtoolbartext,
|
||||
// inactive light hightlight
|
||||
eColorID__moz_mac_secondaryhighlight,
|
||||
|
||||
// Font smoothing background colors needed by the Mac OS X theme, based
|
||||
// on -moz-appearance names
|
||||
eColorID__moz_mac_vibrancy_light,
|
||||
eColorID__moz_mac_vibrancy_dark,
|
||||
eColorID__moz_mac_vibrant_titlebar_light,
|
||||
eColorID__moz_mac_vibrant_titlebar_dark,
|
||||
eColorID__moz_mac_menupopup,
|
||||
eColorID__moz_mac_menuitem,
|
||||
eColorID__moz_mac_active_menuitem,
|
||||
eColorID__moz_mac_source_list,
|
||||
eColorID__moz_mac_source_list_selection,
|
||||
eColorID__moz_mac_active_source_list_selection,
|
||||
eColorID__moz_mac_tooltip,
|
||||
|
||||
// vista rebars
|
||||
|
||||
// accent color for title bar
|
||||
eColorID__moz_win_accentcolor,
|
||||
// color from drawing text over the accent color
|
||||
eColorID__moz_win_accentcolortext,
|
||||
// media rebar text
|
||||
eColorID__moz_win_mediatext,
|
||||
// communications rebar text
|
||||
eColorID__moz_win_communicationstext,
|
||||
|
||||
// Hyperlink color extracted from the system, not affected by the
|
||||
// browser.anchor_color user pref.
|
||||
// There is no OS-specified safe background color for this text,
|
||||
// but it is used regularly within Windows and the Gnome DE on Dialog and
|
||||
// Window colors.
|
||||
eColorID__moz_nativehyperlinktext,
|
||||
|
||||
// Combo box widgets
|
||||
eColorID__moz_comboboxtext,
|
||||
eColorID__moz_combobox,
|
||||
|
||||
// GtkInfoBar
|
||||
eColorID__moz_gtk_info_bar_text,
|
||||
|
||||
// keep this one last, please
|
||||
eColorID_LAST_COLOR
|
||||
};
|
||||
using ColorID = StyleSystemColor;
|
||||
|
||||
// When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
|
||||
// in widget/xpwidgts/nsXPLookAndFeel.cpp.
|
||||
|
@ -587,8 +412,8 @@ class LookAndFeel {
|
|||
* which returns nscolor directly.
|
||||
*
|
||||
* NOTE:
|
||||
* eColorID_TextSelectForeground might return NS_DONT_CHANGE_COLOR.
|
||||
* eColorID_IME* might return NS_TRANSPARENT, NS_SAME_AS_FOREGROUND_COLOR or
|
||||
* ColorID::TextSelectForeground might return NS_DONT_CHANGE_COLOR.
|
||||
* ColorID::IME* might return NS_TRANSPARENT, NS_SAME_AS_FOREGROUND_COLOR or
|
||||
* NS_40PERCENT_FOREGROUND_COLOR.
|
||||
* These values have particular meaning. Then, they are not an actual
|
||||
* color value.
|
||||
|
@ -713,7 +538,7 @@ class LookAndFeel {
|
|||
|
||||
} // namespace mozilla
|
||||
|
||||
// On the Mac, GetColor(eColorID_TextSelectForeground, color) returns this
|
||||
// On the Mac, GetColor(ColorID::TextSelectForeground, color) returns this
|
||||
// constant to specify that the foreground color should not be changed
|
||||
// (ie. a colored text keeps its colors when selected).
|
||||
// Of course if other plaforms work like the Mac, they can use it too.
|
||||
|
@ -722,11 +547,11 @@ class LookAndFeel {
|
|||
// Similar with NS_DONT_CHANGE_COLOR, except NS_DONT_CHANGE_COLOR would returns
|
||||
// complementary color if fg color is same as bg color.
|
||||
// NS_CHANGE_COLOR_IF_SAME_AS_BG would returns
|
||||
// eColorID_TextSelectForegroundCustom if fg and bg color are the same.
|
||||
// ColorID::TextSelectForegroundCustom if fg and bg color are the same.
|
||||
#define NS_CHANGE_COLOR_IF_SAME_AS_BG NS_RGB(0x02, 0x02, 0x02)
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Special colors for eColorID_IME* and eColorID_SpellCheckerUnderline
|
||||
// Special colors for ColorID::IME* and ColorID::SpellCheckerUnderline
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
// For background color only.
|
||||
|
|
|
@ -73,236 +73,236 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
// These colors don't seem to be used for anything anymore in Mozilla
|
||||
// (except here at least TextSelectBackground and TextSelectForeground)
|
||||
// The CSS2 colors below are used.
|
||||
case eColorID_WindowBackground:
|
||||
case ColorID::WindowBackground:
|
||||
aColor = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_WindowForeground:
|
||||
case ColorID::WindowForeground:
|
||||
aColor = mSystemColors.textColorPrimary;
|
||||
break;
|
||||
case eColorID_WidgetBackground:
|
||||
case ColorID::WidgetBackground:
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_WidgetForeground:
|
||||
case ColorID::WidgetForeground:
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case ColorID::WidgetSelectBackground:
|
||||
aColor = mSystemColors.textColorHighlight;
|
||||
break;
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
aColor = mSystemColors.textColorPrimaryInverse;
|
||||
break;
|
||||
case eColorID_Widget3DHighlight:
|
||||
case ColorID::Widget3DHighlight:
|
||||
aColor = LIGHT_GRAY_COLOR;
|
||||
break;
|
||||
case eColorID_Widget3DShadow:
|
||||
case ColorID::Widget3DShadow:
|
||||
aColor = DARK_GRAY_COLOR;
|
||||
break;
|
||||
case eColorID_TextBackground:
|
||||
case ColorID::TextBackground:
|
||||
// not used?
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_TextForeground:
|
||||
case ColorID::TextForeground:
|
||||
// not used?
|
||||
aColor = mSystemColors.textColorPrimary;
|
||||
break;
|
||||
case eColorID_TextSelectBackground:
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case ColorID::TextSelectBackground:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
// still used
|
||||
aColor = mSystemColors.textColorHighlight;
|
||||
break;
|
||||
case eColorID_TextSelectForeground:
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case ColorID::TextSelectForeground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
// still used
|
||||
aColor = mSystemColors.textColorPrimaryInverse;
|
||||
break;
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
aColor = RED_COLOR;
|
||||
break;
|
||||
|
||||
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
||||
case eColorID_activeborder:
|
||||
case ColorID::Activeborder:
|
||||
// active window border
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_activecaption:
|
||||
case ColorID::Activecaption:
|
||||
// active window caption background
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_appworkspace:
|
||||
case ColorID::Appworkspace:
|
||||
// MDI background color
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_background:
|
||||
case ColorID::Background:
|
||||
// desktop background
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_captiontext:
|
||||
case ColorID::Captiontext:
|
||||
// text in active window caption, size box, and scrollbar arrow box (!)
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
case eColorID_graytext:
|
||||
case ColorID::Graytext:
|
||||
// disabled text in windows, menus, etc.
|
||||
aColor = mSystemColors.textColorTertiary;
|
||||
break;
|
||||
case eColorID_highlight:
|
||||
case ColorID::Highlight:
|
||||
// background of selected item
|
||||
aColor = mSystemColors.textColorHighlight;
|
||||
break;
|
||||
case eColorID_highlighttext:
|
||||
case ColorID::Highlighttext:
|
||||
// text of selected item
|
||||
aColor = mSystemColors.textColorPrimaryInverse;
|
||||
break;
|
||||
case eColorID_inactiveborder:
|
||||
case ColorID::Inactiveborder:
|
||||
// inactive window border
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_inactivecaption:
|
||||
case ColorID::Inactivecaption:
|
||||
// inactive window caption
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_inactivecaptiontext:
|
||||
case ColorID::Inactivecaptiontext:
|
||||
// text in inactive window caption
|
||||
aColor = mSystemColors.textColorTertiary;
|
||||
break;
|
||||
case eColorID_infobackground:
|
||||
case ColorID::Infobackground:
|
||||
// tooltip background color
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_infotext:
|
||||
case ColorID::Infotext:
|
||||
// tooltip text color
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
case eColorID_menu:
|
||||
case ColorID::Menu:
|
||||
// menu background
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID_menutext:
|
||||
case ColorID::Menutext:
|
||||
// menu text
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
case eColorID_scrollbar:
|
||||
case ColorID::Scrollbar:
|
||||
// scrollbar gray area
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
|
||||
case eColorID_threedface:
|
||||
case eColorID_buttonface:
|
||||
case ColorID::Threedface:
|
||||
case ColorID::Buttonface:
|
||||
// 3-D face color
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
|
||||
case eColorID_buttontext:
|
||||
case ColorID::Buttontext:
|
||||
// text on push buttons
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
|
||||
case eColorID_buttonhighlight:
|
||||
case ColorID::Buttonhighlight:
|
||||
// 3-D highlighted edge color
|
||||
case eColorID_threedhighlight:
|
||||
case ColorID::Threedhighlight:
|
||||
// 3-D highlighted outer edge color
|
||||
aColor = LIGHT_GRAY_COLOR;
|
||||
break;
|
||||
|
||||
case eColorID_threedlightshadow:
|
||||
case ColorID::Threedlightshadow:
|
||||
// 3-D highlighted inner edge color
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
|
||||
case eColorID_buttonshadow:
|
||||
case ColorID::Buttonshadow:
|
||||
// 3-D shadow edge color
|
||||
case eColorID_threedshadow:
|
||||
case ColorID::Threedshadow:
|
||||
// 3-D shadow inner edge color
|
||||
aColor = GRAY_COLOR;
|
||||
break;
|
||||
|
||||
case eColorID_threeddarkshadow:
|
||||
case ColorID::Threeddarkshadow:
|
||||
// 3-D shadow outer edge color
|
||||
aColor = BLACK_COLOR;
|
||||
break;
|
||||
|
||||
case eColorID_window:
|
||||
case eColorID_windowframe:
|
||||
case ColorID::Window:
|
||||
case ColorID::Windowframe:
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
|
||||
case eColorID_windowtext:
|
||||
case ColorID::Windowtext:
|
||||
aColor = mSystemColors.textColorPrimary;
|
||||
break;
|
||||
|
||||
case eColorID__moz_eventreerow:
|
||||
case eColorID__moz_field:
|
||||
case ColorID::MozEventreerow:
|
||||
case ColorID::MozField:
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID__moz_fieldtext:
|
||||
case ColorID::MozFieldtext:
|
||||
aColor = mSystemColors.textColorPrimary;
|
||||
break;
|
||||
case eColorID__moz_dialog:
|
||||
case ColorID::MozDialog:
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID__moz_dialogtext:
|
||||
case ColorID::MozDialogtext:
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
case eColorID__moz_dragtargetzone:
|
||||
case ColorID::MozDragtargetzone:
|
||||
aColor = mSystemColors.textColorHighlight;
|
||||
break;
|
||||
case eColorID__moz_buttondefault:
|
||||
case ColorID::MozButtondefault:
|
||||
// default button border color
|
||||
aColor = BLACK_COLOR;
|
||||
break;
|
||||
case eColorID__moz_buttonhoverface:
|
||||
case ColorID::MozButtonhoverface:
|
||||
aColor = BG_PRELIGHT_COLOR;
|
||||
break;
|
||||
case eColorID__moz_buttonhovertext:
|
||||
case ColorID::MozButtonhovertext:
|
||||
aColor = FG_PRELIGHT_COLOR;
|
||||
break;
|
||||
case eColorID__moz_cellhighlight:
|
||||
case eColorID__moz_html_cellhighlight:
|
||||
case ColorID::MozCellhighlight:
|
||||
case ColorID::MozHtmlCellhighlight:
|
||||
aColor = mSystemColors.textColorHighlight;
|
||||
break;
|
||||
case eColorID__moz_cellhighlighttext:
|
||||
case eColorID__moz_html_cellhighlighttext:
|
||||
case ColorID::MozCellhighlighttext:
|
||||
case ColorID::MozHtmlCellhighlighttext:
|
||||
aColor = mSystemColors.textColorPrimaryInverse;
|
||||
break;
|
||||
case eColorID__moz_menuhover:
|
||||
case ColorID::MozMenuhover:
|
||||
aColor = BG_PRELIGHT_COLOR;
|
||||
break;
|
||||
case eColorID__moz_menuhovertext:
|
||||
case ColorID::MozMenuhovertext:
|
||||
aColor = FG_PRELIGHT_COLOR;
|
||||
break;
|
||||
case eColorID__moz_oddtreerow:
|
||||
case ColorID::MozOddtreerow:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID__moz_nativehyperlinktext:
|
||||
case ColorID::MozNativehyperlinktext:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID__moz_comboboxtext:
|
||||
case ColorID::MozComboboxtext:
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
case eColorID__moz_combobox:
|
||||
case ColorID::MozCombobox:
|
||||
aColor = mSystemColors.colorBackground;
|
||||
break;
|
||||
case eColorID__moz_menubartext:
|
||||
case ColorID::MozMenubartext:
|
||||
aColor = mSystemColors.colorForeground;
|
||||
break;
|
||||
case eColorID__moz_menubarhovertext:
|
||||
case ColorID::MozMenubarhovertext:
|
||||
aColor = FG_PRELIGHT_COLOR;
|
||||
break;
|
||||
default:
|
||||
|
@ -501,31 +501,31 @@ nsTArray<LookAndFeelInt> nsLookAndFeel::GetIntCacheImpl() {
|
|||
lookAndFeelCache.SetCapacity(sizeof(AndroidSystemColors) / sizeof(nscolor));
|
||||
|
||||
LookAndFeelInt laf;
|
||||
laf.id = eColorID_WindowForeground;
|
||||
laf.id = int32_t(ColorID::WindowForeground);
|
||||
laf.colorValue = mSystemColors.textColorPrimary;
|
||||
lookAndFeelCache.AppendElement(laf);
|
||||
|
||||
laf.id = eColorID_WidgetBackground;
|
||||
laf.id = int32_t(ColorID::WidgetBackground);
|
||||
laf.colorValue = mSystemColors.colorBackground;
|
||||
lookAndFeelCache.AppendElement(laf);
|
||||
|
||||
laf.id = eColorID_WidgetForeground;
|
||||
laf.id = int32_t(ColorID::WidgetForeground);
|
||||
laf.colorValue = mSystemColors.colorForeground;
|
||||
lookAndFeelCache.AppendElement(laf);
|
||||
|
||||
laf.id = eColorID_WidgetSelectBackground;
|
||||
laf.id = int32_t(ColorID::WidgetSelectBackground);
|
||||
laf.colorValue = mSystemColors.textColorHighlight;
|
||||
lookAndFeelCache.AppendElement(laf);
|
||||
|
||||
laf.id = eColorID_WidgetSelectForeground;
|
||||
laf.id = int32_t(ColorID::WidgetSelectForeground);
|
||||
laf.colorValue = mSystemColors.textColorPrimaryInverse;
|
||||
lookAndFeelCache.AppendElement(laf);
|
||||
|
||||
laf.id = eColorID_inactivecaptiontext;
|
||||
laf.id = int32_t(ColorID::Inactivecaptiontext);
|
||||
laf.colorValue = mSystemColors.textColorTertiary;
|
||||
lookAndFeelCache.AppendElement(laf);
|
||||
|
||||
laf.id = eColorID_windowtext;
|
||||
laf.id = int32_t(ColorID::Windowtext);
|
||||
laf.colorValue = mSystemColors.textColorPrimary;
|
||||
lookAndFeelCache.AppendElement(laf);
|
||||
|
||||
|
@ -540,26 +540,26 @@ nsTArray<LookAndFeelInt> nsLookAndFeel::GetIntCacheImpl() {
|
|||
void nsLookAndFeel::SetIntCacheImpl(
|
||||
const nsTArray<LookAndFeelInt>& aLookAndFeelCache) {
|
||||
for (auto entry : aLookAndFeelCache) {
|
||||
switch (entry.id) {
|
||||
case eColorID_WindowForeground:
|
||||
switch (ColorID(entry.id)) {
|
||||
case ColorID::WindowForeground:
|
||||
mSystemColors.textColorPrimary = entry.colorValue;
|
||||
break;
|
||||
case eColorID_WidgetBackground:
|
||||
case ColorID::WidgetBackground:
|
||||
mSystemColors.colorBackground = entry.colorValue;
|
||||
break;
|
||||
case eColorID_WidgetForeground:
|
||||
case ColorID::WidgetForeground:
|
||||
mSystemColors.colorForeground = entry.colorValue;
|
||||
break;
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case ColorID::WidgetSelectBackground:
|
||||
mSystemColors.textColorHighlight = entry.colorValue;
|
||||
break;
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
mSystemColors.textColorPrimaryInverse = entry.colorValue;
|
||||
break;
|
||||
case eColorID_inactivecaptiontext:
|
||||
case ColorID::Inactivecaptiontext:
|
||||
mSystemColors.textColorTertiary = entry.colorValue;
|
||||
break;
|
||||
case eColorID_windowtext:
|
||||
case ColorID::Windowtext:
|
||||
mSystemColors.textColorPrimary = entry.colorValue;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -159,78 +159,78 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
nsresult res = NS_OK;
|
||||
|
||||
switch (aID) {
|
||||
case eColorID_WindowBackground:
|
||||
case ColorID::WindowBackground:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_WindowForeground:
|
||||
case ColorID::WindowForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_WidgetBackground:
|
||||
case ColorID::WidgetBackground:
|
||||
aColor = NS_RGB(0xdd, 0xdd, 0xdd);
|
||||
break;
|
||||
case eColorID_WidgetForeground:
|
||||
case ColorID::WidgetForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case ColorID::WidgetSelectBackground:
|
||||
aColor = NS_RGB(0x80, 0x80, 0x80);
|
||||
break;
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x80);
|
||||
break;
|
||||
case eColorID_Widget3DHighlight:
|
||||
case ColorID::Widget3DHighlight:
|
||||
aColor = NS_RGB(0xa0, 0xa0, 0xa0);
|
||||
break;
|
||||
case eColorID_Widget3DShadow:
|
||||
case ColorID::Widget3DShadow:
|
||||
aColor = NS_RGB(0x40, 0x40, 0x40);
|
||||
break;
|
||||
case eColorID_TextBackground:
|
||||
case ColorID::TextBackground:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_TextForeground:
|
||||
case ColorID::TextForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_TextSelectBackground:
|
||||
case ColorID::TextSelectBackground:
|
||||
aColor = ProcessSelectionBackground(mColorTextSelectBackground);
|
||||
break;
|
||||
// This is used to gray out the selection when it's not focused. Used with
|
||||
// nsISelectionController::SELECTION_DISABLED.
|
||||
case eColorID_TextSelectBackgroundDisabled:
|
||||
case ColorID::TextSelectBackgroundDisabled:
|
||||
aColor = ProcessSelectionBackground(mColorTextSelectBackgroundDisabled);
|
||||
break;
|
||||
case eColorID_highlight: // CSS2 color
|
||||
case ColorID::Highlight: // CSS2 color
|
||||
aColor = mColorHighlight;
|
||||
break;
|
||||
case eColorID__moz_menuhover:
|
||||
case ColorID::MozMenuhover:
|
||||
aColor = mColorMenuHover;
|
||||
break;
|
||||
case eColorID_TextSelectForeground:
|
||||
case ColorID::TextSelectForeground:
|
||||
aColor = mColorTextSelectForeground;
|
||||
break;
|
||||
case eColorID_highlighttext: // CSS2 color
|
||||
case eColorID__moz_menuhovertext:
|
||||
case ColorID::Highlighttext: // CSS2 color
|
||||
case ColorID::MozMenuhovertext:
|
||||
aColor = mColorMenuHoverText;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
aColor = NS_40PERCENT_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
aColor = NS_RGB(0xff, 0, 0);
|
||||
break;
|
||||
|
||||
|
@ -245,150 +245,150 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
// Thanks to mpt26@student.canterbury.ac.nz for the hardcoded values that form the defaults
|
||||
// if querying the Appearance Manager fails ;)
|
||||
//
|
||||
case eColorID__moz_mac_buttonactivetext:
|
||||
case eColorID__moz_mac_defaultbuttontext:
|
||||
case ColorID::MozMacButtonactivetext:
|
||||
case ColorID::MozMacDefaultbuttontext:
|
||||
if (mHasColorButtonText) {
|
||||
aColor = mColorButtonText;
|
||||
break;
|
||||
}
|
||||
// Otherwise fall through and return the regular button text:
|
||||
MOZ_FALLTHROUGH;
|
||||
case eColorID_buttontext:
|
||||
case eColorID__moz_buttonhovertext:
|
||||
case ColorID::Buttontext:
|
||||
case ColorID::MozButtonhovertext:
|
||||
aColor = mColorButtonHoverText;
|
||||
break;
|
||||
case eColorID_captiontext:
|
||||
case eColorID_menutext:
|
||||
case eColorID_infotext:
|
||||
case eColorID__moz_menubartext:
|
||||
case ColorID::Captiontext:
|
||||
case ColorID::Menutext:
|
||||
case ColorID::Infotext:
|
||||
case ColorID::MozMenubartext:
|
||||
aColor = mColorText;
|
||||
break;
|
||||
case eColorID_windowtext:
|
||||
case ColorID::Windowtext:
|
||||
aColor = mColorWindowText;
|
||||
break;
|
||||
case eColorID_activecaption:
|
||||
case ColorID::Activecaption:
|
||||
aColor = mColorActiveCaption;
|
||||
break;
|
||||
case eColorID_activeborder:
|
||||
case ColorID::Activeborder:
|
||||
aColor = mColorActiveBorder;
|
||||
break;
|
||||
case eColorID_appworkspace:
|
||||
case ColorID::Appworkspace:
|
||||
aColor = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_background:
|
||||
case ColorID::Background:
|
||||
aColor = NS_RGB(0x63, 0x63, 0xCE);
|
||||
break;
|
||||
case eColorID_buttonface:
|
||||
case eColorID__moz_buttonhoverface:
|
||||
case ColorID::Buttonface:
|
||||
case ColorID::MozButtonhoverface:
|
||||
aColor = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID_buttonhighlight:
|
||||
case ColorID::Buttonhighlight:
|
||||
aColor = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_buttonshadow:
|
||||
case ColorID::Buttonshadow:
|
||||
aColor = NS_RGB(0xDC, 0xDC, 0xDC);
|
||||
break;
|
||||
case eColorID_graytext:
|
||||
case ColorID::Graytext:
|
||||
aColor = mColorGrayText;
|
||||
break;
|
||||
case eColorID_inactiveborder:
|
||||
case ColorID::Inactiveborder:
|
||||
aColor = mColorInactiveBorder;
|
||||
break;
|
||||
case eColorID_inactivecaption:
|
||||
case ColorID::Inactivecaption:
|
||||
aColor = mColorInactiveCaption;
|
||||
break;
|
||||
case eColorID_inactivecaptiontext:
|
||||
case ColorID::Inactivecaptiontext:
|
||||
aColor = NS_RGB(0x45, 0x45, 0x45);
|
||||
break;
|
||||
case eColorID_scrollbar:
|
||||
case ColorID::Scrollbar:
|
||||
aColor = mColorScrollbar;
|
||||
break;
|
||||
case eColorID_threeddarkshadow:
|
||||
case ColorID::Threeddarkshadow:
|
||||
aColor = NS_RGB(0xDC, 0xDC, 0xDC);
|
||||
break;
|
||||
case eColorID_threedshadow:
|
||||
case ColorID::Threedshadow:
|
||||
aColor = NS_RGB(0xE0, 0xE0, 0xE0);
|
||||
break;
|
||||
case eColorID_threedface:
|
||||
case ColorID::Threedface:
|
||||
aColor = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID_threedhighlight:
|
||||
case ColorID::Threedhighlight:
|
||||
aColor = mColorThreeDHighlight;
|
||||
break;
|
||||
case eColorID_threedlightshadow:
|
||||
case ColorID::Threedlightshadow:
|
||||
aColor = NS_RGB(0xDA, 0xDA, 0xDA);
|
||||
break;
|
||||
case eColorID_menu:
|
||||
case ColorID::Menu:
|
||||
aColor = mColorMenu;
|
||||
break;
|
||||
case eColorID_infobackground:
|
||||
case ColorID::Infobackground:
|
||||
aColor = NS_RGB(0xFF, 0xFF, 0xC7);
|
||||
break;
|
||||
case eColorID_windowframe:
|
||||
case ColorID::Windowframe:
|
||||
aColor = mColorWindowFrame;
|
||||
break;
|
||||
case eColorID_window:
|
||||
case eColorID__moz_field:
|
||||
case eColorID__moz_combobox:
|
||||
case ColorID::Window:
|
||||
case ColorID::MozField:
|
||||
case ColorID::MozCombobox:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID__moz_fieldtext:
|
||||
case eColorID__moz_comboboxtext:
|
||||
case ColorID::MozFieldtext:
|
||||
case ColorID::MozComboboxtext:
|
||||
aColor = mColorFieldText;
|
||||
break;
|
||||
case eColorID__moz_dialog:
|
||||
case ColorID::MozDialog:
|
||||
aColor = mColorDialog;
|
||||
break;
|
||||
case eColorID__moz_dialogtext:
|
||||
case eColorID__moz_cellhighlighttext:
|
||||
case eColorID__moz_html_cellhighlighttext:
|
||||
case ColorID::MozDialogtext:
|
||||
case ColorID::MozCellhighlighttext:
|
||||
case ColorID::MozHtmlCellhighlighttext:
|
||||
aColor = mColorDialogText;
|
||||
break;
|
||||
case eColorID__moz_dragtargetzone:
|
||||
case ColorID::MozDragtargetzone:
|
||||
aColor = mColorDragTargetZone;
|
||||
break;
|
||||
case eColorID__moz_mac_chrome_active:
|
||||
case ColorID::MozMacChromeActive:
|
||||
aColor = mColorChromeActive;
|
||||
break;
|
||||
case eColorID__moz_mac_chrome_inactive:
|
||||
case ColorID::MozMacChromeInactive:
|
||||
aColor = mColorChromeInactive;
|
||||
break;
|
||||
case eColorID__moz_mac_focusring:
|
||||
case ColorID::MozMacFocusring:
|
||||
aColor = mColorFocusRing;
|
||||
break;
|
||||
case eColorID__moz_mac_menushadow:
|
||||
case ColorID::MozMacMenushadow:
|
||||
aColor = NS_RGB(0xA3, 0xA3, 0xA3);
|
||||
break;
|
||||
case eColorID__moz_mac_menutextdisable:
|
||||
case ColorID::MozMacMenutextdisable:
|
||||
aColor = NS_RGB(0x98, 0x98, 0x98);
|
||||
break;
|
||||
case eColorID__moz_mac_menutextselect:
|
||||
case ColorID::MozMacMenutextselect:
|
||||
aColor = mColorTextSelect;
|
||||
break;
|
||||
case eColorID__moz_mac_disabledtoolbartext:
|
||||
case ColorID::MozMacDisabledtoolbartext:
|
||||
aColor = mColorDisabledToolbarText;
|
||||
break;
|
||||
case eColorID__moz_mac_menuselect:
|
||||
case ColorID::MozMacMenuselect:
|
||||
aColor = mColorMenuSelect;
|
||||
break;
|
||||
case eColorID__moz_buttondefault:
|
||||
case ColorID::MozButtondefault:
|
||||
aColor = NS_RGB(0xDC, 0xDC, 0xDC);
|
||||
break;
|
||||
case eColorID__moz_cellhighlight:
|
||||
case eColorID__moz_html_cellhighlight:
|
||||
case eColorID__moz_mac_secondaryhighlight:
|
||||
case ColorID::MozCellhighlight:
|
||||
case ColorID::MozHtmlCellhighlight:
|
||||
case ColorID::MozMacSecondaryhighlight:
|
||||
// For inactive list selection
|
||||
aColor = mColorCellHighlight;
|
||||
break;
|
||||
case eColorID__moz_eventreerow:
|
||||
case ColorID::MozEventreerow:
|
||||
// Background color of even list rows.
|
||||
aColor = mColorEvenTreeRow;
|
||||
break;
|
||||
case eColorID__moz_oddtreerow:
|
||||
case ColorID::MozOddtreerow:
|
||||
// Background color of odd list rows.
|
||||
aColor = mColorOddTreeRow;
|
||||
break;
|
||||
case eColorID__moz_nativehyperlinktext:
|
||||
case ColorID::MozNativehyperlinktext:
|
||||
// There appears to be no available system defined color. HARDCODING to the appropriate color.
|
||||
aColor = NS_RGB(0x14, 0x4F, 0xAE);
|
||||
break;
|
||||
|
@ -400,25 +400,25 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
// We could obtain them at runtime, but doing so may be expensive and
|
||||
// requires the use of the private API
|
||||
// -[NSVisualEffectView fontSmoothingBackgroundColor].
|
||||
case eColorID__moz_mac_vibrancy_light:
|
||||
case eColorID__moz_mac_vibrant_titlebar_light:
|
||||
case eColorID__moz_mac_source_list:
|
||||
case eColorID__moz_mac_tooltip:
|
||||
case ColorID::MozMacVibrancyLight:
|
||||
case ColorID::MozMacVibrantTitlebarLight:
|
||||
case ColorID::MozMacSourceList:
|
||||
case ColorID::MozMacTooltip:
|
||||
aColor = NS_RGB(0xf7, 0xf7, 0xf7);
|
||||
break;
|
||||
case eColorID__moz_mac_vibrancy_dark:
|
||||
case eColorID__moz_mac_vibrant_titlebar_dark:
|
||||
case ColorID::MozMacVibrancyDark:
|
||||
case ColorID::MozMacVibrantTitlebarDark:
|
||||
aColor = NS_RGB(0x28, 0x28, 0x28);
|
||||
break;
|
||||
case eColorID__moz_mac_menupopup:
|
||||
case eColorID__moz_mac_menuitem:
|
||||
case ColorID::MozMacMenupopup:
|
||||
case ColorID::MozMacMenuitem:
|
||||
aColor = NS_RGB(0xe6, 0xe6, 0xe6);
|
||||
break;
|
||||
case eColorID__moz_mac_source_list_selection:
|
||||
case ColorID::MozMacSourceListSelection:
|
||||
aColor = NS_RGB(0xc8, 0xc8, 0xc8);
|
||||
break;
|
||||
case eColorID__moz_mac_active_menuitem:
|
||||
case eColorID__moz_mac_active_source_list_selection:
|
||||
case ColorID::MozMacActiveMenuitem:
|
||||
case ColorID::MozMacActiveSourceListSelection:
|
||||
aColor = mColorActiveSourceListSelection;
|
||||
break;
|
||||
default:
|
||||
|
@ -724,7 +724,7 @@ void nsLookAndFeel::EnsureInit() {
|
|||
mColorHighlight = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
|
||||
mColorMenuHover = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
|
||||
|
||||
GetColor(eColorID_TextSelectBackground, color);
|
||||
GetColor(ColorID::TextSelectBackground, color);
|
||||
if (color == 0x000000) {
|
||||
mColorTextSelectForeground = NS_RGB(0xff, 0xff, 0xff);
|
||||
} else {
|
||||
|
|
|
@ -267,7 +267,7 @@ class SelectionStyleProvider final {
|
|||
// FYI: LookAndFeel always returns selection colors of GtkTextView.
|
||||
nscolor selectionForegroundColor;
|
||||
if (NS_SUCCEEDED(
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectForeground,
|
||||
&selectionForegroundColor))) {
|
||||
double alpha =
|
||||
static_cast<double>(NS_GET_A(selectionForegroundColor)) / 0xFF;
|
||||
|
@ -282,7 +282,7 @@ class SelectionStyleProvider final {
|
|||
}
|
||||
nscolor selectionBackgroundColor;
|
||||
if (NS_SUCCEEDED(
|
||||
LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground,
|
||||
LookAndFeel::GetColor(LookAndFeel::ColorID::TextSelectBackground,
|
||||
&selectionBackgroundColor))) {
|
||||
double alpha =
|
||||
static_cast<double>(NS_GET_A(selectionBackgroundColor)) / 0xFF;
|
||||
|
|
|
@ -271,189 +271,189 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
// These colors don't seem to be used for anything anymore in Mozilla
|
||||
// (except here at least TextSelectBackground and TextSelectForeground)
|
||||
// The CSS2 colors below are used.
|
||||
case eColorID_WindowBackground:
|
||||
case eColorID_WidgetBackground:
|
||||
case eColorID_TextBackground:
|
||||
case eColorID_activecaption: // active window caption background
|
||||
case eColorID_appworkspace: // MDI background color
|
||||
case eColorID_background: // desktop background
|
||||
case eColorID_window:
|
||||
case eColorID_windowframe:
|
||||
case eColorID__moz_dialog:
|
||||
case eColorID__moz_combobox:
|
||||
case ColorID::WindowBackground:
|
||||
case ColorID::WidgetBackground:
|
||||
case ColorID::TextBackground:
|
||||
case ColorID::Activecaption: // active window caption background
|
||||
case ColorID::Appworkspace: // MDI background color
|
||||
case ColorID::Background: // desktop background
|
||||
case ColorID::Window:
|
||||
case ColorID::Windowframe:
|
||||
case ColorID::MozDialog:
|
||||
case ColorID::MozCombobox:
|
||||
aColor = mMozWindowBackground;
|
||||
break;
|
||||
case eColorID_WindowForeground:
|
||||
case eColorID_WidgetForeground:
|
||||
case eColorID_TextForeground:
|
||||
case eColorID_captiontext: // text in active window caption, size box, and
|
||||
case ColorID::WindowForeground:
|
||||
case ColorID::WidgetForeground:
|
||||
case ColorID::TextForeground:
|
||||
case ColorID::Captiontext: // text in active window caption, size box, and
|
||||
// scrollbar arrow box (!)
|
||||
case eColorID_windowtext:
|
||||
case eColorID__moz_dialogtext:
|
||||
case ColorID::Windowtext:
|
||||
case ColorID::MozDialogtext:
|
||||
aColor = mMozWindowText;
|
||||
break;
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case eColorID_TextSelectBackground:
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case eColorID__moz_dragtargetzone:
|
||||
case eColorID__moz_html_cellhighlight:
|
||||
case eColorID_highlight: // preference selected item,
|
||||
case ColorID::WidgetSelectBackground:
|
||||
case ColorID::TextSelectBackground:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
case ColorID::MozDragtargetzone:
|
||||
case ColorID::MozHtmlCellhighlight:
|
||||
case ColorID::Highlight: // preference selected item,
|
||||
aColor = mTextSelectedBackground;
|
||||
break;
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case eColorID_TextSelectForeground:
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case eColorID_highlighttext:
|
||||
case eColorID__moz_html_cellhighlighttext:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
case ColorID::TextSelectForeground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
case ColorID::Highlighttext:
|
||||
case ColorID::MozHtmlCellhighlighttext:
|
||||
aColor = mTextSelectedText;
|
||||
break;
|
||||
case eColorID__moz_cellhighlight:
|
||||
case ColorID::MozCellhighlight:
|
||||
aColor = mMozCellHighlightBackground;
|
||||
break;
|
||||
case eColorID__moz_cellhighlighttext:
|
||||
case ColorID::MozCellhighlighttext:
|
||||
aColor = mMozCellHighlightText;
|
||||
break;
|
||||
case eColorID_Widget3DHighlight:
|
||||
case ColorID::Widget3DHighlight:
|
||||
aColor = NS_RGB(0xa0, 0xa0, 0xa0);
|
||||
break;
|
||||
case eColorID_Widget3DShadow:
|
||||
case ColorID::Widget3DShadow:
|
||||
aColor = NS_RGB(0x40, 0x40, 0x40);
|
||||
break;
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
aColor = NS_RGB(0xff, 0, 0);
|
||||
break;
|
||||
|
||||
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
||||
case eColorID_activeborder:
|
||||
case ColorID::Activeborder:
|
||||
// active window border
|
||||
aColor = mMozWindowActiveBorder;
|
||||
break;
|
||||
case eColorID_inactiveborder:
|
||||
case ColorID::Inactiveborder:
|
||||
// inactive window border
|
||||
aColor = mMozWindowInactiveBorder;
|
||||
break;
|
||||
case eColorID_graytext: // disabled text in windows, menus, etc.
|
||||
case eColorID_inactivecaptiontext: // text in inactive window caption
|
||||
case ColorID::Graytext: // disabled text in windows, menus, etc.
|
||||
case ColorID::Inactivecaptiontext: // text in inactive window caption
|
||||
aColor = mMenuTextInactive;
|
||||
break;
|
||||
case eColorID_inactivecaption:
|
||||
case ColorID::Inactivecaption:
|
||||
// inactive window caption
|
||||
aColor = mMozWindowInactiveCaption;
|
||||
break;
|
||||
case eColorID_infobackground:
|
||||
case ColorID::Infobackground:
|
||||
// tooltip background color
|
||||
aColor = mInfoBackground;
|
||||
break;
|
||||
case eColorID_infotext:
|
||||
case ColorID::Infotext:
|
||||
// tooltip text color
|
||||
aColor = mInfoText;
|
||||
break;
|
||||
case eColorID_menu:
|
||||
case ColorID::Menu:
|
||||
// menu background
|
||||
aColor = mMenuBackground;
|
||||
break;
|
||||
case eColorID_menutext:
|
||||
case ColorID::Menutext:
|
||||
// menu text
|
||||
aColor = mMenuText;
|
||||
break;
|
||||
case eColorID_scrollbar:
|
||||
case ColorID::Scrollbar:
|
||||
// scrollbar gray area
|
||||
aColor = mMozScrollbar;
|
||||
break;
|
||||
|
||||
case eColorID_threedlightshadow:
|
||||
case ColorID::Threedlightshadow:
|
||||
// 3-D highlighted inner edge color
|
||||
// always same as background in GTK code
|
||||
case eColorID_threedface:
|
||||
case eColorID_buttonface:
|
||||
case ColorID::Threedface:
|
||||
case ColorID::Buttonface:
|
||||
// 3-D face color
|
||||
aColor = mMozWindowBackground;
|
||||
break;
|
||||
|
||||
case eColorID_buttontext:
|
||||
case ColorID::Buttontext:
|
||||
// text on push buttons
|
||||
aColor = mButtonText;
|
||||
break;
|
||||
|
||||
case eColorID_buttonhighlight:
|
||||
case ColorID::Buttonhighlight:
|
||||
// 3-D highlighted edge color
|
||||
case eColorID_threedhighlight:
|
||||
case ColorID::Threedhighlight:
|
||||
// 3-D highlighted outer edge color
|
||||
aColor = mFrameOuterLightBorder;
|
||||
break;
|
||||
|
||||
case eColorID_buttonshadow:
|
||||
case ColorID::Buttonshadow:
|
||||
// 3-D shadow edge color
|
||||
case eColorID_threedshadow:
|
||||
case ColorID::Threedshadow:
|
||||
// 3-D shadow inner edge color
|
||||
aColor = mFrameInnerDarkBorder;
|
||||
break;
|
||||
|
||||
case eColorID_threeddarkshadow:
|
||||
case ColorID::Threeddarkshadow:
|
||||
// Hardcode to black
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
|
||||
case eColorID__moz_eventreerow:
|
||||
case eColorID__moz_field:
|
||||
case ColorID::MozEventreerow:
|
||||
case ColorID::MozField:
|
||||
aColor = mMozFieldBackground;
|
||||
break;
|
||||
case eColorID__moz_fieldtext:
|
||||
case ColorID::MozFieldtext:
|
||||
aColor = mMozFieldText;
|
||||
break;
|
||||
case eColorID__moz_buttondefault:
|
||||
case ColorID::MozButtondefault:
|
||||
// default button border color
|
||||
aColor = mButtonDefault;
|
||||
break;
|
||||
case eColorID__moz_buttonhoverface:
|
||||
case ColorID::MozButtonhoverface:
|
||||
aColor = mButtonHoverFace;
|
||||
break;
|
||||
case eColorID__moz_buttonhovertext:
|
||||
case ColorID::MozButtonhovertext:
|
||||
aColor = mButtonHoverText;
|
||||
break;
|
||||
case eColorID__moz_gtk_buttonactivetext:
|
||||
case ColorID::MozGtkButtonactivetext:
|
||||
aColor = mButtonActiveText;
|
||||
break;
|
||||
case eColorID__moz_menuhover:
|
||||
case ColorID::MozMenuhover:
|
||||
aColor = mMenuHover;
|
||||
break;
|
||||
case eColorID__moz_menuhovertext:
|
||||
case ColorID::MozMenuhovertext:
|
||||
aColor = mMenuHoverText;
|
||||
break;
|
||||
case eColorID__moz_oddtreerow:
|
||||
case ColorID::MozOddtreerow:
|
||||
aColor = mOddCellBackground;
|
||||
break;
|
||||
case eColorID__moz_nativehyperlinktext:
|
||||
case ColorID::MozNativehyperlinktext:
|
||||
aColor = mNativeHyperLinkText;
|
||||
break;
|
||||
case eColorID__moz_comboboxtext:
|
||||
case ColorID::MozComboboxtext:
|
||||
aColor = mComboBoxText;
|
||||
break;
|
||||
case eColorID__moz_menubartext:
|
||||
case ColorID::MozMenubartext:
|
||||
aColor = mMenuBarText;
|
||||
break;
|
||||
case eColorID__moz_menubarhovertext:
|
||||
case ColorID::MozMenubarhovertext:
|
||||
aColor = mMenuBarHoverText;
|
||||
break;
|
||||
case eColorID__moz_gtk_info_bar_text:
|
||||
case ColorID::MozGtkInfoBarText:
|
||||
aColor = mInfoBarText;
|
||||
break;
|
||||
default:
|
||||
|
@ -704,8 +704,8 @@ nsresult nsLookAndFeel::GetIntImpl(IntID aID, int32_t& aResult) {
|
|||
// "light" or "dark", so we synthesize it from the CSS2 Window/WindowText
|
||||
// colors instead, by comparing their luminosity.
|
||||
nscolor fg, bg;
|
||||
if (NS_SUCCEEDED(NativeGetColor(eColorID_windowtext, fg)) &&
|
||||
NS_SUCCEEDED(NativeGetColor(eColorID_window, bg))) {
|
||||
if (NS_SUCCEEDED(NativeGetColor(ColorID::Windowtext, fg)) &&
|
||||
NS_SUCCEEDED(NativeGetColor(ColorID::Window, bg))) {
|
||||
aResult = (RelativeLuminanceUtils::Compute(bg) <
|
||||
RelativeLuminanceUtils::Compute(fg))
|
||||
? 1
|
||||
|
|
|
@ -1252,7 +1252,7 @@ bool nsNativeThemeGTK::CreateWebRenderCommandsForWidget(
|
|||
aBuilder.PushRect(
|
||||
bounds, bounds, true,
|
||||
wr::ToColorF(Color::FromABGR(LookAndFeel::GetColor(
|
||||
LookAndFeel::eColorID_WindowBackground, NS_RGBA(0, 0, 0, 0)))));
|
||||
LookAndFeel::ColorID::WindowBackground, NS_RGBA(0, 0, 0, 0)))));
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
|
|
@ -28,94 +28,94 @@ nsresult HeadlessLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
switch (aID) {
|
||||
// Override the solid black that GetStandinForNativeColor provides for
|
||||
// -moz-FieldText, to match our behavior under the real GTK.
|
||||
case eColorID__moz_fieldtext:
|
||||
case ColorID::MozFieldtext:
|
||||
aColor = NS_RGB(0x21, 0x21, 0x21);
|
||||
break;
|
||||
|
||||
// The rest are not provided by GetStandinForNativeColor.
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
aColor = NS_40PERCENT_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID__moz_eventreerow:
|
||||
case ColorID::MozEventreerow:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID__moz_gtk_info_bar_text:
|
||||
case ColorID::MozGtkInfoBarText:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_mac_buttonactivetext:
|
||||
case eColorID__moz_mac_defaultbuttontext:
|
||||
case ColorID::MozMacButtonactivetext:
|
||||
case ColorID::MozMacDefaultbuttontext:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
aColor = NS_RGB(0xff, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_TextBackground:
|
||||
case ColorID::TextBackground:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_TextForeground:
|
||||
case ColorID::TextForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_TextHighlightBackground:
|
||||
case ColorID::TextHighlightBackground:
|
||||
aColor = NS_RGB(0xef, 0x0f, 0xff);
|
||||
break;
|
||||
case eColorID_TextHighlightForeground:
|
||||
case ColorID::TextHighlightForeground:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_TextSelectBackground:
|
||||
case ColorID::TextSelectBackground:
|
||||
aColor = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID_TextSelectBackgroundAttention:
|
||||
case ColorID::TextSelectBackgroundAttention:
|
||||
aColor = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_TextSelectBackgroundDisabled:
|
||||
case ColorID::TextSelectBackgroundDisabled:
|
||||
aColor = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID_TextSelectForeground:
|
||||
GetColor(eColorID_TextSelectBackground, aColor);
|
||||
case ColorID::TextSelectForeground:
|
||||
GetColor(ColorID::TextSelectBackground, aColor);
|
||||
if (aColor == 0x000000)
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
else
|
||||
aColor = NS_DONT_CHANGE_COLOR;
|
||||
break;
|
||||
case eColorID_Widget3DHighlight:
|
||||
case ColorID::Widget3DHighlight:
|
||||
aColor = NS_RGB(0xa0, 0xa0, 0xa0);
|
||||
break;
|
||||
case eColorID_Widget3DShadow:
|
||||
case ColorID::Widget3DShadow:
|
||||
aColor = NS_RGB(0x40, 0x40, 0x40);
|
||||
break;
|
||||
case eColorID_WidgetBackground:
|
||||
case ColorID::WidgetBackground:
|
||||
aColor = NS_RGB(0xdd, 0xdd, 0xdd);
|
||||
break;
|
||||
case eColorID_WidgetForeground:
|
||||
case ColorID::WidgetForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case ColorID::WidgetSelectBackground:
|
||||
aColor = NS_RGB(0x80, 0x80, 0x80);
|
||||
break;
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x80);
|
||||
break;
|
||||
case eColorID_WindowBackground:
|
||||
case ColorID::WindowBackground:
|
||||
aColor = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_WindowForeground:
|
||||
case ColorID::WindowForeground:
|
||||
aColor = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -94,7 +94,8 @@ nsLookAndFeelFloatPref nsXPLookAndFeel::sFloatPrefs[] = {
|
|||
{"ui.caretAspectRatio", eFloatID_CaretAspectRatio, false, 0},
|
||||
};
|
||||
|
||||
// This array MUST be kept in the same order as the color list in LookAndFeel.h.
|
||||
// This array MUST be kept in the same order as the color list in
|
||||
// specified/color.rs
|
||||
/* XXX If you add any strings longer than
|
||||
* "ui.-moz-mac-active-source-list-selection"
|
||||
* to the following array then you MUST update the
|
||||
|
@ -209,7 +210,7 @@ const char nsXPLookAndFeel::sColorPrefs[][41] = {
|
|||
"ui.-moz-combobox",
|
||||
"ui.-moz-gtk-info-bar-text"};
|
||||
|
||||
int32_t nsXPLookAndFeel::sCachedColors[LookAndFeel::eColorID_LAST_COLOR] = {0};
|
||||
int32_t nsXPLookAndFeel::sCachedColors[size_t(LookAndFeel::ColorID::End)] = {0};
|
||||
int32_t nsXPLookAndFeel::sCachedColorBits[COLOR_CACHE_SIZE] = {0};
|
||||
|
||||
bool nsXPLookAndFeel::sInitialized = false;
|
||||
|
@ -336,6 +337,9 @@ void nsXPLookAndFeel::InitFromPref(nsLookAndFeelFloatPref* aPref) {
|
|||
}
|
||||
|
||||
void nsXPLookAndFeel::InitColorFromPref(int32_t i) {
|
||||
static_assert(ArrayLength(sColorPrefs) == size_t(ColorID::End),
|
||||
"Should have a pref for each color value");
|
||||
|
||||
nsAutoString colorStr;
|
||||
nsresult rv = Preferences::GetString(sColorPrefs[i], colorStr);
|
||||
if (NS_FAILED(rv) || colorStr.IsEmpty()) {
|
||||
|
@ -439,21 +443,21 @@ nsXPLookAndFeel::~nsXPLookAndFeel() {
|
|||
|
||||
bool nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor& aColor) {
|
||||
switch (aID) {
|
||||
case eColorID_TextSelectForeground:
|
||||
case ColorID::TextSelectForeground:
|
||||
return (aColor == NS_DONT_CHANGE_COLOR);
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
return NS_IS_SELECTION_SPECIAL_COLOR(aColor);
|
||||
default:
|
||||
/*
|
||||
|
@ -469,35 +473,35 @@ bool nsXPLookAndFeel::ColorIsNotCSSAccessible(ColorID aID) {
|
|||
bool result = false;
|
||||
|
||||
switch (aID) {
|
||||
case eColorID_WindowBackground:
|
||||
case eColorID_WindowForeground:
|
||||
case eColorID_WidgetBackground:
|
||||
case eColorID_WidgetForeground:
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case eColorID_Widget3DHighlight:
|
||||
case eColorID_Widget3DShadow:
|
||||
case eColorID_TextBackground:
|
||||
case eColorID_TextForeground:
|
||||
case eColorID_TextSelectBackground:
|
||||
case eColorID_TextSelectForeground:
|
||||
case eColorID_TextSelectBackgroundDisabled:
|
||||
case eColorID_TextSelectBackgroundAttention:
|
||||
case eColorID_TextHighlightBackground:
|
||||
case eColorID_TextHighlightForeground:
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::WindowBackground:
|
||||
case ColorID::WindowForeground:
|
||||
case ColorID::WidgetBackground:
|
||||
case ColorID::WidgetForeground:
|
||||
case ColorID::WidgetSelectBackground:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
case ColorID::Widget3DHighlight:
|
||||
case ColorID::Widget3DShadow:
|
||||
case ColorID::TextBackground:
|
||||
case ColorID::TextForeground:
|
||||
case ColorID::TextSelectBackground:
|
||||
case ColorID::TextSelectForeground:
|
||||
case ColorID::TextSelectBackgroundDisabled:
|
||||
case ColorID::TextSelectBackgroundAttention:
|
||||
case ColorID::TextHighlightBackground:
|
||||
case ColorID::TextHighlightForeground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
result = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -514,218 +518,218 @@ nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID) {
|
|||
// except Mac-specific colors which are taken from Mac OS 10.7.
|
||||
switch (aID) {
|
||||
// CSS 2 colors:
|
||||
case eColorID_activeborder:
|
||||
case ColorID::Activeborder:
|
||||
result = NS_RGB(0xB4, 0xB4, 0xB4);
|
||||
break;
|
||||
case eColorID_activecaption:
|
||||
case ColorID::Activecaption:
|
||||
result = NS_RGB(0x99, 0xB4, 0xD1);
|
||||
break;
|
||||
case eColorID_appworkspace:
|
||||
case ColorID::Appworkspace:
|
||||
result = NS_RGB(0xAB, 0xAB, 0xAB);
|
||||
break;
|
||||
case eColorID_background:
|
||||
case ColorID::Background:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_buttonface:
|
||||
case ColorID::Buttonface:
|
||||
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID_buttonhighlight:
|
||||
case ColorID::Buttonhighlight:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_buttonshadow:
|
||||
case ColorID::Buttonshadow:
|
||||
result = NS_RGB(0xA0, 0xA0, 0xA0);
|
||||
break;
|
||||
case eColorID_buttontext:
|
||||
case ColorID::Buttontext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_captiontext:
|
||||
case ColorID::Captiontext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_graytext:
|
||||
case ColorID::Graytext:
|
||||
result = NS_RGB(0x6D, 0x6D, 0x6D);
|
||||
break;
|
||||
case eColorID_highlight:
|
||||
case ColorID::Highlight:
|
||||
result = NS_RGB(0x33, 0x99, 0xFF);
|
||||
break;
|
||||
case eColorID_highlighttext:
|
||||
case ColorID::Highlighttext:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_inactiveborder:
|
||||
case ColorID::Inactiveborder:
|
||||
result = NS_RGB(0xF4, 0xF7, 0xFC);
|
||||
break;
|
||||
case eColorID_inactivecaption:
|
||||
case ColorID::Inactivecaption:
|
||||
result = NS_RGB(0xBF, 0xCD, 0xDB);
|
||||
break;
|
||||
case eColorID_inactivecaptiontext:
|
||||
case ColorID::Inactivecaptiontext:
|
||||
result = NS_RGB(0x43, 0x4E, 0x54);
|
||||
break;
|
||||
case eColorID_infobackground:
|
||||
case ColorID::Infobackground:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xE1);
|
||||
break;
|
||||
case eColorID_infotext:
|
||||
case ColorID::Infotext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_menu:
|
||||
case ColorID::Menu:
|
||||
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID_menutext:
|
||||
case ColorID::Menutext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_scrollbar:
|
||||
case ColorID::Scrollbar:
|
||||
result = NS_RGB(0xC8, 0xC8, 0xC8);
|
||||
break;
|
||||
case eColorID_threeddarkshadow:
|
||||
case ColorID::Threeddarkshadow:
|
||||
result = NS_RGB(0x69, 0x69, 0x69);
|
||||
break;
|
||||
case eColorID_threedface:
|
||||
case ColorID::Threedface:
|
||||
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID_threedhighlight:
|
||||
case ColorID::Threedhighlight:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_threedlightshadow:
|
||||
case ColorID::Threedlightshadow:
|
||||
result = NS_RGB(0xE3, 0xE3, 0xE3);
|
||||
break;
|
||||
case eColorID_threedshadow:
|
||||
case ColorID::Threedshadow:
|
||||
result = NS_RGB(0xA0, 0xA0, 0xA0);
|
||||
break;
|
||||
case eColorID_window:
|
||||
case ColorID::Window:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_windowframe:
|
||||
case ColorID::Windowframe:
|
||||
result = NS_RGB(0x64, 0x64, 0x64);
|
||||
break;
|
||||
case eColorID_windowtext:
|
||||
case ColorID::Windowtext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_buttondefault:
|
||||
case ColorID::MozButtondefault:
|
||||
result = NS_RGB(0x69, 0x69, 0x69);
|
||||
break;
|
||||
case eColorID__moz_field:
|
||||
case ColorID::MozField:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_fieldtext:
|
||||
case ColorID::MozFieldtext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_dialog:
|
||||
case ColorID::MozDialog:
|
||||
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID__moz_dialogtext:
|
||||
case ColorID::MozDialogtext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_dragtargetzone:
|
||||
case ColorID::MozDragtargetzone:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_cellhighlight:
|
||||
case ColorID::MozCellhighlight:
|
||||
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID__moz_cellhighlighttext:
|
||||
case ColorID::MozCellhighlighttext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_html_cellhighlight:
|
||||
case ColorID::MozHtmlCellhighlight:
|
||||
result = NS_RGB(0x33, 0x99, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_html_cellhighlighttext:
|
||||
case ColorID::MozHtmlCellhighlighttext:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_buttonhoverface:
|
||||
case ColorID::MozButtonhoverface:
|
||||
result = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID__moz_buttonhovertext:
|
||||
case ColorID::MozButtonhovertext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_menuhover:
|
||||
case ColorID::MozMenuhover:
|
||||
result = NS_RGB(0x33, 0x99, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_menuhovertext:
|
||||
case ColorID::MozMenuhovertext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_menubartext:
|
||||
case ColorID::MozMenubartext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_menubarhovertext:
|
||||
case ColorID::MozMenubarhovertext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_oddtreerow:
|
||||
case eColorID__moz_gtk_buttonactivetext:
|
||||
case ColorID::MozOddtreerow:
|
||||
case ColorID::MozGtkButtonactivetext:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_mac_chrome_active:
|
||||
case ColorID::MozMacChromeActive:
|
||||
result = NS_RGB(0xB2, 0xB2, 0xB2);
|
||||
break;
|
||||
case eColorID__moz_mac_chrome_inactive:
|
||||
case ColorID::MozMacChromeInactive:
|
||||
result = NS_RGB(0xE1, 0xE1, 0xE1);
|
||||
break;
|
||||
case eColorID__moz_mac_focusring:
|
||||
case ColorID::MozMacFocusring:
|
||||
result = NS_RGB(0x60, 0x9D, 0xD7);
|
||||
break;
|
||||
case eColorID__moz_mac_menuselect:
|
||||
case ColorID::MozMacMenuselect:
|
||||
result = NS_RGB(0x38, 0x75, 0xD7);
|
||||
break;
|
||||
case eColorID__moz_mac_menushadow:
|
||||
case ColorID::MozMacMenushadow:
|
||||
result = NS_RGB(0xA3, 0xA3, 0xA3);
|
||||
break;
|
||||
case eColorID__moz_mac_menutextdisable:
|
||||
case ColorID::MozMacMenutextdisable:
|
||||
result = NS_RGB(0x88, 0x88, 0x88);
|
||||
break;
|
||||
case eColorID__moz_mac_menutextselect:
|
||||
case ColorID::MozMacMenutextselect:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_mac_disabledtoolbartext:
|
||||
case ColorID::MozMacDisabledtoolbartext:
|
||||
result = NS_RGB(0x3F, 0x3F, 0x3F);
|
||||
break;
|
||||
case eColorID__moz_mac_secondaryhighlight:
|
||||
case ColorID::MozMacSecondaryhighlight:
|
||||
result = NS_RGB(0xD4, 0xD4, 0xD4);
|
||||
break;
|
||||
case eColorID__moz_mac_vibrancy_light:
|
||||
case eColorID__moz_mac_vibrant_titlebar_light:
|
||||
case ColorID::MozMacVibrancyLight:
|
||||
case ColorID::MozMacVibrantTitlebarLight:
|
||||
result = NS_RGB(0xf7, 0xf7, 0xf7);
|
||||
break;
|
||||
case eColorID__moz_mac_vibrancy_dark:
|
||||
case eColorID__moz_mac_vibrant_titlebar_dark:
|
||||
case ColorID::MozMacVibrancyDark:
|
||||
case ColorID::MozMacVibrantTitlebarDark:
|
||||
result = NS_RGB(0x28, 0x28, 0x28);
|
||||
break;
|
||||
case eColorID__moz_mac_menupopup:
|
||||
case ColorID::MozMacMenupopup:
|
||||
result = NS_RGB(0xe6, 0xe6, 0xe6);
|
||||
break;
|
||||
case eColorID__moz_mac_menuitem:
|
||||
case ColorID::MozMacMenuitem:
|
||||
result = NS_RGB(0xe6, 0xe6, 0xe6);
|
||||
break;
|
||||
case eColorID__moz_mac_active_menuitem:
|
||||
case ColorID::MozMacActiveMenuitem:
|
||||
result = NS_RGB(0x0a, 0x64, 0xdc);
|
||||
break;
|
||||
case eColorID__moz_mac_source_list:
|
||||
case ColorID::MozMacSourceList:
|
||||
result = NS_RGB(0xf7, 0xf7, 0xf7);
|
||||
break;
|
||||
case eColorID__moz_mac_source_list_selection:
|
||||
case ColorID::MozMacSourceListSelection:
|
||||
result = NS_RGB(0xc8, 0xc8, 0xc8);
|
||||
break;
|
||||
case eColorID__moz_mac_active_source_list_selection:
|
||||
case ColorID::MozMacActiveSourceListSelection:
|
||||
result = NS_RGB(0x0a, 0x64, 0xdc);
|
||||
break;
|
||||
case eColorID__moz_mac_tooltip:
|
||||
case ColorID::MozMacTooltip:
|
||||
result = NS_RGB(0xf7, 0xf7, 0xf7);
|
||||
break;
|
||||
case eColorID__moz_win_accentcolor:
|
||||
case ColorID::MozWinAccentcolor:
|
||||
// Seems to be the default color (hardcoded because of bug 1065998)
|
||||
result = NS_RGB(0x9E, 0x9E, 0x9E);
|
||||
break;
|
||||
case eColorID__moz_win_accentcolortext:
|
||||
case ColorID::MozWinAccentcolortext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_win_mediatext:
|
||||
case ColorID::MozWinMediatext:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_win_communicationstext:
|
||||
case ColorID::MozWinCommunicationstext:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID__moz_nativehyperlinktext:
|
||||
case ColorID::MozNativehyperlinktext:
|
||||
result = NS_RGB(0x00, 0x66, 0xCC);
|
||||
break;
|
||||
case eColorID__moz_comboboxtext:
|
||||
case ColorID::MozComboboxtext:
|
||||
result = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID__moz_combobox:
|
||||
case ColorID::MozCombobox:
|
||||
result = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
default:
|
||||
|
@ -758,64 +762,64 @@ nsresult nsXPLookAndFeel::GetColorImpl(ColorID aID,
|
|||
nsresult rv = NS_OK;
|
||||
switch (aID) {
|
||||
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
||||
case eColorID_activecaption:
|
||||
case ColorID::Activecaption:
|
||||
// active window caption background
|
||||
case eColorID_captiontext:
|
||||
case ColorID::Captiontext:
|
||||
// text in active window caption
|
||||
aResult = NS_RGB(0xff, 0x00, 0x00);
|
||||
break;
|
||||
|
||||
case eColorID_highlight:
|
||||
case ColorID::Highlight:
|
||||
// background of selected item
|
||||
case eColorID_highlighttext:
|
||||
case ColorID::Highlighttext:
|
||||
// text of selected item
|
||||
aResult = NS_RGB(0xff, 0xff, 0x00);
|
||||
break;
|
||||
|
||||
case eColorID_inactivecaption:
|
||||
case ColorID::Inactivecaption:
|
||||
// inactive window caption
|
||||
case eColorID_inactivecaptiontext:
|
||||
case ColorID::Inactivecaptiontext:
|
||||
// text in inactive window caption
|
||||
aResult = NS_RGB(0x66, 0x66, 0x00);
|
||||
break;
|
||||
|
||||
case eColorID_infobackground:
|
||||
case ColorID::Infobackground:
|
||||
// tooltip background color
|
||||
case eColorID_infotext:
|
||||
case ColorID::Infotext:
|
||||
// tooltip text color
|
||||
aResult = NS_RGB(0x00, 0xff, 0x00);
|
||||
break;
|
||||
|
||||
case eColorID_menu:
|
||||
case ColorID::Menu:
|
||||
// menu background
|
||||
case eColorID_menutext:
|
||||
case ColorID::Menutext:
|
||||
// menu text
|
||||
aResult = NS_RGB(0x00, 0xff, 0xff);
|
||||
break;
|
||||
|
||||
case eColorID_threedface:
|
||||
case eColorID_buttonface:
|
||||
case ColorID::Threedface:
|
||||
case ColorID::Buttonface:
|
||||
// 3-D face color
|
||||
case eColorID_buttontext:
|
||||
case ColorID::Buttontext:
|
||||
// text on push buttons
|
||||
aResult = NS_RGB(0x00, 0x66, 0x66);
|
||||
break;
|
||||
|
||||
case eColorID_window:
|
||||
case eColorID_windowtext:
|
||||
case ColorID::Window:
|
||||
case ColorID::Windowtext:
|
||||
aResult = NS_RGB(0x00, 0x00, 0xff);
|
||||
break;
|
||||
|
||||
// from the CSS3 working draft (not yet finalized)
|
||||
// http://www.w3.org/tr/2000/wd-css3-userint-20000216.html#color
|
||||
|
||||
case eColorID__moz_field:
|
||||
case eColorID__moz_fieldtext:
|
||||
case ColorID::MozField:
|
||||
case ColorID::MozFieldtext:
|
||||
aResult = NS_RGB(0xff, 0x00, 0xff);
|
||||
break;
|
||||
|
||||
case eColorID__moz_dialog:
|
||||
case eColorID__moz_dialogtext:
|
||||
case ColorID::MozDialog:
|
||||
case ColorID::MozDialogtext:
|
||||
aResult = NS_RGB(0x66, 0x00, 0x66);
|
||||
break;
|
||||
|
||||
|
@ -833,13 +837,13 @@ nsresult nsXPLookAndFeel::GetColorImpl(ColorID aID,
|
|||
}
|
||||
|
||||
if (!aUseStandinsForNativeColors && IS_COLOR_CACHED(aID)) {
|
||||
aResult = sCachedColors[aID];
|
||||
aResult = sCachedColors[uint32_t(aID)];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// There are no system color settings for these, so set them manually
|
||||
#ifndef XP_MACOSX
|
||||
if (aID == eColorID_TextSelectBackgroundDisabled) {
|
||||
if (aID == ColorID::TextSelectBackgroundDisabled) {
|
||||
// This is used to gray out the selection when it's not focused
|
||||
// Used with nsISelectionController::SELECTION_DISABLED
|
||||
aResult = NS_RGB(0xb0, 0xb0, 0xb0);
|
||||
|
@ -847,7 +851,7 @@ nsresult nsXPLookAndFeel::GetColorImpl(ColorID aID,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (aID == eColorID_TextSelectBackgroundAttention) {
|
||||
if (aID == ColorID::TextSelectBackgroundAttention) {
|
||||
if (sFindbarModalHighlight) {
|
||||
aResult = NS_RGBA(0, 0, 0, 0);
|
||||
return NS_OK;
|
||||
|
@ -859,14 +863,14 @@ nsresult nsXPLookAndFeel::GetColorImpl(ColorID aID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aID == eColorID_TextHighlightBackground) {
|
||||
if (aID == ColorID::TextHighlightBackground) {
|
||||
// This makes the matched text stand out when findbar highlighting is on
|
||||
// Used with nsISelectionController::SELECTION_FIND
|
||||
aResult = NS_RGB(0xef, 0x0f, 0xff);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aID == eColorID_TextHighlightForeground) {
|
||||
if (aID == ColorID::TextHighlightForeground) {
|
||||
// The foreground color for the matched text in findbar highlighting
|
||||
// Used with nsISelectionController::SELECTION_FIND
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
|
@ -955,7 +959,7 @@ nsresult nsXPLookAndFeel::GetFloatImpl(FloatID aID, float& aResult) {
|
|||
void nsXPLookAndFeel::RefreshImpl() {
|
||||
// Wipe out our color cache.
|
||||
uint32_t i;
|
||||
for (i = 0; i < eColorID_LAST_COLOR; i++) sCachedColors[i] = 0;
|
||||
for (i = 0; i < uint32_t(ColorID::End); i++) sCachedColors[i] = 0;
|
||||
for (i = 0; i < COLOR_CACHE_SIZE; i++) sCachedColorBits[i] = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define __nsXPLookAndFeel
|
||||
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/ServoStyleConsts.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsLookAndFeel;
|
||||
|
@ -25,17 +26,17 @@ struct nsLookAndFeelFloatPref {
|
|||
float floatVar;
|
||||
};
|
||||
|
||||
#define CACHE_BLOCK(x) ((x) >> 5)
|
||||
#define CACHE_BIT(x) (1 << ((x)&31))
|
||||
#define CACHE_BLOCK(x) (uint32_t(x) >> 5)
|
||||
#define CACHE_BIT(x) (1 << (uint32_t(x) & 31))
|
||||
|
||||
#define COLOR_CACHE_SIZE (CACHE_BLOCK(LookAndFeel::eColorID_LAST_COLOR) + 1)
|
||||
#define COLOR_CACHE_SIZE (CACHE_BLOCK(uint32_t(LookAndFeel::ColorID::End)) + 1)
|
||||
#define IS_COLOR_CACHED(x) \
|
||||
(CACHE_BIT(x) & nsXPLookAndFeel::sCachedColorBits[CACHE_BLOCK(x)])
|
||||
#define CLEAR_COLOR_CACHE(x) \
|
||||
nsXPLookAndFeel::sCachedColors[(x)] = 0; \
|
||||
#define CLEAR_COLOR_CACHE(x) \
|
||||
nsXPLookAndFeel::sCachedColors[uint32_t(x)] = 0; \
|
||||
nsXPLookAndFeel::sCachedColorBits[CACHE_BLOCK(x)] &= ~(CACHE_BIT(x));
|
||||
#define CACHE_COLOR(x, y) \
|
||||
nsXPLookAndFeel::sCachedColors[(x)] = y; \
|
||||
#define CACHE_COLOR(x, y) \
|
||||
nsXPLookAndFeel::sCachedColors[uint32_t(x)] = y; \
|
||||
nsXPLookAndFeel::sCachedColorBits[CACHE_BLOCK(x)] |= CACHE_BIT(x);
|
||||
|
||||
class nsXPLookAndFeel : public mozilla::LookAndFeel {
|
||||
|
@ -112,7 +113,7 @@ class nsXPLookAndFeel : public mozilla::LookAndFeel {
|
|||
* the array see nsXPLookAndFeel.cpp
|
||||
*/
|
||||
static const char sColorPrefs[][41];
|
||||
static int32_t sCachedColors[LookAndFeel::eColorID_LAST_COLOR];
|
||||
static int32_t sCachedColors[size_t(LookAndFeel::ColorID::End)];
|
||||
static int32_t sCachedColorBits[COLOR_CACHE_SIZE];
|
||||
static bool sUseNativeColors;
|
||||
static bool sFindbarModalHighlight;
|
||||
|
|
|
@ -46,203 +46,203 @@ nsresult nsLookAndFeel::NativeGetColor(const ColorID aID, nscolor& aResult) {
|
|||
nsresult res = NS_OK;
|
||||
|
||||
switch (aID) {
|
||||
case eColorID_WindowBackground:
|
||||
case ColorID::WindowBackground:
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_WindowForeground:
|
||||
case ColorID::WindowForeground:
|
||||
aResult = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_WidgetBackground:
|
||||
case ColorID::WidgetBackground:
|
||||
aResult = NS_RGB(0xdd, 0xdd, 0xdd);
|
||||
break;
|
||||
case eColorID_WidgetForeground:
|
||||
case ColorID::WidgetForeground:
|
||||
aResult = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case ColorID::WidgetSelectBackground:
|
||||
aResult = NS_RGB(0x80, 0x80, 0x80);
|
||||
break;
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
aResult = NS_RGB(0x00, 0x00, 0x80);
|
||||
break;
|
||||
case eColorID_Widget3DHighlight:
|
||||
case ColorID::Widget3DHighlight:
|
||||
aResult = NS_RGB(0xa0, 0xa0, 0xa0);
|
||||
break;
|
||||
case eColorID_Widget3DShadow:
|
||||
case ColorID::Widget3DShadow:
|
||||
aResult = NS_RGB(0x40, 0x40, 0x40);
|
||||
break;
|
||||
case eColorID_TextBackground:
|
||||
case ColorID::TextBackground:
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_TextForeground:
|
||||
case ColorID::TextForeground:
|
||||
aResult = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_TextSelectBackground:
|
||||
case eColorID_highlight: // CSS2 color
|
||||
case ColorID::TextSelectBackground:
|
||||
case ColorID::Highlight: // CSS2 color
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID__moz_menuhover:
|
||||
case ColorID::MozMenuhover:
|
||||
aResult = NS_RGB(0xee, 0xee, 0xee);
|
||||
break;
|
||||
case eColorID_TextSelectForeground:
|
||||
case eColorID_highlighttext: // CSS2 color
|
||||
case eColorID__moz_menuhovertext:
|
||||
case ColorID::TextSelectForeground:
|
||||
case ColorID::Highlighttext: // CSS2 color
|
||||
case ColorID::MozMenuhovertext:
|
||||
aResult = mColorTextSelectForeground;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
aResult = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
aResult = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
aResult = NS_40PERCENT_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
aResult = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
break;
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
aResult = NS_RGB(0xff, 0, 0);
|
||||
break;
|
||||
|
||||
//
|
||||
// css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
||||
//
|
||||
case eColorID_buttontext:
|
||||
case eColorID__moz_buttonhovertext:
|
||||
case eColorID_captiontext:
|
||||
case eColorID_menutext:
|
||||
case eColorID_infotext:
|
||||
case eColorID__moz_menubartext:
|
||||
case eColorID_windowtext:
|
||||
case ColorID::Buttontext:
|
||||
case ColorID::MozButtonhovertext:
|
||||
case ColorID::Captiontext:
|
||||
case ColorID::Menutext:
|
||||
case ColorID::Infotext:
|
||||
case ColorID::MozMenubartext:
|
||||
case ColorID::Windowtext:
|
||||
aResult = mColorDarkText;
|
||||
break;
|
||||
case eColorID_activecaption:
|
||||
case ColorID::Activecaption:
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_activeborder:
|
||||
case ColorID::Activeborder:
|
||||
aResult = NS_RGB(0x00, 0x00, 0x00);
|
||||
break;
|
||||
case eColorID_appworkspace:
|
||||
case ColorID::Appworkspace:
|
||||
aResult = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_background:
|
||||
case ColorID::Background:
|
||||
aResult = NS_RGB(0x63, 0x63, 0xCE);
|
||||
break;
|
||||
case eColorID_buttonface:
|
||||
case eColorID__moz_buttonhoverface:
|
||||
case ColorID::Buttonface:
|
||||
case ColorID::MozButtonhoverface:
|
||||
aResult = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID_buttonhighlight:
|
||||
case ColorID::Buttonhighlight:
|
||||
aResult = NS_RGB(0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case eColorID_buttonshadow:
|
||||
case ColorID::Buttonshadow:
|
||||
aResult = NS_RGB(0xDC, 0xDC, 0xDC);
|
||||
break;
|
||||
case eColorID_graytext:
|
||||
case ColorID::Graytext:
|
||||
aResult = NS_RGB(0x44, 0x44, 0x44);
|
||||
break;
|
||||
case eColorID_inactiveborder:
|
||||
case ColorID::Inactiveborder:
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_inactivecaption:
|
||||
case ColorID::Inactivecaption:
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID_inactivecaptiontext:
|
||||
case ColorID::Inactivecaptiontext:
|
||||
aResult = NS_RGB(0x45, 0x45, 0x45);
|
||||
break;
|
||||
case eColorID_scrollbar:
|
||||
case ColorID::Scrollbar:
|
||||
aResult = NS_RGB(0, 0, 0); // XXX
|
||||
break;
|
||||
case eColorID_threeddarkshadow:
|
||||
case ColorID::Threeddarkshadow:
|
||||
aResult = NS_RGB(0xDC, 0xDC, 0xDC);
|
||||
break;
|
||||
case eColorID_threedshadow:
|
||||
case ColorID::Threedshadow:
|
||||
aResult = NS_RGB(0xE0, 0xE0, 0xE0);
|
||||
break;
|
||||
case eColorID_threedface:
|
||||
case ColorID::Threedface:
|
||||
aResult = NS_RGB(0xF0, 0xF0, 0xF0);
|
||||
break;
|
||||
case eColorID_threedhighlight:
|
||||
case ColorID::Threedhighlight:
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_threedlightshadow:
|
||||
case ColorID::Threedlightshadow:
|
||||
aResult = NS_RGB(0xDA, 0xDA, 0xDA);
|
||||
break;
|
||||
case eColorID_menu:
|
||||
case ColorID::Menu:
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID_infobackground:
|
||||
case ColorID::Infobackground:
|
||||
aResult = NS_RGB(0xFF, 0xFF, 0xC7);
|
||||
break;
|
||||
case eColorID_windowframe:
|
||||
case ColorID::Windowframe:
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID_window:
|
||||
case eColorID__moz_field:
|
||||
case eColorID__moz_combobox:
|
||||
case ColorID::Window:
|
||||
case ColorID::MozField:
|
||||
case ColorID::MozCombobox:
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID__moz_fieldtext:
|
||||
case eColorID__moz_comboboxtext:
|
||||
case ColorID::MozFieldtext:
|
||||
case ColorID::MozComboboxtext:
|
||||
aResult = mColorDarkText;
|
||||
break;
|
||||
case eColorID__moz_dialog:
|
||||
case ColorID::MozDialog:
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID__moz_dialogtext:
|
||||
case eColorID__moz_cellhighlighttext:
|
||||
case eColorID__moz_html_cellhighlighttext:
|
||||
case ColorID::MozDialogtext:
|
||||
case ColorID::MozCellhighlighttext:
|
||||
case ColorID::MozHtmlCellhighlighttext:
|
||||
aResult = mColorDarkText;
|
||||
break;
|
||||
case eColorID__moz_dragtargetzone:
|
||||
case eColorID__moz_mac_chrome_active:
|
||||
case eColorID__moz_mac_chrome_inactive:
|
||||
case ColorID::MozDragtargetzone:
|
||||
case ColorID::MozMacChromeActive:
|
||||
case ColorID::MozMacChromeInactive:
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID__moz_mac_focusring:
|
||||
case ColorID::MozMacFocusring:
|
||||
aResult = NS_RGB(0x3F, 0x98, 0xDD);
|
||||
break;
|
||||
case eColorID__moz_mac_menushadow:
|
||||
case ColorID::MozMacMenushadow:
|
||||
aResult = NS_RGB(0xA3, 0xA3, 0xA3);
|
||||
break;
|
||||
case eColorID__moz_mac_menutextdisable:
|
||||
case ColorID::MozMacMenutextdisable:
|
||||
aResult = NS_RGB(0x88, 0x88, 0x88);
|
||||
break;
|
||||
case eColorID__moz_mac_menutextselect:
|
||||
case ColorID::MozMacMenutextselect:
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID__moz_mac_disabledtoolbartext:
|
||||
case ColorID::MozMacDisabledtoolbartext:
|
||||
aResult = NS_RGB(0x3F, 0x3F, 0x3F);
|
||||
break;
|
||||
case eColorID__moz_mac_menuselect:
|
||||
case ColorID::MozMacMenuselect:
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID__moz_buttondefault:
|
||||
case ColorID::MozButtondefault:
|
||||
aResult = NS_RGB(0xDC, 0xDC, 0xDC);
|
||||
break;
|
||||
case eColorID__moz_cellhighlight:
|
||||
case eColorID__moz_html_cellhighlight:
|
||||
case eColorID__moz_mac_secondaryhighlight:
|
||||
case ColorID::MozCellhighlight:
|
||||
case ColorID::MozHtmlCellhighlight:
|
||||
case ColorID::MozMacSecondaryhighlight:
|
||||
// For inactive list selection
|
||||
aResult = NS_RGB(0xaa, 0xaa, 0xaa);
|
||||
break;
|
||||
case eColorID__moz_eventreerow:
|
||||
case ColorID::MozEventreerow:
|
||||
// Background color of even list rows.
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
break;
|
||||
case eColorID__moz_oddtreerow:
|
||||
case ColorID::MozOddtreerow:
|
||||
// Background color of odd list rows.
|
||||
aResult = NS_TRANSPARENT;
|
||||
break;
|
||||
case eColorID__moz_nativehyperlinktext:
|
||||
case ColorID::MozNativehyperlinktext:
|
||||
// There appears to be no available system defined color. HARDCODING to the appropriate color.
|
||||
aResult = NS_RGB(0x14, 0x4F, 0xAE);
|
||||
break;
|
||||
|
@ -396,7 +396,7 @@ void nsLookAndFeel::EnsureInit() {
|
|||
mInitialized = true;
|
||||
|
||||
nscolor color;
|
||||
GetColor(eColorID_TextSelectBackground, color);
|
||||
GetColor(ColorID::TextSelectBackground, color);
|
||||
if (color == 0x000000) {
|
||||
mColorTextSelectForeground = NS_RGB(0xff, 0xff, 0xff);
|
||||
} else {
|
||||
|
|
|
@ -127,184 +127,184 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
|
||||
int idx;
|
||||
switch (aID) {
|
||||
case eColorID_WindowBackground:
|
||||
case ColorID::WindowBackground:
|
||||
idx = COLOR_WINDOW;
|
||||
break;
|
||||
case eColorID_WindowForeground:
|
||||
case ColorID::WindowForeground:
|
||||
idx = COLOR_WINDOWTEXT;
|
||||
break;
|
||||
case eColorID_WidgetBackground:
|
||||
case ColorID::WidgetBackground:
|
||||
idx = COLOR_BTNFACE;
|
||||
break;
|
||||
case eColorID_WidgetForeground:
|
||||
case ColorID::WidgetForeground:
|
||||
idx = COLOR_BTNTEXT;
|
||||
break;
|
||||
case eColorID_WidgetSelectBackground:
|
||||
case ColorID::WidgetSelectBackground:
|
||||
idx = COLOR_HIGHLIGHT;
|
||||
break;
|
||||
case eColorID_WidgetSelectForeground:
|
||||
case ColorID::WidgetSelectForeground:
|
||||
idx = COLOR_HIGHLIGHTTEXT;
|
||||
break;
|
||||
case eColorID_Widget3DHighlight:
|
||||
case ColorID::Widget3DHighlight:
|
||||
idx = COLOR_BTNHIGHLIGHT;
|
||||
break;
|
||||
case eColorID_Widget3DShadow:
|
||||
case ColorID::Widget3DShadow:
|
||||
idx = COLOR_BTNSHADOW;
|
||||
break;
|
||||
case eColorID_TextBackground:
|
||||
case ColorID::TextBackground:
|
||||
idx = COLOR_WINDOW;
|
||||
break;
|
||||
case eColorID_TextForeground:
|
||||
case ColorID::TextForeground:
|
||||
idx = COLOR_WINDOWTEXT;
|
||||
break;
|
||||
case eColorID_TextSelectBackground:
|
||||
case eColorID_IMESelectedRawTextBackground:
|
||||
case eColorID_IMESelectedConvertedTextBackground:
|
||||
case ColorID::TextSelectBackground:
|
||||
case ColorID::IMESelectedRawTextBackground:
|
||||
case ColorID::IMESelectedConvertedTextBackground:
|
||||
idx = COLOR_HIGHLIGHT;
|
||||
break;
|
||||
case eColorID_TextSelectForeground:
|
||||
case eColorID_IMESelectedRawTextForeground:
|
||||
case eColorID_IMESelectedConvertedTextForeground:
|
||||
case ColorID::TextSelectForeground:
|
||||
case ColorID::IMESelectedRawTextForeground:
|
||||
case ColorID::IMESelectedConvertedTextForeground:
|
||||
idx = COLOR_HIGHLIGHTTEXT;
|
||||
break;
|
||||
case eColorID_IMERawInputBackground:
|
||||
case eColorID_IMEConvertedTextBackground:
|
||||
case ColorID::IMERawInputBackground:
|
||||
case ColorID::IMEConvertedTextBackground:
|
||||
aColor = NS_TRANSPARENT;
|
||||
return NS_OK;
|
||||
case eColorID_IMERawInputForeground:
|
||||
case eColorID_IMEConvertedTextForeground:
|
||||
case ColorID::IMERawInputForeground:
|
||||
case ColorID::IMEConvertedTextForeground:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
return NS_OK;
|
||||
case eColorID_IMERawInputUnderline:
|
||||
case eColorID_IMEConvertedTextUnderline:
|
||||
case ColorID::IMERawInputUnderline:
|
||||
case ColorID::IMEConvertedTextUnderline:
|
||||
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
||||
return NS_OK;
|
||||
case eColorID_IMESelectedRawTextUnderline:
|
||||
case eColorID_IMESelectedConvertedTextUnderline:
|
||||
case ColorID::IMESelectedRawTextUnderline:
|
||||
case ColorID::IMESelectedConvertedTextUnderline:
|
||||
aColor = NS_TRANSPARENT;
|
||||
return NS_OK;
|
||||
case eColorID_SpellCheckerUnderline:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
aColor = NS_RGB(0xff, 0, 0);
|
||||
return NS_OK;
|
||||
|
||||
// New CSS 2 Color definitions
|
||||
case eColorID_activeborder:
|
||||
case ColorID::Activeborder:
|
||||
idx = COLOR_ACTIVEBORDER;
|
||||
break;
|
||||
case eColorID_activecaption:
|
||||
case ColorID::Activecaption:
|
||||
idx = COLOR_ACTIVECAPTION;
|
||||
break;
|
||||
case eColorID_appworkspace:
|
||||
case ColorID::Appworkspace:
|
||||
idx = COLOR_APPWORKSPACE;
|
||||
break;
|
||||
case eColorID_background:
|
||||
case ColorID::Background:
|
||||
idx = COLOR_BACKGROUND;
|
||||
break;
|
||||
case eColorID_buttonface:
|
||||
case eColorID__moz_buttonhoverface:
|
||||
case ColorID::Buttonface:
|
||||
case ColorID::MozButtonhoverface:
|
||||
idx = COLOR_BTNFACE;
|
||||
break;
|
||||
case eColorID_buttonhighlight:
|
||||
case ColorID::Buttonhighlight:
|
||||
idx = COLOR_BTNHIGHLIGHT;
|
||||
break;
|
||||
case eColorID_buttonshadow:
|
||||
case ColorID::Buttonshadow:
|
||||
idx = COLOR_BTNSHADOW;
|
||||
break;
|
||||
case eColorID_buttontext:
|
||||
case eColorID__moz_buttonhovertext:
|
||||
case ColorID::Buttontext:
|
||||
case ColorID::MozButtonhovertext:
|
||||
idx = COLOR_BTNTEXT;
|
||||
break;
|
||||
case eColorID_captiontext:
|
||||
case ColorID::Captiontext:
|
||||
idx = COLOR_CAPTIONTEXT;
|
||||
break;
|
||||
case eColorID_graytext:
|
||||
case ColorID::Graytext:
|
||||
idx = COLOR_GRAYTEXT;
|
||||
break;
|
||||
case eColorID_highlight:
|
||||
case eColorID__moz_html_cellhighlight:
|
||||
case eColorID__moz_menuhover:
|
||||
case ColorID::Highlight:
|
||||
case ColorID::MozHtmlCellhighlight:
|
||||
case ColorID::MozMenuhover:
|
||||
idx = COLOR_HIGHLIGHT;
|
||||
break;
|
||||
case eColorID__moz_menubarhovertext:
|
||||
case ColorID::MozMenubarhovertext:
|
||||
if (!IsAppThemed()) {
|
||||
idx = nsUXThemeData::sFlatMenus ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT;
|
||||
break;
|
||||
}
|
||||
// Fall through
|
||||
case eColorID__moz_menuhovertext:
|
||||
case ColorID::MozMenuhovertext:
|
||||
if (mHasColorMenuHoverText) {
|
||||
aColor = mColorMenuHoverText;
|
||||
return NS_OK;
|
||||
}
|
||||
// Fall through
|
||||
case eColorID_highlighttext:
|
||||
case eColorID__moz_html_cellhighlighttext:
|
||||
case ColorID::Highlighttext:
|
||||
case ColorID::MozHtmlCellhighlighttext:
|
||||
idx = COLOR_HIGHLIGHTTEXT;
|
||||
break;
|
||||
case eColorID_inactiveborder:
|
||||
case ColorID::Inactiveborder:
|
||||
idx = COLOR_INACTIVEBORDER;
|
||||
break;
|
||||
case eColorID_inactivecaption:
|
||||
case ColorID::Inactivecaption:
|
||||
idx = COLOR_INACTIVECAPTION;
|
||||
break;
|
||||
case eColorID_inactivecaptiontext:
|
||||
case ColorID::Inactivecaptiontext:
|
||||
idx = COLOR_INACTIVECAPTIONTEXT;
|
||||
break;
|
||||
case eColorID_infobackground:
|
||||
case ColorID::Infobackground:
|
||||
idx = COLOR_INFOBK;
|
||||
break;
|
||||
case eColorID_infotext:
|
||||
case ColorID::Infotext:
|
||||
idx = COLOR_INFOTEXT;
|
||||
break;
|
||||
case eColorID_menu:
|
||||
case ColorID::Menu:
|
||||
idx = COLOR_MENU;
|
||||
break;
|
||||
case eColorID_menutext:
|
||||
case eColorID__moz_menubartext:
|
||||
case ColorID::Menutext:
|
||||
case ColorID::MozMenubartext:
|
||||
idx = COLOR_MENUTEXT;
|
||||
break;
|
||||
case eColorID_scrollbar:
|
||||
case ColorID::Scrollbar:
|
||||
idx = COLOR_SCROLLBAR;
|
||||
break;
|
||||
case eColorID_threeddarkshadow:
|
||||
case ColorID::Threeddarkshadow:
|
||||
idx = COLOR_3DDKSHADOW;
|
||||
break;
|
||||
case eColorID_threedface:
|
||||
case ColorID::Threedface:
|
||||
idx = COLOR_3DFACE;
|
||||
break;
|
||||
case eColorID_threedhighlight:
|
||||
case ColorID::Threedhighlight:
|
||||
idx = COLOR_3DHIGHLIGHT;
|
||||
break;
|
||||
case eColorID_threedlightshadow:
|
||||
case ColorID::Threedlightshadow:
|
||||
idx = COLOR_3DLIGHT;
|
||||
break;
|
||||
case eColorID_threedshadow:
|
||||
case ColorID::Threedshadow:
|
||||
idx = COLOR_3DSHADOW;
|
||||
break;
|
||||
case eColorID_window:
|
||||
case ColorID::Window:
|
||||
idx = COLOR_WINDOW;
|
||||
break;
|
||||
case eColorID_windowframe:
|
||||
case ColorID::Windowframe:
|
||||
idx = COLOR_WINDOWFRAME;
|
||||
break;
|
||||
case eColorID_windowtext:
|
||||
case ColorID::Windowtext:
|
||||
idx = COLOR_WINDOWTEXT;
|
||||
break;
|
||||
case eColorID__moz_eventreerow:
|
||||
case eColorID__moz_oddtreerow:
|
||||
case eColorID__moz_field:
|
||||
case eColorID__moz_combobox:
|
||||
case ColorID::MozEventreerow:
|
||||
case ColorID::MozOddtreerow:
|
||||
case ColorID::MozField:
|
||||
case ColorID::MozCombobox:
|
||||
idx = COLOR_WINDOW;
|
||||
break;
|
||||
case eColorID__moz_fieldtext:
|
||||
case eColorID__moz_comboboxtext:
|
||||
case ColorID::MozFieldtext:
|
||||
case ColorID::MozComboboxtext:
|
||||
idx = COLOR_WINDOWTEXT;
|
||||
break;
|
||||
case eColorID__moz_dialog:
|
||||
case eColorID__moz_cellhighlight:
|
||||
case ColorID::MozDialog:
|
||||
case ColorID::MozCellhighlight:
|
||||
idx = COLOR_3DFACE;
|
||||
break;
|
||||
case eColorID__moz_win_accentcolor:
|
||||
case ColorID::MozWinAccentcolor:
|
||||
if (mHasColorAccent) {
|
||||
aColor = mColorAccent;
|
||||
} else {
|
||||
|
@ -312,14 +312,14 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
aColor = NS_RGB(158, 158, 158);
|
||||
}
|
||||
return NS_OK;
|
||||
case eColorID__moz_win_accentcolortext:
|
||||
case ColorID::MozWinAccentcolortext:
|
||||
if (mHasColorAccentText) {
|
||||
aColor = mColorAccentText;
|
||||
} else {
|
||||
aColor = NS_RGB(0, 0, 0);
|
||||
}
|
||||
return NS_OK;
|
||||
case eColorID__moz_win_mediatext:
|
||||
case ColorID::MozWinMediatext:
|
||||
if (mHasColorMediaText) {
|
||||
aColor = mColorMediaText;
|
||||
return NS_OK;
|
||||
|
@ -327,7 +327,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
// if we've gotten here just return -moz-dialogtext instead
|
||||
idx = COLOR_WINDOWTEXT;
|
||||
break;
|
||||
case eColorID__moz_win_communicationstext:
|
||||
case ColorID::MozWinCommunicationstext:
|
||||
if (mHasColorCommunicationsText) {
|
||||
aColor = mColorCommunicationsText;
|
||||
return NS_OK;
|
||||
|
@ -335,17 +335,17 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
|
|||
// if we've gotten here just return -moz-dialogtext instead
|
||||
idx = COLOR_WINDOWTEXT;
|
||||
break;
|
||||
case eColorID__moz_dialogtext:
|
||||
case eColorID__moz_cellhighlighttext:
|
||||
case ColorID::MozDialogtext:
|
||||
case ColorID::MozCellhighlighttext:
|
||||
idx = COLOR_WINDOWTEXT;
|
||||
break;
|
||||
case eColorID__moz_dragtargetzone:
|
||||
case ColorID::MozDragtargetzone:
|
||||
idx = COLOR_HIGHLIGHTTEXT;
|
||||
break;
|
||||
case eColorID__moz_buttondefault:
|
||||
case ColorID::MozButtondefault:
|
||||
idx = COLOR_3DDKSHADOW;
|
||||
break;
|
||||
case eColorID__moz_nativehyperlinktext:
|
||||
case ColorID::MozNativehyperlinktext:
|
||||
idx = COLOR_HOTLIGHT;
|
||||
break;
|
||||
default:
|
||||
|
|
Загрузка…
Ссылка в новой задаче