summaryrefslogtreecommitdiffstats
path: root/layout/generic
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-05 11:36:03 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-05 11:36:03 -0500
commit714afc76f690ba11e77330e067e5bce486292831 (patch)
tree90b50f1ac6ab3cbf9e751a184bc1df8f8dafd730 /layout/generic
parent711a5031d015a9fde7feb61905473b52d9cc3369 (diff)
parent082670ecb19a229ea20bf9b69991341d4be25e38 (diff)
downloadUXP-714afc76f690ba11e77330e067e5bce486292831.tar
UXP-714afc76f690ba11e77330e067e5bce486292831.tar.gz
UXP-714afc76f690ba11e77330e067e5bce486292831.tar.lz
UXP-714afc76f690ba11e77330e067e5bce486292831.tar.xz
UXP-714afc76f690ba11e77330e067e5bce486292831.zip
Merge branch 'master' into mailnews-work
Diffstat (limited to 'layout/generic')
-rw-r--r--layout/generic/StickyScrollContainer.cpp10
-rw-r--r--layout/generic/nsFrame.cpp8
2 files changed, 13 insertions, 5 deletions
diff --git a/layout/generic/StickyScrollContainer.cpp b/layout/generic/StickyScrollContainer.cpp
index ca68992c3..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) {
@@ -176,6 +176,14 @@ StickyScrollContainer::ComputeStickyLimits(nsIFrame* aFrame, nsRect* aStick,
nsRect rect =
nsLayoutUtils::GetAllInFlowRectsUnion(aFrame, aFrame->GetParent());
+ // Note: Table row groups aren't supposed to be containing blocks, but we treat
+ // them as such anyway.
+ // Not having this basically disables position:sticky on table cells, which
+ // would be really unfortunate, and doesn't match what other browsers do.
+ if (cbFrame != scrolledFrame && cbFrame->GetType() == nsGkAtoms::tableRowGroupFrame) {
+ cbFrame = cbFrame->GetContainingBlock();
+ }
+
// Containing block limits for the position of aFrame relative to its parent.
// The margin box of the sticky element stays within the content box of the
// contaning-block element.
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index a531dea07..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) {
@@ -6629,6 +6626,9 @@ GetNearestBlockContainer(nsIFrame* frame)
// Since the parent of such a block is either a normal block or
// another such pseudo, this shouldn't cause anything bad to happen.
// Also the anonymous blocks inside table cells are not containing blocks.
+ //
+ // If we ever start skipping table row groups from being containing blocks,
+ // we need to remove the containing block assignment in StickyScrollContainer .
while (frame->IsFrameOfType(nsIFrame::eLineParticipant) ||
frame->IsBlockWrapper() ||
// Table rows are not containing blocks either