mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
Auto merge of #14159 - upsuper:media-query, r=Wafflespeanut
Allow empty media query list <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14159) <!-- Reviewable:end -->
This commit is contained in:
commit
c3dc50b7ac
9 changed files with 41 additions and 23 deletions
|
@ -59,11 +59,7 @@ fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) {
|
|||
#[test]
|
||||
fn test_mq_empty() {
|
||||
test_media_rule("@media { }", |list, css| {
|
||||
assert!(list.media_queries.len() == 1, css.to_owned());
|
||||
let q = &list.media_queries[0];
|
||||
assert!(q.qualifier == None, css.to_owned());
|
||||
assert!(q.media_type == MediaQueryType::All, css.to_owned());
|
||||
assert!(q.expressions.len() == 0, css.to_owned());
|
||||
assert!(list.media_queries.len() == 0, css.to_owned());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ fn test_parse_stylesheet() {
|
|||
ParserContextExtraData::default());
|
||||
let expected = Stylesheet {
|
||||
origin: Origin::UserAgent,
|
||||
media: None,
|
||||
media: Default::default(),
|
||||
dirty_on_viewport_size_change: false,
|
||||
rules: vec![
|
||||
CSSRule::Namespace(Arc::new(RwLock::new(NamespaceRule {
|
||||
|
|
|
@ -37753,6 +37753,12 @@
|
|||
"url": "/cookies/path/match.html"
|
||||
}
|
||||
],
|
||||
"cssom-view/MediaQueryList-with-empty-string.html": [
|
||||
{
|
||||
"path": "cssom-view/MediaQueryList-with-empty-string.html",
|
||||
"url": "/cssom-view/MediaQueryList-with-empty-string.html"
|
||||
}
|
||||
],
|
||||
"html/semantics/forms/the-form-element/form-action-url.html": [
|
||||
{
|
||||
"path": "html/semantics/forms/the-form-element/form-action-url.html",
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>cssom-view - MediaQueryList with empty string</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(function () {
|
||||
var mql = window.matchMedia('');
|
||||
assert_equals(mql.media, '', "This should be an empty media query list");
|
||||
assert_equals(mql.matches, true, "Empty media query list should evaluate to true");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue