mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:17:34 +00:00
LibWeb: Convert BorderData::width to CSSPixels
The `clip_shrink` optimization in `paint_background()` now also correctly uses DevicePixels, instead of reducing a DevicePixel rect by a CSSPixels amount.
This commit is contained in:
parent
072ab94889
commit
5ee1b7db7c
7 changed files with 20 additions and 20 deletions
|
@ -224,14 +224,14 @@ void LayoutState::UsedValues::set_node(NodeWithStyleAndBoxModelMetrics& node, Us
|
|||
CSSPixels border_and_padding;
|
||||
|
||||
if (width) {
|
||||
border_and_padding = CSSPixels(computed_values.border_left().width)
|
||||
border_and_padding = computed_values.border_left().width
|
||||
+ computed_values.padding().left().to_px(*m_node, containing_block_used_values->content_width())
|
||||
+ CSSPixels(computed_values.border_right().width)
|
||||
+ computed_values.border_right().width
|
||||
+ computed_values.padding().right().to_px(*m_node, containing_block_used_values->content_width());
|
||||
} else {
|
||||
border_and_padding = CSSPixels(computed_values.border_top().width)
|
||||
border_and_padding = computed_values.border_top().width
|
||||
+ computed_values.padding().top().to_px(*m_node, containing_block_used_values->content_width())
|
||||
+ CSSPixels(computed_values.border_bottom().width)
|
||||
+ computed_values.border_bottom().width
|
||||
+ computed_values.padding().bottom().to_px(*m_node, containing_block_used_values->content_width());
|
||||
}
|
||||
|
||||
|
|
|
@ -654,12 +654,12 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
if (border.line_style == CSS::LineStyle::None || border.line_style == CSS::LineStyle::Hidden) {
|
||||
border.width = 0;
|
||||
} else {
|
||||
auto resolve_border_width = [&]() -> double {
|
||||
auto resolve_border_width = [&]() -> CSSPixels {
|
||||
auto value = computed_style.property(width_property);
|
||||
if (value->is_calculated())
|
||||
return value->as_calculated().resolve_length(*this)->to_px(*this).to_double();
|
||||
return value->as_calculated().resolve_length(*this)->to_px(*this);
|
||||
if (value->is_length())
|
||||
return value->as_length().length().to_px(*this).to_double();
|
||||
return value->as_length().length().to_px(*this);
|
||||
if (value->is_identifier()) {
|
||||
// https://www.w3.org/TR/css-backgrounds-3/#valdef-line-width-thin
|
||||
switch (value->to_identifier()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue