Skip to content

Commit

Permalink
Bug 1331213: Implement Device::media_type, without supporting overrid…
Browse files Browse the repository at this point in the history
…es for now. r=heycam

MozReview-Commit-ID: 9AeHViwoX1t
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
  • Loading branch information
emilio committed Jan 17, 2017
1 parent 646258e commit 13878d6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions components/style/gecko/media_queries.rs
Expand Up @@ -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.
Expand Down

0 comments on commit 13878d6

Please sign in to comment.