mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Split RectStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
Notes:
sideshowbarker
2024-07-16 22:21:46 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/3a2de67c7b Pull-request: https://github.com/SerenityOS/serenity/pull/18040
38
Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h
Normal file
38
Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class RectStyleValue : public StyleValueWithDefaultOperators<RectStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<RectStyleValue> create(EdgeRect rect);
|
||||
virtual ~RectStyleValue() override = default;
|
||||
|
||||
EdgeRect rect() const { return m_rect; }
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
virtual bool has_rect() const override { return true; }
|
||||
virtual EdgeRect to_rect() const override { return m_rect; }
|
||||
|
||||
bool properties_equal(RectStyleValue const& other) const { return m_rect == other.m_rect; }
|
||||
|
||||
private:
|
||||
explicit RectStyleValue(EdgeRect rect)
|
||||
: StyleValueWithDefaultOperators(Type::Rect)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
EdgeRect m_rect;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user