OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
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 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 break; | 1438 break; |
1439 } | 1439 } |
1440 | 1440 |
1441 if (this.treeOutline.isXMLMimeType || !WebInspector.ElementsTreeElem
ent.ForbiddenClosingTagElements.has(tagName)) | 1441 if (this.treeOutline.isXMLMimeType || !WebInspector.ElementsTreeElem
ent.ForbiddenClosingTagElements.has(tagName)) |
1442 this._buildTagDOM(titleDOM, tagName, true, false, updateRecord); | 1442 this._buildTagDOM(titleDOM, tagName, true, false, updateRecord); |
1443 break; | 1443 break; |
1444 | 1444 |
1445 case Node.TEXT_NODE: | 1445 case Node.TEXT_NODE: |
1446 if (node.parentNode && node.parentNode.nodeName().toLowerCase() ===
"script") { | 1446 if (node.parentNode && node.parentNode.nodeName().toLowerCase() ===
"script") { |
1447 var newNode = titleDOM.createChild("span", "webkit-html-text-nod
e webkit-html-js-node"); | 1447 var newNode = titleDOM.createChild("span", "webkit-html-text-nod
e webkit-html-js-node"); |
1448 newNode.textContent = node.nodeValue(); | 1448 var text = node.nodeValue(); |
| 1449 newNode.textContent = text.startsWith("\n") ? text.substring(1)
: text; |
1449 | 1450 |
1450 var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHigh
lighter("text/javascript", true); | 1451 var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHigh
lighter("text/javascript", true); |
1451 javascriptSyntaxHighlighter.syntaxHighlightNode(newNode).then(up
dateSearchHighlight.bind(this)); | 1452 javascriptSyntaxHighlighter.syntaxHighlightNode(newNode).then(up
dateSearchHighlight.bind(this)); |
1452 } else if (node.parentNode && node.parentNode.nodeName().toLowerCase
() === "style") { | 1453 } else if (node.parentNode && node.parentNode.nodeName().toLowerCase
() === "style") { |
1453 var newNode = titleDOM.createChild("span", "webkit-html-text-nod
e webkit-html-css-node"); | 1454 var newNode = titleDOM.createChild("span", "webkit-html-text-nod
e webkit-html-css-node"); |
1454 newNode.textContent = node.nodeValue(); | 1455 var text = node.nodeValue(); |
| 1456 newNode.textContent = text.startsWith("\n") ? text.substring(1)
: text; |
1455 | 1457 |
1456 var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter
("text/css", true); | 1458 var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter
("text/css", true); |
1457 cssSyntaxHighlighter.syntaxHighlightNode(newNode).then(updateSea
rchHighlight.bind(this)); | 1459 cssSyntaxHighlighter.syntaxHighlightNode(newNode).then(updateSea
rchHighlight.bind(this)); |
1458 } else { | 1460 } else { |
1459 titleDOM.createTextChild("\""); | 1461 titleDOM.createTextChild("\""); |
1460 var textNodeElement = titleDOM.createChild("span", "webkit-html-
text-node"); | 1462 var textNodeElement = titleDOM.createChild("span", "webkit-html-
text-node"); |
1461 var result = this._convertWhitespaceToEntities(node.nodeValue())
; | 1463 var result = this._convertWhitespaceToEntities(node.nodeValue())
; |
1462 textNodeElement.textContent = result.text; | 1464 textNodeElement.textContent = result.text; |
1463 WebInspector.highlightRangesWithStyleClass(textNodeElement, resu
lt.entityRanges, "webkit-html-entity-value"); | 1465 WebInspector.highlightRangesWithStyleClass(textNodeElement, resu
lt.entityRanges, "webkit-html-entity-value"); |
1464 titleDOM.createTextChild("\""); | 1466 titleDOM.createTextChild("\""); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 }, | 1626 }, |
1625 | 1627 |
1626 _editAsHTML: function() | 1628 _editAsHTML: function() |
1627 { | 1629 { |
1628 var promise = WebInspector.Revealer.revealPromise(this.node()); | 1630 var promise = WebInspector.Revealer.revealPromise(this.node()); |
1629 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as-
html").execute()); | 1631 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as-
html").execute()); |
1630 }, | 1632 }, |
1631 | 1633 |
1632 __proto__: TreeElement.prototype | 1634 __proto__: TreeElement.prototype |
1633 } | 1635 } |
OLD | NEW |