aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow/construct.rs
diff options
context:
space:
mode:
authorAnthony Ramine <nox@nox.paris>2020-03-31 14:58:56 +0200
committerAnthony Ramine <nox@nox.paris>2020-03-31 15:02:13 +0200
commit6fe294fa5bab1b0ccd80d6dfb53be85adfaec4ad (patch)
tree6a177fee39ac5ba1c3c2de58e3d11657b2044d2e /components/layout_2020/flow/construct.rs
parent409bd3d989c1877f8e0a5da92bd758dd20ac724b (diff)
downloadservo-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.rs8
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