mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Move some code from ServoThreadSafeLayoutNode::text_content into script.
This commit is contained in:
parent
9a8c81773a
commit
a5be5a82c1
2 changed files with 23 additions and 18 deletions
|
@ -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>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue