layout: Simplify ThreadSafeLayout::text_content

This commit is contained in:
Emilio Cobos Álvarez 2016-04-24 19:17:26 +02:00
parent 2e05190e68
commit 5577a083ec
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -1077,13 +1077,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
fn text_content(&self) -> TextContent { fn text_content(&self) -> TextContent {
if self.pseudo.is_replaced_content() { if self.pseudo.is_replaced_content() {
let data = &self.borrow_layout_data().unwrap().style_data; let style = self.resolved_style();
let style = if self.pseudo.is_before() {
data.per_pseudo.get(&PseudoElement::Before).unwrap()
} else {
data.per_pseudo.get(&PseudoElement::After).unwrap()
};
return match style.as_ref().get_counters().content { return match style.as_ref().get_counters().content {
content::T::Content(ref value) if !value.is_empty() => { content::T::Content(ref value) if !value.is_empty() => {
@ -1109,7 +1103,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
return TextContent::Text(data); return TextContent::Text(data);
} }
panic!("not text!") unreachable!("not text!")
} }
fn selection(&self) -> Option<Range<ByteIndex>> { fn selection(&self) -> Option<Range<ByteIndex>> {