mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Make image-set without valid images render nothing
Differential Revision: https://phabricator.services.mozilla.com/D172341
This commit is contained in:
parent
29105eeb49
commit
76e8eeda72
3 changed files with 4 additions and 6 deletions
|
@ -78,10 +78,8 @@ impl ToComputedValue for specified::ImageSet {
|
|||
let items = self.items.to_computed_value(context);
|
||||
let dpr = context.device().device_pixel_ratio().get();
|
||||
|
||||
// If no item have a supported MIME type, the behavior is undefined by the standard
|
||||
// By default, we select the first item
|
||||
let mut supported_image = false;
|
||||
let mut selected_index = 0;
|
||||
let mut selected_index = std::usize::MAX;
|
||||
let mut selected_resolution = items[0].resolution.dppx();
|
||||
|
||||
for (i, item) in items.iter().enumerate() {
|
||||
|
@ -126,7 +124,7 @@ impl ToComputedValue for specified::ImageSet {
|
|||
|
||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||
Self {
|
||||
selected_index: 0,
|
||||
selected_index: std::usize::MAX,
|
||||
items: ToComputedValue::from_computed_value(&computed.items),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ pub use self::GenericCrossFadeImage as CrossFadeImage;
|
|||
#[css(comma, function = "image-set")]
|
||||
#[repr(C)]
|
||||
pub struct GenericImageSet<Image, Resolution> {
|
||||
/// The index of the selected candidate. Zero for specified values.
|
||||
/// The index of the selected candidate. usize::MAX for specified values or invalid images.
|
||||
#[css(skip)]
|
||||
pub selected_index: usize,
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ impl ImageSet {
|
|||
})
|
||||
})?;
|
||||
Ok(Self {
|
||||
selected_index: 0,
|
||||
selected_index: std::usize::MAX,
|
||||
items: items.into(),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue