From a934a45ffd386e8667996fc77ea3095fcd404d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 14 Oct 2019 22:29:17 +0000 Subject: [PATCH] Bug 1586600 - Make nsPresContext's overflow propagation match the spec. r=hiro From https://drafts.csswg.org/css-overflow/#overflow-propagation: > UAs must apply the overflow-* values set on the root element to the viewport. > However, when the root element is an [HTML] html element (including XML syntax > for HTML) whose overflow value is visible (in both axes), and that element has > a body element as a child, user agents must instead apply the overflow-* > values of the first such child element to the viewport. The element from which > the value is propagated must then have a used overflow value of visible. This was out of sync with Document::IsScrollingElement, which implements the right thing. Differential Revision: https://phabricator.services.mozilla.com/D49196 --HG-- extra : moz-landing-system : lando --- .../helper_overscroll_behavior_bug1494440.html | 2 +- layout/base/crashtests/1586600.html | 5 +++++ layout/base/crashtests/crashtests.list | 1 + layout/base/nsPresContext.cpp | 6 ++---- .../overflow-body-propagation-005.html | 17 +++++++++++++++++ .../overflow-body-propagation-006.html | 17 +++++++++++++++++ 6 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 layout/base/crashtests/1586600.html create mode 100644 testing/web-platform/tests/css/css-overflow/overflow-body-propagation-005.html create mode 100644 testing/web-platform/tests/css/css-overflow/overflow-body-propagation-006.html diff --git a/gfx/layers/apz/test/mochitest/helper_overscroll_behavior_bug1494440.html b/gfx/layers/apz/test/mochitest/helper_overscroll_behavior_bug1494440.html index b2e3be2ca866..148940098562 100644 --- a/gfx/layers/apz/test/mochitest/helper_overscroll_behavior_bug1494440.html +++ b/gfx/layers/apz/test/mochitest/helper_overscroll_behavior_bug1494440.html @@ -6,7 +6,7 @@ -
diff --git a/layout/base/crashtests/1586600.html b/layout/base/crashtests/1586600.html new file mode 100644 index 000000000000..c825c5c85ed1 --- /dev/null +++ b/layout/base/crashtests/1586600.html @@ -0,0 +1,5 @@ + + + diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 33b1ae3d4264..cb098a2569b3 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -586,3 +586,4 @@ load 1578844-2.html pref(layout.css.column-span.enabled,true) load 1579953-1.html pref(layout.css.column-span.enabled,true) load 1580576.html load empty-mask.html +load 1586600.html diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index c238000249c4..0dc1f6a76473 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1037,10 +1037,8 @@ static bool CheckOverflow(const ComputedStyle* aComputedStyle, return false; } - if (display->mOverflowX == StyleOverflow::Visible && - display->mOverscrollBehaviorX == StyleOverscrollBehavior::Auto && - display->mOverscrollBehaviorY == StyleOverscrollBehavior::Auto && - display->mScrollSnapType.strictness == StyleScrollSnapStrictness::None) { + if (display->mOverflowX == StyleOverflow::Visible) { + MOZ_ASSERT(display->mOverflowY == StyleOverflow::Visible); return false; } diff --git a/testing/web-platform/tests/css/css-overflow/overflow-body-propagation-005.html b/testing/web-platform/tests/css/css-overflow/overflow-body-propagation-005.html new file mode 100644 index 000000000000..e4de57695846 --- /dev/null +++ b/testing/web-platform/tests/css/css-overflow/overflow-body-propagation-005.html @@ -0,0 +1,17 @@ + +CSS Overflow Test: overscroll-behavior doesn't stop overflow from being propagated from the body + + + + + + +The viewport should have scrollbars, not the body. diff --git a/testing/web-platform/tests/css/css-overflow/overflow-body-propagation-006.html b/testing/web-platform/tests/css/css-overflow/overflow-body-propagation-006.html new file mode 100644 index 000000000000..475815068357 --- /dev/null +++ b/testing/web-platform/tests/css/css-overflow/overflow-body-propagation-006.html @@ -0,0 +1,17 @@ + +CSS Overflow Test: scroll-snap-type doesn't stop overflow from being propagated from the body + + + + + + +The viewport should have scrollbars, not the body.