Commit 1c633d48 authored by Stephen Chenney's avatar Stephen Chenney Committed by Commit Bot

Snap the snapped_dest_rect for backgrounds

For some reason the snapped_dest_rect for background image geometry
calculations was not actually snapped. Snapping it fixes cases where
we were not filling to the border without regressing any tests (in
fact improving some).

Probably fixes most of the background bugs resulting from the previous
big refactoring.

R=fmalita@chromium.org
BUG=912423,889426

Change-Id: Ieba65130e7f8c0e95db7375ab3a8188bfc78d8d5
Reviewed-on: https://chromium-review.googlesource.com/c/1372556
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616014}
parent 5603ac3d
...@@ -677,9 +677,12 @@ void BackgroundImageGeometry::ComputePositioningArea( ...@@ -677,9 +677,12 @@ void BackgroundImageGeometry::ComputePositioningArea(
// Apply the adjustments. // Apply the adjustments.
snapped_dest_rect_ = unsnapped_dest_rect_; snapped_dest_rect_ = unsnapped_dest_rect_;
snapped_dest_rect_.Contract(snapped_dest_adjust); snapped_dest_rect_.Contract(snapped_dest_adjust);
snapped_dest_rect_ = LayoutRect(PixelSnappedIntRect(snapped_dest_rect_));
unsnapped_dest_rect_.Contract(unsnapped_dest_adjust); unsnapped_dest_rect_.Contract(unsnapped_dest_adjust);
snapped_positioning_area = unsnapped_positioning_area; snapped_positioning_area = unsnapped_positioning_area;
snapped_positioning_area.Contract(snapped_box_outset); snapped_positioning_area.Contract(snapped_box_outset);
snapped_positioning_area =
LayoutRect(PixelSnappedIntRect(snapped_positioning_area));
unsnapped_positioning_area.Contract(unsnapped_box_outset); unsnapped_positioning_area.Contract(unsnapped_box_outset);
// Offset of the positioning area from the corner of the // Offset of the positioning area from the corner of the
......
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test: There should be no gap between border-collapsed backgrounds</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<link rel="help" href="http://www.w3.org/TR/css3-background">
<link rel="match" href="reference/background-border-collapsed-gradient-ref.html">
<style>
div {
background: linear-gradient(to bottom,#222,#666);
float: left;
padding: 32px;
color: white;
border-collapse: collapse;
}
</style>
</head>
<body>
<div style="height:18px;width:11.5625px;"></div>
<div style="height:18px;width:11.4375px;"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test: A background image on table cells with collapsed borders should fill the table</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<link rel="help" href="http://www.w3.org/TR/css3-background">
<link rel="match" href="reference/background-image-table-cells-zoomed-ref.html">
<style>
body {
zoom: 121%;
}
.test-table {
display: table;
width: 600px;
border-collapse: collapse;
border-spacing: 0;
background-color: red;
}
.test-row {
padding: 0px;
border: 0px;
display: table-row;
}
.test-cell {
display: table-cell;
padding: 0px;
height: 50px;
border: 0px;
background: url("support/50x50-green.png");
background-size: 100% 100%;
}
</style>
</head>
<body>
<div class="test-table">
<div class="test-row">
<div class="test-cell"></div>
<div class="test-cell"></div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test Reference</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<style>
div {
background: linear-gradient(to bottom,#222,#666);
float: left;
padding: 32px 64px;
color: white;
border-collapse: collapse;
}
</style>
</head>
<body>
<div style="height:18px;width:23px;"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test Reference</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<style>
body {
zoom: 121%;
}
.test-table {
display: table;
width: 600px;
border-collapse: collapse;
border-spacing: 0;
background-color: green;
}
.test-row {
display: table-row;
padding: 0px;
}
.test-cell {
display: table-cell;
padding: 0px;
height: 50px;
border: 0;
}
</style>
</head>
<body>
<div class="test-table">
<div class="test-row">
<div class="test-cell"></div>
<div class="test-cell"></div>
</div>
</div>
</body>
</html>
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