From 1039de8e7de73d69930849ec60ff22649af7f131 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 15 Jun 2016 08:45:28 +0100 Subject: [PATCH] Introduce a node_text_content method. --- components/layout/wrapper.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index f5d77472e70..ce360602525 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -949,6 +949,8 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Sized + PartialEq { /// FIXME(pcwalton): This might have too much copying and/or allocation. Profile this. fn text_content(&self) -> TextContent; + fn node_text_content(&self) -> String; + /// If the insertion point is within this node, returns it. Otherwise, returns `None`. fn selection(&self) -> Option>; @@ -1189,8 +1191,12 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> { }; } + return TextContent::Text(self.node_text_content()); + } + + fn node_text_content(&self) -> String { let this = unsafe { self.get_jsmanaged() }; - return TextContent::Text(this.text_content()); + return this.text_content(); } fn selection(&self) -> Option> {