Bug 1598132 - Add GetPrevContinuationOrIBSplitSibling() and improve GetNextContinuationOrIBSplitSibling() in nsLayoutUtils. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D54037
This commit is contained in:
@@ -4776,16 +4776,31 @@ nsIFrame* nsLayoutUtils::GetDisplayListParent(nsIFrame* aFrame) {
|
|||||||
return nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(aFrame);
|
return nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame* nsLayoutUtils::GetNextContinuationOrIBSplitSibling(nsIFrame* aFrame) {
|
nsIFrame* nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(
|
||||||
nsIFrame* result = aFrame->GetNextContinuation();
|
const nsIFrame* aFrame) {
|
||||||
if (result) return result;
|
if (nsIFrame* result = aFrame->GetPrevContinuation()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if ((aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) != 0) {
|
if (aFrame->HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT)) {
|
||||||
// We only store the ib-split sibling annotation with the first
|
// We are the first frame in the continuation chain. Get the ib-split prev
|
||||||
// frame in the continuation chain. Walk back to find that frame now.
|
// sibling property stored in us.
|
||||||
aFrame = aFrame->FirstContinuation();
|
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;
|
return nullptr;
|
||||||
|
|||||||
@@ -1399,10 +1399,16 @@ class nsLayoutUtils {
|
|||||||
static nsIFrame* GetDisplayListParent(nsIFrame* aFrame);
|
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.
|
* 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
|
* 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.
|
// 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
|
// If this is our first reflow, and our out-of-flow has already received its
|
||||||
// first reflow (before us), complain.
|
// 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) &&
|
if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
|
||||||
!(mOutOfFlowFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
!(mOutOfFlowFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||||
// Unfortunately, this can currently happen when the placeholder is in a
|
// Unfortunately, this can currently happen when the placeholder is in a
|
||||||
@@ -124,8 +121,7 @@ void nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
bool isInContinuationOrIBSplit = false;
|
bool isInContinuationOrIBSplit = false;
|
||||||
nsIFrame* ancestor = this;
|
nsIFrame* ancestor = this;
|
||||||
while ((ancestor = ancestor->GetParent())) {
|
while ((ancestor = ancestor->GetParent())) {
|
||||||
if (ancestor->GetPrevContinuation() ||
|
if (nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(ancestor)) {
|
||||||
ancestor->GetProperty(IBSplitPrevSibling())) {
|
|
||||||
isInContinuationOrIBSplit = true;
|
isInContinuationOrIBSplit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user