LibWeb: Delete m_selected flag from Paintable

This was redundant when Paintable already has `m_selection_state` that
could be none.
This commit is contained in:
Aliaksandr Kalenik 2024-11-14 19:43:08 +03:00 committed by Andreas Kling
commit d7caa426a0
Notes: github-actions[bot] 2024-11-14 18:51:50 +00:00
9 changed files with 0 additions and 50 deletions

View file

@ -62,7 +62,6 @@ public:
[[nodiscard]] bool is_absolutely_positioned() const { return m_absolutely_positioned; }
[[nodiscard]] bool is_floating() const { return m_floating; }
[[nodiscard]] bool is_inline() const { return m_inline; }
[[nodiscard]] bool is_selected() const { return m_selected; }
[[nodiscard]] CSS::Display display() const;
template<typename U, typename Callback>
@ -228,7 +227,6 @@ public:
SelectionState selection_state() const { return m_selection_state; }
void set_selection_state(SelectionState state) { m_selection_state = state; }
void set_selected(bool selected) { m_selected = selected; }
Gfx::AffineTransform compute_combined_css_transform() const;
@ -263,7 +261,6 @@ private:
bool m_absolutely_positioned : 1 { false };
bool m_floating : 1 { false };
bool m_inline : 1 { false };
bool m_selected : 1 { false };
};
inline DOM::Node* HitTestResult::dom_node()

View file

@ -187,9 +187,6 @@ Gfx::Orientation PaintableFragment::orientation() const
CSSPixelRect PaintableFragment::selection_rect(Gfx::Font const& font) const
{
if (!paintable().is_selected())
return {};
if (auto const* focused_element = paintable().document().focused_element(); focused_element && is<HTML::FormAssociatedTextControlElement>(*focused_element)) {
HTML::FormAssociatedTextControlElement const* text_control_element = nullptr;
if (is<HTML::HTMLInputElement>(*focused_element)) {

View file

@ -278,32 +278,6 @@ JS::GCPtr<Selection::Selection> ViewportPaintable::selection() const
return const_cast<DOM::Document&>(document()).get_selection();
}
void ViewportPaintable::update_selection()
{
// 1. Start by setting all layout nodes to unselected.
for_each_in_inclusive_subtree([&](auto& layout_node) {
layout_node.set_selected(false);
return TraversalDecision::Continue;
});
// 2. If there is no active Selection or selected Range, return.
auto selection = document().get_selection();
if (!selection)
return;
auto range = selection->range();
if (!range)
return;
auto* start_container = range->start_container();
auto* end_container = range->end_container();
// 3. Mark the nodes included in range selected.
for (auto* node = start_container; node && node != end_container->next_in_pre_order(); node = node->next_in_pre_order()) {
if (auto* paintable = node->paintable())
paintable->set_selected(true);
}
}
void ViewportPaintable::recompute_selection_states(DOM::Range& range)
{
// 1. Start by resetting the selection state of all layout nodes to None.

View file

@ -33,7 +33,6 @@ public:
JS::GCPtr<Selection::Selection> selection() const;
void recompute_selection_states(DOM::Range&);
void update_selection();
bool handle_mousewheel(Badge<EventHandler>, CSSPixelPoint, unsigned, unsigned, int wheel_delta_x, int wheel_delta_y) override;