OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 this.style.removeProperty("left"); | 168 this.style.removeProperty("left"); |
169 | 169 |
170 if (typeof y === "number") | 170 if (typeof y === "number") |
171 this.style.setProperty("top", (shift.y + y) + "px"); | 171 this.style.setProperty("top", (shift.y + y) + "px"); |
172 else | 172 else |
173 this.style.removeProperty("top"); | 173 this.style.removeProperty("top"); |
174 } | 174 } |
175 | 175 |
176 Element.prototype.isScrolledToBottom = function() | 176 Element.prototype.isScrolledToBottom = function() |
177 { | 177 { |
178 // This code works only for 0-width border | 178 // This code works only for 0-width border. |
179 return this.scrollTop + this.clientHeight === this.scrollHeight; | 179 // Both clientHeight and scrollHeight are rounded to integer values, so we t
olerate |
| 180 // one pixel error. |
| 181 return Math.abs(this.scrollTop + this.clientHeight - this.scrollHeight) <= 1
; |
180 } | 182 } |
181 | 183 |
182 /** | 184 /** |
183 * @param {!Node} fromNode | 185 * @param {!Node} fromNode |
184 * @param {!Node} toNode | 186 * @param {!Node} toNode |
185 */ | 187 */ |
186 function removeSubsequentNodes(fromNode, toNode) | 188 function removeSubsequentNodes(fromNode, toNode) |
187 { | 189 { |
188 for (var node = fromNode; node && node !== toNode; ) { | 190 for (var node = fromNode; node && node !== toNode; ) { |
189 var nodeToRemove = node; | 191 var nodeToRemove = node; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 */ | 564 */ |
563 function isEnterKey(event) { | 565 function isEnterKey(event) { |
564 // Check if in IME. | 566 // Check if in IME. |
565 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; | 567 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; |
566 } | 568 } |
567 | 569 |
568 function consumeEvent(e) | 570 function consumeEvent(e) |
569 { | 571 { |
570 e.consume(); | 572 e.consume(); |
571 } | 573 } |
OLD | NEW |