dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / namespace.lucb
#==============================================================================================
#
# namespace - Namespace: the namespace URLs of HTML, MathML, SVG, XLink, XML and XMLNS
#
# DESCRIPTION:
# Port of Libraries/LibWeb/Namespace.cpp (lines 1-16) with Namespace.h's
# ENUMERATE_NAMESPACES. The C++ FlyStrings are initialized statically; these are longer
# than a short FlyString, so they are interned by namespace_initialize_strings, which
# web_initialize_strings runs at startup (DESIGN.md ยง2.6).
#
# Copyright (c) 2020, the SerenityOS developers.
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Whether namespace_initialize_strings has run.
var namespace_strings_initialized: bool
## Ported from Libraries/LibWeb/Namespace.cpp:10 the definitions of Web::Namespace's FlyStrings
## (`FlyString name = namespace_##_fly_string;` for each ENUMERATE_NAMESPACES entry).
pub func namespace_initialize_strings():
if namespace_strings_initialized:
return
namespace_html = ak.fly_string_from_str("http://www.w3.org/1999/xhtml")
namespace_math_ml = ak.fly_string_from_str("http://www.w3.org/1998/Math/MathML")
namespace_svg = ak.fly_string_from_str("http://www.w3.org/2000/svg")
namespace_x_link = ak.fly_string_from_str("http://www.w3.org/1999/xlink")
namespace_xml = ak.fly_string_from_str("http://www.w3.org/XML/1998/namespace")
namespace_xmlns = ak.fly_string_from_str("http://www.w3.org/2000/xmlns/")
namespace_strings_initialized = true