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);
|
||||
|
||||
@@ -752,7 +752,7 @@ load 1586470.html
|
||||
load 1588955-very-large-frameset.html
|
||||
load 1590569.html
|
||||
load 1596310.html
|
||||
load 1608851.html
|
||||
skip-if(Android) load 1608851.html # bug 1639947
|
||||
load 1613210.html
|
||||
load 1614101.html
|
||||
load 1618312.html
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="UTF-8">
|
||||
<title>CSS Position: Box inset properties & position:absolute flex container as the root element</title>
|
||||
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
|
||||
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-position-3/#insets">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1584890">
|
||||
<link rel="match" href="position-absolute-root-element-ref.html">
|
||||
<meta name="assert" content="This test verifies the box inset properties on a position:absolute flex container root element.">
|
||||
|
||||
<style>
|
||||
html {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
right: 20px;
|
||||
top: 30px;
|
||||
bottom: 40px;
|
||||
border: 5px dashed black;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
The black border should encompass the whole viewport,
|
||||
with a bit of space on each side.
|
||||
<br><br>
|
||||
It shouldn't just shrinkwrap this text's height.
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="UTF-8">
|
||||
<title>CSS Position: Box inset properties & position:absolute grid container as the root element</title>
|
||||
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
|
||||
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-position-3/#insets">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1584890">
|
||||
<link rel="match" href="position-absolute-root-element-ref.html">
|
||||
<meta name="assert" content="This test verifies the box inset properties on a position:absolute grid container root element.">
|
||||
|
||||
<style>
|
||||
html {
|
||||
display: grid;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
right: 20px;
|
||||
top: 30px;
|
||||
bottom: 40px;
|
||||
border: 5px dashed black;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
The black border should encompass the whole viewport,
|
||||
with a bit of space on each side.
|
||||
<br><br>
|
||||
It shouldn't just shrinkwrap this text's height.
|
||||
</html>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="UTF-8">
|
||||
<title>CSS Position Reference: Box inset properties & position:absolute root element</title>
|
||||
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
|
||||
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
|
||||
<style>
|
||||
html {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
right: 20px;
|
||||
top: 30px;
|
||||
bottom: 40px;
|
||||
border: 5px dashed black;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
The black border should encompass the whole viewport,
|
||||
with a bit of space on each side.
|
||||
<br><br>
|
||||
It shouldn't just shrinkwrap this text's height.
|
||||
</html>
|
||||
Reference in New Issue
Block a user