# HG changeset patch # User Gregory Szorc # Date 1420586942 28800 # Node ID d1933c2e3c8c9c60524f5c7b0c9766385796daf2 # Parent 606a3bf82e3030d1e612be50b9943f4379675415 templates: use CSS classes for diff styling Use of inline style for diff styling led to significant browser memory usage on large diffs. Moving the styling into CSS classes corrects this. This patch is based on work from https://bugzilla.mozilla.org/show_bug.cgi?id=766952 and https://hg.mozilla.org/hgcustom/version-control-tools/rev/2c355a580af6 diff -r 606a3bf82e30 -r d1933c2e3c8c mercurial/templates/gitweb/map --- a/mercurial/templates/gitweb/map Tue Jan 06 15:21:48 2015 -0800 +++ b/mercurial/templates/gitweb/map Tue Jan 06 15:29:02 2015 -0800 @@ -105,9 +105,9 @@
{linenumber}
{line|escape}
' -difflineplus = '{linenumber} {line|escape}' -difflineminus = '{linenumber} {line|escape}' -difflineat = '{linenumber} {line|escape}' +difflineplus = '{linenumber} {line|escape}' +difflineminus = '{linenumber} {line|escape}' +difflineat = '{linenumber} {line|escape}' diffline = '{linenumber} {line|escape}' comparisonblock =' diff -r 606a3bf82e30 -r d1933c2e3c8c mercurial/templates/monoblue/map --- a/mercurial/templates/monoblue/map Tue Jan 06 15:21:48 2015 -0800 +++ b/mercurial/templates/monoblue/map Tue Jan 06 15:29:02 2015 -0800 @@ -100,9 +100,9 @@ {line|escape} ' -difflineplus = '{linenumber} {line|escape}' -difflineminus = '{linenumber} {line|escape}' -difflineat = '{linenumber} {line|escape}' +difflineplus = '{linenumber} {line|escape}' +difflineminus = '{linenumber} {line|escape}' +difflineat = '{linenumber} {line|escape}' diffline = '{linenumber} {line|escape}' comparisonblock =' diff -r 606a3bf82e30 -r d1933c2e3c8c mercurial/templates/static/style-gitweb.css --- a/mercurial/templates/static/style-gitweb.css Tue Jan 06 15:21:48 2015 -0800 +++ b/mercurial/templates/static/style-gitweb.css Tue Jan 06 15:29:02 2015 -0800 @@ -84,6 +84,9 @@ background-color: #afdffa; border-color: #ccecff #46ace6 #46ace6 #ccecff; } +span.difflineplus { color:#008800; } +span.difflineminus { color:#cc0000; } +span.difflineat { color:#990099; } /* Graph */ div#wrapper { diff -r 606a3bf82e30 -r d1933c2e3c8c mercurial/templates/static/style-monoblue.css --- a/mercurial/templates/static/style-monoblue.css Tue Jan 06 15:21:48 2015 -0800 +++ b/mercurial/templates/static/style-monoblue.css Tue Jan 06 15:29:02 2015 -0800 @@ -260,6 +260,10 @@ font-size: 1.2em; padding: 3px 0; } +span.difflineplus { color:#008800; } +span.difflineminus { color:#cc0000; } +span.difflineat { color:#990099; } + td.source { white-space: pre; font-family: monospace; diff -r 606a3bf82e30 -r d1933c2e3c8c tests/test-hgweb.t --- a/tests/test-hgweb.t Tue Jan 06 15:21:48 2015 -0800 +++ b/tests/test-hgweb.t Tue Jan 06 15:29:02 2015 -0800 @@ -332,7 +332,7 @@ $ "$TESTDIR/get-with-headers.py" --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server 200 Script output follows - content-length: 5262 + content-length: 5372 content-type: text/css body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; } @@ -421,6 +421,9 @@ background-color: #afdffa; border-color: #ccecff #46ace6 #46ace6 #ccecff; } + span.difflineplus { color:#008800; } + span.difflineminus { color:#cc0000; } + span.difflineat { color:#990099; } /* Graph */ div#wrapper {