Add support for rendering webp image files

This will be available in Safari 14 [1] so pages needing to support
older Safari versions may want to hold off on taking advantage of it.
It should already be safe on all browsers (since it doesn't have XSS
potential like SVG), though, so we can allow it now.

[1] https://caniuse.com/?search=webp

[jrn: rebased, fleshed out commit message]

Change-Id: Ibae2f3a3fe1d40b66f26f4f385d07d2aabd346a2
diff --git a/Documentation/markdown.md b/Documentation/markdown.md
index 23e3bae..e6b766c 100644
--- a/Documentation/markdown.md
+++ b/Documentation/markdown.md
@@ -443,8 +443,8 @@
 Relative and absolute links to image files within the Git repository
 (such as `../images/banner.png`) are resolved during rendering by
 inserting the base64 encoding of the image using a `data:` URI.  Only
-PNG (`*.png`), JPEG (`*.jpg` or `*.jpeg`) and GIF (`*.gif`) image
-formats are supported when referenced from the Git repository.
+PNG (`*.png`), JPEG (`*.jpg` or `*.jpeg`), GIF (`*.gif`) and WebP (`*.webp`)
+image formats are supported when referenced from the Git repository.
 
 Unsupported extensions or files larger than [image size](#Image-size)
 limit (default 256K) will display a broken image.
diff --git a/java/com/google/gitiles/doc/ImageLoader.java b/java/com/google/gitiles/doc/ImageLoader.java
index 3e536d7..81724b6 100644
--- a/java/com/google/gitiles/doc/ImageLoader.java
+++ b/java/com/google/gitiles/doc/ImageLoader.java
@@ -34,7 +34,7 @@
 class ImageLoader {
   private static final Logger log = LoggerFactory.getLogger(ImageLoader.class);
   private static final ImmutableSet<String> ALLOWED_TYPES =
-      ImmutableSet.of("image/gif", "image/jpeg", "image/png");
+      ImmutableSet.of("image/gif", "image/jpeg", "image/png", "image/webp");
 
   private final ObjectReader reader;
   private final GitilesView view;
diff --git a/resources/com/google/gitiles/mime-types.properties b/resources/com/google/gitiles/mime-types.properties
index 0b4bd26..8cc19b4 100644
--- a/resources/com/google/gitiles/mime-types.properties
+++ b/resources/com/google/gitiles/mime-types.properties
@@ -13,4 +13,5 @@
 svg = image/svg+xml
 tiff = image/tiff
 txt = text/plain
+webp = image/webp
 xml = text/xml