mirror of
https://github.com/servo/servo.git
synced 2025-06-22 08:08:59 +01:00
style: Modify background image styling to only apply URL-sourced images when backplate is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D64200
This commit is contained in:
parent
b9bf5fb868
commit
45cc310f7f
1 changed files with 14 additions and 3 deletions
|
@ -380,6 +380,9 @@ fn application_when_ignoring_colors(
|
|||
// Here we check backplate status to decide if ignoring background-image
|
||||
// is the right decision.
|
||||
match *declaration {
|
||||
// If we've got multiple declarations in the same block, they'll
|
||||
// get overridden at parse time. We should probably adjust this
|
||||
// to turn Ignored decls into `none`. See 1619701
|
||||
PropertyDeclaration::BackgroundColor(ref color) => {
|
||||
if color.is_transparent() {
|
||||
return DeclarationApplication::Apply;
|
||||
|
@ -405,11 +408,19 @@ fn application_when_ignoring_colors(
|
|||
// special case along with the 'ignored_when_colors_disabled=True' mako line
|
||||
// for the "background-image" property.
|
||||
#[cfg(feature = "gecko")]
|
||||
PropertyDeclaration::BackgroundImage(..) => {
|
||||
PropertyDeclaration::BackgroundImage(ref bkg) => {
|
||||
use crate::values::generics::image::Image;
|
||||
// We should only allow images to be rendered in HCM if the backplate pref
|
||||
// is enabled, and if all the images applied to the background are from URLs.
|
||||
// If one or more background images aren't from URL's (ie. gradients)
|
||||
// we should ignore all background-image styling.
|
||||
if static_prefs::pref!("browser.display.permit_backplate") {
|
||||
DeclarationApplication::Apply
|
||||
if bkg.0.iter().all(|image| matches!(*image, Image::Url(..))) {
|
||||
return DeclarationApplication::Apply;
|
||||
}
|
||||
return DeclarationApplication::Ignore;
|
||||
} else {
|
||||
DeclarationApplication::Ignore
|
||||
return DeclarationApplication::Ignore;
|
||||
}
|
||||
},
|
||||
_ => DeclarationApplication::Ignore,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue