Commit 7f7beb7d authored by Robert Hogan's avatar Robert Hogan Committed by Commit Bot

Fix position:sticky on nested table parts

Bug: 702927
Change-Id: Ifeaa89a292e96bb66a26507ab85cf4e3a81d42c4
Reviewed-on: https://chromium-review.googlesource.com/786014
Commit-Queue: Robert Hogan <robhogan@gmail.com>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520181}
parent 55ebfef7
<!DOCTYPE html>
<title>Nested position:sticky table elements should render correctly</title>
<style>
.scroller {
width: 100px;
height: 250px;
overflow-x: hidden;
overflow-y: auto;
}
.contents {
height: 700px;
}
table {
border-collapse: collapse;
}
#child, td, th {
height: 50px;
width: 50px;
padding: 0;
background: green;
}
.prepadding {
height: 155px;
}
</style>
<script>
window.addEventListener('load', function() {
document.getElementById('scroller1').scrollTop = 150;
});
</script>
<div id="scroller1" class="scroller">
<div class="contents">
<div class="prepadding"></div>
<table>
<tbody>
<tr><td><div id="child"></div></td></tr>
</tbody>
</table>
</div>
</div>
<div>There should be a green square at the top of the scroll view and no red visible.</div>
<!DOCTYPE html>
<title>Nested position:sticky table elements should render correctly</title>
<link rel="match" href="position-sticky-table-parts-ref.html" />
<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
<meta name="assert" content="This test checks that nested position:sticky table elements render correctly" />
<style>
.scroller {
position: relative;
width: 100px;
height: 250px;
overflow-x: hidden;
overflow-y: auto;
}
.contents {
height: 700px;
}
table {
border-collapse: collapse;
}
.child, td, th {
height: 50px;
width: 50px;
padding: 0;
}
.child {
background: green;
}
table * {
position: sticky;
top: 5px;
}
.indicator {
position: absolute;
left: 0;
background-color: red;
height: 50px;
width: 50px;
}
</style>
<script>
window.addEventListener('load', function() {
document.body.offsetTop;
document.getElementById('scroller1').scrollTop = 150;
});
</script>
<div id="scroller1" class="scroller">
<div class="contents">
<div class="indicator" style="top: 155px;"></div>
<table>
<tbody>
<tr><td><div class="child"></div></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
</tbody>
</table>
</div>
</div>
<div>There should be a green square at the top of the scroll view and no red visible.</div>
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "core/layout/LayoutFlexibleBox.h" #include "core/layout/LayoutFlexibleBox.h"
#include "core/layout/LayoutGeometryMap.h" #include "core/layout/LayoutGeometryMap.h"
#include "core/layout/LayoutInline.h" #include "core/layout/LayoutInline.h"
#include "core/layout/LayoutTableCell.h"
#include "core/layout/LayoutView.h" #include "core/layout/LayoutView.h"
#include "core/paint/ObjectPaintInvalidator.h" #include "core/paint/ObjectPaintInvalidator.h"
#include "core/paint/PaintLayer.h" #include "core/paint/PaintLayer.h"
...@@ -827,7 +828,9 @@ void LayoutBoxModelObject::UpdateStickyPositionConstraints() const { ...@@ -827,7 +828,9 @@ void LayoutBoxModelObject::UpdateStickyPositionConstraints() const {
LayoutBlock* containing_block = this->ContainingBlock(); LayoutBlock* containing_block = this->ContainingBlock();
// The location container for boxes is not always the containing block. // The location container for boxes is not always the containing block.
LayoutObject* location_container = LayoutObject* location_container =
IsLayoutInline() ? Container() : ToLayoutBox(this)->LocationContainer(); IsLayoutInline() || IsTableCell()
? Container()
: ToLayoutBox(this)->LocationContainer();
// Skip anonymous containing blocks. // Skip anonymous containing blocks.
while (containing_block->IsAnonymous()) { while (containing_block->IsAnonymous()) {
containing_block = containing_block->ContainingBlock(); containing_block = containing_block->ContainingBlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment