Introduce <LayoutDom<Element>>::focus_state

This commit is contained in:
Anthony Ramine 2020-04-01 11:30:21 +02:00
parent 295f120425
commit 28e5abe606
3 changed files with 14 additions and 2 deletions

View file

@ -592,6 +592,18 @@ pub trait LayoutElementHelpers<'dom> {
fn get_attr_vals_for_layout(self, name: &LocalName) -> Vec<&'dom AttrValue>;
}
impl<'dom> LayoutDom<'dom, Element> {
#[allow(unsafe_code)]
pub(super) fn focus_state(self) -> bool {
unsafe {
self.unsafe_get()
.state
.get()
.contains(ElementState::IN_FOCUS_STATE)
}
}
}
impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
#[allow(unsafe_code)]
#[inline]