servoshell: fix gap between minibrowser toolbar and webview (#31774)

This commit is contained in:
Delan Azabani 2024-03-20 19:11:51 +08:00 committed by GitHub
parent 02a0cdd6fa
commit 94d2f2183a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,7 +142,6 @@ impl Minibrowser {
} = self; } = self;
let widget_fbo = *widget_surface_fbo; let widget_fbo = *widget_surface_fbo;
let _duration = context.run(window, |ctx| { let _duration = context.run(window, |ctx| {
let InnerResponse { inner: height, .. } =
TopBottomPanel::top("toolbar").show(ctx, |ui| { TopBottomPanel::top("toolbar").show(ctx, |ui| {
ui.allocate_ui_with_layout( ui.allocate_ui_with_layout(
ui.available_size(), ui.available_size(),
@ -171,9 +170,7 @@ impl Minibrowser {
if location_field.changed() { if location_field.changed() {
location_dirty.set(true); location_dirty.set(true);
} }
if ui.input(|i| { if ui.input(|i| i.clone().consume_key(Modifiers::COMMAND, Key::L)) {
i.clone().consume_key(Modifiers::COMMAND, Key::L)
}) {
location_field.request_focus(); location_field.request_focus();
} }
if location_field.lost_focus() && if location_field.lost_focus() &&
@ -186,9 +183,12 @@ impl Minibrowser {
); );
}, },
); );
ui.cursor().min.y
}); });
*toolbar_height = Length::new(height);
// The toolbar height is where the Contexts available rect starts.
// For reasons that are unclear, the TopBottomPanels ui cursor exceeds this by one egui
// point, but the Context is correct and the TopBottomPanel is wrong.
*toolbar_height = Length::new(ctx.available_rect().min.y);
CentralPanel::default() CentralPanel::default()
.frame(Frame::none()) .frame(Frame::none())