Commit 3973180d authored by Ehsan Karamad's avatar Ehsan Karamad Committed by Commit Bot

No vertical bars if 'vertical-policy' disabled

When 'vertical-scroll' policy is disabled in a document, the contents
cannot be scrolled (will not be user-input scrollable and targeted
for gesture scroll). However, currently disabling 'vertical-scroll'
still leaves the vertical scrollbars behind; the bars position cannot
be changed however.

This CL fixes the issue by hiding the vertical scrollbars for
scrollable elements inside documents where the policy is enforced
(i.e., disabled).

Bug: 898151
Change-Id: If01925e27184a7370d5b12583dc73bc946f2c6e2
Reviewed-on: https://chromium-review.googlesource.com/c/1305878
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604420}
parent 8c8047ec
<!doctype html>
<title>Ref: vertical-scroll test for scrollbar</title>
<iframe src="/feature-policy/experimental-features/resources/vertical-scroll-scrollable-content.html"></iframe>
<script>
let iframe = document.querySelector("iframe");
let overflow_y = "visible";
if (window.location.search.indexOf("no-vertical-scrollbar") !== -1)
overflow_y = "hidden"
iframe.addEventListener("load", () => {
iframe.contentDocument.body.style.overflowY = overflow_y;
});
</script>
<!doctype html>
<title>vertical-scroll test for vertical scrollbar</title>
<link rel="match" href="/feature-policy/experimental-features/resources/vertical-scroll-scrollbar-ref.html?no-vertical-scrollbar">
<iframe src="/feature-policy/experimental-features/resources/vertical-scroll-scrollable-content.html" allow="vertical-scroll 'none'"></iframe>
...@@ -1562,6 +1562,13 @@ bool PaintLayerScrollableArea::SetHasVerticalScrollbar(bool has_scrollbar) { ...@@ -1562,6 +1562,13 @@ bool PaintLayerScrollableArea::SetHasVerticalScrollbar(bool has_scrollbar) {
if (FreezeScrollbarsScope::ScrollbarsAreFrozen()) if (FreezeScrollbarsScope::ScrollbarsAreFrozen())
return false; return false;
if (GetLayoutBox()->GetDocument().IsVerticalScrollEnforced()) {
// When the policy is enforced the contents of document cannot be scrolled.
// This would make rendering a scrollbar look strange
// (https://crbug.com/898151).
return false;
}
if (has_scrollbar == HasVerticalScrollbar()) if (has_scrollbar == HasVerticalScrollbar())
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment