Commit 2bca53a6 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

Ensure that we establish an overflow clip on paint containment.

This patch ensures that we don't leak geometry outside of paint
contained element, which may incorrectly affect layout oveflow
of other elements.

Added a WPT with a tall clipped div which causes scrollbars without
this patch, and passes with the patch.

R=chrishtr@chromium.org

Bug: 882322
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I929542d4ad643df8dad1ab388a878bd0892c0c69
Reviewed-on: https://chromium-review.googlesource.com/1246922
Commit-Queue: vmpstr <vmpstr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595201}
parent 854bc43f
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Containment Test: 'contain: paint' and clipping prevents scrollbars</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-contain-1/#containment-paint">
<link rel="match" href="reference/contain-paint-clip-019-ref.html">
<meta content="This test checks that the paint containment of an element clips contents.
It should also prevent layout overflow from being propagated to ancestors." name="assert">
<meta content="" name="flags">
<style>
#container {
contain: paint;
width: 100px;
height: 100px;
}
#green {
background-color: green;
width: 100px;
height: 100px;
}
#red {
background-color: red;
width: 100px;
height: 10000px;
}
</style>
<p>Test passes if there there is a green square. No red and no scrollbars should be visible.</p>
<div id="container">
<div id="green"></div>
<div id="red"></div>
</div>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Reference Test</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<style>
#green {
background-color: green;
width: 100px;
height: 100px;
}
</style>
<p>Test passes if there there is a green square. No red and no scrollbars should be visible.</p>
<div id="green"></div>
...@@ -5517,7 +5517,7 @@ LayoutRect LayoutBox::LayoutOverflowRectForPropagation( ...@@ -5517,7 +5517,7 @@ LayoutRect LayoutBox::LayoutOverflowRectForPropagation(
: LayoutSize(MarginAfter(container_style), LayoutUnit())); : LayoutSize(MarginAfter(container_style), LayoutUnit()));
} }
if (!HasOverflowClip() && !ShouldApplyLayoutContainment()) if (!ShouldClipOverflow() && !ShouldApplyLayoutContainment())
rect.Unite(LayoutOverflowRect()); rect.Unite(LayoutOverflowRect());
bool has_transform = HasLayer() && Layer()->Transform(); bool has_transform = HasLayer() && Layer()->Transform();
......
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