Add transparent padding around ServoSurface

This commit is contained in:
Paul Rouget 2019-03-25 17:52:50 +01:00
parent 40d599e39f
commit 8f2390fdff
10 changed files with 186 additions and 74 deletions

View file

@ -18,7 +18,8 @@ use std::fmt::{Debug, Error, Formatter};
use std::rc::Rc;
use style_traits::DevicePixel;
use webrender_api::{
DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePoint, FramebufferIntSize, ScrollLocation,
DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePoint, FramebufferIntRect,
FramebufferIntSize, ScrollLocation,
};
use webvr::VRServiceManager;
use webvr_traits::WebVRMainThreadHeartbeat;
@ -173,3 +174,12 @@ pub struct EmbedderCoordinates {
/// Coordinates of the document within the framebuffer.
pub viewport: DeviceIntRect,
}
impl EmbedderCoordinates {
pub fn get_flipped_viewport(&self) -> FramebufferIntRect {
let fb_height = self.framebuffer.height;
let mut view = self.viewport.clone();
view.origin.y = fb_height - view.origin.y - view.size.height;
FramebufferIntRect::from_untyped(&view.to_untyped())
}
}