Chromium Code Reviews| 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 /** | |
| 381 * @param {?Insets} insets | |
| 382 * @return {boolean} | |
| 383 */ | |
| 384 Insets.prototype.isEqual = function(insets) | |
|
pfeldman
2015/06/13 06:48:59
Please follow prototype definition code style.
dgozman
2015/06/16 15:09:30
Done.
| |
| 385 { | |
| 386 return !!insets && this.left === insets.left && this.top === insets.top && t his.right == insets.right && this.bottom == insets.bottom; | |
| 387 } | |
| 388 | |
| 389 | |
| 390 /** | |
| 391 * @constructor | |
| 367 * @param {!Size=} minimum | 392 * @param {!Size=} minimum |
| 368 * @param {?Size=} preferred | 393 * @param {?Size=} preferred |
| 369 */ | 394 */ |
| 370 function Constraints(minimum, preferred) | 395 function Constraints(minimum, preferred) |
| 371 { | 396 { |
| 372 /** | 397 /** |
| 373 * @type {!Size} | 398 * @type {!Size} |
| 374 */ | 399 */ |
| 375 this.minimum = minimum || new Size(0, 0); | 400 this.minimum = minimum || new Size(0, 0); |
| 376 | 401 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 /** | 453 /** |
| 429 * @param {!Constraints|number} value | 454 * @param {!Constraints|number} value |
| 430 * @return {!Constraints} | 455 * @return {!Constraints} |
| 431 */ | 456 */ |
| 432 Constraints.prototype.addHeight = function(value) | 457 Constraints.prototype.addHeight = function(value) |
| 433 { | 458 { |
| 434 if (typeof value === "number") | 459 if (typeof value === "number") |
| 435 return new Constraints(this.minimum.addHeight(value), this.preferred.add Height(value)); | 460 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)); | 461 return new Constraints(this.minimum.addHeight(value.minimum), this.preferred .addHeight(value.preferred)); |
| 437 } | 462 } |
| OLD | NEW |