mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #13453 - metajack:media-query-list, r=jdm
Implement matchMedia and MediaQueryList <!-- 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 #13376 (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. --> Fixes #13376. <!-- 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/13453) <!-- Reviewable:end -->
This commit is contained in:
commit
6ef46ab9e4
22 changed files with 500 additions and 20 deletions
|
@ -137,6 +137,8 @@ pub mod values;
|
|||
pub mod viewport;
|
||||
pub mod workqueue;
|
||||
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// The CSS properties supported by the style system.
|
||||
|
@ -176,3 +178,16 @@ pub fn arc_ptr_eq<T: 'static>(a: &Arc<T>, b: &Arc<T>) -> bool {
|
|||
let b: &T = &**b;
|
||||
(a as *const T) == (b as *const T)
|
||||
}
|
||||
|
||||
pub fn serialize_comma_separated_list<W, T>(dest: &mut W, list: &[T])
|
||||
-> fmt::Result where W: fmt::Write, T: ToCss {
|
||||
if list.len() > 0 {
|
||||
for item in &list[..list.len()-1] {
|
||||
try!(item.to_css(dest));
|
||||
try!(write!(dest, ", "));
|
||||
}
|
||||
list[list.len()-1].to_css(dest)
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue