OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 } | 806 } |
807 | 807 |
808 var currentStyle = null; | 808 var currentStyle = null; |
809 function styleFormatter(obj) | 809 function styleFormatter(obj) |
810 { | 810 { |
811 currentStyle = {}; | 811 currentStyle = {}; |
812 var buffer = createElement("span"); | 812 var buffer = createElement("span"); |
813 buffer.setAttribute("style", obj.description); | 813 buffer.setAttribute("style", obj.description); |
814 for (var i = 0; i < buffer.style.length; i++) { | 814 for (var i = 0; i < buffer.style.length; i++) { |
815 var property = buffer.style[i]; | 815 var property = buffer.style[i]; |
816 var value = buffer.style.getPropertyValue(property); | 816 if (isWhitelistedProperty(property)) |
817 if (!value.startsWith("url(") && isWhitelistedProperty(property)
) | |
818 currentStyle[property] = buffer.style[property]; | 817 currentStyle[property] = buffer.style[property]; |
819 } | 818 } |
820 } | 819 } |
821 | 820 |
822 function isWhitelistedProperty(property) | 821 function isWhitelistedProperty(property) |
823 { | 822 { |
824 var prefixes = ["background", "border", "color", "font", "line", "ma
rgin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font"
, "-webkit-margin", "-webkit-padding", "-webkit-text"]; | 823 var prefixes = ["background", "border", "color", "font", "line", "ma
rgin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font"
, "-webkit-margin", "-webkit-padding", "-webkit-text"]; |
825 for (var i = 0; i < prefixes.length; i++) { | 824 for (var i = 0; i < prefixes.length; i++) { |
826 if (property.startsWith(prefixes[i])) | 825 if (property.startsWith(prefixes[i])) |
827 return true; | 826 return true; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 { | 1356 { |
1358 if (!this._wrapperElement) { | 1357 if (!this._wrapperElement) { |
1359 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this
); | 1358 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this
); |
1360 this._wrapperElement.classList.toggle("collapsed", this._collapsed); | 1359 this._wrapperElement.classList.toggle("collapsed", this._collapsed); |
1361 } | 1360 } |
1362 return this._wrapperElement; | 1361 return this._wrapperElement; |
1363 }, | 1362 }, |
1364 | 1363 |
1365 __proto__: WebInspector.ConsoleViewMessage.prototype | 1364 __proto__: WebInspector.ConsoleViewMessage.prototype |
1366 } | 1365 } |
OLD | NEW |