mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Introduce <LayoutDom<Element>>::attrs()
This safe method is the basic block to access element attributes from layout. We reuse it in the other attr-related layout methods to remove a pretty big source of rampant unsafe code between script and layout.
This commit is contained in:
parent
0bda174823
commit
5ff931d171
16 changed files with 203 additions and 301 deletions
|
@ -730,13 +730,11 @@ impl<'dom> LayoutHTMLInputElementHelpers<'dom> for LayoutDom<'dom, HTMLInputElem
|
|||
input: LayoutDom<'dom, HTMLInputElement>,
|
||||
default: &'static str,
|
||||
) -> Cow<'dom, str> {
|
||||
unsafe {
|
||||
input
|
||||
.upcast::<Element>()
|
||||
.get_attr_val_for_layout(&ns!(), &local_name!("value"))
|
||||
.unwrap_or(default)
|
||||
.into()
|
||||
}
|
||||
input
|
||||
.upcast::<Element>()
|
||||
.get_attr_val_for_layout(&ns!(), &local_name!("value"))
|
||||
.unwrap_or(default)
|
||||
.into()
|
||||
}
|
||||
|
||||
let placeholder = unsafe { &**self.unsafe_get().placeholder.borrow_for_layout() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue