mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Factor PreferenceSheet colors to its own struct
This will come handy in the next patch. Depends on D120678 Differential Revision: https://phabricator.services.mozilla.com/D120679
This commit is contained in:
parent
c2a50c92fa
commit
eca66dba72
2 changed files with 9 additions and 9 deletions
|
@ -93,7 +93,7 @@ impl Device {
|
|||
document,
|
||||
default_values: ComputedValues::default_values(doc),
|
||||
root_font_size: AtomicU32::new(FONT_MEDIUM_PX.to_bits()),
|
||||
body_text_color: AtomicUsize::new(prefs.mDefaultColor as usize),
|
||||
body_text_color: AtomicUsize::new(prefs.mColors.mDefault as usize),
|
||||
used_root_font_size: AtomicBool::new(false),
|
||||
used_font_metrics: AtomicBool::new(false),
|
||||
used_viewport_size: AtomicBool::new(false),
|
||||
|
@ -387,12 +387,12 @@ impl Device {
|
|||
|
||||
/// Returns the default background color.
|
||||
pub fn default_background_color(&self) -> RGBA {
|
||||
convert_nscolor_to_rgba(self.pref_sheet_prefs().mDefaultBackgroundColor)
|
||||
convert_nscolor_to_rgba(self.pref_sheet_prefs().mColors.mDefaultBackground)
|
||||
}
|
||||
|
||||
/// Returns the default foreground color.
|
||||
pub fn default_color(&self) -> RGBA {
|
||||
convert_nscolor_to_rgba(self.pref_sheet_prefs().mDefaultColor)
|
||||
convert_nscolor_to_rgba(self.pref_sheet_prefs().mColors.mDefault)
|
||||
}
|
||||
|
||||
/// Returns the current effective text zoom.
|
||||
|
|
|
@ -408,14 +408,14 @@ impl SystemColor {
|
|||
fn compute(&self, cx: &Context, scheme: SystemColorScheme) -> ComputedColor {
|
||||
use crate::gecko_bindings::bindings;
|
||||
|
||||
let prefs = cx.device().pref_sheet_prefs();
|
||||
let colors = &cx.device().pref_sheet_prefs().mColors;
|
||||
|
||||
convert_nscolor_to_computedcolor(match *self {
|
||||
SystemColor::Canvastext => prefs.mDefaultColor,
|
||||
SystemColor::Canvas => prefs.mDefaultBackgroundColor,
|
||||
SystemColor::Linktext => prefs.mLinkColor,
|
||||
SystemColor::Activetext => prefs.mActiveLinkColor,
|
||||
SystemColor::Visitedtext => prefs.mVisitedLinkColor,
|
||||
SystemColor::Canvastext => colors.mDefault,
|
||||
SystemColor::Canvas => colors.mDefaultBackground,
|
||||
SystemColor::Linktext => colors.mLink,
|
||||
SystemColor::Activetext => colors.mActiveLink,
|
||||
SystemColor::Visitedtext => colors.mVisitedLink,
|
||||
|
||||
_ => {
|
||||
let color = unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue