| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 tree.classList.add('pretty-print'); | 65 tree.classList.add('pretty-print'); |
| 66 tree.id = 'tree'; | 66 tree.id = 'tree'; |
| 67 window.onload = sourceXMLLoaded; | 67 window.onload = sourceXMLLoaded; |
| 68 } | 68 } |
| 69 | 69 |
| 70 function sourceXMLLoaded() | 70 function sourceXMLLoaded() |
| 71 { | 71 { |
| 72 var sourceXML = document.getElementById('webkit-xml-viewer-source-xml'); | 72 var sourceXML = document.getElementById('webkit-xml-viewer-source-xml'); |
| 73 if (!sourceXML) | 73 if (!sourceXML) |
| 74 return; // Stop if some XML tree extension is already processing this do
cument | 74 return; // Stop if some XML tree extension is already processing this do
cument |
| 75 //var style = document.head.firstChild; | |
| 76 //document.head.removeChild(style); | |
| 77 //document.head.appendChild(style); | |
| 78 var root = document.getElementById('tree'); | 75 var root = document.getElementById('tree'); |
| 79 | 76 |
| 80 for (var child = sourceXML.firstChild; child; child = child.nextSibling) | 77 for (var child = sourceXML.firstChild; child; child = child.nextSibling) |
| 81 nodeParentPairs.push({parentElement: root, node: child}); | 78 nodeParentPairs.push({parentElement: root, node: child}); |
| 82 | 79 |
| 83 for (var i = 0; i < nodeParentPairs.length; i++) | 80 for (var i = 0; i < nodeParentPairs.length; i++) |
| 84 processNode(nodeParentPairs[i].parentElement, nodeParentPairs[i].node); | 81 processNode(nodeParentPairs[i].parentElement, nodeParentPairs[i].node); |
| 85 | 82 |
| 86 drawArrows(); | 83 drawArrows(); |
| 87 initButtons(); | 84 initButtons(); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 expandButton.onmousedown = handleButtonMouseDown; | 423 expandButton.onmousedown = handleButtonMouseDown; |
| 427 } | 424 } |
| 428 | 425 |
| 429 } | 426 } |
| 430 | 427 |
| 431 function handleButtonMouseDown(e) | 428 function handleButtonMouseDown(e) |
| 432 { | 429 { |
| 433 // To prevent selection on double click | 430 // To prevent selection on double click |
| 434 e.preventDefault(); | 431 e.preventDefault(); |
| 435 } | 432 } |
| OLD | NEW |