Make LayoutNodeHelpers::text_content return a cow

This commit is contained in:
Anthony Ramine 2020-03-31 14:58:56 +02:00
parent 409bd3d989
commit 6fe294fa5b
7 changed files with 32 additions and 19 deletions

View file

@ -67,6 +67,7 @@ use selectors::sink::Push;
use servo_arc::{Arc, ArcBorrow};
use servo_atoms::Atom;
use servo_url::ServoUrl;
use std::borrow::Cow;
use std::fmt;
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
@ -1110,9 +1111,8 @@ impl<'ln> ThreadSafeLayoutNode<'ln> for ServoThreadSafeLayoutNode<'ln> {
self.node
}
fn node_text_content(&self) -> String {
let this = unsafe { self.get_jsmanaged() };
return this.text_content();
fn node_text_content(self) -> Cow<'ln, str> {
unsafe { self.get_jsmanaged().text_content() }
}
fn selection(&self) -> Option<Range<ByteIndex>> {