minibrowser: Disables urlbar when in fullscreen (#32425)

* minibrowser: Disables urlbar when in fullscreen

Signed-off-by: Nylme <nylme@protonmail.com>

* Added a TODO to minibrowser about: "Hiding URL bar in fullscreen is a phishing risk"

Signed-off-by: Nylme <nylme@protonmail.com>

* Ran ./mach fmt

Signed-off-by: Nylme <nylme@protonmail.com>

* Fixed typo.

Signed-off-by: Nylme <nylme@protonmail.com>

* Fixed `./mach tidy-test` failing for reason: "Line is longer than 120 characters" on a comment.
And deleted an unecessary comment.

Signed-off-by: Nylme <nylme@protonmail.com>

---------

Signed-off-by: Nylme <nylme@protonmail.com>
This commit is contained in:
Nylme 2024-06-12 08:53:56 +00:00 committed by GitHub
parent b4e41d8727
commit 699f6960f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -171,6 +171,9 @@ impl Minibrowser {
} = self;
let widget_fbo = *widget_surface_fbo;
let _duration = context.run(window, |ctx| {
// TODO: While in fullscreen add some way to mitigate the increased phishing risk
// when not displaying the URL bar: https://github.com/servo/servo/issues/32443
if !window.fullscreen().is_some() {
TopBottomPanel::top("toolbar").show(ctx, |ui| {
ui.allocate_ui_with_layout(
ui.available_size(),
@ -209,7 +212,9 @@ impl Minibrowser {
if location_field.changed() {
location_dirty.set(true);
}
if ui.input(|i| i.clone().consume_key(Modifiers::COMMAND, Key::L)) {
if ui.input(|i| {
i.clone().consume_key(Modifiers::COMMAND, Key::L)
}) {
location_field.request_focus();
}
if location_field.lost_focus() &&
@ -223,6 +228,7 @@ impl Minibrowser {
},
);
});
};
// The toolbar height is where the Contexts available rect starts.
// For reasons that are unclear, the TopBottomPanels ui cursor exceeds this by one egui