зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1422235 - Implement the 'overflow-inline' media query. r=emilio
This commit is contained in:
Родитель
20fa93316d
Коммит
baf06c6032
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<span>A</span>
|
||||
<span>D</span>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<style>
|
||||
@media (overflow-inline: none) {
|
||||
.a { display: none }
|
||||
}
|
||||
@media (overflow-inline: scroll) {
|
||||
.b { display: none }
|
||||
}
|
||||
@media (overflow-inline) {
|
||||
.c { display: none }
|
||||
}
|
||||
@media (overflow-inline: something-new-and-unknown) {
|
||||
.d { display: none }
|
||||
}
|
||||
</style>
|
||||
<span class=a>A</span>
|
||||
<span class=b>B</span>
|
||||
<span class=c>C</span>
|
||||
<span class=d>D</span>
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html class=reftest-paged>
|
||||
<span>B</span>
|
||||
<span>C</span>
|
||||
<span>D</span>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html class=reftest-paged>
|
||||
<style>
|
||||
@media (overflow-inline: none) {
|
||||
.a { display: none }
|
||||
}
|
||||
@media (overflow-inline: scroll) {
|
||||
.b { display: none }
|
||||
}
|
||||
@media (overflow-inline) {
|
||||
.c { display: none }
|
||||
}
|
||||
@media (overflow-inline: something-new-and-unknown) {
|
||||
.d { display: none }
|
||||
}
|
||||
</style>
|
||||
<span class=a>A</span>
|
||||
<span class=b>B</span>
|
||||
<span class=c>C</span>
|
||||
<span class=d>D</span>
|
|
@ -12,6 +12,8 @@ fuzzy-if(Android,0-8,0-454) == mq_print_maxheight.xhtml mq_print-ref.xhtml
|
|||
== mq_overflow-block.html mq_overflow-block-ref.html
|
||||
== mq_print_overflow-block.html mq_print_overflow-block-ref.html
|
||||
== mq_overflow-block.svg mq_overflow-block-ref.svg
|
||||
== mq_overflow-inline.html mq_overflow-inline-ref.html
|
||||
== mq_print_overflow-inline.html mq_print_overflow-inline-ref.html
|
||||
|
||||
== mq_print_maxwidth_updown.xhtml mq_print-ref.xhtml
|
||||
== mq_print_maxheight_updown.xhtml mq_print-ref.xhtml
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -528,6 +528,17 @@ function run() {
|
|||
var overflow_block_none = query_applies("(overflow-block: none)");
|
||||
assert_not_equals(any_overflow_block, overflow_block_none, "overflow-block should be equivalent to not (overflow-block: none)");
|
||||
|
||||
// Parsing tests for overflow-inline from mediaqueries-4
|
||||
expression_should_be_parseable("overflow-inline")
|
||||
expression_should_be_parseable("overflow-inline: none")
|
||||
expression_should_be_parseable("overflow-inline: scroll")
|
||||
expression_should_not_be_parseable("overflow-inline: some-random-invalid-thing")
|
||||
|
||||
// Sanity check for overflow-inline
|
||||
var any_overflow_inline = query_applies("(overflow-inline)");
|
||||
var overflow_inline_none = query_applies("(overflow-inline: none)");
|
||||
assert_not_equals(any_overflow_inline, overflow_inline_none, "overflow-inline should be equivalent to not (overflow-inline: none)");
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
|
|
|
@ -927,6 +927,7 @@ STATIC_ATOMS = [
|
|||
Atom("output", "output"),
|
||||
Atom("overflow", "overflow"),
|
||||
Atom("overflowBlock", "overflow-block"),
|
||||
Atom("overflowInline", "overflow-inline"),
|
||||
Atom("overlay", "overlay"),
|
||||
Atom("p", "p"),
|
||||
Atom("pack", "pack"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче