Bug 1053035: Don't give <body> its own scroll frame, when it's styled as 'flex' or 'grid' and we've propagated its scrollability to the viewport. r=mats

This commit is contained in:
Daniel Holbert 2014-08-20 08:01:32 -07:00
parent aecd542da9
commit 4752030d6b
5 changed files with 69 additions and 0 deletions

View File

@ -4552,6 +4552,22 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
return &sNonScrollableBlockData;
}
// If this is for a <body> node and we've propagated the scroll-frame to the
// viewport, we need to make sure not to add another layer of scrollbars, so
// we use a different FCData struct without FCDATA_MAY_NEED_SCROLLFRAME.
if (propagatedScrollToViewport && aDisplay->IsScrollableOverflow()) {
if (aDisplay->mDisplay == NS_STYLE_DISPLAY_FLEX) {
static const FrameConstructionData sNonScrollableFlexData =
FCDATA_DECL(0, NS_NewFlexContainerFrame);
return &sNonScrollableFlexData;
}
if (aDisplay->mDisplay == NS_STYLE_DISPLAY_GRID) {
static const FrameConstructionData sNonScrollableGridData =
FCDATA_DECL(0, NS_NewGridContainerFrame);
return &sNonScrollableGridData;
}
}
static const FrameConstructionDataByInt sDisplayData[] = {
// To keep the hash table small don't add inline frames (they're
// typically things like FONT and B), because we can quickly

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
background: yellow;
overflow: scroll;
border: 1px solid black;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: grid;
background: yellow;
overflow: scroll;
border: 1px solid black;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: block;
background: yellow;
overflow: scroll;
border: 1px solid black;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
</body>
</html>

View File

@ -1821,3 +1821,5 @@ pref(browser.display.use_document_fonts,0) == 1022481-1.html 1022481-1-ref.html
== 1042104-1.html 1042104-1-ref.html
== 1044198-1.html 1044198-1-ref.html
== 1049499-1.html 1049499-1-ref.html
== 1053035-1-flex.html 1053035-1-ref.html
test-pref(layout.css.grid.enabled,true) == 1053035-1-grid.html 1053035-1-ref.html