OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 <include src="../node_utils.js"> | 5 <include src="../node_utils.js"> |
6 | 6 |
7 cr.define('cr.ui.pageManager', function() { | 7 cr.define('cr.ui.pageManager', function() { |
8 var PageManager = cr.ui.pageManager.PageManager; | 8 var PageManager = cr.ui.pageManager.PageManager; |
9 | 9 |
10 /** | 10 /** |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 pageDiv.hidden = false; | 235 pageDiv.hidden = false; |
236 pageDiv.page = this; | 236 pageDiv.page = this; |
237 } | 237 } |
238 return; | 238 return; |
239 } | 239 } |
240 | 240 |
241 var self = this; | 241 var self = this; |
242 var loading = PageManager.isLoading(); | 242 var loading = PageManager.isLoading(); |
243 if (!loading) { | 243 if (!loading) { |
244 // TODO(flackr): Use an event delegate to avoid having to subscribe and | 244 // TODO(flackr): Use an event delegate to avoid having to subscribe and |
245 // unsubscribe for webkitTransitionEnd events. | 245 // unsubscribe for transitionend events. |
246 container.addEventListener('webkitTransitionEnd', function f(e) { | 246 container.addEventListener('transitionend', function f(e) { |
247 var propName = e.propertyName; | 247 var propName = e.propertyName; |
248 if (e.target != e.currentTarget || | 248 if (e.target != e.currentTarget || |
249 (propName && propName != 'opacity')) { | 249 (propName && propName != 'opacity')) { |
250 return; | 250 return; |
251 } | 251 } |
252 container.removeEventListener('webkitTransitionEnd', f); | 252 container.removeEventListener('transitionend', f); |
253 self.fadeCompleted_(); | 253 self.fadeCompleted_(); |
254 }); | 254 }); |
255 // -webkit-transition is 200ms. Let's wait for 400ms. | 255 // transition is 200ms. Let's wait for 400ms. |
256 ensureTransitionEndEvent(container, 400); | 256 ensureTransitionEndEvent(container, 400); |
257 } | 257 } |
258 | 258 |
259 if (visible) { | 259 if (visible) { |
260 container.hidden = false; | 260 container.hidden = false; |
261 pageDiv.hidden = false; | 261 pageDiv.hidden = false; |
262 pageDiv.page = this; | 262 pageDiv.page = this; |
263 // NOTE: This is a hacky way to force the container to layout which | 263 // NOTE: This is a hacky way to force the container to layout which |
264 // will allow us to trigger the webkit transition. | 264 // will allow us to trigger the transition. |
265 /** @suppress {uselessCode} */ | 265 /** @suppress {uselessCode} */ |
266 container.scrollTop; | 266 container.scrollTop; |
267 | 267 |
268 this.pageDiv.removeAttribute('aria-hidden'); | 268 this.pageDiv.removeAttribute('aria-hidden'); |
269 if (this.parentPage) { | 269 if (this.parentPage) { |
270 this.parentPage.pageDiv.parentElement.setAttribute('aria-hidden', | 270 this.parentPage.pageDiv.parentElement.setAttribute('aria-hidden', |
271 true); | 271 true); |
272 } | 272 } |
273 container.classList.remove('transparent'); | 273 container.classList.remove('transparent'); |
274 PageManager.onPageVisibilityChanged(this); | 274 PageManager.onPageVisibilityChanged(this); |
(...skipping 23 matching lines...) Expand all Loading... |
298 PageManager.onPageVisibilityChanged(this); | 298 PageManager.onPageVisibilityChanged(this); |
299 } | 299 } |
300 }, | 300 }, |
301 }; | 301 }; |
302 | 302 |
303 // Export | 303 // Export |
304 return { | 304 return { |
305 Page: Page | 305 Page: Page |
306 }; | 306 }; |
307 }); | 307 }); |
OLD | NEW |