building blocks for bottom-aligned attachments

Attachment overlays now warrant their own adapter entries,
because they are no longer attached to each message header.

So since cursor items no longer map 1:1 to adapter items, add a
new specialized adapter to house different kinds of scrolling
overlay views. This support is also needed for super-collapsed
blocks.

The adapter is also an ideal place to store transient render
state like 'expanded' and 'show pics', as each ConversationItem
can manage its own state instead of having the fragment do it.
And view recycling requires that the adapter remember item
state as you scroll around anyway.

Next CL will actually separate attachment views and logic out
of MessageHeaderView.

Change-Id: Ibc589915f01ada0d9a41d8968a0ee63be6030449
diff --git a/assets/script.js b/assets/script.js
index e8a070e..a68db32 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -129,24 +129,23 @@
 }
 
 function measurePositions() {
-    var headerHeights;
-    var headerBottoms;
+    var overlayBottoms;
     var h;
     var i;
     var len;
 
-    var headers = document.querySelectorAll(".spacer");
+    var expandedSpacerDivs = document.querySelectorAll(".expanded > .spacer");
 
-    headerHeights = new Array(headers.length);
-    headerBottoms = new Array(headers.length);
-    for (i = 0, len = headers.length; i < len; i++) {
-        h = headers[i].offsetHeight;
+    overlayBottoms = new Array(expandedSpacerDivs.length + 1);
+    for (i = 0, len = expandedSpacerDivs.length; i < len; i++) {
+        h = expandedSpacerDivs[i].offsetHeight;
         // addJavascriptInterface handler only supports string arrays
-        headerHeights[i] = "" + h;
-        headerBottoms[i] = "" + (getTotalOffset(headers[i]).top + h);
+        overlayBottoms[i] = "" + (getTotalOffset(expandedSpacerDivs[i]).top + h);
     }
+    // add an extra one to mark the bottom of the last message
+    overlayBottoms[i] = "" + document.body.offsetHeight;
 
-    window.mail.onWebContentGeometryChange(headerBottoms, headerHeights);
+    window.mail.onWebContentGeometryChange(overlayBottoms);
 }
 
 // BEGIN Java->JavaScript handlers