| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 * @param {number=} y | 465 * @param {number=} y |
| 466 * @param {number=} width | 466 * @param {number=} width |
| 467 * @param {number=} height | 467 * @param {number=} height |
| 468 */ | 468 */ |
| 469 constructor(x, y, width, height) { | 469 constructor(x, y, width, height) { |
| 470 this.x = x || 0; | 470 this.x = x || 0; |
| 471 this.y = y || 0; | 471 this.y = y || 0; |
| 472 this.width = width || 0; | 472 this.width = width || 0; |
| 473 this.height = height || 0; | 473 this.height = height || 0; |
| 474 } | 474 } |
| 475 |
| 476 /** |
| 477 * @param {number} x |
| 478 * @param {number} y |
| 479 * @return {boolean} |
| 480 */ |
| 481 contains(x, y) { |
| 482 return x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y
+ this.height; |
| 483 } |
| 475 }; | 484 }; |
| 476 | 485 |
| 477 /** | 486 /** |
| 478 * @param {!AnchorBox} box | 487 * @param {!AnchorBox} box |
| 479 * @return {!AnchorBox} | 488 * @return {!AnchorBox} |
| 480 */ | 489 */ |
| 481 AnchorBox.prototype.relativeTo = function(box) { | 490 AnchorBox.prototype.relativeTo = function(box) { |
| 482 return new AnchorBox(this.x - box.x, this.y - box.y, this.width, this.height); | 491 return new AnchorBox(this.x - box.x, this.y - box.y, this.width, this.height); |
| 483 }; | 492 }; |
| 484 | 493 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 return event.keyCode !== 229 && event.key === 'Enter'; | 820 return event.keyCode !== 229 && event.key === 'Enter'; |
| 812 } | 821 } |
| 813 | 822 |
| 814 /** | 823 /** |
| 815 * @param {!Event} event | 824 * @param {!Event} event |
| 816 * @return {boolean} | 825 * @return {boolean} |
| 817 */ | 826 */ |
| 818 function isEscKey(event) { | 827 function isEscKey(event) { |
| 819 return event.keyCode === 27; | 828 return event.keyCode === 27; |
| 820 } | 829 } |
| OLD | NEW |