layout: Implement most of border-collapse per CSS 2.1 § 17.6.2.

Known issues:

* Collapsed borders do not correctly affect the border-box of the table
  itself.

* The content widths of all cells in a column and the content height of
  all cells in a row is the same in this patch, but not in Gecko and
  WebKit.

* Corners are not painted well. The spec does not say what to do here.

* Column spans are not handled well. The spec does not say what to do
  here either.
This commit is contained in:
Patrick Walton 2015-03-09 12:33:04 -07:00 committed by Simon Sapin
parent 92359c7b9a
commit 48299a53cb
22 changed files with 1975 additions and 520 deletions

View file

@ -171,13 +171,27 @@ impl DisplayList {
let doit = |items: &Vec<DisplayItem>| {
for item in items.iter() {
match *item {
DisplayItem::SolidColorClass(ref solid_color) => println!("{} SolidColor. {:?}", indentation, solid_color.base.bounds),
DisplayItem::TextClass(ref text) => println!("{:?} Text. {:?}", indentation, text.base.bounds),
DisplayItem::ImageClass(ref image) => println!("{:?} Image. {:?}", indentation, image.base.bounds),
DisplayItem::BorderClass(ref border) => println!("{:?} Border. {:?}", indentation, border.base.bounds),
DisplayItem::GradientClass(ref gradient) => println!("{:?} Gradient. {:?}", indentation, gradient.base.bounds),
DisplayItem::LineClass(ref line) => println!("{:?} Line. {:?}", indentation, line.base.bounds),
DisplayItem::BoxShadowClass(ref box_shadow) => println!("{:?} Box_shadow. {:?}", indentation, box_shadow.base.bounds),
DisplayItem::SolidColorClass(ref solid_color) => {
println!("{:?} SolidColor. {:?}", indentation, solid_color.base.bounds)
}
DisplayItem::TextClass(ref text) => {
println!("{:?} Text. {:?}", indentation, text.base.bounds)
}
DisplayItem::ImageClass(ref image) => {
println!("{:?} Image. {:?}", indentation, image.base.bounds)
}
DisplayItem::BorderClass(ref border) => {
println!("{:?} Border. {:?}", indentation, border.base.bounds)
}
DisplayItem::GradientClass(ref gradient) => {
println!("{:?} Gradient. {:?}", indentation, gradient.base.bounds)
}
DisplayItem::LineClass(ref line) => {
println!("{:?} Line. {:?}", indentation, line.base.bounds)
}
DisplayItem::BoxShadowClass(ref box_shadow) => {
println!("{:?} Box_shadow. {:?}", indentation, box_shadow.base.bounds)
}
}
}
println!("\n");

View file

@ -290,11 +290,7 @@ impl<'a> PaintContext<'a> {
radii: &BorderRadii<AzFloat>,
color: Color) {
let mut path_builder = self.draw_target.create_path_builder();
self.create_border_path_segment(&mut path_builder,
bounds,
direction,
border,
radii);
self.create_border_path_segment(&mut path_builder, bounds, direction, border, radii);
let draw_options = DrawOptions::new(1.0, 0);
self.draw_target.fill(&path_builder.finish(), &ColorPattern::new(color), &draw_options);
}
@ -693,7 +689,8 @@ impl<'a> PaintContext<'a> {
let scaled_left_top = left_top + Point2D(scaled_border.left,
scaled_border.top);
return Rect(scaled_left_top,
Size2D(rect.size.width - 2.0 * scaled_border.right, rect.size.height - 2.0 * scaled_border.bottom));
Size2D(rect.size.width - 2.0 * scaled_border.right,
rect.size.height - 2.0 * scaled_border.bottom));
}
fn scale_color(&self, color: Color, scale_factor: f32) -> Color {
@ -1129,6 +1126,7 @@ impl ToAzureRect for Rect<Au> {
fn to_azure_rect(&self) -> Rect<AzFloat> {
Rect(self.origin.to_azure_point(), Size2D(self.size.width.to_nearest_px() as AzFloat,
self.size.height.to_nearest_px() as AzFloat))
}
fn to_subpx_azure_rect(&self) -> Rect<AzFloat> {
Rect(self.origin.to_subpx_azure_point(), Size2D(self.size.width.to_subpx() as AzFloat,