aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2015-11-23 10:42:04 -0500
committerMs2ger <Ms2ger@gmail.com>2016-02-20 18:47:11 +0100
commitf5b5079e2a01113492e76da61d0bf27488d8a6f4 (patch)
tree9f0cc7be09ac254b63a4c97717ad41f30a0c1af0
parent704505617399f040b0ca10eb1d06dde2811937c0 (diff)
downloadservo-f5b5079e2a01113492e76da61d0bf27488d8a6f4.tar.gz
servo-f5b5079e2a01113492e76da61d0bf27488d8a6f4.zip
Use the browsing context from the document where appropriate.
This should not change behaviour.
-rw-r--r--components/script/dom/document.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 9fdff62aabb..7a1ce36e5e4 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -314,8 +314,10 @@ impl Document {
// https://html.spec.whatwg.org/multipage/#fully-active
pub fn is_fully_active(&self) -> bool {
- let browsing_context = self.window.browsing_context();
- let browsing_context = browsing_context.as_ref().unwrap();
+ let browsing_context = match self.browsing_context() {
+ Some(browsing_context) => browsing_context,
+ None => return false,
+ };
let active_document = browsing_context.active_document();
if self != &*active_document {
@@ -1766,17 +1768,12 @@ impl DocumentMethods for Document {
// https://html.spec.whatwg.org/multipage/#dom-document-hasfocus
fn HasFocus(&self) -> bool {
- // Step 1.
- let target = self;
- let browsing_context = self.window.browsing_context();
- let browsing_context = browsing_context.as_ref();
-
- match browsing_context {
+ match self.browsing_context() {
Some(browsing_context) => {
// Step 2.
let candidate = browsing_context.active_document();
// Step 3.
- if &*candidate == target {
+ if &*candidate == self {
true
} else {
false //TODO Step 4.