@@ -123,32 +123,12 @@ cls.JsSourceView = function(id, name, container_class)
123123 var updateBreakpoints = function ( force_repaint )
124124 {
125125 if ( force_repaint && line_numbers )
126- {
127126 line_numbers . style . visibility = "hidden" ;
128- }
129- var lines = line_numbers && line_numbers . getElementsByTagName ( 'span' ) ;
130- var bp_states = __current_script && __current_script . breakpoint_states ;
131- var default_y = context [ 'bp-line-pointer-default' ] ;
132- var line_height = context [ 'line-height' ] ;
133- if ( bp_states )
134- {
135- for ( var i = 0 , line , y ; line = lines [ i ] ; i ++ )
136- {
137- if ( bp_states [ __top_line + i ] )
138- {
139- y = default_y - 1 * bp_states [ __top_line + i ] * BP_IMAGE_LINE_HEIGHT ;
140- line . style . backgroundPosition = '0 ' + y + 'px' ;
141- }
142- else
143- {
144- line . style . backgroundPosition = '0 0' ;
145- }
146- }
147- }
127+
128+ cls . JsSourceView . update_breakpoints ( __current_script , line_numbers , __top_line ) ;
148129 if ( force_repaint )
149- {
150130 setTimeout ( repaint_line_numbers , 0 ) ;
151- }
131+
152132 addLineHighlight ( ) ;
153133 } ;
154134
@@ -219,6 +199,7 @@ cls.JsSourceView = function(id, name, container_class)
219199 {
220200 style . height = context [ 'line-height' ] + 'px' ;
221201 }
202+ cls . JsSourceView . update_default_y ( ) ;
222203 }
223204
224205 this . createView = function ( container )
@@ -1016,7 +997,46 @@ cls.JsSourceView = function(id, name, container_class)
1016997 this . _slice_highlighter = new VirtualTextSearch ( config ) ;
1017998 this . _tooltip = null ;
1018999
1019- }
1000+ } ;
1001+
1002+ cls . JsSourceView . update_breakpoints = function ( script , line_numbers , top_line )
1003+ {
1004+ var BP_IMAGE_LINE_HEIGHT = 24 ;
1005+ var lines = line_numbers && line_numbers . querySelectorAll ( "span" ) ;
1006+ var bp_states = script && script . breakpoint_states ;
1007+ if ( typeof top_line != "number" )
1008+ {
1009+ var input = line_numbers . querySelector ( "input" ) ;
1010+ top_line = input && Number ( input . value ) ;
1011+ }
1012+ if ( lines && bp_states && typeof top_line == "number" )
1013+ {
1014+ for ( var i = 0 , line ; line = lines [ i ] ; i ++ )
1015+ {
1016+ var y = bp_states [ top_line + i ]
1017+ ? this . default_y - 1 * bp_states [ top_line + i ] * BP_IMAGE_LINE_HEIGHT
1018+ : 0 ;
1019+ line . style . backgroundPosition = "0 " + y + "px" ;
1020+ }
1021+ }
1022+ } ;
1023+
1024+ cls . JsSourceView . __defineGetter__ ( "default_y" , function ( )
1025+ {
1026+ if ( ! this . _default_y )
1027+ this . update_default_y ( ) ;
1028+
1029+ return this . _default_y ;
1030+ } ) ;
1031+
1032+ cls . JsSourceView . __defineSetter__ ( "default_y" , function ( ) { } ;
1033+
1034+ cls . JsSourceView . update_default_y = function ( )
1035+ {
1036+ var BP_IMAGE_HEIGHT = 12 ;
1037+ var d_line_h = window . defaults [ "js-source-line-height" ] ;
1038+ this . _default_y = ( d_line_h - BP_IMAGE_HEIGHT ) / 2 >> 0 ;
1039+ } ) ;
10201040
10211041cls . JsSourceView . prototype = ViewBase ;
10221042
0 commit comments