| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * @param {?Element=} containerElement | 280 * @param {?Element=} containerElement |
| 281 * @return {!Size} | 281 * @return {!Size} |
| 282 */ | 282 */ |
| 283 Element.prototype.measurePreferredSize = function(containerElement) | 283 Element.prototype.measurePreferredSize = function(containerElement) |
| 284 { | 284 { |
| 285 containerElement = containerElement || document.body; | 285 containerElement = containerElement || document.body; |
| 286 containerElement.appendChild(this); | 286 containerElement.appendChild(this); |
| 287 var fakingComponentRoot = false; | 287 var fakingComponentRoot = WebInspector.installComponentRootStyles(this); |
| 288 if (!this.classList.contains("component-root")) { | |
| 289 fakingComponentRoot = true; | |
| 290 this.classList.add("component-root"); | |
| 291 } | |
| 292 this.positionAt(0, 0); | 288 this.positionAt(0, 0); |
| 293 var result = new Size(this.offsetWidth, this.offsetHeight); | 289 var result = new Size(this.offsetWidth, this.offsetHeight); |
| 294 this.positionAt(undefined, undefined); | 290 this.positionAt(undefined, undefined); |
| 295 this.remove(); | 291 this.remove(); |
| 296 if (fakingComponentRoot) | 292 if (fakingComponentRoot) |
| 297 this.classList.remove("component-root"); | 293 WebInspector.uninstallComponentRootStyles(this); |
| 298 return result; | 294 return result; |
| 299 } | 295 } |
| 300 | 296 |
| 301 /** | 297 /** |
| 302 * @param {!Event} event | 298 * @param {!Event} event |
| 303 * @return {boolean} | 299 * @return {boolean} |
| 304 */ | 300 */ |
| 305 Element.prototype.containsEventPoint = function(event) | 301 Element.prototype.containsEventPoint = function(event) |
| 306 { | 302 { |
| 307 var box = this.getBoundingClientRect(); | 303 var box = this.getBoundingClientRect(); |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 */ | 858 */ |
| 863 function isEnterKey(event) { | 859 function isEnterKey(event) { |
| 864 // Check if in IME. | 860 // Check if in IME. |
| 865 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; | 861 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; |
| 866 } | 862 } |
| 867 | 863 |
| 868 function consumeEvent(e) | 864 function consumeEvent(e) |
| 869 { | 865 { |
| 870 e.consume(); | 866 e.consume(); |
| 871 } | 867 } |
| OLD | NEW |