diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 371940ba070..c8348e756f1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -79,8 +79,8 @@ void HTMLInputElement::visit_edges(Cell::Visitor& visitor) visitor.visit(m_legacy_pre_activation_behavior_checked_element_in_group); visitor.visit(m_selected_files); visitor.visit(m_slider_thumb); + visitor.visit(m_slider_progress_element); visitor.visit(m_image_request); - visitor.visit(m_range_progress_element); } // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-validity @@ -766,7 +766,7 @@ void HTMLInputElement::update_shadow_tree() update_file_input_shadow_tree(); break; case TypeAttributeState::Range: - update_slider_thumb_element(); + update_slider_shadow_tree_elements(); break; default: update_text_input_shadow_tree(); @@ -993,18 +993,18 @@ void HTMLInputElement::create_range_input_shadow_tree() slider_runnable_track->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::SliderRunnableTrack); MUST(shadow_root->append_child(slider_runnable_track)); - m_range_progress_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML)); - MUST(m_range_progress_element->set_attribute(HTML::AttributeNames::style, R"~~~( + m_slider_progress_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML)); + MUST(m_slider_progress_element->set_attribute(HTML::AttributeNames::style, R"~~~( display: block; position: absolute; height: 100%; )~~~"_string)); - MUST(slider_runnable_track->append_child(*m_range_progress_element)); + MUST(slider_runnable_track->append_child(*m_slider_progress_element)); m_slider_thumb = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML)); m_slider_thumb->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::SliderThumb); MUST(slider_runnable_track->append_child(*m_slider_thumb)); - update_slider_thumb_element(); + update_slider_shadow_tree_elements(); auto keydown_callback_function = JS::NativeFunction::create( realm(), [this](JS::VM& vm) { @@ -1095,8 +1095,8 @@ void HTMLInputElement::computed_css_values_changed() if (accent_color_property->has_color()) accent_color = accent_color_property->to_string(); - if (m_range_progress_element) - MUST(m_range_progress_element->style_for_bindings()->set_property(CSS::PropertyID::BackgroundColor, accent_color)); + if (m_slider_progress_element) + MUST(m_slider_progress_element->style_for_bindings()->set_property(CSS::PropertyID::BackgroundColor, accent_color)); if (m_slider_thumb) MUST(m_slider_thumb->style_for_bindings()->set_property(CSS::PropertyID::BackgroundColor, accent_color)); } @@ -1118,7 +1118,7 @@ void HTMLInputElement::user_interaction_did_change_input_value() }); } -void HTMLInputElement::update_slider_thumb_element() +void HTMLInputElement::update_slider_shadow_tree_elements() { double value = convert_string_to_number(value_sanitization_algorithm(m_value)).value_or(0); double minimum = *min(); @@ -1128,8 +1128,8 @@ void HTMLInputElement::update_slider_thumb_element() if (m_slider_thumb) MUST(m_slider_thumb->style_for_bindings()->set_property(CSS::PropertyID::MarginLeft, MUST(String::formatted("{}%", position)))); - if (m_range_progress_element) - MUST(m_range_progress_element->style_for_bindings()->set_property(CSS::PropertyID::Width, MUST(String::formatted("{}%", position)))); + if (m_slider_progress_element) + MUST(m_slider_progress_element->style_for_bindings()->set_property(CSS::PropertyID::Width, MUST(String::formatted("{}%", position)))); } void HTMLInputElement::did_receive_focus() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index bdf8a49367c..f0289685d2f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -287,8 +287,9 @@ private: JS::GCPtr m_file_button; JS::GCPtr m_file_label; - void update_slider_thumb_element(); + void update_slider_shadow_tree_elements(); JS::GCPtr m_slider_thumb; + JS::GCPtr m_slider_progress_element; JS::GCPtr image_data() const; JS::GCPtr m_image_request; @@ -322,8 +323,6 @@ private: String m_last_src_value; bool m_has_uncommitted_changes { false }; - - JS::GCPtr m_range_progress_element; }; }