mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Introduce more layout helpers to make selection_for_layout be safe
This commit is contained in:
parent
28e5abe606
commit
d9e4f7a0ba
3 changed files with 30 additions and 18 deletions
|
@ -1478,14 +1478,13 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
|
|||
panic!("not text!")
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn selection(self) -> Option<Range<usize>> {
|
||||
if let Some(area) = self.downcast::<HTMLTextAreaElement>() {
|
||||
return unsafe { area.selection_for_layout() };
|
||||
return area.selection_for_layout();
|
||||
}
|
||||
|
||||
if let Some(input) = self.downcast::<HTMLInputElement>() {
|
||||
return unsafe { input.selection_for_layout() };
|
||||
return input.selection_for_layout();
|
||||
}
|
||||
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue