diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-03 19:43:51 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-03 19:43:51 +0100 |
commit | 5ab2da700448caf181dae7dec2f53997faf118ea (patch) | |
tree | d04be907b452da59046b8c8cefbdd8a6c2f7cfd1 /layout | |
parent | ce11d5cae866f24b8f7435cdc3725cfd2748595b (diff) | |
download | UXP-5ab2da700448caf181dae7dec2f53997faf118ea.tar UXP-5ab2da700448caf181dae7dec2f53997faf118ea.tar.gz UXP-5ab2da700448caf181dae7dec2f53997faf118ea.tar.lz UXP-5ab2da700448caf181dae7dec2f53997faf118ea.tar.xz UXP-5ab2da700448caf181dae7dec2f53997faf118ea.zip |
Issue #146 - Part 6: Allow `position: sticky` on table elements.
Diffstat (limited to 'layout')
-rw-r--r-- | layout/base/RestyleManagerBase.cpp | 9 | ||||
-rw-r--r-- | layout/generic/StickyScrollContainer.cpp | 2 | ||||
-rw-r--r-- | layout/generic/nsFrame.cpp | 5 | ||||
-rw-r--r-- | layout/tables/nsTableRowFrame.cpp | 11 |
4 files changed, 7 insertions, 20 deletions
diff --git a/layout/base/RestyleManagerBase.cpp b/layout/base/RestyleManagerBase.cpp index 6770f9464..6ef048a19 100644 --- a/layout/base/RestyleManagerBase.cpp +++ b/layout/base/RestyleManagerBase.cpp @@ -474,15 +474,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 diff --git a/layout/generic/StickyScrollContainer.cpp b/layout/generic/StickyScrollContainer.cpp index ff8ebcfef..c5ed44e92 100644 --- a/layout/generic/StickyScrollContainer.cpp +++ b/layout/generic/StickyScrollContainer.cpp @@ -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) { diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index d4bcf22ed..bbbb5c332 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -562,15 +562,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) { diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 05b9deee9..ea2477b73 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -926,12 +926,11 @@ 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 |