diff options
author | Anthony Ramine <nox@nox.paris> | 2020-03-31 14:58:56 +0200 |
---|---|---|
committer | Anthony Ramine <nox@nox.paris> | 2020-03-31 15:02:13 +0200 |
commit | 6fe294fa5bab1b0ccd80d6dfb53be85adfaec4ad (patch) | |
tree | 6a177fee39ac5ba1c3c2de58e3d11657b2044d2e /components/layout_2020/flow/construct.rs | |
parent | 409bd3d989c1877f8e0a5da92bd758dd20ac724b (diff) | |
download | servo-6fe294fa5bab1b0ccd80d6dfb53be85adfaec4ad.tar.gz servo-6fe294fa5bab1b0ccd80d6dfb53be85adfaec4ad.zip |
Make LayoutNodeHelpers::text_content return a cow
Diffstat (limited to 'components/layout_2020/flow/construct.rs')
-rw-r--r-- | components/layout_2020/flow/construct.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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<ComputedValues>) { + fn handle_text( + &mut self, + node: Node, + input: Cow<'dom, str>, + parent_style: &Arc<ComputedValues>, + ) { 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 |