auto merge of #4437 : Adenilson/servo/fixInsetOutsetBlack03, r=jdm

Freshly rebased.
This commit is contained in:
bors-servo 2014-12-18 16:24:54 -07:00
commit 4ac8b6a723
5 changed files with 79 additions and 5 deletions

View file

@ -642,11 +642,22 @@ impl<'a> PaintContext<'a> {
};
// original bounds as a Rect<f32>
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
// select and scale the color appropriately.
let scaled_color = match direction {
Direction::Top | Direction::Left => self.scale_color(color, if is_inset { 2.0/3.0 } else { 1.0 }),
Direction::Right | Direction::Bottom => self.scale_color(color, if is_inset { 1.0 } else { 2.0/3.0 })
};
let mut scaled_color;
// You can't scale black color (i.e. 'scaled = 0 * scale', equals black).
if color.r != 0.0 || color.g != 0.0 || color.b != 0.0 {
scaled_color = match direction {
Direction::Top | Direction::Left => self.scale_color(color, if is_inset { 2.0/3.0 } else { 1.0 }),
Direction::Right | Direction::Bottom => self.scale_color(color, if is_inset { 1.0 } else { 2.0/3.0 })
};
} else {
scaled_color = match direction {
Direction::Top | Direction::Left => if is_inset { Color::new(0.3, 0.3, 0.3, color.a) } else { Color::new(0.7, 0.7, 0.7, color.a) },
Direction::Right | Direction::Bottom => if is_inset { Color::new(0.7, 0.7, 0.7, color.a) } else { Color::new(0.3, 0.3, 0.3, color.a) }
};
}
self.draw_border_path(&original_bounds, direction, border, radius, scaled_color);
}

View file

@ -219,3 +219,6 @@ fragment=top != ../html/acid2.html acid2_ref.html
== table_caption_top_a.html table_caption_top_ref.html
== table_caption_bottom_a.html table_caption_bottom_ref.html
== clip_a.html clip_ref.html
!= inset_blackborder.html blackborder_ref.html
!= outset_blackborder.html blackborder_ref.html

View file

@ -0,0 +1,20 @@
<html>
<style>
body {
margin: 0px;
}
.box {
width: 100px;
height: 100px;
margin: 0px;
border-width: 10px;
border-style: solid;
}
</style>
<body>
<div class="box"></div>
</body>
</html>

View file

@ -0,0 +1,20 @@
<html>
<style>
body {
margin: 0px;
}
.box {
width: 100px;
height: 100px;
margin: 0px;
border-width: 10px;
}
.inset { border-style: inset; }
</style>
<body>
<div class="box inset"></div>
</body>
</html>

View file

@ -0,0 +1,20 @@
<html>
<style>
body {
margin: 0px;
}
.box {
width: 100px;
height: 100px;
margin: 0px;
border-width: 10px;
}
.outset { border-style: outset; }
</style>
<body>
<div class="box outset"></div>
</body>
</html>