mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Don't borrow CharacterData.data from layout.
This should fix the most frequent intermittent wpt failure.
This commit is contained in:
parent
fd70b366ae
commit
16e071168c
2 changed files with 9 additions and 2 deletions
|
@ -189,7 +189,7 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> {
|
|||
unsafe {
|
||||
if self.get().is_text() {
|
||||
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
||||
(*text.unsafe_get()).characterdata().data().clone()
|
||||
(*text.unsafe_get()).characterdata().data_for_layout().to_string()
|
||||
} else if self.get().is_htmlinputelement() {
|
||||
let input: JS<HTMLInputElement> = self.get_jsmanaged().transmute_copy();
|
||||
input.get_value_for_layout()
|
||||
|
@ -765,7 +765,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
Some(TextNodeTypeId) => {
|
||||
unsafe {
|
||||
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
||||
if !is_whitespace((*text.unsafe_get()).characterdata().data().as_slice()) {
|
||||
if !is_whitespace((*text.unsafe_get()).characterdata().data_for_layout()) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::node::{CommentNodeTypeId, Node, NodeTypeId, TextNodeTypeId, ProcessingI
|
|||
use servo_util::str::DOMString;
|
||||
|
||||
use std::cell::{Ref, RefCell};
|
||||
use std::mem;
|
||||
|
||||
#[jstraceable]
|
||||
#[must_root]
|
||||
|
@ -57,6 +58,12 @@ impl CharacterData {
|
|||
pub fn set_data(&self, data: DOMString) {
|
||||
*self.data.borrow_mut() = data;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn data_for_layout<'a>(&'a self) -> &'a str {
|
||||
mem::transmute::<&RefCell<DOMString>, &DOMString>(&self.data).as_slice()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue