| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 * @return {!Constraints} | 270 * @return {!Constraints} |
| 271 */ | 271 */ |
| 272 Constraints.prototype.addHeight = function(value) | 272 Constraints.prototype.addHeight = function(value) |
| 273 { | 273 { |
| 274 if (typeof value === "number") | 274 if (typeof value === "number") |
| 275 return new Constraints(this.minimum.addHeight(value), this.preferred.add
Height(value)); | 275 return new Constraints(this.minimum.addHeight(value), this.preferred.add
Height(value)); |
| 276 return new Constraints(this.minimum.addHeight(value.minimum), this.preferred
.addHeight(value.preferred)); | 276 return new Constraints(this.minimum.addHeight(value.minimum), this.preferred
.addHeight(value.preferred)); |
| 277 } | 277 } |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * @param {?Element=} containerElement | |
| 281 * @return {!Size} | |
| 282 */ | |
| 283 Element.prototype.measurePreferredSize = function(containerElement) | |
| 284 { | |
| 285 containerElement = containerElement || this.ownerDocument.body; | |
| 286 containerElement.appendChild(this); | |
| 287 var fakingComponentRoot = WebInspector.installComponentRootStyles(this); | |
| 288 this.positionAt(0, 0); | |
| 289 var result = new Size(this.offsetWidth, this.offsetHeight); | |
| 290 this.positionAt(undefined, undefined); | |
| 291 this.remove(); | |
| 292 if (fakingComponentRoot) | |
| 293 WebInspector.uninstallComponentRootStyles(this); | |
| 294 return result; | |
| 295 } | |
| 296 | |
| 297 /** | |
| 298 * @param {!Event} event | 280 * @param {!Event} event |
| 299 * @return {boolean} | 281 * @return {boolean} |
| 300 */ | 282 */ |
| 301 Element.prototype.containsEventPoint = function(event) | 283 Element.prototype.containsEventPoint = function(event) |
| 302 { | 284 { |
| 303 var box = this.getBoundingClientRect(); | 285 var box = this.getBoundingClientRect(); |
| 304 return box.left < event.x && event.x < box.right && | 286 return box.left < event.x && event.x < box.right && |
| 305 box.top < event.y && event.y < box.bottom; | 287 box.top < event.y && event.y < box.bottom; |
| 306 } | 288 } |
| 307 | 289 |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 */ | 844 */ |
| 863 function isEnterKey(event) { | 845 function isEnterKey(event) { |
| 864 // Check if in IME. | 846 // Check if in IME. |
| 865 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; | 847 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; |
| 866 } | 848 } |
| 867 | 849 |
| 868 function consumeEvent(e) | 850 function consumeEvent(e) |
| 869 { | 851 { |
| 870 e.consume(); | 852 e.consume(); |
| 871 } | 853 } |
| OLD | NEW |