mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb/CSS: Set enum sizes for PropertyID and Keyword
The effect of this is hard to measure, but reducing them from 4 bytes each to 2 bytes can't hurt. :^)
This commit is contained in:
parent
3add623f22
commit
6e45d8ba6c
Notes:
github-actions[bot]
2025-05-19 22:15:17 +00:00
Author: https://github.com/AtkinsSJ
Commit: 6e45d8ba6c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4820
5 changed files with 8 additions and 7 deletions
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
enum class Important {
|
enum class Important : u8 {
|
||||||
No,
|
No,
|
||||||
Yes,
|
Yes,
|
||||||
};
|
};
|
||||||
|
|
|
@ -309,9 +309,9 @@ class URL;
|
||||||
class URLStyleValue;
|
class URLStyleValue;
|
||||||
class VisualViewport;
|
class VisualViewport;
|
||||||
|
|
||||||
enum class Keyword;
|
enum class Keyword : u16;
|
||||||
enum class MediaFeatureID : u8;
|
enum class MediaFeatureID : u8;
|
||||||
enum class PropertyID;
|
enum class PropertyID : u16;
|
||||||
|
|
||||||
struct BackgroundLayerData;
|
struct BackgroundLayerData;
|
||||||
struct CSSStyleSheetInit;
|
struct CSSStyleSheetInit;
|
||||||
|
|
|
@ -47,11 +47,10 @@ ErrorOr<void> generate_header_file(JsonObject& enums_data, Core::File& file)
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
|
#include <LibWeb/Forward.h>
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
enum class Keyword;
|
|
||||||
|
|
||||||
)~~~");
|
)~~~");
|
||||||
|
|
||||||
enums_data.for_each_member([&](auto& name, auto& value) {
|
enums_data.for_each_member([&](auto& name, auto& value) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ ErrorOr<void> generate_header_file(JsonArray& keyword_data, Core::File& file)
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
SourceGenerator generator { builder };
|
SourceGenerator generator { builder };
|
||||||
|
generator.set("keyword_underlying_type", underlying_type_for_enum(keyword_data.size()));
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ ErrorOr<void> generate_header_file(JsonArray& keyword_data, Core::File& file)
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
enum class Keyword {
|
enum class Keyword : @keyword_underlying_type@ {
|
||||||
Invalid,
|
Invalid,
|
||||||
)~~~");
|
)~~~");
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ ErrorOr<void> generate_header_file(JsonObject& properties, Core::File& file)
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
SourceGenerator generator { builder };
|
SourceGenerator generator { builder };
|
||||||
|
generator.set("property_id_underlying_type", underlying_type_for_enum(properties.size()));
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ ErrorOr<void> generate_header_file(JsonObject& properties, Core::File& file)
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
enum class PropertyID {
|
enum class PropertyID : @property_id_underlying_type@ {
|
||||||
Invalid,
|
Invalid,
|
||||||
Custom,
|
Custom,
|
||||||
All,
|
All,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue