aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xrsystem.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-04-09 20:27:24 -0700
committerManish Goregaokar <manishsmail@gmail.com>2020-04-09 22:25:27 -0700
commitd146303f1d7e2247cfa768a6caf2b4deb5e5bf11 (patch)
treeb56dc8687237ec00b15043a117750aa654efd74c /components/script/dom/xrsystem.rs
parent37023b24f256f7defd605e90e0873afee9197a1e (diff)
downloadservo-d146303f1d7e2247cfa768a6caf2b4deb5e5bf11.tar.gz
servo-d146303f1d7e2247cfa768a6caf2b4deb5e5bf11.zip
Dirty canvas when exiting immersive sessions
Diffstat (limited to 'components/script/dom/xrsystem.rs')
-rw-r--r--components/script/dom/xrsystem.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/components/script/dom/xrsystem.rs b/components/script/dom/xrsystem.rs
index 0e2a44f09cb..7bd7f72e8fe 100644
--- a/components/script/dom/xrsystem.rs
+++ b/components/script/dom/xrsystem.rs
@@ -3,8 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::cell::DomRefCell;
+use crate::dom::bindings::codegen::Bindings::XRRenderStateBinding::XRRenderStateMethods;
+use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::XRSessionInit;
use crate::dom::bindings::codegen::Bindings::XRSystemBinding::{XRSessionMode, XRSystemMethods};
+use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
+ XRWebGLLayerMethods, XRWebGLRenderingContext,
+};
use crate::dom::bindings::conversions::{ConversionResult, FromJSValConvertible};
use crate::dom::bindings::error::Error;
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
@@ -81,6 +86,17 @@ impl XRSystem {
if let Some(active) = self.active_immersive_session.get() {
if Dom::from_ref(&*active) == Dom::from_ref(session) {
self.active_immersive_session.set(None);
+
+ // Dirty the canvas, since it has been skipping this step whilst in immersive
+ // mode
+ if let Some(layer) = session.RenderState().GetBaseLayer() {
+ match layer.Context() {
+ XRWebGLRenderingContext::WebGLRenderingContext(c) => c.mark_as_dirty(),
+ XRWebGLRenderingContext::WebGL2RenderingContext(c) => {
+ c.base_context().mark_as_dirty()
+ },
+ }
+ }
}
}
self.active_inline_sessions