summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 04:18:15 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 04:18:15 +0000
commit3f96c4e4b7254361caccc433be724469438cbc95 (patch)
tree066fbc199883c2a763676346cef24c9f72a04df9 /chrome/browser/resources
parent176d7a3657ee1891c7b59589ca90b8ff292de587 (diff)
downloadchromium_src-3f96c4e4b7254361caccc433be724469438cbc95.zip
chromium_src-3f96c4e4b7254361caccc433be724469438cbc95.tar.gz
chromium_src-3f96c4e4b7254361caccc433be724469438cbc95.tar.bz2
* Let MenuLocator tell if menu needs to scroll or not so that
we only show scroll buttons when there is no space left. * If there not enough space left to make a turn, place the menu on the original direction but make it fit to the screen. BUG=chromium-os:5760, chromium-os:4762 TEST=manual: network list should no longer show scroll bar and language menu should be shown on right side of button. Review URL: http://codereview.chromium.org/3669006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/menu.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/chrome/browser/resources/menu.js b/chrome/browser/resources/menu.js
index 66d205e..67e34fa 100644
--- a/chrome/browser/resources/menu.js
+++ b/chrome/browser/resources/menu.js
@@ -222,6 +222,12 @@ Menu.prototype = {
buttonHeight_ : 0,
/**
+ * True to enable scroll button.
+ * @type {boolean}
+ */
+ scrollEnabled_ : false,
+
+ /**
* Decorates the menu element.
*/
decorate: function() {
@@ -400,6 +406,21 @@ Menu.prototype = {
},
/**
+ * Enable/disable menu scroll.
+ * @param {boolean} enabled True to enable scroll, or false otherwise.
+ */
+ set scrollEnabled(enabled) {
+ this.scrollEnabled_ = enabled;
+ },
+
+ /**
+ * Tells if the menu scroll is enabled.
+ */
+ get scrollEnabled() {
+ return this.scrollEnabled_;
+ },
+
+ /**
* Handle keyboard navigation and activation.
* @private
*/
@@ -474,7 +495,10 @@ Menu.prototype = {
down.classList.add('hidden');
return;
}
- if (this.scrollHeight > window.innerHeight) {
+ // Do not use screen width to determin if we need scroll buttons
+ // as the max renderer hight can be shorter than actual screen size.
+ // TODO(oshima): Fix this when we implement transparent renderer.
+ if (this.scrollHeight > window.innerHeight && this.scrollEnabled_) {
this.style.height = (window.innerHeight - this.buttonHeight_) + 'px';
up.classList.remove('hidden');
down.classList.remove('hidden');
@@ -624,3 +648,7 @@ function updateModel(model) {
function modelUpdated() {
chrome.send('model_updated', []);
}
+
+function enableScroll(enabled) {
+ document.getElementById('viewport').scrollEnabled = enabled;
+}