1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:15:09 +00:00

LibWeb: Improve select element CSS stylebility

This commit is contained in:
Bastiaan van der Plaat 2023-12-10 19:59:25 +01:00 committed by Andreas Kling
parent d025d207d9
commit 3b3558865c
2 changed files with 15 additions and 9 deletions

View file

@ -344,23 +344,25 @@ void HTMLSelectElement::create_shadow_tree_if_needed()
auto border = DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
MUST(border->set_attribute(HTML::AttributeNames::style, R"~~~(
display: flex;
justify-content: center;
align-items: center;
height: 100%;
padding: 4px;
border: 1px solid ButtonBorder;
background-color: ButtonFace;
)~~~"_string));
)~~~"_string));
MUST(shadow_root->append_child(border));
m_inner_text_element = DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
MUST(m_inner_text_element->set_attribute(HTML::AttributeNames::style, R"~~~(
flex: 1;
)~~~"_string));
)~~~"_string));
MUST(border->append_child(*m_inner_text_element));
// FIXME: Find better way to add chevron icon
auto chevron_icon_element = DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
MUST(chevron_icon_element->set_inner_html("<svg style=\"width: 16px; height: 16px;\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z\" /></svg>"sv));
MUST(chevron_icon_element->set_attribute(HTML::AttributeNames::style, R"~~~(
width: 16px;
height: 16px;
margin-left: 4px;
)~~~"_string));
MUST(chevron_icon_element->set_inner_html("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z\" /></svg>"sv));
MUST(border->append_child(*chevron_icon_element));
update_inner_text_element();