| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 /** | 350 /** |
| 351 * @param {?UI.Size} size | 351 * @param {?UI.Size} size |
| 352 * @return {!UI.Size} | 352 * @return {!UI.Size} |
| 353 */ | 353 */ |
| 354 clipTo(size) { | 354 clipTo(size) { |
| 355 if (!size) | 355 if (!size) |
| 356 return this; | 356 return this; |
| 357 return new UI.Size(Math.min(this.width, size.width), Math.min(this.height, s
ize.height)); | 357 return new UI.Size(Math.min(this.width, size.width), Math.min(this.height, s
ize.height)); |
| 358 } | 358 } |
| 359 |
| 360 /** |
| 361 * @param {number} scale |
| 362 * @return {!UI.Size} |
| 363 */ |
| 364 scale(scale) { |
| 365 return new UI.Size(this.width * scale, this.height * scale); |
| 366 } |
| 359 }; | 367 }; |
| 360 | 368 |
| 361 /** | 369 /** |
| 362 * @param {?UI.Size} size | 370 * @param {?UI.Size} size |
| 363 * @return {boolean} | 371 * @return {boolean} |
| 364 */ | 372 */ |
| 365 UI.Size.prototype.isEqual = function(size) { | 373 UI.Size.prototype.isEqual = function(size) { |
| 366 return !!size && this.width === size.width && this.height === size.height; | 374 return !!size && this.width === size.width && this.height === size.height; |
| 367 }; | 375 }; |
| 368 | 376 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 scale(scale) { | 466 scale(scale) { |
| 459 return new UI.Rect(this.left * scale, this.top * scale, this.width * scale,
this.height * scale); | 467 return new UI.Rect(this.left * scale, this.top * scale, this.width * scale,
this.height * scale); |
| 460 } | 468 } |
| 461 | 469 |
| 462 /** | 470 /** |
| 463 * @return {!UI.Size} | 471 * @return {!UI.Size} |
| 464 */ | 472 */ |
| 465 size() { | 473 size() { |
| 466 return new UI.Size(this.width, this.height); | 474 return new UI.Size(this.width, this.height); |
| 467 } | 475 } |
| 476 |
| 477 /** |
| 478 * @param {!UI.Rect} origin |
| 479 * @return {!UI.Rect} |
| 480 */ |
| 481 relativeTo(origin) { |
| 482 return new UI.Rect(this.left - origin.left, this.top - origin.top, this.widt
h, this.height); |
| 483 } |
| 484 |
| 485 /** |
| 486 * @param {!UI.Rect} origin |
| 487 * @return {!UI.Rect} |
| 488 */ |
| 489 rebaseTo(origin) { |
| 490 return new UI.Rect(this.left + origin.left, this.top + origin.top, this.widt
h, this.height); |
| 491 } |
| 468 }; | 492 }; |
| 469 | 493 |
| 470 /** | 494 /** |
| 471 * @unrestricted | 495 * @unrestricted |
| 472 */ | 496 */ |
| 473 UI.Constraints = class { | 497 UI.Constraints = class { |
| 474 /** | 498 /** |
| 475 * @param {!UI.Size=} minimum | 499 * @param {!UI.Size=} minimum |
| 476 * @param {?UI.Size=} preferred | 500 * @param {?UI.Size=} preferred |
| 477 */ | 501 */ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 555 |
| 532 /** | 556 /** |
| 533 * @param {!UI.Constraints|number} value | 557 * @param {!UI.Constraints|number} value |
| 534 * @return {!UI.Constraints} | 558 * @return {!UI.Constraints} |
| 535 */ | 559 */ |
| 536 UI.Constraints.prototype.addHeight = function(value) { | 560 UI.Constraints.prototype.addHeight = function(value) { |
| 537 if (typeof value === 'number') | 561 if (typeof value === 'number') |
| 538 return new UI.Constraints(this.minimum.addHeight(value), this.preferred.addH
eight(value)); | 562 return new UI.Constraints(this.minimum.addHeight(value), this.preferred.addH
eight(value)); |
| 539 return new UI.Constraints(this.minimum.addHeight(value.minimum), this.preferre
d.addHeight(value.preferred)); | 563 return new UI.Constraints(this.minimum.addHeight(value.minimum), this.preferre
d.addHeight(value.preferred)); |
| 540 }; | 564 }; |
| OLD | NEW |