mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Implement the 'overflow-inline' media query.
Bug: 1422235 Reviewed-by: emilio
This commit is contained in:
parent
81a07b4351
commit
274845fc14
1 changed files with 29 additions and 1 deletions
|
@ -327,6 +327,28 @@ fn eval_overflow_block(device: &Device, query_value: Option<OverflowBlock>) -> b
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
||||
#[repr(u8)]
|
||||
enum OverflowInline {
|
||||
None,
|
||||
Scroll,
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/mediaqueries-4/#mf-overflow-inline
|
||||
fn eval_overflow_inline(device: &Device, query_value: Option<OverflowInline>) -> bool {
|
||||
// See the note in eval_overflow_block.
|
||||
let scrolling = device.media_type() != MediaType::print();
|
||||
let query_value = match query_value {
|
||||
Some(v) => v,
|
||||
None => return scrolling,
|
||||
};
|
||||
|
||||
match query_value {
|
||||
OverflowInline::None => !scrolling,
|
||||
OverflowInline::Scroll => scrolling,
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/mediaqueries-4/#mf-interaction
|
||||
bitflags! {
|
||||
struct PointerCapabilities: u8 {
|
||||
|
@ -505,7 +527,7 @@ lazy_static! {
|
|||
/// to support new types in these entries and (2) ensuring that either
|
||||
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
||||
/// would be returned by the evaluator function could change.
|
||||
pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 49] = [
|
||||
pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 50] = [
|
||||
feature!(
|
||||
atom!("width"),
|
||||
AllowsRanges::Yes,
|
||||
|
@ -630,6 +652,12 @@ lazy_static! {
|
|||
keyword_evaluator!(eval_overflow_block, OverflowBlock),
|
||||
ParsingRequirements::empty(),
|
||||
),
|
||||
feature!(
|
||||
atom!("overflow-inline"),
|
||||
AllowsRanges::No,
|
||||
keyword_evaluator!(eval_overflow_inline, OverflowInline),
|
||||
ParsingRequirements::empty(),
|
||||
),
|
||||
feature!(
|
||||
atom!("pointer"),
|
||||
AllowsRanges::No,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue