Bug 1331213: Implement Device::media_type, without supporting overrides for now. r=heycam

MozReview-Commit-ID: 9AeHViwoX1t
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-01-15 23:51:58 +01:00
parent 646258e5a0
commit 13878d674c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -76,8 +76,17 @@ impl Device {
/// Returns the current media type of the device.
pub fn media_type(&self) -> MediaType {
// TODO
MediaType::Screen
unsafe {
// FIXME(emilio): Gecko allows emulating random media with
// mIsEmulatingMedia / mMediaEmulated . Refactor both sides so that
// is supported (probably just making MediaType an Atom).
if (*self.pres_context).mMedium == atom!("screen").as_ptr() {
MediaType::Screen
} else {
debug_assert!((*self.pres_context).mMedium == atom!("print").as_ptr());
MediaType::Print
}
}
}
/// Returns the current viewport size in app units.