OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('uber', function() { | 5 cr.define('uber', function() { |
6 /** | 6 /** |
7 * Options for how web history should be handled. | 7 * Options for how web history should be handled. |
8 */ | 8 */ |
9 var HISTORY_STATE_OPTION = { | 9 var HISTORY_STATE_OPTION = { |
10 PUSH: 1, // Push a new history state. | 10 PUSH: 1, // Push a new history state. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 lastSelected.setAttribute('aria-hidden', 'true'); | 352 lastSelected.setAttribute('aria-hidden', 'true'); |
353 } | 353 } |
354 | 354 |
355 // Containers that aren't selected have to be hidden so that their | 355 // Containers that aren't selected have to be hidden so that their |
356 // content isn't focusable. | 356 // content isn't focusable. |
357 container.hidden = false; | 357 container.hidden = false; |
358 container.setAttribute('aria-hidden', 'false'); | 358 container.setAttribute('aria-hidden', 'false'); |
359 | 359 |
360 // Trigger a layout after making it visible and before setting | 360 // Trigger a layout after making it visible and before setting |
361 // the class to 'selected', so that it animates in. | 361 // the class to 'selected', so that it animates in. |
| 362 /** @suppress {uselessCode} */ |
362 container.offsetTop; | 363 container.offsetTop; |
363 container.classList.add('selected'); | 364 container.classList.add('selected'); |
364 | 365 |
365 setContentChanging(true); | 366 setContentChanging(true); |
366 adjustToScroll(0); | 367 adjustToScroll(0); |
367 | 368 |
368 var selectedFrame = getSelectedIframe().querySelector('iframe'); | 369 var selectedFrame = getSelectedIframe().querySelector('iframe'); |
369 uber.invokeMethodOnWindow(selectedFrame.contentWindow, 'frameSelected'); | 370 uber.invokeMethodOnWindow(selectedFrame.contentWindow, 'frameSelected'); |
370 | 371 |
371 if (historyOption != HISTORY_STATE_OPTION.NONE) | 372 if (historyOption != HISTORY_STATE_OPTION.NONE) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 } | 452 } |
452 | 453 |
453 return { | 454 return { |
454 onLoad: onLoad, | 455 onLoad: onLoad, |
455 onPopHistoryState: onPopHistoryState | 456 onPopHistoryState: onPopHistoryState |
456 }; | 457 }; |
457 }); | 458 }); |
458 | 459 |
459 window.addEventListener('popstate', uber.onPopHistoryState); | 460 window.addEventListener('popstate', uber.onPopHistoryState); |
460 document.addEventListener('DOMContentLoaded', uber.onLoad); | 461 document.addEventListener('DOMContentLoaded', uber.onLoad); |
OLD | NEW |