style: Make the pres context optional in the style system.

Differential Revision: https://phabricator.services.mozilla.com/D21239
This commit is contained in:
Emilio Cobos Álvarez 2019-03-06 21:36:12 +00:00
parent 4e3e4c106a
commit e723a5b7d6
4 changed files with 85 additions and 38 deletions

View file

@ -17,12 +17,13 @@ use app_units::Au;
use euclid::Size2D;
fn viewport_size(device: &Device) -> Size2D<Au> {
let pc = device.pres_context();
if pc.mIsRootPaginatedDocument() != 0 {
// We want the page size, including unprintable areas and margins.
// FIXME(emilio, bug 1414600): Not quite!
let area = &pc.mPageSize;
return Size2D::new(Au(area.width), Au(area.height));
if let Some(pc) = device.pres_context() {
if pc.mIsRootPaginatedDocument() != 0 {
// We want the page size, including unprintable areas and margins.
// FIXME(emilio, bug 1414600): Not quite!
let area = &pc.mPageSize;
return Size2D::new(Au(area.width), Au(area.height));
}
}
device.au_viewport_size()
}