mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Construct viewports for inline sessions
This commit is contained in:
parent
3414c8d22d
commit
fe7cbd7843
2 changed files with 5 additions and 7 deletions
|
@ -20,7 +20,7 @@ use crate::dom::xrview::XRView;
|
|||
use crate::dom::xrviewport::XRViewport;
|
||||
use canvas_traits::webgl::WebGLFramebufferId;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::Size2D;
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use std::convert::TryInto;
|
||||
use webxr_api::SwapChainId as WebXRSwapChainId;
|
||||
use webxr_api::{Viewport, Views};
|
||||
|
@ -211,11 +211,13 @@ impl XRWebGLLayerMethods for XRWebGLLayer {
|
|||
let views = self.session.with_session(|s| s.views().clone());
|
||||
|
||||
let viewport = match (view.Eye(), views) {
|
||||
(XREye::None, Views::Inline) => {
|
||||
let origin = Point2D::new(0, 0);
|
||||
Rect::new(origin, self.size().cast())
|
||||
},
|
||||
(XREye::None, Views::Mono(view)) => view.viewport,
|
||||
(XREye::Left, Views::Stereo(view, _)) => view.viewport,
|
||||
(XREye::Right, Views::Stereo(_, view)) => view.viewport,
|
||||
// The spec doesn't really say what to do in this case
|
||||
// https://github.com/immersive-web/webxr/issues/769
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[xrWebGLLayer_viewports.https.html]
|
||||
[XRWebGLLayer reports a valid viewports for inline sessions]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue