mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +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
|
@ -620,6 +620,23 @@ impl WindowProxy {
|
|||
result
|
||||
}
|
||||
|
||||
/// Run [the focusing steps] with this browsing context.
|
||||
///
|
||||
/// [the focusing steps]: https://html.spec.whatwg.org/multipage/#focusing-steps
|
||||
pub fn focus(&self) {
|
||||
debug!(
|
||||
"Requesting the constellation to initiate a focus operation for \
|
||||
browsing context {}",
|
||||
self.browsing_context_id()
|
||||
);
|
||||
self.global()
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptToConstellationMessage::FocusRemoteDocument(
|
||||
self.browsing_context_id(),
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
/// Change the Window that this WindowProxy resolves to.
|
||||
// TODO: support setting the window proxy to a dummy value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue