mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Do not ignore color: transparent in high contrast mode.
PDFJS uses it, for example to allow text selection. It's not great if it shows on top of the actual PDF :-) Differential Revision: https://phabricator.services.mozilla.com/D58703
This commit is contained in:
parent
e9c14bb9fc
commit
c569d314a5
2 changed files with 25 additions and 16 deletions
|
@ -280,6 +280,11 @@ impl Device {
|
||||||
convert_nscolor_to_rgba(self.pref_sheet_prefs().mDefaultBackgroundColor)
|
convert_nscolor_to_rgba(self.pref_sheet_prefs().mDefaultBackgroundColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the default foreground color.
|
||||||
|
pub fn default_color(&self) -> RGBA {
|
||||||
|
convert_nscolor_to_rgba(self.pref_sheet_prefs().mDefaultColor)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the current effective text zoom.
|
/// Returns the current effective text zoom.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn effective_text_zoom(&self) -> f32 {
|
fn effective_text_zoom(&self) -> f32 {
|
||||||
|
|
|
@ -25,7 +25,7 @@ use smallvec::SmallVec;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use crate::style_adjuster::StyleAdjuster;
|
use crate::style_adjuster::StyleAdjuster;
|
||||||
use crate::values::computed;
|
use crate::values::{computed, specified};
|
||||||
|
|
||||||
/// We split the cascade in two phases: 'early' properties, and 'late'
|
/// We split the cascade in two phases: 'early' properties, and 'late'
|
||||||
/// properties.
|
/// properties.
|
||||||
|
@ -365,24 +365,28 @@ fn should_ignore_declaration_when_ignoring_document_colors(
|
||||||
// a background image, if we're ignoring document colors).
|
// a background image, if we're ignoring document colors).
|
||||||
// Here we check backplate status to decide if ignoring background-image
|
// Here we check backplate status to decide if ignoring background-image
|
||||||
// is the right decision.
|
// is the right decision.
|
||||||
{
|
let (is_background, is_transparent) = match **declaration {
|
||||||
let background_color = match **declaration {
|
PropertyDeclaration::BackgroundColor(ref color) => (true, color.is_transparent()),
|
||||||
PropertyDeclaration::BackgroundColor(ref color) => color,
|
PropertyDeclaration::Color(ref color) => (false, color.0.is_transparent()),
|
||||||
// In the future, if/when we remove the backplate pref, we can remove this
|
// In the future, if/when we remove the backplate pref, we can remove this
|
||||||
// special case along with the 'ignored_when_colors_disabled=True' mako line
|
// special case along with the 'ignored_when_colors_disabled=True' mako line
|
||||||
// for the "background-image" property.
|
// for the "background-image" property.
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
PropertyDeclaration::BackgroundImage(..) => return !static_prefs::pref!("browser.display.permit_backplate"),
|
PropertyDeclaration::BackgroundImage(..) => return !static_prefs::pref!("browser.display.permit_backplate"),
|
||||||
_ => return true,
|
_ => return true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if background_color.is_transparent() {
|
if is_transparent {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let color = device.default_background_color();
|
if is_background {
|
||||||
*declaration.to_mut() = PropertyDeclaration::BackgroundColor(color.into());
|
let color = device.default_background_color();
|
||||||
|
*declaration.to_mut() = PropertyDeclaration::BackgroundColor(color.into());
|
||||||
|
} else {
|
||||||
|
let color = device.default_color();
|
||||||
|
*declaration.to_mut() = PropertyDeclaration::Color(specified::ColorPropertyValue(color.into()));
|
||||||
|
}
|
||||||
|
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue