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.
This commit is contained in:
Bryan Bell 2015-09-21 17:13:25 -07:00
parent 61267cde63
commit 071acf476b
4 changed files with 146 additions and 27 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>