ladybird/Userland/Libraries/LibWeb/SVG/AttributeNames.h
Timothy Flynn db2ba5f1d9 LibWeb: Initialize static web strings during main-thread VM creation
These are currently initialized in a [[gnu::constructor]], which has a
weird initialization order. These constructors are invoked before main()
and, incidentally, before any user-defined default constructors of the
static strings they are initializing.

This will become an issue when these strings are ported to FlyString,
which has a user-defined default constructor. In that scenario, when the
FlyString constructor is executed after the [[gnu::constructor]], the
strings will be "reset" to the empty string.

Instead of relying on a non-standard compiler extension here, let's just
initialize these strings explicitly during main-thread VM creation, as
this now happens in WebContent's main().
2023-03-18 19:50:45 +01:00

97 lines
3.2 KiB
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/Error.h>
namespace Web::SVG::AttributeNames {
#define ENUMERATE_SVG_ATTRIBUTES(E) \
E(attributeName) \
E(attributeType) \
E(baseFrequency) \
E(baseProfile) \
E(calcMode) \
E(clipPathUnits) \
E(contentScriptType) \
E(contentStyleType) \
E(cx) \
E(cy) \
E(diffuseConstant) \
E(edgeMode) \
E(filterUnits) \
E(glyphRef) \
E(gradientTransform) \
E(gradientUnits) \
E(height) \
E(kernelMatrix) \
E(kernelUnitLength) \
E(keyPoints) \
E(keySplines) \
E(keyTimes) \
E(lengthAdjust) \
E(limitingConeAngle) \
E(markerHeight) \
E(markerUnits) \
E(markerWidth) \
E(maskContentUnits) \
E(maskUnits) \
E(numOctaves) \
E(pathLength) \
E(patternContentUnits) \
E(patternTransform) \
E(patternUnits) \
E(points) \
E(pointsAtX) \
E(pointsAtY) \
E(pointsAtZ) \
E(preserveAlpha) \
E(preserveAspectRatio) \
E(primitiveUnits) \
E(r) \
E(refX) \
E(refY) \
E(repeatCount) \
E(repeatDur) \
E(requiredExtensions) \
E(rx) \
E(ry) \
E(requiredFeatures) \
E(specularConstant) \
E(specularExponent) \
E(spreadMethod) \
E(startOffset) \
E(stdDeviation) \
E(stitchTiles) \
E(surfaceScale) \
E(systemLanguage) \
E(tableValues) \
E(targetX) \
E(targetY) \
E(textLength) \
E(version) \
E(viewBox) \
E(viewTarget) \
E(width) \
E(x) \
E(x1) \
E(x2) \
E(xChannelSelector) \
E(y) \
E(y1) \
E(y2) \
E(yChannelSelector) \
E(zoomAndPan)
#define __ENUMERATE_SVG_ATTRIBUTE(name) extern DeprecatedFlyString name;
ENUMERATE_SVG_ATTRIBUTES(__ENUMERATE_SVG_ATTRIBUTE)
#undef __ENUMERATE_SVG_ATTRIBUTE
ErrorOr<void> initialize_strings();
}