mirror of
https://github.com/servo/servo.git
synced 2025-06-17 12:54:28 +00:00
Introduce LayoutDocumentHelpers::is_html_document_for_layout for LayoutElementHelpers::html_element_in_html_document_for_layout.
This commit is contained in:
parent
32bcc192b0
commit
d643ade7e8
2 changed files with 14 additions and 3 deletions
|
@ -311,6 +311,18 @@ pub enum DocumentSource {
|
|||
NotFromParser,
|
||||
}
|
||||
|
||||
pub trait LayoutDocumentHelpers {
|
||||
unsafe fn is_html_document_for_layout(&self) -> bool;
|
||||
}
|
||||
|
||||
impl LayoutDocumentHelpers for JS<Document> {
|
||||
#[allow(unrooted_must_root)]
|
||||
#[inline]
|
||||
unsafe fn is_html_document_for_layout(&self) -> bool {
|
||||
(*self.unsafe_get()).is_html_document
|
||||
}
|
||||
}
|
||||
|
||||
impl Document {
|
||||
fn new_inherited(window: JSRef<Window>,
|
||||
url: Option<Url>,
|
||||
|
|
|
@ -21,7 +21,7 @@ use dom::bindings::error::{ErrorResult, Fallible, NamespaceError, InvalidCharact
|
|||
use dom::bindings::utils::{QName, Name, InvalidXMLName, xml_name_type};
|
||||
use dom::domrect::DOMRect;
|
||||
use dom::domrectlist::DOMRectList;
|
||||
use dom::document::{Document, DocumentHelpers};
|
||||
use dom::document::{Document, DocumentHelpers, LayoutDocumentHelpers};
|
||||
use dom::domtokenlist::DOMTokenList;
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
|
@ -335,8 +335,7 @@ impl LayoutElementHelpers for JS<Element> {
|
|||
return false
|
||||
}
|
||||
let node: JS<Node> = self.transmute_copy();
|
||||
let owner_doc = node.owner_doc_for_layout().unsafe_get();
|
||||
(*owner_doc).is_html_document()
|
||||
node.owner_doc_for_layout().is_html_document_for_layout()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue