mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +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
69
Libraries/LibWeb/CSS/StyleValues/CSSKeywordValue.h
Normal file
69
Libraries/LibWeb/CSS/StyleValues/CSSKeywordValue.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/CSSStyleValue.h>
|
||||
#include <LibWeb/CSS/Keyword.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
// https://drafts.css-houdini.org/css-typed-om-1/#csskeywordvalue
|
||||
class CSSKeywordValue : public StyleValueWithDefaultOperators<CSSKeywordValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> create(Keyword keyword)
|
||||
{
|
||||
// NOTE: We'll have to be much more careful with caching once we expose CSSKeywordValue to JS, as it's mutable.
|
||||
switch (keyword) {
|
||||
case Keyword::Inherit: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const inherit_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Inherit));
|
||||
return inherit_instance;
|
||||
}
|
||||
case Keyword::Initial: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const initial_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Initial));
|
||||
return initial_instance;
|
||||
}
|
||||
case Keyword::Revert: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const revert_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Revert));
|
||||
return revert_instance;
|
||||
}
|
||||
case Keyword::RevertLayer: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const revert_layer_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::RevertLayer));
|
||||
return revert_layer_instance;
|
||||
}
|
||||
case Keyword::Unset: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const unset_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Unset));
|
||||
return unset_instance;
|
||||
}
|
||||
default:
|
||||
return adopt_ref(*new (nothrow) CSSKeywordValue(keyword));
|
||||
}
|
||||
}
|
||||
virtual ~CSSKeywordValue() override = default;
|
||||
|
||||
Keyword keyword() const { return m_keyword; }
|
||||
|
||||
static bool is_color(Keyword);
|
||||
virtual bool has_color() const override;
|
||||
virtual Color to_color(Optional<Layout::NodeWithStyle const&> node) const override;
|
||||
virtual String to_string() const override;
|
||||
|
||||
bool properties_equal(CSSKeywordValue const& other) const { return m_keyword == other.m_keyword; }
|
||||
|
||||
private:
|
||||
explicit CSSKeywordValue(Keyword keyword)
|
||||
: StyleValueWithDefaultOperators(Type::Keyword)
|
||||
, m_keyword(keyword)
|
||||
{
|
||||
}
|
||||
|
||||
Keyword m_keyword { Keyword::Invalid };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue