| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 * @return {!Size} | 357 * @return {!Size} |
| 358 */ | 358 */ |
| 359 Size.prototype.addHeight = function(size) | 359 Size.prototype.addHeight = function(size) |
| 360 { | 360 { |
| 361 return new Size(this.width, this.height + (typeof size === "number" ? size :
size.height)); | 361 return new Size(this.width, this.height + (typeof size === "number" ? size :
size.height)); |
| 362 }; | 362 }; |
| 363 | 363 |
| 364 | 364 |
| 365 /** | 365 /** |
| 366 * @constructor | 366 * @constructor |
| 367 * @param {number} left |
| 368 * @param {number} top |
| 369 * @param {number} right |
| 370 * @param {number} bottom |
| 371 */ |
| 372 function Insets(left, top, right, bottom) |
| 373 { |
| 374 this.left = left; |
| 375 this.top = top; |
| 376 this.right = right; |
| 377 this.bottom = bottom; |
| 378 } |
| 379 |
| 380 Insets.prototype = { |
| 381 /** |
| 382 * @param {?Insets} insets |
| 383 * @return {boolean} |
| 384 */ |
| 385 isEqual: function(insets) |
| 386 { |
| 387 return !!insets && this.left === insets.left && this.top === insets.top
&& this.right == insets.right && this.bottom == insets.bottom; |
| 388 } |
| 389 } |
| 390 |
| 391 |
| 392 /** |
| 393 * @constructor |
| 367 * @param {!Size=} minimum | 394 * @param {!Size=} minimum |
| 368 * @param {?Size=} preferred | 395 * @param {?Size=} preferred |
| 369 */ | 396 */ |
| 370 function Constraints(minimum, preferred) | 397 function Constraints(minimum, preferred) |
| 371 { | 398 { |
| 372 /** | 399 /** |
| 373 * @type {!Size} | 400 * @type {!Size} |
| 374 */ | 401 */ |
| 375 this.minimum = minimum || new Size(0, 0); | 402 this.minimum = minimum || new Size(0, 0); |
| 376 | 403 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 /** | 455 /** |
| 429 * @param {!Constraints|number} value | 456 * @param {!Constraints|number} value |
| 430 * @return {!Constraints} | 457 * @return {!Constraints} |
| 431 */ | 458 */ |
| 432 Constraints.prototype.addHeight = function(value) | 459 Constraints.prototype.addHeight = function(value) |
| 433 { | 460 { |
| 434 if (typeof value === "number") | 461 if (typeof value === "number") |
| 435 return new Constraints(this.minimum.addHeight(value), this.preferred.add
Height(value)); | 462 return new Constraints(this.minimum.addHeight(value), this.preferred.add
Height(value)); |
| 436 return new Constraints(this.minimum.addHeight(value.minimum), this.preferred
.addHeight(value.preferred)); | 463 return new Constraints(this.minimum.addHeight(value.minimum), this.preferred
.addHeight(value.preferred)); |
| 437 } | 464 } |
| OLD | NEW |