Sticky positioning contributes to overflow at in-flow scroll position.

Even if a stickily positioned box sticks to the scrollport when
scrolling, that doesn't mean that the current distance to the start of
the scrollable container should make any difference during layout, as
far as overflow contribution from the stickily positioned box is
concerned.

Bug: 958803
Change-Id: I8a268c3ec2d5d62960f1f92322e75f932afe2a91
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1597588
Reviewed-by: Emil A Eklund <eae@chromium.org>
Reviewed-by: Aleks Totic <atotic@chromium.org>
Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657467}
diff --git a/css/css-position/position-sticky-scrolled-remove-sibling.html b/css/css-position/position-sticky-scrolled-remove-sibling.html
new file mode 100644
index 0000000..f2cf8a9
--- /dev/null
+++ b/css/css-position/position-sticky-scrolled-remove-sibling.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos">
+<p>Test passes if there is a filled green square, and no scrollbars</p>
+<div id="container" style="overflow:auto; width:100px; height:100px; background:red;">
+  <div style="position:sticky; top:0; height:100px; background:green;"></div>
+  <div id="bigItem" style="height:600px;"></div>
+</div>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+  container.scrollTop = 600;
+  requestAnimationFrame(()=>{
+    requestAnimationFrame(()=>{
+      bigItem.style.display = "none";
+      test(()=> {
+        assert_equals(container.scrollHeight, 100);
+      }, "Sticky position and its overflow contribution");
+    });
+  });
+</script>