| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 document.onload = (function(d3){ | 5 document.onload = (function(d3){ |
| 6 "use strict"; | 6 "use strict"; |
| 7 var jsonObj; | 7 var jsonObj; |
| 8 var sourceExpandClassList = document.getElementById(SOURCE_EXPAND_ID).classLis
t; | 8 var sourceExpandClassList = document.getElementById(SOURCE_EXPAND_ID).classLis
t; |
| 9 var sourceCollapseClassList = document.getElementById(SOURCE_COLLAPSE_ID).clas
sList; | 9 var sourceCollapseClassList = document.getElementById(SOURCE_COLLAPSE_ID).clas
sList; |
| 10 var sourceExpanded = sourceCollapseClassList.contains(COLLAPSE_PANE_BUTTON_VIS
IBLE); | 10 var sourceExpanded = sourceCollapseClassList.contains(COLLAPSE_PANE_BUTTON_VIS
IBLE); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 d3.select("#" + INTERMEDIATE_PANE_ID).style(WIDTH, "50%"); | 37 d3.select("#" + INTERMEDIATE_PANE_ID).style(WIDTH, "50%"); |
| 38 d3.select("#" + GENERATED_PANE_ID).style(WIDTH, "50%"); | 38 d3.select("#" + GENERATED_PANE_ID).style(WIDTH, "50%"); |
| 39 } else { | 39 } else { |
| 40 d3.select("#" + SOURCE_PANE_ID).style(WIDTH, "0%"); | 40 d3.select("#" + SOURCE_PANE_ID).style(WIDTH, "0%"); |
| 41 d3.select("#" + INTERMEDIATE_PANE_ID).style(WIDTH, "100%"); | 41 d3.select("#" + INTERMEDIATE_PANE_ID).style(WIDTH, "100%"); |
| 42 d3.select("#" + GENERATED_PANE_ID).style(WIDTH, "0%"); | 42 d3.select("#" + GENERATED_PANE_ID).style(WIDTH, "0%"); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 function toggleSourceExpanded() { |
| 48 setSourceExpanded(!sourceExpanded); |
| 49 } |
| 50 |
| 47 function setSourceExpanded(newState) { | 51 function setSourceExpanded(newState) { |
| 48 sourceExpanded = newState; | 52 sourceExpanded = newState; |
| 49 updatePanes(); | 53 updatePanes(); |
| 50 if (newState) { | 54 if (newState) { |
| 51 sourceCollapseClassList.add(COLLAPSE_PANE_BUTTON_VISIBLE); | 55 sourceCollapseClassList.add(COLLAPSE_PANE_BUTTON_VISIBLE); |
| 52 sourceCollapseClassList.remove(COLLAPSE_PANE_BUTTON_INVISIBLE); | 56 sourceCollapseClassList.remove(COLLAPSE_PANE_BUTTON_INVISIBLE); |
| 53 sourceExpandClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); | 57 sourceExpandClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); |
| 54 sourceExpandClassList.remove(COLLAPSE_PANE_BUTTON_VISIBLE); | 58 sourceExpandClassList.remove(COLLAPSE_PANE_BUTTON_VISIBLE); |
| 55 } else { | 59 } else { |
| 56 sourceCollapseClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); | 60 sourceCollapseClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); |
| 57 sourceCollapseClassList.remove(COLLAPSE_PANE_BUTTON_VISIBLE); | 61 sourceCollapseClassList.remove(COLLAPSE_PANE_BUTTON_VISIBLE); |
| 58 sourceExpandClassList.add(COLLAPSE_PANE_BUTTON_VISIBLE); | 62 sourceExpandClassList.add(COLLAPSE_PANE_BUTTON_VISIBLE); |
| 59 sourceExpandClassList.remove(COLLAPSE_PANE_BUTTON_INVISIBLE); | 63 sourceExpandClassList.remove(COLLAPSE_PANE_BUTTON_INVISIBLE); |
| 60 } | 64 } |
| 61 } | 65 } |
| 62 | 66 |
| 67 function toggleDisassemblyExpanded() { |
| 68 setDisassemblyExpanded(!disassemblyExpanded); |
| 69 } |
| 70 |
| 63 function setDisassemblyExpanded(newState) { | 71 function setDisassemblyExpanded(newState) { |
| 64 disassemblyExpanded = newState; | 72 disassemblyExpanded = newState; |
| 65 updatePanes(); | 73 updatePanes(); |
| 66 if (newState) { | 74 if (newState) { |
| 67 disassemblyCollapseClassList.add(COLLAPSE_PANE_BUTTON_VISIBLE); | 75 disassemblyCollapseClassList.add(COLLAPSE_PANE_BUTTON_VISIBLE); |
| 68 disassemblyCollapseClassList.remove(COLLAPSE_PANE_BUTTON_INVISIBLE); | 76 disassemblyCollapseClassList.remove(COLLAPSE_PANE_BUTTON_INVISIBLE); |
| 69 disassemblyExpandClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); | 77 disassemblyExpandClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); |
| 70 disassemblyExpandClassList.remove(COLLAPSE_PANE_BUTTON_VISIBLE); | 78 disassemblyExpandClassList.remove(COLLAPSE_PANE_BUTTON_VISIBLE); |
| 71 } else { | 79 } else { |
| 72 disassemblyCollapseClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); | 80 disassemblyCollapseClassList.add(COLLAPSE_PANE_BUTTON_INVISIBLE); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 disassemblyView.resizeToParent(); | 119 disassemblyView.resizeToParent(); |
| 112 sourceView.resizeToParent(); | 120 sourceView.resizeToParent(); |
| 113 | 121 |
| 114 d3.select("#left").classed("scrollable", true); | 122 d3.select("#left").classed("scrollable", true); |
| 115 d3.select("#right").classed("scrollable", true); | 123 d3.select("#right").classed("scrollable", true); |
| 116 } | 124 } |
| 117 | 125 |
| 118 selectionBroker = new SelectionBroker(); | 126 selectionBroker = new SelectionBroker(); |
| 119 | 127 |
| 120 function initializeHandlers(g) { | 128 function initializeHandlers(g) { |
| 121 d3.select("#source-expand").on("click", function(){ | 129 d3.select("#source-collapse").on("click", function(){ |
| 122 setSourceExpanded(true); | 130 toggleSourceExpanded(true); |
| 123 setTimeout(function(){ | 131 setTimeout(function(){ |
| 124 g.fitGraphViewToWindow(); | 132 g.fitGraphViewToWindow(); |
| 125 }, 1000); | 133 }, 1000); |
| 126 }); | 134 }); |
| 127 d3.select("#source-shrink").on("click", function(){ | 135 d3.select("#disassembly-collapse").on("click", function(){ |
| 128 setSourceExpanded(false); | 136 toggleDisassemblyExpanded(); |
| 129 setTimeout(function(){ | 137 setTimeout(function(){ |
| 130 g.fitGraphViewToWindow(); | 138 g.fitGraphViewToWindow(); |
| 131 }, 1000); | 139 }, 1000); |
| 132 }); | |
| 133 d3.select("#disassembly-expand").on("click", function(){ | |
| 134 setDisassemblyExpanded(true); | |
| 135 setTimeout(function(){ | |
| 136 g.fitGraphViewToWindow(); | |
| 137 }, 1000); | |
| 138 }); | |
| 139 d3.select("#disassembly-shrink").on("click", function(){ | |
| 140 setDisassemblyExpanded(false); | |
| 141 setTimeout(function(){ | |
| 142 g.fitGraphViewToWindow(); | |
| 143 }, 1000); | |
| 144 }); | 140 }); |
| 145 window.onresize = function(){ | 141 window.onresize = function(){ |
| 146 fitPanesToParents(); | 142 fitPanesToParents(); |
| 147 }; | 143 }; |
| 148 d3.select("#hidden-file-upload").on("change", function() { | 144 d3.select("#hidden-file-upload").on("change", function() { |
| 149 if (window.File && window.FileReader && window.FileList) { | 145 if (window.File && window.FileReader && window.FileList) { |
| 150 var uploadFile = this.files[0]; | 146 var uploadFile = this.files[0]; |
| 151 var filereader = new window.FileReader(); | 147 var filereader = new window.FileReader(); |
| 152 var consts = Node.consts; | 148 var consts = Node.consts; |
| 153 filereader.onload = function(){ | 149 filereader.onload = function(){ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 empty = new EmptyView(EMPTY_PANE_ID, selectionBroker); | 202 empty = new EmptyView(EMPTY_PANE_ID, selectionBroker); |
| 207 | 203 |
| 208 initializeHandlers(graph); | 204 initializeHandlers(graph); |
| 209 | 205 |
| 210 setSourceExpanded(true); | 206 setSourceExpanded(true); |
| 211 setDisassemblyExpanded(false); | 207 setDisassemblyExpanded(false); |
| 212 | 208 |
| 213 displayPhaseView(empty, null); | 209 displayPhaseView(empty, null); |
| 214 fitPanesToParents(); | 210 fitPanesToParents(); |
| 215 })(window.d3); | 211 })(window.d3); |
| OLD | NEW |