Show whether diff sides lack trailing newlines

Show a small warning at the end of a diff if either side does not have a
trailing newline. When a diff loads, find the last chunk for both sides
and examine the last line of each chunk. If the newline is missing from
either or both, show a corresponding message.

Keep track of whether the diff component is loading using a _loading
property so that the message can be hidden when loading a new diff.

Feature: Issue 9459
Change-Id: I59f59de5676af2f0352a42aa6d7dabaad5fc65b4
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html
index 718fa17..0fb15c4 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.html
@@ -245,6 +245,13 @@
         background-position: var(--line-limit) 0;
         background-repeat: repeat-y;
       }
+      .newlineWarning {
+        color: var(--deemphasized-text-color);
+        text-align: center;
+      }
+      .newlineWarning.hidden {
+        display: none;
+      }
     </style>
     <style include="gr-syntax-theme"></style>
     <div id="diffHeader" hidden$="[[_computeDiffHeaderHidden(_diffHeaderItems)]]">
@@ -284,6 +291,9 @@
         </gr-diff-highlight>
       </gr-diff-selection>
     </div>
+    <div class$="[[_computeNewlineWarningClass(_newlineWarning, _loading)]]">
+      [[_newlineWarning]]
+    </div>
     <div id="sizeWarning" class$="[[_computeWarningClass(_showWarning)]]">
       <p>
         Prevented render because "Whole file" is enabled and this diff is very