mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
implement update_source_set, select_image_source
This commit is contained in:
parent
8eb2a53e20
commit
8d06da8afd
6 changed files with 289 additions and 99 deletions
|
@ -18,6 +18,7 @@ use values::specified::{Length, NoCalcLength, ViewportPercentageLength};
|
|||
/// A value for a `<source-size>`:
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#source-size
|
||||
#[derive(Debug)]
|
||||
pub struct SourceSize {
|
||||
condition: MediaCondition,
|
||||
value: Length,
|
||||
|
@ -38,6 +39,7 @@ impl Parse for SourceSize {
|
|||
/// A value for a `<source-size-list>`:
|
||||
///
|
||||
/// https://html.spec.whatwg.org/multipage/#source-size-list
|
||||
#[derive(Debug)]
|
||||
pub struct SourceSizeList {
|
||||
source_sizes: Vec<SourceSize>,
|
||||
value: Option<Length>,
|
||||
|
@ -52,6 +54,11 @@ impl SourceSizeList {
|
|||
}
|
||||
}
|
||||
|
||||
/// Set content of `value`, which can be used as fall-back during evaluate.
|
||||
pub fn set_fallback_value(&mut self, width: Option<Length>) {
|
||||
self.value = width;
|
||||
}
|
||||
|
||||
/// Evaluate this <source-size-list> to get the final viewport length.
|
||||
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au {
|
||||
let matching_source_size = self.source_sizes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue