mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +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 {
|
unsafe {
|
||||||
if self.get().is_text() {
|
if self.get().is_text() {
|
||||||
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
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() {
|
} else if self.get().is_htmlinputelement() {
|
||||||
let input: JS<HTMLInputElement> = self.get_jsmanaged().transmute_copy();
|
let input: JS<HTMLInputElement> = self.get_jsmanaged().transmute_copy();
|
||||||
input.get_value_for_layout()
|
input.get_value_for_layout()
|
||||||
|
@ -765,7 +765,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
Some(TextNodeTypeId) => {
|
Some(TextNodeTypeId) => {
|
||||||
unsafe {
|
unsafe {
|
||||||
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ use dom::node::{CommentNodeTypeId, Node, NodeTypeId, TextNodeTypeId, ProcessingI
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
|
|
||||||
use std::cell::{Ref, RefCell};
|
use std::cell::{Ref, RefCell};
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
@ -57,6 +58,12 @@ impl CharacterData {
|
||||||
pub fn set_data(&self, data: DOMString) {
|
pub fn set_data(&self, data: DOMString) {
|
||||||
*self.data.borrow_mut() = data;
|
*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> {
|
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue