Auto merge of #18024 - bradwerth:mediatypeAtom, r=emilio

Rework MediaType to be an atom-based struct instead of an enum.

MozReview-Commit-ID: 1Tfrs9PBkhA

<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1371395
https://reviewboard.mozilla.org/r/163194/

---
<!-- 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 _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/18024)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-09 18:24:48 -05:00 committed by GitHub
commit faf5b1f797
9 changed files with 92 additions and 72 deletions

View file

@ -222,7 +222,7 @@ fn test_insert() {
}
fn mock_stylist() -> Stylist {
let device = Device::new(MediaType::Screen, TypedSize2D::new(0f32, 0f32), ScaleFactor::new(1.0));
let device = Device::new(MediaType::screen(), TypedSize2D::new(0f32, 0f32), ScaleFactor::new(1.0));
Stylist::new(device, QuirksMode::NoQuirks)
}
@ -230,9 +230,9 @@ fn mock_stylist() -> Stylist {
fn test_stylist_device_accessors() {
thread_state::initialize(thread_state::LAYOUT);
let stylist = mock_stylist();
assert_eq!(stylist.device().media_type(), MediaType::Screen);
assert_eq!(stylist.device().media_type(), MediaType::screen());
let mut stylist_mut = mock_stylist();
assert_eq!(stylist_mut.device_mut().media_type(), MediaType::Screen);
assert_eq!(stylist_mut.device_mut().media_type(), MediaType::screen());
}
#[test]