Bug 851514. Make sure that we add the parent frame before its kids when constructing a scrollable block, so that things will appear in the right order in fixed-pos lists. r=dbaron

This commit is contained in:
Boris Zbarsky 2013-05-21 14:15:30 -04:00
parent faa061aa98
commit f2de87b7cb
5 changed files with 110 additions and 1 deletions

View File

@ -4364,6 +4364,10 @@ nsCSSFrameConstructor::ConstructScrollableBlock(nsFrameConstructorState& aState,
nsIFrame* scrolledFrame =
NS_NewBlockFormattingContext(mPresShell, styleContext);
// Make sure to AddChild before we call ConstructBlock so that we
// end up before our descendants in fixed-pos lists as needed.
aState.AddChild(newFrame, aFrameItems, content, styleContext, aParentFrame);
nsFrameItems blockItem;
ConstructBlock(aState, scrolledContentStyle->StyleDisplay(), content,
newFrame, newFrame, scrolledContentStyle,
@ -4375,7 +4379,6 @@ nsCSSFrameConstructor::ConstructScrollableBlock(nsFrameConstructorState& aState,
"Scrollframe's frameItems should be exactly the scrolled frame");
FinishBuildingScrollFrame(newFrame, scrolledFrame);
aState.AddChild(newFrame, aFrameItems, content, styleContext, aParentFrame);
return newFrame;
}

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Testcase Bug 851514</title>
<style>
#parent {
position: fixed;
height: 30px;
width: 30px;
background: green;
left: 70px;
top: 70px;
}
#child {
position: fixed;
top: auto;
left: auto;
width: 10px;
height: 10px;
background: purple;
}
</style>
</head>
<body>
<div id="parent">
<div id="child"></div>
</div>
The purple block should be inside the green block.
</body>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>Testcase Bug 851514</title>
<style>
#parent {
position: fixed;
height: 30px;
width: 30px;
background: green;
left: 70px;
top: 70px;
overflow:hidden;
display: none; /* So we can make sure there is only one frame construction
and one reflow for the parent + child thing */
}
#child {
position: fixed;
top: auto;
left: auto;
width: 10px;
height: 10px;
background: purple;
}
</style>
<script>
function doTest() {
var par = document.getElementById("parent");
// Flush layout
par.getBoundingClientRect();
par.style.display = "block";
document.documentElement.className = "";
}
</script>
</head>
<body onload="doTest();">
<div id="parent">
<div id="child"></div>
</div>
The purple block should be inside the green block.
</body>
</html>

View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<!-- Important: no meta charset! -->
<title>Testcase Bug 851514</title>
<style>
#parent {
position: fixed;
height: 30px;
width: 30px;
background: green;
left: 70px;
top: 70px;
overflow: hidden;
}
#child {
position: fixed;
top: auto;
left: auto;
width: 10px;
height: 10px;
background: purple;
}
</style>
</head>
<body>
<div id="parent">
<div id="child"></div>
</div>
The purple block should be inside the green block.
</body>
</html>

View File

@ -17,3 +17,5 @@ fuzzy-if(gtk2Widget,1,19) fuzzy-if(Android||B2G,17,726) == select-3.html select-
== button-1.html button-1-ref.html
== button-2.html button-2-ref.html
== relative-row-animation-1.html relative-row-animation-1-ref.html
== fixed-pos-auto-offset-1a.html fixed-pos-auto-offset-1-ref.html
== fixed-pos-auto-offset-1b.html fixed-pos-auto-offset-1-ref.html