mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Parse CSS fit-content(<length-percentage>) values
Before this change, we only parsed fit-content as a standalone keyword, but CSS-SIZING-3 added it as a function as well. I don't know of anything else in CSS that is overloaded like this, so it ends up looking a little awkward in the implementation. Note that a lot of code had already been prepped for fit-content values to have an argument, we just weren't parsing it.
This commit is contained in:
parent
6fc19ec059
commit
8ab61843be
Notes:
github-actions[bot]
2025-02-26 23:45:14 +00:00
Author: https://github.com/awesomekling
Commit: 8ab61843be
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3706
Reviewed-by: https://github.com/AtkinsSJ
25 changed files with 185 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2018-2025, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -19,6 +19,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/CounterStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/FitContentStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridAutoFlowStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
|
||||
|
@ -158,14 +159,16 @@ Size ComputedProperties::size_value(PropertyID id) const
|
|||
return Size::make_min_content();
|
||||
case Keyword::MaxContent:
|
||||
return Size::make_max_content();
|
||||
case Keyword::FitContent:
|
||||
return Size::make_fit_content();
|
||||
case Keyword::None:
|
||||
return Size::make_none();
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
if (value.is_fit_content()) {
|
||||
auto& fit_content = value.as_fit_content();
|
||||
return Size::make_fit_content(fit_content.length_percentage());
|
||||
}
|
||||
|
||||
if (value.is_calculated())
|
||||
return Size::make_calculated(value.as_calculated());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue