mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Use the browsing context from the document where appropriate.
This should not change behaviour.
This commit is contained in:
parent
7045056173
commit
f5b5079e2a
1 changed files with 6 additions and 9 deletions
|
@ -314,8 +314,10 @@ impl Document {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#fully-active
|
// https://html.spec.whatwg.org/multipage/#fully-active
|
||||||
pub fn is_fully_active(&self) -> bool {
|
pub fn is_fully_active(&self) -> bool {
|
||||||
let browsing_context = self.window.browsing_context();
|
let browsing_context = match self.browsing_context() {
|
||||||
let browsing_context = browsing_context.as_ref().unwrap();
|
Some(browsing_context) => browsing_context,
|
||||||
|
None => return false,
|
||||||
|
};
|
||||||
let active_document = browsing_context.active_document();
|
let active_document = browsing_context.active_document();
|
||||||
|
|
||||||
if self != &*active_document {
|
if self != &*active_document {
|
||||||
|
@ -1766,17 +1768,12 @@ impl DocumentMethods for Document {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-document-hasfocus
|
// https://html.spec.whatwg.org/multipage/#dom-document-hasfocus
|
||||||
fn HasFocus(&self) -> bool {
|
fn HasFocus(&self) -> bool {
|
||||||
// Step 1.
|
match self.browsing_context() {
|
||||||
let target = self;
|
|
||||||
let browsing_context = self.window.browsing_context();
|
|
||||||
let browsing_context = browsing_context.as_ref();
|
|
||||||
|
|
||||||
match browsing_context {
|
|
||||||
Some(browsing_context) => {
|
Some(browsing_context) => {
|
||||||
// Step 2.
|
// Step 2.
|
||||||
let candidate = browsing_context.active_document();
|
let candidate = browsing_context.active_document();
|
||||||
// Step 3.
|
// Step 3.
|
||||||
if &*candidate == target {
|
if &*candidate == self {
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false //TODO Step 4.
|
false //TODO Step 4.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue