Move some code from ServoThreadSafeLayoutNode::text_content into script.

This commit is contained in:
Ms2ger 2016-04-11 17:50:01 +02:00
parent 9a8c81773a
commit a5be5a82c1
2 changed files with 23 additions and 18 deletions

View file

@ -58,7 +58,6 @@ use script::layout_interface::TrustedNodeAddress;
use selectors::matching::{DeclarationBlock, ElementFlags};
use selectors::parser::{AttrSelector, NamespaceConstraint};
use smallvec::VecLike;
use std::borrow::ToOwned;
use std::cell::{Ref, RefCell, RefMut};
use std::marker::PhantomData;
use std::mem::{transmute, transmute_copy};
@ -1137,22 +1136,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
}
let this = unsafe { self.get_jsmanaged() };
if let Some(text) = this.downcast::<Text>() {
let data = unsafe {
text.upcast().data_for_layout().to_owned()
};
return TextContent::Text(data);
}
if let Some(input) = this.downcast::<HTMLInputElement>() {
let data = unsafe { input.value_for_layout() };
return TextContent::Text(data);
}
if let Some(area) = this.downcast::<HTMLTextAreaElement>() {
let data = unsafe { area.get_value_for_layout() };
return TextContent::Text(data);
}
unreachable!("not text!")
return TextContent::Text(this.text_content());
}
fn selection(&self) -> Option<Range<ByteIndex>> {