Auto merge of #7703 - bjwbell:bugfix-0px-and-non-0px-border-widths, r=pcwalton

gfx: Fix border-radius panic when a corner has 0px and >0px borders

When one border is 0px and the other is >0px then the border corner
drawing code panics when computing the values to use in drawing the
border corner arcs.

This fixes that bug and makes the `draw_corner` function more robust
by explicitly passing an enum, `BorderCorner`, naming which corner is
being drawn e.g. `BorderCorner::TL`.

Add a ref test,
`border_radius_zero_sizes_a.html/border_radius_zero_sizes_ref.html`.

Fixes https://github.com/servo/servo/issues/7700.

r? @pcwalton or @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7703)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-09-24 18:18:07 -06:00
commit 4d1be2f56c
4 changed files with 143 additions and 31 deletions

View file

@ -69,6 +69,7 @@ flaky_cpu == append_style_a.html append_style_b.html
== border_radius_elliptical_a.html border_radius_elliptical_ref.html
== border_radius_overlapping_a.html border_radius_overlapping_ref.html
== border_radius_shorthand_a.html border_radius_shorthand_ref.html
== border_radius_zero_sizes_a.html border_radius_zero_sizes_ref.html
== border_rounding_1px_invisible_issue_7184_a.html border_rounding_1px_invisible_issue_7184_ref.html
== border_spacing_a.html border_spacing_ref.html
== border_spacing_auto_layout_a.html border_spacing_ref.html

View file

@ -0,0 +1,10 @@
<html>
<head>
</head>
<body>
<div style="border-top: 20px solid black; border-radius: 5px"></div>
<div style="border-right: 30px solid black; border-radius: 15px; height: 30px"></div>
<div style="border-bottom: 20px solid black; border-radius: 5px"></div>
<div style="border-left: 30px solid black; border-radius: 15px; height: 30px"></div>
</body>
</html>

View file

@ -0,0 +1,10 @@
<html>
<head>
</head>
<body>
<div style="border: 10px solid black; border-top-left-radius: 5px; border-top-right-radius: 5px"></div>
<div style="border-right: 30px solid black; border-top-right-radius: 15px; border-bottom-right-radius: 15px; height: 30px"></div>
<div style="border: 10px solid black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px"></div>
<div style="border-left: 30px solid black; border-bottom-left-radius: 15px; border-top-left-radius: 15px; height: 30px"></div>
</body>
</html>