diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 09:01:54 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 09:01:54 +0000 |
commit | 602eb9e9f25e7f7b50639bba04c7961e012c67f2 (patch) | |
tree | 2ac52ab1521eb042b5432308de6320e36b7bac4e /remoting/webapp/client_session.js | |
parent | 3d03c33d135b7d33c5b29b1afdeb76af05e9c08d (diff) | |
download | chromium_src-602eb9e9f25e7f7b50639bba04c7961e012c67f2.zip chromium_src-602eb9e9f25e7f7b50639bba04c7961e012c67f2.tar.gz chromium_src-602eb9e9f25e7f7b50639bba04c7961e012c67f2.tar.bz2 |
Set initial scroll bar visibility.
The initial shrink-to-fit state is set early in the connection process, before
the UI switches to session mode, hence the no-scroll style was not being applied
initially. This CL sets it explicitly once connection is complete.
BUG=252796,257089
Review URL: https://chromiumcodereview.appspot.com/19729015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp/client_session.js')
-rw-r--r-- | remoting/webapp/client_session.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js index 29add54..508a49f 100644 --- a/remoting/webapp/client_session.js +++ b/remoting/webapp/client_session.js @@ -153,6 +153,22 @@ remoting.ClientSession.prototype.setOnStateChange = function(onStateChange) { this.onStateChange_ = onStateChange; }; +/** + * Called when the connection has been established to set the initial scroll- + * bar visibility correctly. + * + * TODO(jamiewalch): crbug.com/252796: Remove this once crbug.com/240772 is + * fixed. + */ +remoting.ClientSession.prototype.setScrollbarVisibility = function() { + var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); + if (this.shrinkToFit_) { + htmlNode.classList.add('no-scroll'); + } else { + htmlNode.classList.remove('no-scroll'); + } +}; + // Note that the positive values in both of these enums are copied directly // from chromoting_scriptable_object.h and must be kept in sync. The negative // values represent state transitions that occur within the web-app that have @@ -640,6 +656,7 @@ remoting.ClientSession.prototype.setScreenMode_ = this.shrinkToFit_ = shrinkToFit; this.resizeToClient_ = resizeToClient; + this.setScrollbarVisibility(); if (this.hostId != '') { var options = {}; @@ -653,14 +670,6 @@ remoting.ClientSession.prototype.setScreenMode_ = this.scroll_(0, 0); } - // TODO(jamiewalch): crbug.com/252796: Remove this once crbug.com/240772 - // is fixed. - var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); - if (this.shrinkToFit_) { - htmlNode.classList.add('no-scroll'); - } else { - htmlNode.classList.remove('no-scroll'); - } } /** |