Make LayoutCharacterDataHelpers::data_for_layout be safe

This commit is contained in:
Anthony Ramine 2020-03-31 14:40:47 +02:00
parent 00c5ec202c
commit 409bd3d989
4 changed files with 7 additions and 9 deletions

View file

@ -1456,10 +1456,9 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
val
}
#[allow(unsafe_code)]
fn text_content(self) -> String {
if let Some(text) = self.downcast::<Text>() {
return unsafe { text.upcast().data_for_layout().to_owned() };
return text.upcast().data_for_layout().to_owned();
}
if let Some(input) = self.downcast::<HTMLInputElement>() {