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

Unified Diff: remoting/webapp/client_session.js

Issue 22006002: Fix scroll-bar behaviour. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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 | « no previous file | remoting/webapp/main.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_session.js
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index 51b72a751ffca4542a6f4d722a327f867a55f373..26b20c4c28ce2da4babe31ddf2a471a092618cf2 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -161,11 +161,31 @@ remoting.ClientSession.prototype.setOnStateChange = function(onStateChange) {
* fixed.
*/
remoting.ClientSession.prototype.setScrollbarVisibility = function() {
+ // Determine whether or not horizontal or vertical scrollbars are required,
+ // taking into account their width.
+ var kScrollBarWidth = 16;
Wez 2013/08/03 00:19:51 Is this defined in our CSS?
Jamie 2013/08/03 00:36:16 Yes.
+ var needsVerticalScroll =
+ !this.shrinkToFit_ && window.innerHeight < this.plugin.desktopHeight;
Wez 2013/08/03 00:19:51 nit: Might be clearer to just skip this logic enti
Jamie 2013/08/03 00:36:16 I think it's clearer this way. The variables are c
Wez 2013/08/03 00:47:18 Yes, exactly. So why not: needsHScroll = false; n
Jamie 2013/08/03 01:35:54 Done.
+ var needsHorizontalScroll =
+ !this.shrinkToFit_ && window.innerWidth < this.plugin.desktopWidth;
+ if (needsHorizontalScroll && !needsVerticalScroll) {
+ needsVerticalScroll =
+ window.innerHeight - kScrollBarWidth < this.plugin.desktopHeight;
+ } else if (!needsHorizontalScroll && needsVerticalScroll) {
+ needsHorizontalScroll =
+ window.innerWidth - kScrollBarWidth < this.plugin.desktopWidth;
+ }
+
var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode);
- if (this.shrinkToFit_) {
- htmlNode.classList.add('no-scroll');
+ if (needsHorizontalScroll) {
+ htmlNode.classList.remove('no-horizontal-scroll');
} else {
- htmlNode.classList.remove('no-scroll');
+ htmlNode.classList.add('no-horizontal-scroll');
+ }
+ if (needsVerticalScroll) {
+ htmlNode.classList.remove('no-vertical-scroll');
+ } else {
+ htmlNode.classList.add('no-vertical-scroll');
}
};
@@ -930,6 +950,8 @@ remoting.ClientSession.prototype.onResize = function() {
// If bump-scrolling is enabled, adjust the plugin margins to fully utilize
// the new window area.
this.scroll_(0, 0);
+
+ this.setScrollbarVisibility();
};
/**
« no previous file with comments | « no previous file | remoting/webapp/main.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698