mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibWeb: Return Optional from StyleProperties::box_sizing()
This function was written as if it returned `Optional<CSS::BoxSizing>` but actually returned a plain `CSS::BoxSizing`, meaning if the property was not set or was invalid, it would return whichever enum value was first. This wasn't visible because we don't yet pay any attention to the `box-sizing` property.
This commit is contained in:
parent
3f61f869c8
commit
4d42885327
Notes:
sideshowbarker
2024-07-17 11:49:06 +09:00
Author: https://github.com/AtkinsSJ
Commit: 4d42885327
Pull-request: https://github.com/SerenityOS/serenity/pull/13673
3 changed files with 4 additions and 3 deletions
|
@ -961,7 +961,7 @@ Vector<ShadowData> StyleProperties::text_shadow() const
|
|||
return shadow(PropertyID::TextShadow);
|
||||
}
|
||||
|
||||
CSS::BoxSizing StyleProperties::box_sizing() const
|
||||
Optional<CSS::BoxSizing> StyleProperties::box_sizing() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::BoxSizing);
|
||||
if (!value.has_value())
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
Optional<CSS::Overflow> overflow_x() const;
|
||||
Optional<CSS::Overflow> overflow_y() const;
|
||||
Vector<CSS::ShadowData> box_shadow() const;
|
||||
CSS::BoxSizing box_sizing() const;
|
||||
Optional<CSS::BoxSizing> box_sizing() const;
|
||||
Optional<CSS::PointerEvents> pointer_events() const;
|
||||
Variant<CSS::VerticalAlign, CSS::LengthPercentage> vertical_align() const;
|
||||
Optional<CSS::FontVariant> font_variant() const;
|
||||
|
|
|
@ -363,7 +363,8 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
}
|
||||
computed_values.set_background_color(computed_style.color_or_fallback(CSS::PropertyID::BackgroundColor, *this, CSS::InitialValues::background_color()));
|
||||
|
||||
computed_values.set_box_sizing(computed_style.box_sizing());
|
||||
if (auto box_sizing = computed_style.box_sizing(); box_sizing.has_value())
|
||||
computed_values.set_box_sizing(box_sizing.release_value());
|
||||
|
||||
if (auto maybe_font_variant = computed_style.font_variant(); maybe_font_variant.has_value())
|
||||
computed_values.set_font_variant(maybe_font_variant.release_value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue