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('options', function() { | 5 cr.define('options', function() { |
6 ///////////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////////// |
7 // OptionsPage class: | 7 // OptionsPage class: |
8 | 8 |
9 /** | 9 /** |
10 * Base class for options page. | 10 * Base class for options page. |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
716 * Updates all frozen pages to match the horizontal scroll position. | 716 * Updates all frozen pages to match the horizontal scroll position. |
717 * @private | 717 * @private |
718 */ | 718 */ |
719 OptionsPage.updateAllFrozenElementPositions_ = function() { | 719 OptionsPage.updateAllFrozenElementPositions_ = function() { |
720 var frozenElements = document.querySelectorAll('.frozen'); | 720 var frozenElements = document.querySelectorAll('.frozen'); |
721 for (var i = 0; i < frozenElements.length; i++) | 721 for (var i = 0; i < frozenElements.length; i++) |
722 this.updateFrozenElementHorizontalPosition_(frozenElements[i]); | 722 this.updateFrozenElementHorizontalPosition_(frozenElements[i]); |
723 }; | 723 }; |
724 | 724 |
725 /** | 725 /** |
726 * Update the left of all the position: fixed; header elements. | 726 * Update the start margin of all the position: fixed; header elements. |
727 * @private | 727 * @private |
728 */ | 728 */ |
729 OptionsPage.updateAllHeaderElementPositions_ = function() { | 729 OptionsPage.updateAllHeaderElementPositions_ = function() { |
730 var translate = 'translateX(' + (document.body.scrollLeft * -1) + 'px)'; | 730 var adjust = document.documentElement.dir == 'rtl' ? 1 : -1; |
Dan Beam
2012/01/31 22:49:49
use isRTL()
csilv
2012/01/31 23:45:19
Done.
| |
731 var marginStart = (document.body.scrollLeft * adjust) + 'px'; | |
Dan Beam
2012/01/31 22:49:49
the JavaScript style guide would probably want to
csilv
2012/01/31 23:45:19
Done.
| |
731 for (var i = 0; i < this.fixedHeaders_.length; ++i) | 732 for (var i = 0; i < this.fixedHeaders_.length; ++i) |
732 this.fixedHeaders_[i].style.webkitTransform = translate; | 733 this.fixedHeaders_[i].style.webkitMarginStart = marginStart; |
733 | 734 |
734 uber.invokeMethodOnParent('adjustToScroll', document.body.scrollLeft); | 735 uber.invokeMethodOnParent('adjustToScroll', document.body.scrollLeft); |
735 }; | 736 }; |
736 | 737 |
737 /** | 738 /** |
738 * Updates the given frozen element to match the horizontal scroll position. | 739 * Updates the given frozen element to match the horizontal scroll position. |
739 * @param {HTMLElement} e The frozen element to update | 740 * @param {HTMLElement} e The frozen element to update |
740 * @private | 741 * @private |
741 */ | 742 */ |
742 OptionsPage.updateFrozenElementHorizontalPosition_ = function(e) { | 743 OptionsPage.updateFrozenElementHorizontalPosition_ = function(e) { |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1102 canShowPage: function() { | 1103 canShowPage: function() { |
1103 return true; | 1104 return true; |
1104 }, | 1105 }, |
1105 }; | 1106 }; |
1106 | 1107 |
1107 // Export | 1108 // Export |
1108 return { | 1109 return { |
1109 OptionsPage: OptionsPage | 1110 OptionsPage: OptionsPage |
1110 }; | 1111 }; |
1111 }); | 1112 }); |
OLD | NEW |