ladybird/Libraries/LibWeb/HTML/SelectItem.h
Pavel Shliak 1bdc41faa1
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
LibWeb: Reduce SelectItemOption struct from 40 to 32 bytes
2024-11-11 17:06:20 +01:00

55 lines
1.1 KiB
C++

/*
* Copyright (c) 2023, Bastiaan van der Plaat <bastiaan.v.d.plaat@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <LibIPC/Forward.h>
#include <LibWeb/HTML/HTMLOptionElement.h>
namespace Web::HTML {
struct SelectItemOption {
u32 id { 0 };
bool selected { false };
bool disabled { false };
JS::GCPtr<HTMLOptionElement> option_element {};
String label {};
String value {};
};
struct SelectItemOptionGroup {
String label = {};
Vector<SelectItemOption> items = {};
};
struct SelectItemSeparator { };
using SelectItem = Variant<SelectItemOption, SelectItemOptionGroup, SelectItemSeparator>;
}
namespace IPC {
template<>
ErrorOr<void> encode(Encoder&, Web::HTML::SelectItemOption const&);
template<>
ErrorOr<Web::HTML::SelectItemOption> decode(Decoder&);
template<>
ErrorOr<void> encode(Encoder&, Web::HTML::SelectItemOptionGroup const&);
template<>
ErrorOr<Web::HTML::SelectItemOptionGroup> decode(Decoder&);
template<>
ErrorOr<void> encode(Encoder&, Web::HTML::SelectItemSeparator const&);
template<>
ErrorOr<Web::HTML::SelectItemSeparator> decode(Decoder&);
}