mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
LibWeb/HTMLInputElement: Move text input shadow tree into a function
This commit is contained in:
parent
81169ee6e6
commit
ce48ac3101
2 changed files with 7 additions and 2 deletions
|
@ -507,7 +507,6 @@ void HTMLInputElement::create_shadow_tree_if_needed()
|
||||||
if (shadow_root_internal())
|
if (shadow_root_internal())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// FIXME: This could be better factored. Everything except the below types becomes a text input.
|
|
||||||
switch (type_state()) {
|
switch (type_state()) {
|
||||||
case TypeAttributeState::RadioButton:
|
case TypeAttributeState::RadioButton:
|
||||||
case TypeAttributeState::Checkbox:
|
case TypeAttributeState::Checkbox:
|
||||||
|
@ -516,11 +515,16 @@ void HTMLInputElement::create_shadow_tree_if_needed()
|
||||||
case TypeAttributeState::ResetButton:
|
case TypeAttributeState::ResetButton:
|
||||||
case TypeAttributeState::ImageButton:
|
case TypeAttributeState::ImageButton:
|
||||||
case TypeAttributeState::Color:
|
case TypeAttributeState::Color:
|
||||||
return;
|
break;
|
||||||
|
// FIXME: This could be better factored. Everything except the above types becomes a text input.
|
||||||
default:
|
default:
|
||||||
|
create_text_input_shadow_tree();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HTMLInputElement::create_text_input_shadow_tree()
|
||||||
|
{
|
||||||
auto shadow_root = heap().allocate<DOM::ShadowRoot>(realm(), document(), *this, Bindings::ShadowRootMode::Closed);
|
auto shadow_root = heap().allocate<DOM::ShadowRoot>(realm(), document(), *this, Bindings::ShadowRootMode::Closed);
|
||||||
auto initial_value = m_value;
|
auto initial_value = m_value;
|
||||||
auto element = DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
|
auto element = DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
|
@ -166,6 +166,7 @@ private:
|
||||||
|
|
||||||
static TypeAttributeState parse_type_attribute(StringView);
|
static TypeAttributeState parse_type_attribute(StringView);
|
||||||
void create_shadow_tree_if_needed();
|
void create_shadow_tree_if_needed();
|
||||||
|
void create_text_input_shadow_tree();
|
||||||
WebIDL::ExceptionOr<void> run_input_activation_behavior();
|
WebIDL::ExceptionOr<void> run_input_activation_behavior();
|
||||||
void set_checked_within_group();
|
void set_checked_within_group();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue