From 4752030d6b2a38cb91d9a44c6aa9769067b17f26 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Wed, 20 Aug 2014 08:01:32 -0700 Subject: [PATCH] Bug 1053035: Don't give its own scroll frame, when it's styled as 'flex' or 'grid' and we've propagated its scrollability to the viewport. r=mats --- layout/base/nsCSSFrameConstructor.cpp | 16 ++++++++++++++++ layout/reftests/bugs/1053035-1-flex.html | 17 +++++++++++++++++ layout/reftests/bugs/1053035-1-grid.html | 17 +++++++++++++++++ layout/reftests/bugs/1053035-1-ref.html | 17 +++++++++++++++++ layout/reftests/bugs/reftest.list | 2 ++ 5 files changed, 69 insertions(+) create mode 100644 layout/reftests/bugs/1053035-1-flex.html create mode 100644 layout/reftests/bugs/1053035-1-grid.html create mode 100644 layout/reftests/bugs/1053035-1-ref.html diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 33ab80c65761..75b7cccf8716 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -4552,6 +4552,22 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, return &sNonScrollableBlockData; } + // If this is for a 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 diff --git a/layout/reftests/bugs/1053035-1-flex.html b/layout/reftests/bugs/1053035-1-flex.html new file mode 100644 index 000000000000..5ab6b8fcd062 --- /dev/null +++ b/layout/reftests/bugs/1053035-1-flex.html @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/layout/reftests/bugs/1053035-1-grid.html b/layout/reftests/bugs/1053035-1-grid.html new file mode 100644 index 000000000000..4d01c3ff7f0d --- /dev/null +++ b/layout/reftests/bugs/1053035-1-grid.html @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/layout/reftests/bugs/1053035-1-ref.html b/layout/reftests/bugs/1053035-1-ref.html new file mode 100644 index 000000000000..27e1ec066bad --- /dev/null +++ b/layout/reftests/bugs/1053035-1-ref.html @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index af567f66200a..2dbb6c6b3948 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -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