mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Return a reference in BrowserContext::active_document()
This commit is contained in:
parent
6c7f37061b
commit
1f31d5b856
3 changed files with 5 additions and 6 deletions
|
@ -44,13 +44,12 @@ impl BrowsingContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn active_document(&self) -> Root<Document> {
|
||||
self.history[self.active_index].document.root()
|
||||
pub fn active_document(&self) -> &Document {
|
||||
&*self.history[self.active_index].document
|
||||
}
|
||||
|
||||
pub fn active_window(&self) -> Root<Window> {
|
||||
let doc = self.active_document();
|
||||
doc.r().window()
|
||||
self.active_document().window()
|
||||
}
|
||||
|
||||
pub fn frame_element(&self) -> Option<Root<Element>> {
|
||||
|
|
|
@ -254,7 +254,7 @@ impl Document {
|
|||
let browsing_context = browsing_context.as_ref().unwrap();
|
||||
let active_document = browsing_context.active_document();
|
||||
|
||||
if self != active_document.r() {
|
||||
if self != active_document {
|
||||
return false;
|
||||
}
|
||||
// FIXME: It should also check whether the browser context is top-level or not
|
||||
|
|
|
@ -381,7 +381,7 @@ impl WindowMethods for Window {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-document-0
|
||||
fn Document(&self) -> Root<Document> {
|
||||
self.browsing_context().as_ref().unwrap().active_document()
|
||||
Root::from_ref(self.browsing_context().as_ref().unwrap().active_document())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue