From 6fe294fa5bab1b0ccd80d6dfb53be85adfaec4ad Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 31 Mar 2020 14:58:56 +0200 Subject: Make LayoutNodeHelpers::text_content return a cow --- components/layout_2020/flow/construct.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'components/layout_2020/flow/construct.rs') diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs index fe9465f775e..186a4b4d4ff 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout_2020/flow/construct.rs @@ -16,6 +16,7 @@ use crate::style_ext::{ComputedValuesExt, DisplayGeneratingBox, DisplayInside, D use rayon::iter::{IntoParallelIterator, ParallelIterator}; use rayon_croissant::ParallelIteratorExt; use servo_arc::Arc; +use std::borrow::Cow; use std::convert::{TryFrom, TryInto}; use style::properties::ComputedValues; use style::selector_parser::PseudoElement; @@ -286,7 +287,12 @@ where } } - fn handle_text(&mut self, node: Node, input: String, parent_style: &Arc) { + fn handle_text( + &mut self, + node: Node, + input: Cow<'dom, str>, + parent_style: &Arc, + ) { let (leading_whitespace, mut input) = self.handle_leading_whitespace(&input); if leading_whitespace || !input.is_empty() { // This text node should be pushed either to the next ongoing -- cgit v1.2.3