diff options
author | dzhioev@chromium.org <dzhioev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 00:01:25 +0000 |
---|---|---|
committer | dzhioev@chromium.org <dzhioev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 00:01:25 +0000 |
commit | 0d8f08af1714a6fd9d0f289b0da969220a33cb64 (patch) | |
tree | 7588e2d2cf2c26a3f0a7f8077d94dfeb58ff6d65 /ui/login | |
parent | 67fe364327232a0cc101d775cf69370c9db36bfb (diff) | |
download | chromium_src-0d8f08af1714a6fd9d0f289b0da969220a33cb64.zip chromium_src-0d8f08af1714a6fd9d0f289b0da969220a33cb64.tar.gz chromium_src-0d8f08af1714a6fd9d0f289b0da969220a33cb64.tar.bz2 |
Prevented false error messages from user manager UI.
Messages like "Pod offsetHeight (0) and POD_HEIGHT (226) are not equal." were
reported on desktop user manager. It happened because |placePods_| method call
were made, when account picker was hidden.
In addition deprecated |webkitRequestAnimationFrame| was replaced with
|requestAnimationFrame| in login code.
BUG=none
TEST=Run user manager, see that messages are gone.
Review URL: https://codereview.chromium.org/422563002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/login')
-rw-r--r-- | ui/login/account_picker/screen_account_picker.js | 8 | ||||
-rw-r--r-- | ui/login/account_picker/user_pod_row.js | 67 |
2 files changed, 34 insertions, 41 deletions
diff --git a/ui/login/account_picker/screen_account_picker.js b/ui/login/account_picker/screen_account_picker.js index b053cac..7fad61a 100644 --- a/ui/login/account_picker/screen_account_picker.js +++ b/ui/login/account_picker/screen_account_picker.js @@ -13,12 +13,6 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() { * @const */ var MAX_LOGIN_ATTEMPTS_IN_POD = 3; - /** - * Whether to preselect the first pod automatically on login screen. - * @type {boolean} - * @const - */ - var PRESELECT_FIRST_POD = true; return { EXTERNAL_API: [ @@ -122,7 +116,7 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() { this.firstShown_ = false; // Ensure that login is actually visible. - window.webkitRequestAnimationFrame(function() { + window.requestAnimationFrame(function() { chrome.send('accountPickerReady'); chrome.send('loginVisible', ['account-picker']); }); diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js index e1b5d13..0b2c6b6 100644 --- a/ui/login/account_picker/user_pod_row.js +++ b/ui/login/account_picker/user_pod_row.js @@ -64,13 +64,6 @@ cr.define('login', function() { var USER_POD_KEYBOARD_MIN_PADDING = 20; /** - * Whether to preselect the first pod automatically on login screen. - * @type {boolean} - * @const - */ - var PRESELECT_FIRST_POD = true; - - /** * Maximum time for which the pod row remains hidden until all user images * have been loaded. * @type {number} @@ -1702,28 +1695,20 @@ cr.define('login', function() { $('pod-row').classList.remove('images-loading'); }, POD_ROW_IMAGES_LOAD_TIMEOUT_MS); - var isCrosAccountPicker = $('login-header-bar').signinUIState == + var isAccountPicker = $('login-header-bar').signinUIState == SIGNIN_UI_STATE.ACCOUNT_PICKER; - var isDesktopUserManager = Oobe.getInstance().displayType == - DISPLAY_TYPE.DESKTOP_USER_MANAGER; - // Chrome OS: immediately recalculate pods layout only when current UI - // is account picker. Otherwise postpone it. - // Desktop: recalculate pods layout right away. - if (isDesktopUserManager || isCrosAccountPicker) { + // Immediately recalculate pods layout only when current UI is account + // picker. Otherwise postpone it. + if (isAccountPicker) { this.placePods_(); + this.maybePreselectPod(); // Without timeout changes in pods positions will be animated even // though it happened when 'flying-pods' class was disabled. setTimeout(function() { Oobe.getInstance().toggleClass('flying-pods', true); }, 0); - - // On desktop, don't pre-select a pod if it's the only one. - if (isDesktopUserManager && this.pods.length == 1) - this.focusPod(); - else - this.focusPod(this.preselectedPod); } else { this.podPlacementPostponed_ = true; @@ -1938,6 +1923,11 @@ cr.define('login', function() { var height = this.userPodHeight_; var width = this.userPodWidth_; this.pods.forEach(function(pod, index) { + if (index >= maxPodsNumber) { + pod.hidden = true; + return; + } + pod.hidden = false; if (pod.offsetHeight != height) { console.error('Pod offsetHeight (' + pod.offsetHeight + ') and POD_HEIGHT (' + height + ') are not equal.'); @@ -1946,11 +1936,6 @@ cr.define('login', function() { console.error('Pod offsetWidth (' + pod.offsetWidth + ') and POD_WIDTH (' + width + ') are not equal.'); } - if (index >= maxPodsNumber) { - pod.hidden = true; - return; - } - pod.hidden = false; var column = index % columns; var row = Math.floor(index / columns); var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING : @@ -2119,8 +2104,14 @@ cr.define('login', function() { * @type {?UserPod} */ get preselectedPod() { + // On desktop, don't pre-select a pod if it's the only one. + var isDesktopUserManager = Oobe.getInstance().displayType == + DISPLAY_TYPE.DESKTOP_USER_MANAGER; + if (isDesktopUserManager && this.pods.length == 1) + return null; + var lockedPod = this.lockedPod; - if (lockedPod || !PRESELECT_FIRST_POD) + if (lockedPod) return lockedPod; for (var i = 0, pod; pod = this.pods[i]; ++i) { if (!pod.multiProfilesPolicyApplied) { @@ -2377,13 +2368,7 @@ cr.define('login', function() { if (this.podPlacementPostponed_) { this.podPlacementPostponed_ = false; this.placePods_(); - pod = this.preselectedPod; - this.focusPod(pod); - // Hide user-type-bubble in case all user pods are disabled and we focus - // first pod. - if (pod && pod.multiProfilesPolicyApplied) { - pod.userTypeBubbleElement.classList.remove('bubble-shown'); - } + this.maybePreselectPod(); } }, @@ -2411,7 +2396,21 @@ cr.define('login', function() { if (this.podsWithPendingImages_.length == 0) { this.classList.remove('images-loading'); } - } + }, + + /** + * Preselects pod, if needed. + */ + maybePreselectPod: function() { + var pod = this.preselectedPod; + this.focusPod(pod); + + // Hide user-type-bubble in case all user pods are disabled and we focus + // first pod. + if (pod && pod.multiProfilesPolicyApplied) { + pod.userTypeBubbleElement.classList.remove('bubble-shown'); + } + } }; return { |