Auto merge of #7502 - bjwbell:elliptical-borders, r=pcwalton

gfx: Add elliptical border radius support

TODO: Add code for parsing shorthand border-radius e.g. "border-radius: 10px 5% / 20px".

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7502)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-09-04 18:46:24 -06:00
commit 5bad6b1b6e
9 changed files with 603 additions and 305 deletions

View file

@ -377,9 +377,9 @@ pub mod longhands {
// FIXME(#4126): when gfx supports painting it, make this Size2D<LengthOrPercentage>
% for corner in ["top-left", "top-right", "bottom-right", "bottom-left"]:
${predefined_type("border-" + corner + "-radius", "LengthOrPercentage",
"computed::LengthOrPercentage::Length(Au(0))",
"parse_non_negative")}
${predefined_type("border-" + corner + "-radius", "BorderRadiusSize",
"computed::BorderRadiusSize::zero()",
"parse")}
% endfor
${new_style_struct("Outline", is_inherited=False)}
@ -5135,16 +5135,16 @@ pub mod shorthands {
'border-%s-radius' % (corner)
for corner in ['top-left', 'top-right', 'bottom-right', 'bottom-left']
)}">
use util::geometry::Au;
use values::specified::{Length, LengthOrPercentage};
use values::specified::BorderRadiusSize;
let _ignored = context;
fn parse_one_set_of_border_radii(mut input: &mut Parser)
-> Result<[LengthOrPercentage; 4], ()> {
-> Result<[BorderRadiusSize; 4], ()> {
let mut count = 0;
let mut values = [LengthOrPercentage::Length(Length::Absolute(Au(0))); 4];
let mut values = [BorderRadiusSize::zero(); 4];
while count < 4 {
if let Ok(value) = input.try(LengthOrPercentage::parse) {
if let Ok(value) = input.try(BorderRadiusSize::parse_one_radii) {
values[count] = value;
count += 1;
} else {
@ -5162,7 +5162,7 @@ pub mod shorthands {
}
let radii = try!(parse_one_set_of_border_radii(input));
// TODO(pcwalton): Elliptical borders.
// TODO(bjwbell): Finish parsing code for elliptical borders.
Ok(Longhands {
border_top_left_radius: Some(radii[0]),