Bug 1584890 Part 1 - Use nsFrameConstructorState::AddChild() to construct out-of-flow flex or grid container as the root element. r=dholbert
If `contentFrame` is out-of-flow, nsFrameConstructorState::AddChild() can construct a placeholder frame for `contentFrame` and put the placeholder in `frameList`. Also, we need to use nsFrameConstructorState::GetGeometricParent() to get the correct parent when calling InitAndRestoreFrame() for an out-of-flow `contentFrame`. For example, if `contentFrame` has position:fixed, its parent should be ViewportFrame, not CanvasFrame (which is mDocElementContainingBlock). This patch also adds reftests for position:absolute flex & grid root element. Reftests for position:fixed root element are in the next part. Disable crashtest 1608851.html on Android because it causes OOM crash after landing this patch. Differential Revision: https://phabricator.services.mozilla.com/D76205
This commit is contained in:
@@ -2304,9 +2304,12 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
|
||||
? NS_NewGridContainerFrame
|
||||
: NS_NewFlexContainerFrame;
|
||||
contentFrame = func(mPresShell, computedStyle);
|
||||
InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
|
||||
contentFrame);
|
||||
frameList = {contentFrame, contentFrame};
|
||||
InitAndRestoreFrame(
|
||||
state, aDocElement,
|
||||
state.GetGeometricParent(*display, mDocElementContainingBlock),
|
||||
contentFrame);
|
||||
state.AddChild(contentFrame, frameList, aDocElement,
|
||||
mDocElementContainingBlock);
|
||||
processChildren = true;
|
||||
|
||||
contentFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
|
||||
|
||||
Reference in New Issue
Block a user