Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2428383006: Decouple VR Shell DPR and CSS size from Physical Displays. (Closed)
Patch Set: Address bshe comments + minor fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | ui/android/delegated_frame_host_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index a266f43d9b194bc884955d27c1c2187d10041e79..b46246a502f6a442924cadf6d7752a488178eae9 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -450,8 +450,9 @@ void VRDisplay::beginPresent(ScriptPromiseResolver* resolver) {
Fullscreen::requestFullscreen(*canvas, Fullscreen::UnprefixedRequest);
// Check to see if the canvas is still the current fullscreen
- // element once every 5 seconds.
- m_fullscreenCheckTimer.startRepeating(5.0, BLINK_FROM_HERE);
+ // element once every 2 seconds.
+ m_fullscreenCheckTimer.startRepeating(2.0, BLINK_FROM_HERE);
+ m_reenteredFullscreen = false;
}
if (doc) {
@@ -639,18 +640,38 @@ void VRDisplay::OnDeactivate(
}
void VRDisplay::onFullscreenCheck(TimerBase*) {
+ if (!m_isPresenting) {
+ m_fullscreenCheckTimer.stop();
+ return;
+ }
// TODO: This is a temporary measure to track if fullscreen mode has been
// exited by the UA. If so we need to end VR presentation. Soon we won't
// depend on the Fullscreen API to fake VR presentation, so this will
// become unnessecary. Until that point, though, this seems preferable to
// adding a bunch of notification plumbing to Fullscreen.
if (!Fullscreen::isCurrentFullScreenElement(*m_layer.source())) {
- m_isPresenting = false;
- OnPresentChange();
- m_fullscreenCheckTimer.stop();
- if (!m_display)
+ // TODO(mthiesse): Due to asynchronous resizing, we might get kicked out of
+ // fullscreen when changing display parameters upon entering WebVR. So one
+ // time only, we reenter fullscreen after having left it; otherwise we exit
+ // presentation.
+ if (m_reenteredFullscreen) {
+ m_isPresenting = false;
+ OnPresentChange();
+ m_fullscreenCheckTimer.stop();
+ if (m_display)
+ m_display->ExitPresent();
return;
- m_display->ExitPresent();
+ }
+ m_reenteredFullscreen = true;
+ auto canvas = m_layer.source();
+ Document* doc = m_navigatorVR->document();
+ std::unique_ptr<UserGestureIndicator> gestureIndicator;
+ if (doc) {
+ gestureIndicator =
+ wrapUnique(new UserGestureIndicator(DocumentUserGestureToken::create(
+ doc, UserGestureToken::Status::PossiblyExistingGesture)));
+ }
+ Fullscreen::requestFullscreen(*canvas, Fullscreen::UnprefixedRequest);
}
}
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | ui/android/delegated_frame_host_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698