Chromium Code Reviews| 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 4cf3973662823f203c01223e67c35aa38b26ad44..f2cebb033ce5d2f9fd8c7f4b3b3ca5becdf6a07f 100644 |
| --- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
| +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
| @@ -4,6 +4,7 @@ |
| #include "modules/vr/VRDisplay.h" |
| +#include "core/css/StylePropertySet.h" |
| #include "core/dom/DOMException.h" |
| #include "core/dom/FrameRequestCallback.h" |
| #include "core/dom/Fullscreen.h" |
| @@ -336,8 +337,22 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, |
| // TODO: Need a proper VR compositor, but for the moment on mobile |
| // we'll just make the canvas fullscreen so that VrShell can pick it |
| // up through the standard (high latency) compositing path. |
| - Fullscreen::requestFullscreen(*m_layer.source(), |
| - Fullscreen::UnprefixedRequest); |
| + auto canvas = m_layer.source(); |
| + auto inlineStyle = canvas->inlineStyle(); |
| + if (inlineStyle) { |
| + m_fullscreenOrigWidth = inlineStyle->getPropertyValue(CSSPropertyWidth); |
|
mthiesse
2016/11/16 21:30:41
why are we changing CSS properties?
mthiesse
2016/11/16 21:31:35
Just saw your comment in the CL description. Put i
klausw
2016/11/16 23:37:39
Done, with a bit more detail:
// THREE.js's
|
| + if (!m_fullscreenOrigWidth.isNull()) { |
| + canvas->setInlineStyleProperty(CSSPropertyWidth, "100%"); |
| + } |
| + m_fullscreenOrigHeight = inlineStyle->getPropertyValue(CSSPropertyHeight); |
| + if (!m_fullscreenOrigHeight.isNull()) { |
| + canvas->setInlineStyleProperty(CSSPropertyHeight, "100%"); |
| + } |
| + } else { |
| + m_fullscreenOrigWidth = String(); |
| + m_fullscreenOrigHeight = String(); |
| + } |
| + Fullscreen::requestFullscreen(*canvas, Fullscreen::UnprefixedRequest); |
| // Check to see if the canvas is still the current fullscreen |
| // element once per second. |
| @@ -435,8 +450,18 @@ void VRDisplay::beginPresent(ScriptPromiseResolver* resolver) { |
| void VRDisplay::forceExitPresent() { |
| if (m_isPresenting) { |
| if (!m_capabilities->hasExternalDisplay()) { |
| - Fullscreen::fullyExitFullscreen(m_layer.source()->document()); |
| + auto canvas = m_layer.source(); |
| + Fullscreen::fullyExitFullscreen(canvas->document()); |
| m_fullscreenCheckTimer.stop(); |
| + if (!m_fullscreenOrigWidth.isNull()) { |
|
bajones
2016/11/16 21:23:52
This is all so hacky anyway I don't know how much
klausw
2016/11/16 23:37:39
I don't have strong feelings about this, but at th
|
| + canvas->setInlineStyleProperty(CSSPropertyWidth, m_fullscreenOrigWidth); |
| + m_fullscreenOrigWidth = String(); |
| + } |
| + if (!m_fullscreenOrigHeight.isNull()) { |
| + canvas->setInlineStyleProperty(CSSPropertyWidth, |
| + m_fullscreenOrigHeight); |
| + m_fullscreenOrigHeight = String(); |
| + } |
| } else { |
| // Can't get into this presentation mode, so nothing to do here. |
| } |