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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (scrollOffset != 0) | 419 if (scrollOffset != 0) |
420 setContentChanging(false); | 420 setContentChanging(false); |
421 | 421 |
422 if (isRTL()) { | 422 if (isRTL()) { |
423 uber.invokeMethodOnWindow(navFrame.firstChild.contentWindow, | 423 uber.invokeMethodOnWindow(navFrame.firstChild.contentWindow, |
424 'adjustToScroll', | 424 'adjustToScroll', |
425 scrollOffset); | 425 scrollOffset); |
426 var navWidth = Math.max(0, +navFrame.dataset.width + scrollOffset); | 426 var navWidth = Math.max(0, +navFrame.dataset.width + scrollOffset); |
427 navFrame.style.width = navWidth + 'px'; | 427 navFrame.style.width = navWidth + 'px'; |
428 } else { | 428 } else { |
429 navFrame.style.webkitTransform = 'translateX(' + -scrollOffset + 'px)'; | 429 navFrame.style.transform = 'translateX(' + -scrollOffset + 'px)'; |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 /** | 433 /** |
434 * Forward scroll wheel events to subpages. | 434 * Forward scroll wheel events to subpages. |
435 * @param {Object} params Relevant parameters of wheel event. | 435 * @param {Object} params Relevant parameters of wheel event. |
436 */ | 436 */ |
437 function forwardMouseWheel(params) { | 437 function forwardMouseWheel(params) { |
438 uber.invokeMethodOnWindow(getSelectedIframeWindow(), 'mouseWheel', params); | 438 uber.invokeMethodOnWindow(getSelectedIframeWindow(), 'mouseWheel', params); |
439 } | 439 } |
(...skipping 12 matching lines...) Expand all Loading... |
452 * immediately, rather than only after the transition ends. | 452 * immediately, rather than only after the transition ends. |
453 */ | 453 */ |
454 function ensureNonSelectedFrameContainersAreHidden() { | 454 function ensureNonSelectedFrameContainersAreHidden() { |
455 var containers = document.querySelectorAll('.iframe-container'); | 455 var containers = document.querySelectorAll('.iframe-container'); |
456 for (var i = 0; i < containers.length; i++) { | 456 for (var i = 0; i < containers.length; i++) { |
457 var container = containers[i]; | 457 var container = containers[i]; |
458 if (!container.classList.contains('selected')) { | 458 if (!container.classList.contains('selected')) { |
459 container.hidden = true; | 459 container.hidden = true; |
460 container.setAttribute('aria-hidden', 'true'); | 460 container.setAttribute('aria-hidden', 'true'); |
461 } | 461 } |
462 container.addEventListener('webkitTransitionEnd', function(event) { | 462 container.addEventListener('transitionend', function(event) { |
463 if (!event.target.classList.contains('selected')) | 463 if (!event.target.classList.contains('selected')) |
464 event.target.hidden = true; | 464 event.target.hidden = true; |
465 }); | 465 }); |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 return { | 469 return { |
470 onLoad: onLoad, | 470 onLoad: onLoad, |
471 onPopHistoryState: onPopHistoryState | 471 onPopHistoryState: onPopHistoryState |
472 }; | 472 }; |
473 }); | 473 }); |
474 | 474 |
475 window.addEventListener('popstate', uber.onPopHistoryState); | 475 window.addEventListener('popstate', uber.onPopHistoryState); |
476 document.addEventListener('DOMContentLoaded', uber.onLoad); | 476 document.addEventListener('DOMContentLoaded', uber.onLoad); |
OLD | NEW |