| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 */ | 339 */ |
| 340 UI.Size = class { | 340 UI.Size = class { |
| 341 /** | 341 /** |
| 342 * @param {number} width | 342 * @param {number} width |
| 343 * @param {number} height | 343 * @param {number} height |
| 344 */ | 344 */ |
| 345 constructor(width, height) { | 345 constructor(width, height) { |
| 346 this.width = width; | 346 this.width = width; |
| 347 this.height = height; | 347 this.height = height; |
| 348 } | 348 } |
| 349 |
| 350 /** |
| 351 * @param {?UI.Size} size |
| 352 * @return {!UI.Size} |
| 353 */ |
| 354 clipTo(size) { |
| 355 if (!size) |
| 356 return this; |
| 357 return new UI.Size(Math.min(this.width, size.width), Math.min(this.height, s
ize.height)); |
| 358 } |
| 349 }; | 359 }; |
| 350 | 360 |
| 351 /** | 361 /** |
| 352 * @param {?UI.Size} size | 362 * @param {?UI.Size} size |
| 353 * @return {boolean} | 363 * @return {boolean} |
| 354 */ | 364 */ |
| 355 UI.Size.prototype.isEqual = function(size) { | 365 UI.Size.prototype.isEqual = function(size) { |
| 356 return !!size && this.width === size.width && this.height === size.height; | 366 return !!size && this.width === size.width && this.height === size.height; |
| 357 }; | 367 }; |
| 358 | 368 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 531 |
| 522 /** | 532 /** |
| 523 * @param {!UI.Constraints|number} value | 533 * @param {!UI.Constraints|number} value |
| 524 * @return {!UI.Constraints} | 534 * @return {!UI.Constraints} |
| 525 */ | 535 */ |
| 526 UI.Constraints.prototype.addHeight = function(value) { | 536 UI.Constraints.prototype.addHeight = function(value) { |
| 527 if (typeof value === 'number') | 537 if (typeof value === 'number') |
| 528 return new UI.Constraints(this.minimum.addHeight(value), this.preferred.addH
eight(value)); | 538 return new UI.Constraints(this.minimum.addHeight(value), this.preferred.addH
eight(value)); |
| 529 return new UI.Constraints(this.minimum.addHeight(value.minimum), this.preferre
d.addHeight(value.preferred)); | 539 return new UI.Constraints(this.minimum.addHeight(value.minimum), this.preferre
d.addHeight(value.preferred)); |
| 530 }; | 540 }; |
| OLD | NEW |