mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:57:44 +00:00
LibWeb: Add support for "place-items" CSS property
Adds support for place-items property which allows to specify both align-items and justify-items in a single declaration.
This commit is contained in:
parent
a74c56bc1b
commit
a8587fe54e
12 changed files with 135 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class PlaceItemsStyleValue final : public StyleValueWithDefaultOperators<PlaceItemsStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<PlaceItemsStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> align_items, ValueComparingNonnullRefPtr<StyleValue> justify_items)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceItemsStyleValue(move(align_items), move(justify_items)));
|
||||
}
|
||||
virtual ~PlaceItemsStyleValue() override = default;
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue> align_items() const { return m_properties.align_items; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> justify_items() const { return m_properties.justify_items; }
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
|
||||
bool properties_equal(PlaceItemsStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||
|
||||
private:
|
||||
PlaceItemsStyleValue(ValueComparingNonnullRefPtr<StyleValue> align_items, ValueComparingNonnullRefPtr<StyleValue> justify_items)
|
||||
: StyleValueWithDefaultOperators(Type::PlaceItems)
|
||||
, m_properties { .align_items = move(align_items), .justify_items = move(justify_items) }
|
||||
{
|
||||
}
|
||||
|
||||
struct Properties {
|
||||
ValueComparingNonnullRefPtr<StyleValue> align_items;
|
||||
ValueComparingNonnullRefPtr<StyleValue> justify_items;
|
||||
bool operator==(Properties const&) const = default;
|
||||
} m_properties;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue