mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
LibWeb: Make selection state recomputation implicit
Add a LayoutDocument API for modifying the selection and make clients call that so we can recompute selection states automatically.
This commit is contained in:
parent
d47f77169f
commit
684fa0f99b
4 changed files with 18 additions and 8 deletions
|
@ -146,4 +146,16 @@ void LayoutDocument::recompute_selection_states()
|
|||
});
|
||||
}
|
||||
|
||||
void LayoutDocument::set_selection(const LayoutRange & selection)
|
||||
{
|
||||
m_selection = selection;
|
||||
recompute_selection_states();
|
||||
}
|
||||
|
||||
void LayoutDocument::set_selection_end(const LayoutPosition& position)
|
||||
{
|
||||
m_selection.set_end(position);
|
||||
recompute_selection_states();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ public:
|
|||
virtual HitTestResult hit_test(const Gfx::IntPoint&, HitTestType) const override;
|
||||
|
||||
const LayoutRange& selection() const { return m_selection; }
|
||||
LayoutRange& selection() { return m_selection; }
|
||||
void set_selection(const LayoutRange&);
|
||||
void set_selection_end(const LayoutPosition&);
|
||||
|
||||
void did_set_viewport_rect(Badge<Frame>, const Gfx::IntRect&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue