aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/layout_thread/dom_wrapper.rs2
-rw-r--r--components/layout_thread_2020/dom_wrapper.rs2
-rw-r--r--components/script/dom/characterdata.rs9
-rw-r--r--components/script/dom/node.rs3
4 files changed, 7 insertions, 9 deletions
diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs
index f2ba0a6fafa..a0eb66a7fd8 100644
--- a/components/layout_thread/dom_wrapper.rs
+++ b/components/layout_thread/dom_wrapper.rs
@@ -828,7 +828,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
.dom_children()
.all(|node| match node.script_type_id() {
NodeTypeId::Element(..) => false,
- NodeTypeId::CharacterData(CharacterDataTypeId::Text(TextTypeId::Text)) => unsafe {
+ NodeTypeId::CharacterData(CharacterDataTypeId::Text(TextTypeId::Text)) => {
node.node.downcast().unwrap().data_for_layout().is_empty()
},
_ => true,
diff --git a/components/layout_thread_2020/dom_wrapper.rs b/components/layout_thread_2020/dom_wrapper.rs
index d8aa7b05360..c79aa891214 100644
--- a/components/layout_thread_2020/dom_wrapper.rs
+++ b/components/layout_thread_2020/dom_wrapper.rs
@@ -835,7 +835,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
.dom_children()
.all(|node| match node.script_type_id() {
NodeTypeId::Element(..) => false,
- NodeTypeId::CharacterData(CharacterDataTypeId::Text(TextTypeId::Text)) => unsafe {
+ NodeTypeId::CharacterData(CharacterDataTypeId::Text(TextTypeId::Text)) => {
node.node.downcast().unwrap().data_for_layout().is_empty()
},
_ => true,
diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs
index 4e0d32d4456..f8c5acb5a8f 100644
--- a/components/script/dom/characterdata.rs
+++ b/components/script/dom/characterdata.rs
@@ -280,16 +280,15 @@ impl CharacterDataMethods for CharacterData {
}
}
-#[allow(unsafe_code)]
pub trait LayoutCharacterDataHelpers<'dom> {
- unsafe fn data_for_layout(self) -> &'dom str;
+ fn data_for_layout(self) -> &'dom str;
}
-#[allow(unsafe_code)]
impl<'dom> LayoutCharacterDataHelpers<'dom> for LayoutDom<'dom, CharacterData> {
+ #[allow(unsafe_code)]
#[inline]
- unsafe fn data_for_layout(self) -> &'dom str {
- &(*self.unsafe_get()).data.borrow_for_layout()
+ fn data_for_layout(self) -> &'dom str {
+ unsafe { self.unsafe_get().data.borrow_for_layout() }
}
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 425e29d45f3..07b7d60cbe6 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -1456,10 +1456,9 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
val
}
- #[allow(unsafe_code)]
fn text_content(self) -> String {
if let Some(text) = self.downcast::<Text>() {
- return unsafe { text.upcast().data_for_layout().to_owned() };
+ return text.upcast().data_for_layout().to_owned();
}
if let Some(input) = self.downcast::<HTMLInputElement>() {