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
This commit is contained in:
Emilio Cobos Álvarez 2019-10-14 22:29:17 +00:00
Родитель 62c9920956
Коммит a934a45ffd
6 изменённых файлов: 43 добавлений и 5 удалений

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

@ -6,7 +6,7 @@
<script src="/tests/SimpleTest/paint_listener.js"></script>
</head>
<body>
<iframe id="scroll" srcdoc="<html style='overscroll-behavior:none;'><div style='width:100px;height:2000px;'>">
<iframe id="scroll" srcdoc="<!doctype html><html style='overscroll-behavior:none;'><div style='width:100px;height:2000px;'>">
</iframe>
<div style="height: 5000px;"></div><!-- So the page is scrollable as well -->

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

@ -0,0 +1,5 @@
<html style="overscroll-behavior-y: contain;">
<body style="overflow: hidden;">
<script>
document.body.clientWidth;
</script>

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

@ -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

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

@ -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;
}

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

@ -0,0 +1,17 @@
<!doctype html>
<title>CSS Overflow Test: overscroll-behavior doesn't stop overflow from being propagated from the body</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="help" href="https://drafts.csswg.org/css-overflow/#overflow-propagation">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1586600">
<link rel="match" href="reference/overflow-body-propagation-ref.html">
<style>
:root {
overscroll-behavior-y: contain;
}
body {
overflow: scroll;
margin-top: 100px;
}
</style>
<body>The viewport should have scrollbars, not the body.</body>

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

@ -0,0 +1,17 @@
<!doctype html>
<title>CSS Overflow Test: scroll-snap-type doesn't stop overflow from being propagated from the body</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="help" href="https://drafts.csswg.org/css-overflow/#overflow-propagation">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1586600">
<link rel="match" href="reference/overflow-body-propagation-ref.html">
<style>
:root {
scroll-snap-type: both mandatory;
}
body {
overflow: scroll;
margin-top: 100px;
}
</style>
<body>The viewport should have scrollbars, not the body.</body>