# HG changeset patch # User Gregory Szorc # Date 2015-01-06 23:29:02 # 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 --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map --- a/mercurial/templates/gitweb/map +++ b/mercurial/templates/gitweb/map @@ -105,9 +105,9 @@ annotateline = '
{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 --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map --- a/mercurial/templates/monoblue/map +++ b/mercurial/templates/monoblue/map @@ -100,9 +100,9 @@ annotateline = ' {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 --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css --- a/mercurial/templates/static/style-gitweb.css +++ b/mercurial/templates/static/style-gitweb.css @@ -84,6 +84,9 @@ span.logtags span.bookmarktag { 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 --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css --- a/mercurial/templates/static/style-monoblue.css +++ b/mercurial/templates/static/style-monoblue.css @@ -260,6 +260,10 @@ div.diff pre span { 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 --git a/tests/test-hgweb.t b/tests/test-hgweb.t --- a/tests/test-hgweb.t +++ b/tests/test-hgweb.t @@ -332,7 +332,7 @@ static file $ "$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 @@ static file background-color: #afdffa; border-color: #ccecff #46ace6 #46ace6 #ccecff; } + span.difflineplus { color:#008800; } + span.difflineminus { color:#cc0000; } + span.difflineat { color:#990099; } /* Graph */ div#wrapper {