mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Improve inter-document focus handling (#36649)
*Describe the changes that this pull request makes here. This will be the commit message.* rewritten the PR #28571 Implement [Window#focus](https://html.spec.whatwg.org/multipage/#dom-window-focus), [Window#blur](https://html.spec.whatwg.org/multipage/#dom-window-blur) Testing: WPT Fixes: #8981 #9421 --------- Signed-off-by: kongbai1996 <1782765876@qq.com> Co-authored-by: yvt <i@yvt.jp>
This commit is contained in:
parent
27570987fd
commit
0c0ee04b8e
33 changed files with 1123 additions and 242 deletions
|
@ -787,6 +787,32 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
doc.abort(can_gc);
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-focus>
|
||||
fn Focus(&self) {
|
||||
// > 1. Let `current` be this `Window` object's browsing context.
|
||||
// >
|
||||
// > 2. If `current` is null, then return.
|
||||
let current = match self.undiscarded_window_proxy() {
|
||||
Some(proxy) => proxy,
|
||||
None => return,
|
||||
};
|
||||
|
||||
// > 3. Run the focusing steps with `current`.
|
||||
current.focus();
|
||||
|
||||
// > 4. If current is a top-level browsing context, user agents are
|
||||
// > encouraged to trigger some sort of notification to indicate to
|
||||
// > the user that the page is attempting to gain focus.
|
||||
//
|
||||
// TODO: Step 4
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-window-blur
|
||||
fn Blur(&self) {
|
||||
// > User agents are encouraged to ignore calls to this `blur()` method
|
||||
// > entirely.
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-open
|
||||
fn Open(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue