mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +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
60
Libraries/LibWeb/CSS/CSSNamespaceRule.cpp
Normal file
60
Libraries/LibWeb/CSS/CSSNamespaceRule.cpp
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Jonah Shafran <jonahshafran@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/CSSNamespaceRulePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSNamespaceRule.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CSSNamespaceRule);
|
||||
|
||||
CSSNamespaceRule::CSSNamespaceRule(JS::Realm& realm, Optional<FlyString> prefix, FlyString namespace_uri)
|
||||
: CSSRule(realm, Type::Namespace)
|
||||
, m_namespace_uri(move(namespace_uri))
|
||||
, m_prefix(prefix.value_or(""_fly_string))
|
||||
{
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<CSSNamespaceRule> CSSNamespaceRule::create(JS::Realm& realm, Optional<FlyString> prefix, FlyString namespace_uri)
|
||||
{
|
||||
return realm.heap().allocate<CSSNamespaceRule>(realm, realm, move(prefix), move(namespace_uri));
|
||||
}
|
||||
|
||||
void CSSNamespaceRule::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSNamespaceRule);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom/#serialize-a-css-rule
|
||||
String CSSNamespaceRule::serialized() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
// The literal string "@namespace", followed by a single SPACE (U+0020),
|
||||
builder.append("@namespace "sv);
|
||||
|
||||
// followed by the serialization as an identifier of the prefix attribute (if any),
|
||||
if (!m_prefix.is_empty()) {
|
||||
serialize_an_identifier(builder, m_prefix);
|
||||
// followed by a single SPACE (U+0020) if there is a prefix,
|
||||
builder.append(" "sv);
|
||||
}
|
||||
|
||||
// followed by the serialization as URL of the namespaceURI attribute,
|
||||
serialize_a_url(builder, m_namespace_uri);
|
||||
|
||||
// followed the character ";" (U+003B).
|
||||
builder.append(";"sv);
|
||||
|
||||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue