mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb/CSS: Add FontSourceStyleValue
This will be used by the `@font { src: ... }` descriptor once we parse descriptors as style values.
This commit is contained in:
parent
79093291b5
commit
60c536bdd5
Notes:
github-actions[bot]
2025-04-04 09:42:16 +00:00
Author: https://github.com/AtkinsSJ
Commit: 60c536bdd5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4206
8 changed files with 186 additions and 0 deletions
41
Libraries/LibWeb/CSS/StyleValues/FontSourceStyleValue.h
Normal file
41
Libraries/LibWeb/CSS/StyleValues/FontSourceStyleValue.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/CSS/CSSStyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class FontSourceStyleValue final : public StyleValueWithDefaultOperators<FontSourceStyleValue> {
|
||||
public:
|
||||
struct Local {
|
||||
NonnullRefPtr<CSSStyleValue> name;
|
||||
};
|
||||
using Source = Variant<Local, URL::URL>;
|
||||
|
||||
static ValueComparingNonnullRefPtr<FontSourceStyleValue> create(Source source, Optional<FlyString> format)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) FontSourceStyleValue(move(source), move(format)));
|
||||
}
|
||||
virtual ~FontSourceStyleValue() override;
|
||||
|
||||
Source const& source() const { return m_source; }
|
||||
Optional<FlyString> const& format() const { return m_format; }
|
||||
|
||||
virtual String to_string(SerializationMode) const override;
|
||||
|
||||
bool properties_equal(FontSourceStyleValue const&) const;
|
||||
|
||||
private:
|
||||
FontSourceStyleValue(Source source, Optional<FlyString> format);
|
||||
|
||||
Source m_source;
|
||||
Optional<FlyString> m_format;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue