aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface
diff options
context:
space:
mode:
authorbors-servo <servo-ops@mozilla.com>2020-03-31 10:51:18 -0400
committerGitHub <noreply@github.com>2020-03-31 10:51:18 -0400
commit3aa15e3fa30194e465c8bbb21c07d5239a6ac9f8 (patch)
treebd64feee4c1f3d5861f5714b032dd3a52fd2aa70 /components/script_layout_interface
parent09271826f6a771cace1755dd18794d7085fccbd3 (diff)
parentfb1ff3f097c0c8a994c9e7c4bb72c3ba5b64492d (diff)
downloadservo-3aa15e3fa30194e465c8bbb21c07d5239a6ac9f8.tar.gz
servo-3aa15e3fa30194e465c8bbb21c07d5239a6ac9f8.zip
Auto merge of #26070 - servo:layout-2020-more-cleanups, r=SimonSapin
Make LayoutNodeHelpers::text_content return a cow What does it mean? It means that layout can process `Text` nodes' contents by just borrowing them, potentially saving us from a lot of unnecessary tempoorary allocations, which is nice.
Diffstat (limited to 'components/script_layout_interface')
-rw-r--r--components/script_layout_interface/wrapper_traits.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index 67b107a86d7..462d11f2c7e 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -17,6 +17,7 @@ use net_traits::image::base::{Image, ImageMetadata};
use range::Range;
use servo_arc::Arc;
use servo_url::ServoUrl;
+use std::borrow::Cow;
use std::fmt::Debug;
use std::sync::Arc as StdArc;
use style::attr::AttrValue;
@@ -262,7 +263,7 @@ pub trait ThreadSafeLayoutNode<'dom>:
/// data flags, and we have this annoying trait separation between script and layout :-(
unsafe fn unsafe_get(self) -> Self::ConcreteNode;
- fn node_text_content(&self) -> String;
+ fn node_text_content(self) -> Cow<'dom, str>;
/// If the insertion point is within this node, returns it. Otherwise, returns `None`.
fn selection(&self) -> Option<Range<ByteIndex>>;