| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 lastSelected.setAttribute('aria-hidden', 'true'); | 350 lastSelected.setAttribute('aria-hidden', 'true'); |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Containers that aren't selected have to be hidden so that their | 353 // Containers that aren't selected have to be hidden so that their |
| 354 // content isn't focusable. | 354 // content isn't focusable. |
| 355 container.hidden = false; | 355 container.hidden = false; |
| 356 container.setAttribute('aria-hidden', 'false'); | 356 container.setAttribute('aria-hidden', 'false'); |
| 357 | 357 |
| 358 // Trigger a layout after making it visible and before setting | 358 // Trigger a layout after making it visible and before setting |
| 359 // the class to 'selected', so that it animates in. | 359 // the class to 'selected', so that it animates in. |
| 360 /** @suppress {uselessCode} */ |
| 360 container.offsetTop; | 361 container.offsetTop; |
| 361 container.classList.add('selected'); | 362 container.classList.add('selected'); |
| 362 | 363 |
| 363 setContentChanging(true); | 364 setContentChanging(true); |
| 364 adjustToScroll(0); | 365 adjustToScroll(0); |
| 365 | 366 |
| 366 var selectedFrame = getSelectedIframe().querySelector('iframe'); | 367 var selectedFrame = getSelectedIframe().querySelector('iframe'); |
| 367 uber.invokeMethodOnWindow(selectedFrame.contentWindow, 'frameSelected'); | 368 uber.invokeMethodOnWindow(selectedFrame.contentWindow, 'frameSelected'); |
| 368 | 369 |
| 369 if (historyOption != HISTORY_STATE_OPTION.NONE) | 370 if (historyOption != HISTORY_STATE_OPTION.NONE) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 447 } |
| 447 | 448 |
| 448 return { | 449 return { |
| 449 onLoad: onLoad, | 450 onLoad: onLoad, |
| 450 onPopHistoryState: onPopHistoryState | 451 onPopHistoryState: onPopHistoryState |
| 451 }; | 452 }; |
| 452 }); | 453 }); |
| 453 | 454 |
| 454 window.addEventListener('popstate', uber.onPopHistoryState); | 455 window.addEventListener('popstate', uber.onPopHistoryState); |
| 455 document.addEventListener('DOMContentLoaded', uber.onLoad); | 456 document.addEventListener('DOMContentLoaded', uber.onLoad); |
| OLD | NEW |