| 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 /** | 5 /** |
| 6 * @fileoverview A collection of utility methods for UberPage and its contained | 6 * @fileoverview A collection of utility methods for UberPage and its contained |
| 7 * pages. | 7 * pages. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 cr.define('uber', function() { | 10 cr.define('uber', function() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 /** | 38 /** |
| 39 * Handles scroll events on the document. This adjusts the position of all | 39 * Handles scroll events on the document. This adjusts the position of all |
| 40 * headers and updates the parent frame when the page is scrolled. | 40 * headers and updates the parent frame when the page is scrolled. |
| 41 */ | 41 */ |
| 42 function handleScroll() { | 42 function handleScroll() { |
| 43 var scrollLeft = scrollLeftForDocument(document); | 43 var scrollLeft = scrollLeftForDocument(document); |
| 44 var offset = scrollLeft * -1; | 44 var offset = scrollLeft * -1; |
| 45 for (var i = 0; i < headerElements.length; i++) { | 45 for (var i = 0; i < headerElements.length; i++) { |
| 46 // As a workaround for http://crbug.com/231830, set the transform to | 46 // As a workaround for http://crbug.com/231830, set the transform to |
| 47 // 'none' rather than 0px. | 47 // 'none' rather than 0px. |
| 48 headerElements[i].style.webkitTransform = offset ? | 48 headerElements[i].style.transform = offset ? |
| 49 'translateX(' + offset + 'px)' : 'none'; | 49 'translateX(' + offset + 'px)' : 'none'; |
| 50 } | 50 } |
| 51 | 51 |
| 52 invokeMethodOnParent('adjustToScroll', scrollLeft); | 52 invokeMethodOnParent('adjustToScroll', scrollLeft); |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Tells the parent to focus the current frame if the mouse goes down in the | 56 * Tells the parent to focus the current frame if the mouse goes down in the |
| 57 * current frame (and it doesn't already have focus). | 57 * current frame (and it doesn't already have focus). |
| 58 * @param {Event} e A mousedown event. | 58 * @param {Event} e A mousedown event. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 return { | 218 return { |
| 219 invokeMethodOnParent: invokeMethodOnParent, | 219 invokeMethodOnParent: invokeMethodOnParent, |
| 220 invokeMethodOnWindow: invokeMethodOnWindow, | 220 invokeMethodOnWindow: invokeMethodOnWindow, |
| 221 onContentFrameLoaded: onContentFrameLoaded, | 221 onContentFrameLoaded: onContentFrameLoaded, |
| 222 pushState: pushState, | 222 pushState: pushState, |
| 223 replaceState: replaceState, | 223 replaceState: replaceState, |
| 224 setTitle: setTitle, | 224 setTitle: setTitle, |
| 225 }; | 225 }; |
| 226 }); | 226 }); |
| OLD | NEW |