summaryrefslogtreecommitdiffstats
path: root/layout/generic/StickyScrollContainer.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-11-04 08:41:04 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-04 08:41:48 +0100
commitbbc2206a0fda053a6f5071b457bd209dab9ed268 (patch)
tree8dae72f2c725e512dfcfca5ba4f4062dd98d1cdd /layout/generic/StickyScrollContainer.cpp
parent22b410f31b0fc61a0a99522fe2aea1a31823bd99 (diff)
parentee8c5d3878456b4e194dc3724616d194907ed466 (diff)
downloadUXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar.gz
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar.lz
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.tar.xz
UXP-bbc2206a0fda053a6f5071b457bd209dab9ed268.zip
Merge branch 'table-sticky-work'
This resolves #146.
Diffstat (limited to 'layout/generic/StickyScrollContainer.cpp')
-rw-r--r--layout/generic/StickyScrollContainer.cpp10
1 files changed, 9 insertions, 1 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.