1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

LibHTML: Respect "border-style: dotted"

Dotted borders are now painted correctly (as long as they are 1px wide)
which is yet another little improvement to my Apache2 default page :^)
This commit is contained in:
Andreas Kling 2019-11-27 20:53:28 +01:00
parent 478cfae7c8
commit 70fadbad37

View file

@ -72,12 +72,12 @@ void LayoutBox::paint_border(RenderingContext& context, Edge edge, const FloatRe
auto top_left_color = Color::from_rgb(0x888888);
auto bottom_right_color = Color::from_rgb(0x5a5a5a);
color = (edge == Edge::Left || edge == Edge::Top) ? top_left_color : bottom_right_color;
} else {
// border-style: solid
}
bool dotted = border_style.has_value() && border_style.value()->to_string() == "dotted";
auto draw_line = [&](auto& p1, auto& p2) {
context.painter().draw_line({ (int)p1.x(), (int)p1.y() }, { (int)p2.x(), (int)p2.y() }, color, 1);
context.painter().draw_line({ (int)p1.x(), (int)p1.y() }, { (int)p2.x(), (int)p2.y() }, color, 1, dotted);
};
auto width_for = [&](CSS::PropertyID property_id) -> float {