mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
script: Consider a selection collapsed when the edit point equals the selection origin (#41978)
In text inputs, the edit point can be equal to a non-`None` selection origin for a variety of reasons such as when the selection is set by a DOM API or when a composition event inserts a zero length string. In both of these cases, we should treat the selection as collapsed. It is important to do this because for the purposes of arrow key movement and context menu entries, we should think of the text input as not having a selection at all. Testing: This change adds a Servo-specific WPT test, as key press behavior is platform specific. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
@@ -270,8 +270,8 @@ impl TextControlElement for HTMLTextAreaElement {
|
||||
!self.textinput.borrow().get_content().is_empty()
|
||||
}
|
||||
|
||||
fn has_selection(&self) -> bool {
|
||||
self.textinput.borrow().has_selection()
|
||||
fn has_uncollapsed_selection(&self) -> bool {
|
||||
self.textinput.borrow().has_uncollapsed_selection()
|
||||
}
|
||||
|
||||
fn set_dirty_value_flag(&self, value: bool) {
|
||||
|
||||
Reference in New Issue
Block a user