Bug 1278455. If the root element is grid or flex, allow it to be an absolute containing block. r=dholbert

If the root element is block or table then the PushAbsoluteContainingBlock call happens in ConstructBlock and ConstructTable respectively.
This commit is contained in:
Timothy Nikkel 2016-06-26 12:25:11 -05:00
Родитель 0ae824a629
Коммит 9fb446699f
3 изменённых файлов: 30 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html style="transform: translateX(3px); display: grid;">
<head>
<!--
user_pref("layout.event-regions.enabled", true);
-->
</head>
<body>
<div style="position: absolute;">Z</div>
</body>
</html>

Просмотреть файл

@ -473,3 +473,4 @@ load 1234622-1.html
load 1235467-1.html
pref(dom.webcomponents.enabled,true) load 1261351.html
load 1270797-1.html
load 1278455-1.html

Просмотреть файл

@ -2496,14 +2496,14 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// Make sure to start any background image loads for the root element now.
styleContext->StartBackgroundImageLoads();
nsFrameConstructorSaveState absoluteSaveState;
nsFrameConstructorSaveState docElementContainingBlockAbsoluteSaveState;
if (mHasRootAbsPosContainingBlock) {
// Push the absolute containing block now so we can absolutely position
// the root element
mDocElementContainingBlock->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
state.PushAbsoluteContainingBlock(mDocElementContainingBlock,
mDocElementContainingBlock,
absoluteSaveState);
docElementContainingBlockAbsoluteSaveState);
}
// The rules from CSS 2.1, section 9.2.4, have already been applied
@ -2520,6 +2520,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
nsIFrame* newFrame;
bool processChildren = false;
nsFrameConstructorSaveState absoluteSaveState;
// Check whether we need to build a XUL box or SVG root frame
#ifdef MOZ_XUL
if (aDocElement->IsXULElement()) {
@ -2565,12 +2567,26 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
contentFrame);
newFrame = contentFrame;
processChildren = true;
newFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
if (display->IsAbsPosContainingBlock(newFrame)) {
state.PushAbsoluteContainingBlock(contentFrame, newFrame,
absoluteSaveState);
}
} else if (display->mDisplay == NS_STYLE_DISPLAY_GRID) {
contentFrame = NS_NewGridContainerFrame(mPresShell, styleContext);
InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
contentFrame);
newFrame = contentFrame;
processChildren = true;
newFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
if (display->IsAbsPosContainingBlock(newFrame)) {
state.PushAbsoluteContainingBlock(contentFrame, newFrame,
absoluteSaveState);
}
} else if (display->mDisplay == NS_STYLE_DISPLAY_TABLE) {
// We're going to call the right function ourselves, so no need to give a
// function to this FrameConstructionData.