Skip to content

Commit ce48ac3

Browse files
circl-lastnameAtkinsSJ
authored andcommitted
LibWeb/HTMLInputElement: Move text input shadow tree into a function
1 parent 81169ee commit ce48ac3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ void HTMLInputElement::create_shadow_tree_if_needed()
507507
if (shadow_root_internal())
508508
return;
509509

510-
// FIXME: This could be better factored. Everything except the below types becomes a text input.
511510
switch (type_state()) {
512511
case TypeAttributeState::RadioButton:
513512
case TypeAttributeState::Checkbox:
@@ -516,11 +515,16 @@ void HTMLInputElement::create_shadow_tree_if_needed()
516515
case TypeAttributeState::ResetButton:
517516
case TypeAttributeState::ImageButton:
518517
case TypeAttributeState::Color:
519-
return;
518+
break;
519+
// FIXME: This could be better factored. Everything except the above types becomes a text input.
520520
default:
521+
create_text_input_shadow_tree();
521522
break;
522523
}
524+
}
523525

526+
void HTMLInputElement::create_text_input_shadow_tree()
527+
{
524528
auto shadow_root = heap().allocate<DOM::ShadowRoot>(realm(), document(), *this, Bindings::ShadowRootMode::Closed);
525529
auto initial_value = m_value;
526530
auto element = DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML).release_value_but_fixme_should_propagate_errors();

Userland/Libraries/LibWeb/HTML/HTMLInputElement.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class HTMLInputElement final
166166

167167
static TypeAttributeState parse_type_attribute(StringView);
168168
void create_shadow_tree_if_needed();
169+
void create_text_input_shadow_tree();
169170
WebIDL::ExceptionOr<void> run_input_activation_behavior();
170171
void set_checked_within_group();
171172

0 commit comments

Comments
 (0)