mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Skip update_associated_selection()
when there's no selection
This change fixes at least two issues: - `update_associated_selection()` is responsible for selectionchange dispatch, and we were incorrectly dispatching this event on ranges that were not associated with a selection. - `Range::get_client_rects()` was using `update_associated_selection()` to refresh the selection state in the paintable tree for the current range, but since a range might not be associated with a selection, this could make the painted selection reflect the state of an arbitrary range instead of the actual selection range. Fixes a bug on Discord where any text typed into the message input would get selected.
This commit is contained in:
parent
69074a3841
commit
5874b7a76f
Notes:
github-actions[bot]
2025-07-03 20:17:46 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 5874b7a76f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5292
Reviewed-by: https://github.com/gmta ✅
5 changed files with 73 additions and 12 deletions
|
@ -39,7 +39,7 @@ public:
|
|||
Gfx::Orientation orientation() const;
|
||||
|
||||
CSSPixelRect selection_rect() const;
|
||||
CSSPixelRect range_rect(size_t start_offset_in_code_units, size_t end_offset_in_code_units) const;
|
||||
CSSPixelRect range_rect(Paintable::SelectionState selection_state, size_t start_offset_in_code_units, size_t end_offset_in_code_units) const;
|
||||
|
||||
CSSPixels width() const { return m_size.width(); }
|
||||
CSSPixels height() const { return m_size.height(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue