OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 var CodeView = function(divID, PR, sourceText, sourcePosition, broker) { | 5 var CodeView = function(divID, PR, sourceText, sourcePosition, broker) { |
6 "use strict"; | 6 "use strict"; |
7 var view = this; | 7 var view = this; |
8 | 8 |
9 view.divElement = document.getElementById(divID); | 9 view.divElement = document.getElementById(divID); |
10 view.broker = broker; | 10 view.broker = broker; |
(...skipping 12 matching lines...) Expand all Loading... |
23 if (selected) { | 23 if (selected) { |
24 span.classList.add("selected"); | 24 span.classList.add("selected"); |
25 } else { | 25 } else { |
26 span.classList.remove("selected"); | 26 span.classList.remove("selected"); |
27 } | 27 } |
28 } | 28 } |
29 var ranges = []; | 29 var ranges = []; |
30 for (var span of items) { | 30 for (var span of items) { |
31 ranges.push([span.start, span.end, null]); | 31 ranges.push([span.start, span.end, null]); |
32 } | 32 } |
| 33 broker.clear(selectionHandler); |
33 broker.select(selectionHandler, ranges, selected); | 34 broker.select(selectionHandler, ranges, selected); |
34 }, | 35 }, |
35 selectionDifference: function(span1, inclusive1, span2, inclusive2) { | 36 selectionDifference: function(span1, inclusive1, span2, inclusive2) { |
36 var pos1 = span1.start; | 37 var pos1 = span1.start; |
37 var pos2 = span2.start; | 38 var pos2 = span2.start; |
38 var result = []; | 39 var result = []; |
39 var lineListDiv = view.divElement.firstChild.firstChild.childNodes; | 40 var lineListDiv = view.divElement.firstChild.firstChild.childNodes; |
40 for (var i=0; i < lineListDiv.length; i++) { | 41 for (var i=0; i < lineListDiv.length; i++) { |
41 var currentLineElement = lineListDiv[i]; | 42 var currentLineElement = lineListDiv[i]; |
42 var spans = currentLineElement.childNodes; | 43 var spans = currentLineElement.childNodes; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 169 |
169 this.resizeToParent(); | 170 this.resizeToParent(); |
170 } | 171 } |
171 | 172 |
172 CodeView.prototype.resizeToParent = function() { | 173 CodeView.prototype.resizeToParent = function() { |
173 var view = this; | 174 var view = this; |
174 var documentElement = document.documentElement; | 175 var documentElement = document.documentElement; |
175 var y = view.divElement.parentNode.clientHeight || documentElement.clientHeigh
t; | 176 var y = view.divElement.parentNode.clientHeight || documentElement.clientHeigh
t; |
176 view.divElement.style.height = y + "px"; | 177 view.divElement.style.height = y + "px"; |
177 } | 178 } |
OLD | NEW |