summaryrefslogtreecommitdiff
path: root/layout
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-11-03 19:09:47 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-03 19:09:47 +0100
commite74efa172fdf3fbd3d7e790b213d14ce0d04a597 (patch)
treec503edc95b12a46ee9e01427861aba8743d88212 /layout
parentb58c7ef3923a90badcfa9b6cc45cdd516e7bb47e (diff)
downloadaura-central-e74efa172fdf3fbd3d7e790b213d14ce0d04a597.tar.gz
Issue mcp-graveyard/UXP%146 - Part 5: Treat table row groups as containing blocks.
This aligns our behavior with Gecko/Blink.
Diffstat (limited to 'layout')
-rw-r--r--layout/generic/StickyScrollContainer.cpp8
-rw-r--r--layout/generic/nsFrame.cpp3
2 files changed, 11 insertions, 0 deletions
diff --git a/layout/generic/StickyScrollContainer.cpp b/layout/generic/StickyScrollContainer.cpp
index ca68992c3..ff8ebcfef 100644
--- a/layout/generic/StickyScrollContainer.cpp
+++ b/layout/generic/StickyScrollContainer.cpp
@@ -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..d4bcf22ed 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6629,6 +6629,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