mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
LibWeb: Ensure resolved border-width values are non-negative
This commit is contained in:
parent
5f5ae6bf8b
commit
7d7bab7cac
Notes:
github-actions[bot]
2025-05-19 07:56:12 +00:00
Author: https://github.com/tcl3
Commit: 7d7bab7cac
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4810
Reviewed-by: https://github.com/gmta ✅
3 changed files with 263 additions and 266 deletions
|
@ -733,8 +733,11 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
|
|||
if (value.is_calculated())
|
||||
return max(CSSPixels { 0 },
|
||||
value.as_calculated().resolve_length({ .length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(*this) })->to_px(*this));
|
||||
if (value.is_length())
|
||||
return value.as_length().length().to_px(*this);
|
||||
if (value.is_length()) {
|
||||
// FIXME: Currently, interpolation can set property values outside of their valid range.
|
||||
// We should instead clamp property values to the valid range when interpolating.
|
||||
return max(CSSPixels { 0 }, value.as_length().length().to_px(*this));
|
||||
}
|
||||
if (value.is_keyword()) {
|
||||
// https://www.w3.org/TR/css-backgrounds-3/#valdef-line-width-thin
|
||||
switch (value.to_keyword()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue