diff options
Diffstat (limited to 'coverage/htmlfiles')
-rw-r--r-- | coverage/htmlfiles/coverage_html.js | 34 | ||||
-rw-r--r-- | coverage/htmlfiles/index.html | 2 | ||||
-rw-r--r-- | coverage/htmlfiles/pyfile.html | 2 | ||||
-rw-r--r-- | coverage/htmlfiles/style.css | 3 |
4 files changed, 19 insertions, 22 deletions
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js index f6f5de20..2b32c391 100644 --- a/coverage/htmlfiles/coverage_html.js +++ b/coverage/htmlfiles/coverage_html.js @@ -1,5 +1,5 @@ // Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -// For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt +// For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt // Coverage.py HTML report browser code. /*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */ @@ -169,22 +169,13 @@ coverage.wire_up_filter = function () { // Loaded on index.html coverage.index_ready = function ($) { - // Look for a cookie containing previous sort settings: + // Look for a localStorage item containing previous sort settings: var sort_list = []; - var cookie_name = "COVERAGE_INDEX_SORT"; - var i; + var storage_name = "COVERAGE_INDEX_SORT"; + var stored_list = localStorage.getItem(storage_name); - // This almost makes it worth installing the jQuery cookie plugin: - if (document.cookie.indexOf(cookie_name) > -1) { - var cookies = document.cookie.split(";"); - for (i = 0; i < cookies.length; i++) { - var parts = cookies[i].split("="); - - if ($.trim(parts[0]) === cookie_name && parts[1]) { - sort_list = eval("[[" + parts[1] + "]]"); - break; - } - } + if (stored_list) { + sort_list = JSON.parse('[[' + stored_list + ']]'); } // Create a new widget which exists only to save and restore @@ -231,7 +222,7 @@ coverage.index_ready = function ($) { // Watch for page unload events so we can save the final sort settings: $(window).unload(function () { - document.cookie = cookie_name + "=" + sort_list.toString() + "; path=/"; + localStorage.setItem(storage_name, sort_list.toString()) }); }; @@ -555,11 +546,16 @@ coverage.resize_scroll_markers = function () { var previous_line = -99, last_mark, - last_top; + last_top, + offsets = {}; + // Calculate line offsets outside loop to prevent relayouts + c.missed_lines.each(function() { + offsets[this.id] = $(this).offset().top; + }); c.missed_lines.each(function () { - var line_top = Math.round($(this).offset().top * marker_scale), - id_name = $(this).attr('id'), + var id_name = $(this).attr('id'), + line_top = Math.round(offsets[id_name] * marker_scale), line_number = parseInt(id_name.substring(1, id_name.length)); if (line_number === previous_line + 1) { diff --git a/coverage/htmlfiles/index.html b/coverage/htmlfiles/index.html index 1e3999f9..4129bc31 100644 --- a/coverage/htmlfiles/index.html +++ b/coverage/htmlfiles/index.html @@ -1,5 +1,5 @@ {# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 #} -{# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt #} +{# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt #} <!DOCTYPE html> <html> diff --git a/coverage/htmlfiles/pyfile.html b/coverage/htmlfiles/pyfile.html index 8542a467..245ecf41 100644 --- a/coverage/htmlfiles/pyfile.html +++ b/coverage/htmlfiles/pyfile.html @@ -1,5 +1,5 @@ {# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 #} -{# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt #} +{# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt #} <!DOCTYPE html> <html> diff --git a/coverage/htmlfiles/style.css b/coverage/htmlfiles/style.css index 86b82091..14592865 100644 --- a/coverage/htmlfiles/style.css +++ b/coverage/htmlfiles/style.css @@ -1,5 +1,5 @@ /* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ -/* For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt */ +/* For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt */ /* CSS styles for coverage.py. */ @@ -365,6 +365,7 @@ td.text { height: 100%; background: white; border-left: 1px solid #eee; + will-change: transform; /* for faster scrolling of fixed element in Chrome */ } #scroll_marker .marker { |