mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-01 12:03:08 +00:00
Bug 1598132 - Add GetPrevContinuationOrIBSplitSibling() and improve GetNextContinuationOrIBSplitSibling() in nsLayoutUtils. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D54037 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1e8edf9e02
commit
73021bb855
@ -4776,16 +4776,31 @@ nsIFrame* nsLayoutUtils::GetDisplayListParent(nsIFrame* aFrame) {
|
||||
return nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(aFrame);
|
||||
}
|
||||
|
||||
nsIFrame* nsLayoutUtils::GetNextContinuationOrIBSplitSibling(nsIFrame* aFrame) {
|
||||
nsIFrame* result = aFrame->GetNextContinuation();
|
||||
if (result) return result;
|
||||
nsIFrame* nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(
|
||||
const nsIFrame* aFrame) {
|
||||
if (nsIFrame* result = aFrame->GetPrevContinuation()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) != 0) {
|
||||
// We only store the ib-split sibling annotation with the first
|
||||
// frame in the continuation chain. Walk back to find that frame now.
|
||||
aFrame = aFrame->FirstContinuation();
|
||||
if (aFrame->HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT)) {
|
||||
// We are the first frame in the continuation chain. Get the ib-split prev
|
||||
// sibling property stored in us.
|
||||
return aFrame->GetProperty(nsIFrame::IBSplitPrevSibling());
|
||||
}
|
||||
|
||||
return aFrame->GetProperty(nsIFrame::IBSplitSibling());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIFrame* nsLayoutUtils::GetNextContinuationOrIBSplitSibling(
|
||||
const nsIFrame* aFrame) {
|
||||
if (nsIFrame* result = aFrame->GetNextContinuation()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (aFrame->HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT)) {
|
||||
// We only store the ib-split sibling annotation with the first frame in the
|
||||
// continuation chain.
|
||||
return aFrame->FirstContinuation()->GetProperty(nsIFrame::IBSplitSibling());
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -1399,10 +1399,16 @@ class nsLayoutUtils {
|
||||
static nsIFrame* GetDisplayListParent(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get a frame's next-in-flow, or, if it doesn't have one, its
|
||||
* Get a frame's previous continuation, or, if it doesn't have one, its
|
||||
* previous block-in-inline-split sibling.
|
||||
*/
|
||||
static nsIFrame* GetPrevContinuationOrIBSplitSibling(const nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get a frame's next continuation, or, if it doesn't have one, its
|
||||
* block-in-inline-split sibling.
|
||||
*/
|
||||
static nsIFrame* GetNextContinuationOrIBSplitSibling(nsIFrame* aFrame);
|
||||
static nsIFrame* GetNextContinuationOrIBSplitSibling(const nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the first frame in the continuation-plus-ib-split-sibling chain
|
||||
|
@ -112,9 +112,6 @@ void nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
|
||||
// We should be getting reflowed before our out-of-flow.
|
||||
// If this is our first reflow, and our out-of-flow has already received its
|
||||
// first reflow (before us), complain.
|
||||
// XXXdholbert This "look for a previous continuation or IB-split sibling"
|
||||
// code could use nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(), if
|
||||
// we ever add a function like that. (We currently have a "Next" version.)
|
||||
if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
|
||||
!(mOutOfFlowFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||
// Unfortunately, this can currently happen when the placeholder is in a
|
||||
@ -124,8 +121,7 @@ void nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
|
||||
bool isInContinuationOrIBSplit = false;
|
||||
nsIFrame* ancestor = this;
|
||||
while ((ancestor = ancestor->GetParent())) {
|
||||
if (ancestor->GetPrevContinuation() ||
|
||||
ancestor->GetProperty(IBSplitPrevSibling())) {
|
||||
if (nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(ancestor)) {
|
||||
isInContinuationOrIBSplit = true;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user