From 1ba19b19403e855c0c838d753188f613817b6e16 Mon Sep 17 00:00:00 2001 From: jamiewalch Date: Fri, 14 Nov 2014 12:04:51 -0800 Subject: [PATCH] Unify full-screen and fullscreen CSS. ClientSession registers for full-screen events only while connected, which can result in a race-condition whereby the property is not removed when the app is windowed. When the apps v2 custom window frame was added, a separate "fullscreen" property was added to the node with the same semantics, so the simplest fix is just to get rid of "full-screen" in favour of the always-updated "fullscreen", and to update apps v1 to also maintain that property. Review URL: https://codereview.chromium.org/727563002 Cr-Commit-Position: refs/heads/master@{#304258} --- remoting/webapp/base/html/main.css | 2 +- remoting/webapp/crd/js/client_session.js | 6 ------ remoting/webapp/crd/js/fullscreen_v1.js | 5 +++++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/remoting/webapp/base/html/main.css b/remoting/webapp/base/html/main.css index a9df6ec2841d..c4823c6271d7 100644 --- a/remoting/webapp/base/html/main.css +++ b/remoting/webapp/base/html/main.css @@ -703,7 +703,7 @@ html.apps-v2.scrollable { * no scroll-bars, so the advantages of flex-box layout to achieve centering * (ie, the DOM is easier to measure to determine when scroll-bars are needed) * don't apply */ -.full-screen #session-mode { +.fullscreen #session-mode { position: fixed; top: 0; left: 0; diff --git a/remoting/webapp/crd/js/client_session.js b/remoting/webapp/crd/js/client_session.js index 6c46ebdd160f..5be8029a6431 100644 --- a/remoting/webapp/crd/js/client_session.js +++ b/remoting/webapp/crd/js/client_session.js @@ -1302,13 +1302,7 @@ remoting.ClientSession.prototype.requestPairing = function(clientName, onDone) { * @private */ remoting.ClientSession.prototype.onFullScreenChanged_ = function (fullscreen) { - var htmlNode = /** @type {HTMLElement} */ (document.documentElement); this.enableBumpScroll_(fullscreen); - if (fullscreen) { - htmlNode.classList.add('full-screen'); - } else { - htmlNode.classList.remove('full-screen'); - } }; /** diff --git a/remoting/webapp/crd/js/fullscreen_v1.js b/remoting/webapp/crd/js/fullscreen_v1.js index 5935e3555433..a68a77bc27cb 100644 --- a/remoting/webapp/crd/js/fullscreen_v1.js +++ b/remoting/webapp/crd/js/fullscreen_v1.js @@ -87,6 +87,11 @@ remoting.FullscreenAppsV1.prototype.onFullscreenChanged_ = function() { window.setTimeout( /** @this {remoting.FullscreenAppsV1} */ function() { + if (this.isActive()) { + document.body.classList.add('fullscreen'); + } else { + document.body.classList.remove('fullscreen'); + } this.eventSource_.raiseEvent(this.kEventName_, this.isActive()); }.bind(this), 500);