Bug 975644: Enable position sticky in table parts. r=bz

MozReview-Commit-ID: 85nCuChHdTa
This commit is contained in:
Emilio Cobos Álvarez 2017-11-29 16:11:25 +01:00
parent fb0dc0f67a
commit 033d6b32fc
16 changed files with 10 additions and 111 deletions

View File

@ -744,15 +744,6 @@ RecomputePosition(nsIFrame* aFrame)
if (display->IsRelativelyPositionedStyle()) {
// Move the frame
if (display->mPosition == NS_STYLE_POSITION_STICKY) {
if (display->IsInnerTableStyle()) {
// We don't currently support sticky positioning of inner table
// elements (bug 975644). Bail.
//
// When this is fixed, remove the null-check for the computed
// offsets in nsTableRowFrame::ReflowChildren.
return true;
}
// Update sticky positioning for an entire element at once, starting with
// the first continuation or ib-split sibling.
// It's rare that the frame we already have isn't already the first

View File

@ -45,7 +45,7 @@ StickyScrollContainer::GetStickyScrollContainerForFrame(nsIFrame* aFrame)
// <html style="position: fixed">
return nullptr;
}
auto frame = static_cast<nsIFrame*>(do_QueryFrame(scrollFrame));
nsIFrame* frame = do_QueryFrame(scrollFrame);
StickyScrollContainer* s =
frame->GetProperty(StickyScrollContainerProperty());
if (!s) {

View File

@ -690,15 +690,12 @@ nsFrame::Init(nsIContent* aContent,
}
if (disp->mPosition == NS_STYLE_POSITION_STICKY &&
!aPrevInFlow &&
!(mState & NS_FRAME_IS_NONDISPLAY) &&
!disp->IsInnerTableStyle()) {
!(mState & NS_FRAME_IS_NONDISPLAY)) {
// Note that we only add first continuations, but we really only
// want to add first continuation-or-ib-split-siblings. But since we
// don't yet know if we're a later part of a block-in-inline split,
// we'll just add later members of a block-in-inline split here, and
// then StickyScrollContainer will remove them later.
// We don't currently support relative positioning of inner table
// elements (bug 35168), so exclude them from sticky positioning too.
StickyScrollContainer* ssc =
StickyScrollContainer::GetStickyScrollContainerForFrame(this);
if (ssc) {
@ -726,8 +723,7 @@ nsFrame::Init(nsIContent* aContent,
"root frame should always be a container");
}
if (PresShell()->AssumeAllFramesVisible() &&
TrackingVisibility()) {
if (PresShell()->AssumeAllFramesVisible() && TrackingVisibility()) {
IncApproximateVisibleCount();
}

View File

@ -1,26 +0,0 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<link rel="author" title="Corey Ford" href="mailto:corey@coreyford.name">
</head>
<body>
<table>
<thead>
<tr>
<td>a</td>
</tr>
</thead>
<tr>
<td>b</td>
</tr>
<tr>
<td>c</td>
</tr>
<tr>
<td>d</td>
</tr>
</table>
</body>
</html>

View File

@ -1,35 +0,0 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<title>CSS Test: Sticky Positioning - inner table elements</title>
<link rel="author" title="Corey Ford" href="mailto:corey@coreyford.name">
<link rel="match" href="inner-table-1-ref.html">
<meta name="assert" content="Sticky positioning on inner table elements should have no effect (until bug 35168 is fixed)">
<style>
.sticky {
position: sticky;
top: 1000px;
}
</style>
</head>
<body>
<table>
<thead class="sticky">
<tr>
<td>a</td>
</tr>
</thead>
<tr class="sticky">
<td>b</td>
</tr>
<tr>
<td class="sticky">c</td>
</tr>
<tr>
<td>d</td>
</tr>
</table>
</body>
</html>

View File

@ -48,5 +48,4 @@ fails == column-contain-1a.html column-contain-1-ref.html
fuzzy-if(skiaContent,1,22) fuzzy-if(winWidget&&!layersGPUAccelerated,116,1320) fuzzy-if(Android,8,1533) == block-in-inline-2.html block-in-inline-2-ref.html
fuzzy-if(Android,8,630) fuzzy-if(OSX,1,11) fuzzy-if(skiaContent,1,220) fuzzy-if(winWidget&&!layersGPUAccelerated,116,1320) == block-in-inline-3.html block-in-inline-3-ref.html
== block-in-inline-continuations.html block-in-inline-continuations-ref.html
fuzzy-if(winWidget&&!layersGPUAccelerated,140,140) == inner-table-1.html inner-table-1-ref.html
== iframe-1.html iframe-1-ref.html

View File

@ -941,12 +941,13 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// be merged into the else below if we can.)
nsMargin* computedOffsetProp =
kidFrame->GetProperty(nsIFrame::ComputedOffsetProperty());
// Bug 975644: a position:sticky kid can end up with a null
// property value here.
LogicalMargin computedOffsets(wm, computedOffsetProp ?
*computedOffsetProp : nsMargin());
ReflowInput::ApplyRelativePositioning(kidFrame, wm, computedOffsets,
&kidPosition, containerSize);
// On our fist reflow sticky children may not have the property yet (we
// need to reflow the children first to size the scroll frame).
LogicalMargin computedOffsets(
wm, computedOffsetProp ? *computedOffsetProp : nsMargin());
ReflowInput::ApplyRelativePositioning(
kidFrame, wm, computedOffsets, &kidPosition, containerSize);
}
// In vertical-rl mode, we are likely to have containerSize.width = 0

View File

@ -1,3 +0,0 @@
[position-sticky-nested-table.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-tfoot-bottom.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-th-bottom.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-th-left.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-th-right.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-th-top.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-thead-top.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-tr-bottom.html]
type: reftest
expected: FAIL

View File

@ -1,3 +0,0 @@
[position-sticky-table-tr-top.html]
type: reftest
expected: FAIL