mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
LibWeb: Add plumbing for the new 'object-position' property
Now, the 'object-position' property gets properly parsed and is provided to the rest of the ecosystem. In the parser we use the same parsing as for the background-position, which is not entirely correct but almost a <position>.
This commit is contained in:
parent
7e11de272f
commit
d00c7e55a5
Notes:
sideshowbarker
2024-07-18 01:43:16 +09:00
Author: https://github.com/TobyAsE
Commit: d00c7e55a5
Pull-request: https://github.com/SerenityOS/serenity/pull/21461
Reviewed-by: https://github.com/AtkinsSJ
3 changed files with 14 additions and 0 deletions
|
@ -5952,6 +5952,12 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
|||
if (auto parsed_value = parse_math_depth_value(component_values))
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::ObjectPosition:
|
||||
// FIXME: This should use a parse_position compatible to VALUES-4
|
||||
// and not the background position, which is almost the same.
|
||||
if (auto parsed_value = parse_comma_separated_value_list(component_values, [this](auto& tokens) { return parse_single_background_position_value(tokens); }))
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::Overflow:
|
||||
if (auto parsed_value = parse_overflow_value(component_values))
|
||||
return parsed_value.release_nonnull();
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/MathDepthStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||
|
@ -1007,6 +1008,12 @@ Optional<CSS::ObjectFit> StyleProperties::object_fit() const
|
|||
return value_id_to_object_fit(value->to_identifier());
|
||||
}
|
||||
|
||||
CSS::PositionStyleValue const& StyleProperties::object_position() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::ObjectPosition);
|
||||
return value->as_position();
|
||||
}
|
||||
|
||||
Optional<CSS::TableLayout> StyleProperties::table_layout() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::TableLayout);
|
||||
|
|
|
@ -117,6 +117,7 @@ public:
|
|||
Vector<Vector<String>> grid_template_areas() const;
|
||||
String grid_area() const;
|
||||
Optional<CSS::ObjectFit> object_fit() const;
|
||||
CSS::PositionStyleValue const& object_position() const;
|
||||
Optional<CSS::TableLayout> table_layout() const;
|
||||
|
||||
Vector<CSS::Transformation> transformations() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue