gitblit/gitblit — pull request #229 by tomaswolf (2014-11-11 07:16:49+00:00)
Title: Image diffs

**[Ticket 88](https://dev.gitblit.com/tickets/gitblit.git/88)**

UI based on [Lea Verou's pure CSS slider](http://lea.verou.me/2014/07/image-comparison-slider-with-pure-css/).

* Add a callback interface, pass it through DiffUtils to the GitBlitDiffFormatter. Is needed because the rendering needs access to the repositoryName and other things that are known only at higher levels.

* New class ImageDiffHandler responsible for rendering an image diff. Called for all binary diffs, doesn't do anything if it's not an image. HTML is generated via JSoup: no worries about forgetting to close a tag, nor about HTML escaping, nor about XSS.

* The 3 diff pages set up such an ImageDIffHandler and pass it along.

* CSS changes: from Lea Verou, with some minor improvements (ability to slide all the way to the left).

I think in the long run there'll be no way around rewriting the HTML diff formatter from scratch, not using the standard JGit DiffFormatter at all. For now, it's still manageable (even though the binary file interception is a bit a of a dirty trick), but if one ever wanted intraline diffs, there'll be no way around that.