mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
auto merge of #4437 : Adenilson/servo/fixInsetOutsetBlack03, r=jdm
Freshly rebased.
This commit is contained in:
commit
4ac8b6a723
5 changed files with 79 additions and 5 deletions
|
@ -642,11 +642,22 @@ impl<'a> PaintContext<'a> {
|
||||||
};
|
};
|
||||||
// original bounds as a Rect<f32>
|
// original bounds as a Rect<f32>
|
||||||
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
|
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
|
||||||
// select and scale the color appropriately.
|
|
||||||
let scaled_color = match direction {
|
let mut scaled_color;
|
||||||
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 })
|
// 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);
|
self.draw_border_path(&original_bounds, direction, border, radius, scaled_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,3 +219,6 @@ fragment=top != ../html/acid2.html acid2_ref.html
|
||||||
== table_caption_top_a.html table_caption_top_ref.html
|
== table_caption_top_a.html table_caption_top_ref.html
|
||||||
== table_caption_bottom_a.html table_caption_bottom_ref.html
|
== table_caption_bottom_a.html table_caption_bottom_ref.html
|
||||||
== clip_a.html clip_ref.html
|
== clip_a.html clip_ref.html
|
||||||
|
!= inset_blackborder.html blackborder_ref.html
|
||||||
|
!= outset_blackborder.html blackborder_ref.html
|
||||||
|
|
||||||
|
|
20
tests/ref/blackborder_ref.html
Normal file
20
tests/ref/blackborder_ref.html
Normal 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>
|
20
tests/ref/inset_blackborder.html
Normal file
20
tests/ref/inset_blackborder.html
Normal 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>
|
20
tests/ref/outset_blackborder.html
Normal file
20
tests/ref/outset_blackborder.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue