mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
58
Libraries/LibWeb/CSS/Parser/ComponentValue.h
Normal file
58
Libraries/LibWeb/CSS/Parser/ComponentValue.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibWeb/CSS/Parser/Token.h>
|
||||
#include <LibWeb/CSS/Parser/Types.h>
|
||||
|
||||
namespace Web::CSS::Parser {
|
||||
|
||||
// https://drafts.csswg.org/css-syntax/#component-value
|
||||
class ComponentValue {
|
||||
AK_MAKE_DEFAULT_COPYABLE(ComponentValue);
|
||||
AK_MAKE_DEFAULT_MOVABLE(ComponentValue);
|
||||
|
||||
public:
|
||||
ComponentValue(Token);
|
||||
explicit ComponentValue(Function&&);
|
||||
explicit ComponentValue(SimpleBlock&&);
|
||||
~ComponentValue();
|
||||
|
||||
bool is_block() const { return m_value.has<SimpleBlock>(); }
|
||||
SimpleBlock const& block() const { return m_value.get<SimpleBlock>(); }
|
||||
|
||||
bool is_function() const { return m_value.has<Function>(); }
|
||||
bool is_function(StringView name) const;
|
||||
Function const& function() const { return m_value.get<Function>(); }
|
||||
|
||||
bool is_token() const { return m_value.has<Token>(); }
|
||||
bool is(Token::Type type) const { return is_token() && token().is(type); }
|
||||
bool is_delim(u32 delim) const { return is(Token::Type::Delim) && token().delim() == delim; }
|
||||
bool is_ident(StringView ident) const;
|
||||
Token const& token() const { return m_value.get<Token>(); }
|
||||
operator Token() const { return m_value.get<Token>(); }
|
||||
|
||||
String to_string() const;
|
||||
String to_debug_string() const;
|
||||
String original_source_text() const;
|
||||
|
||||
private:
|
||||
Variant<Token, Function, SimpleBlock> m_value;
|
||||
};
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<Web::CSS::Parser::ComponentValue> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Parser::ComponentValue const& component_value)
|
||||
{
|
||||
return Formatter<StringView>::format(builder, component_value.to_string());
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue