mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Make the pres context optional in the style system.
Differential Revision: https://phabricator.services.mozilla.com/D21239
This commit is contained in:
parent
4e3e4c106a
commit
e723a5b7d6
4 changed files with 85 additions and 38 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue