OLD | NEW |
---|---|
1 "use strict"; | 1 "use strict"; |
2 /* | 2 /* |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1513 event.preventDefault(); | 1513 event.preventDefault(); |
1514 }; | 1514 }; |
1515 | 1515 |
1516 | 1516 |
1517 /** | 1517 /** |
1518 * @param {!number} value | 1518 * @param {!number} value |
1519 */ | 1519 */ |
1520 ScrollView.prototype.setContentOffset = function(value) { | 1520 ScrollView.prototype.setContentOffset = function(value) { |
1521 console.assert(isFinite(value)); | 1521 console.assert(isFinite(value)); |
1522 value = Math.min(this.maximumContentOffset - this._height, Math.max(this.min imumContentOffset, Math.floor(value))); | 1522 value = Math.min(this.maximumContentOffset - this._height, Math.max(this.min imumContentOffset, Math.floor(value))); |
1523 if (this._contentOffset === value) | 1523 |
1524 if (this._contentOffset < 0) | |
keishi
2014/03/14 08:38:59
The original code's intent is to return early if t
Habib Virji
2014/03/14 10:38:15
Done.
| |
1524 return; | 1525 return; |
keishi
2014/03/14 08:38:59
I think I would separate out everything below this
Habib Virji
2014/03/14 10:38:15
Done.
| |
1525 var newPartitionNumber = Math.floor(value / ScrollView.PartitionHeight); | 1526 var newPartitionNumber = Math.floor(value / ScrollView.PartitionHeight); |
1526 var partitionChanged = this._partitionNumber !== newPartitionNumber; | 1527 var partitionChanged = this._partitionNumber !== newPartitionNumber; |
1527 this._partitionNumber = newPartitionNumber; | 1528 this._partitionNumber = newPartitionNumber; |
1528 this._contentOffset = value; | 1529 this._contentOffset = value; |
1529 this.contentElement.style.webkitTransform = "translate(0, " + (-this.content PositionForContentOffset(this._contentOffset)) + "px)"; | 1530 this.contentElement.style.webkitTransform = "translate(0, " + (-this.content PositionForContentOffset(this._contentOffset)) + "px)"; |
1530 if (this.delegate) { | 1531 if (this.delegate) { |
1531 this.delegate.scrollViewDidChangeContentOffset(this); | 1532 this.delegate.scrollViewDidChangeContentOffset(this); |
keishi
2014/03/14 08:38:59
Keep this line in setContentOffset()
Habib Virji
2014/03/14 10:38:15
Done.
| |
1532 if (partitionChanged) | 1533 if (partitionChanged) |
1533 this.delegate.scrollViewDidChangePartition(this); | 1534 this.delegate.scrollViewDidChangePartition(this); |
1534 } | 1535 } |
1535 }; | 1536 }; |
1536 | 1537 |
1537 /** | 1538 /** |
1538 * @param {!number} offset | 1539 * @param {!number} offset |
1539 */ | 1540 */ |
1540 ScrollView.prototype.contentPositionForContentOffset = function(offset) { | 1541 ScrollView.prototype.contentPositionForContentOffset = function(offset) { |
1541 return offset - this._partitionNumber * ScrollView.PartitionHeight; | 1542 return offset - this._partitionNumber * ScrollView.PartitionHeight; |
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4025 event.stopPropagation(); | 4026 event.stopPropagation(); |
4026 event.preventDefault(); | 4027 event.preventDefault(); |
4027 } | 4028 } |
4028 } | 4029 } |
4029 | 4030 |
4030 if (window.dialogArguments) { | 4031 if (window.dialogArguments) { |
4031 initialize(dialogArguments); | 4032 initialize(dialogArguments); |
4032 } else { | 4033 } else { |
4033 window.addEventListener("message", handleMessage, false); | 4034 window.addEventListener("message", handleMessage, false); |
4034 } | 4035 } |
OLD | NEW |