servoshell: upgrade egui and related depenencies (#35353)

Also fix build errors resulting from the use of the type
`egui::Rounding` which is now renamed to `egui::CornerRadius`.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2025-02-07 11:39:08 +05:30 committed by GitHub
parent bbbff61840
commit 2ef12cf40f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 139 additions and 113 deletions

67
Cargo.lock generated
View file

@ -1602,11 +1602,11 @@ dependencies = [
[[package]] [[package]]
name = "directories" name = "directories"
version = "5.0.1" version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
dependencies = [ dependencies = [
"dirs-sys", "dirs-sys 0.5.0",
] ]
[[package]] [[package]]
@ -1615,7 +1615,7 @@ version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [ dependencies = [
"dirs-sys", "dirs-sys 0.4.1",
] ]
[[package]] [[package]]
@ -1626,10 +1626,22 @@ checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [ dependencies = [
"libc", "libc",
"option-ext", "option-ext",
"redox_users", "redox_users 0.4.6",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "dirs-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
"redox_users 0.5.0",
"windows-sys 0.59.0",
]
[[package]] [[package]]
name = "dispatch" name = "dispatch"
version = "0.2.0" version = "0.2.0"
@ -1740,9 +1752,9 @@ dependencies = [
[[package]] [[package]]
name = "ecolor" name = "ecolor"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d72e9c39f6e11a2e922d04a34ec5e7ef522ea3f5a1acfca7a19d16ad5fe50f5" checksum = "878e9005799dd739e5d5d89ff7480491c12d0af571d44399bcaefa1ee172dd76"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"emath", "emath",
@ -1750,11 +1762,12 @@ dependencies = [
[[package]] [[package]]
name = "egui" name = "egui"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "252d52224d35be1535d7fd1d6139ce071fb42c9097773e79f7665604f5596b5e" checksum = "7d2768eaa6d5c80a6e2a008da1f0e062dff3c83eb2b28605ea2d0732d46e74d6"
dependencies = [ dependencies = [
"ahash", "ahash",
"bitflags 2.8.0",
"emath", "emath",
"epaint", "epaint",
"log", "log",
@ -1764,9 +1777,9 @@ dependencies = [
[[package]] [[package]]
name = "egui-file-dialog" name = "egui-file-dialog"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac4167fcddb279f41863074b96b877c6e48c02d543b7d6111d1f3957b9a5874f" checksum = "bee10521c25a2fd1ef0d9568ef181087c7648165d61aa7e82f879f408d4c3b4e"
dependencies = [ dependencies = [
"directories", "directories",
"dunce", "dunce",
@ -1777,12 +1790,13 @@ dependencies = [
[[package]] [[package]]
name = "egui-winit" name = "egui-winit"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e84c2919cd9f3a38a91e8f84ac6a245c19251fd95226ed9fae61d5ea564fce3" checksum = "ace791b367c1f63e6044aef2f3834904509d1d1a6912fd23ebf3f6a9af92cd84"
dependencies = [ dependencies = [
"ahash", "ahash",
"arboard", "arboard",
"bytemuck",
"egui", "egui",
"log", "log",
"profiling", "profiling",
@ -1794,9 +1808,9 @@ dependencies = [
[[package]] [[package]]
name = "egui_glow" name = "egui_glow"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf6264cc7608e3e69a7d57a6175f438275f1b3889c1a551b418277721c95e6" checksum = "9a53e2374a964c3c793cb0b8ead81bca631f24974bc0b747d1a5622f4e39fdd0"
dependencies = [ dependencies = [
"ahash", "ahash",
"bytemuck", "bytemuck",
@ -1819,9 +1833,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]] [[package]]
name = "emath" name = "emath"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4fe73c1207b864ee40aa0b0c038d6092af1030744678c60188a05c28553515d" checksum = "55b7b6be5ad1d247f11738b0e4699d9c20005ed366f2c29f5ec1f8e1de180bc2"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
] ]
@ -1910,9 +1924,9 @@ dependencies = [
[[package]] [[package]]
name = "epaint" name = "epaint"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5666f8d25236293c966fbb3635eac18b04ad1914e3bab55bc7d44b9980cafcac" checksum = "275b665a7b9611d8317485187e5458750850f9e64604d3c58434bb3fc1d22915"
dependencies = [ dependencies = [
"ab_glyph", "ab_glyph",
"ahash", "ahash",
@ -1928,9 +1942,9 @@ dependencies = [
[[package]] [[package]]
name = "epaint_default_fonts" name = "epaint_default_fonts"
version = "0.30.0" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66f6ddac3e6ac6fd4c3d48bb8b1943472f8da0f43a4303bcd8a18aa594401c80" checksum = "9343d356d7cac894dacafc161b4654e0881301097bdf32a122ed503d97cb94b6"
[[package]] [[package]]
name = "equivalent" name = "equivalent"
@ -6008,6 +6022,17 @@ dependencies = [
"thiserror 1.0.69", "thiserror 1.0.69",
] ]
[[package]]
name = "redox_users"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
dependencies = [
"getrandom",
"libredox",
"thiserror 2.0.9",
]
[[package]] [[package]]
name = "ref_filter_map" name = "ref_filter_map"
version = "1.0.1" version = "1.0.1"

View file

@ -34,11 +34,11 @@ allow = [
"BSL-1.0", "BSL-1.0",
"CC0-1.0", "CC0-1.0",
"ISC", "ISC",
"LicenseRef-UFL-1.0", # No official SPDX, see https://github.com/emilk/egui/issues/2321.
"MIT", "MIT",
"MPL-2.0", "MPL-2.0",
"OpenSSL", "OpenSSL",
"OFL-1.1", "OFL-1.1",
"Ubuntu-font-1.0",
"Unicode-3.0", "Unicode-3.0",
"Zlib", "Zlib",
"zlib-acknowledgement", "zlib-acknowledgement",
@ -156,6 +156,10 @@ skip = [
"http", "http",
"http-body", "http-body",
"hyper", "hyper",
# duplicated by font-kit
"redox_users",
"dirs-sys",
] ]
# github.com organizations to allow git sources for # github.com organizations to allow git sources for

View file

@ -107,9 +107,9 @@ serde_json = { workspace = true }
servo_allocator = { path = "../../components/allocator" } servo_allocator = { path = "../../components/allocator" }
arboard = { version = "3" } arboard = { version = "3" }
dirs = "5.0" dirs = "5.0"
egui = { version = "0.30.0" } egui = { version = "0.31.0" }
egui_glow = { version = "0.30.0", features = ["winit"] } egui_glow = { version = "0.31.0", features = ["winit"] }
egui-winit = { version = "0.30.0", default-features = false, features = ["clipboard", "wayland"] } egui-winit = { version = "0.31.0", default-features = false, features = ["clipboard", "wayland"] }
gilrs = "0.11.0" gilrs = "0.11.0"
gleam = { workspace = true } gleam = { workspace = true }
glow = "0.16.0" glow = "0.16.0"
@ -122,7 +122,7 @@ serde_json = { workspace = true }
shellwords = "1.0.0" shellwords = "1.0.0"
surfman = { workspace = true, features = ["sm-x11", "sm-raw-window-handle-06"] } surfman = { workspace = true, features = ["sm-x11", "sm-raw-window-handle-06"] }
tinyfiledialogs = "3.0" tinyfiledialogs = "3.0"
egui-file-dialog = "0.8.0" egui-file-dialog = "0.9.0"
winit = "0.30.9" winit = "0.30.9"
[target.'cfg(any(all(target_os = "linux", not(target_env = "ohos")), target_os = "windows"))'.dependencies] [target.'cfg(any(all(target_os = "linux", not(target_env = "ohos")), target_os = "windows"))'.dependencies]

View file

@ -69,13 +69,13 @@ impl Dialog {
match state { match state {
DialogState::Open => true, DialogState::Open => true,
DialogState::Selected(path) => { DialogState::Picked(path) => {
if let Err(e) = dialog.response_sender.send(Some(vec![path])) { if let Err(e) = dialog.response_sender.send(Some(vec![path])) {
warn!("Failed to send file selection response: {}", e); warn!("Failed to send file selection response: {}", e);
} }
false false
}, },
DialogState::SelectedMultiple(paths) => { DialogState::PickedMultiple(paths) => {
if let Err(e) = dialog.response_sender.send(Some(paths)) { if let Err(e) = dialog.response_sender.send(Some(paths)) {
warn!("Failed to send file selection response: {}", e); warn!("Failed to send file selection response: {}", e);
} }

View file

@ -211,15 +211,15 @@ impl Minibrowser {
visuals.widgets.hovered.expansion = 0.0; visuals.widgets.hovered.expansion = 0.0;
// The rounding is changed so it looks as though the 2 widgets are a single widget // The rounding is changed so it looks as though the 2 widgets are a single widget
// with a uniform rounding // with a uniform rounding
let rounding = egui::Rounding { let corner_radius = egui::CornerRadius {
ne: 0.0, ne: 0,
nw: 4.0, nw: 4,
sw: 4.0, sw: 4,
se: 0.0, se: 0,
}; };
visuals.widgets.active.rounding = rounding; visuals.widgets.active.corner_radius = corner_radius;
visuals.widgets.hovered.rounding = rounding; visuals.widgets.hovered.corner_radius = corner_radius;
visuals.widgets.inactive.rounding = rounding; visuals.widgets.inactive.corner_radius = corner_radius;
let selected = webview.focused(); let selected = webview.focused();
let tab = ui.add(SelectableLabel::new( let tab = ui.add(SelectableLabel::new(
@ -230,16 +230,16 @@ impl Minibrowser {
ui.label(label); ui.label(label);
}); });
let rounding = egui::Rounding { let corner_radius = egui::CornerRadius {
ne: 4.0, ne: 4,
nw: 0.0, nw: 0,
sw: 0.0, sw: 0,
se: 4.0, se: 4,
}; };
let visuals = ui.visuals_mut(); let visuals = ui.visuals_mut();
visuals.widgets.active.rounding = rounding; visuals.widgets.active.corner_radius = corner_radius;
visuals.widgets.hovered.rounding = rounding; visuals.widgets.hovered.corner_radius = corner_radius;
visuals.widgets.inactive.rounding = rounding; visuals.widgets.inactive.corner_radius = corner_radius;
let fill_color = if selected || tab.hovered() { let fill_color = if selected || tab.hovered() {
active_bg_color active_bg_color
@ -386,80 +386,77 @@ impl Minibrowser {
let Some(webview) = state.focused_webview() else { let Some(webview) = state.focused_webview() else {
return; return;
}; };
CentralPanel::default() CentralPanel::default().frame(Frame::NONE).show(ctx, |ui| {
.frame(Frame::none()) let Pos2 { x, y } = ui.cursor().min;
.show(ctx, |ui| { let Vec2 {
let Pos2 { x, y } = ui.cursor().min; x: width,
let Vec2 { y: height,
x: width, } = ui.available_size();
y: height, let rect =
} = ui.available_size(); Box2D::from_origin_and_size(Point2D::new(x, y), Size2D::new(width, height)) *
let rect = Box2D::from_origin_and_size( scale;
Point2D::new(x, y), if rect != webview.rect() {
Size2D::new(width, height), webview.move_resize(rect);
) * scale; }
if rect != webview.rect() { let min = ui.cursor().min;
webview.move_resize(rect); let size = ui.available_size();
} let rect = egui::Rect::from_min_size(min, size);
let min = ui.cursor().min; ui.allocate_space(size);
let size = ui.available_size();
let rect = egui::Rect::from_min_size(min, size);
ui.allocate_space(size);
let Some(servo_fbo) = servo_framebuffer_id else { let Some(servo_fbo) = servo_framebuffer_id else {
return; return;
}; };
if let Some(status_text) = &self.status_text { if let Some(status_text) = &self.status_text {
egui::containers::popup::show_tooltip_at( egui::containers::popup::show_tooltip_at(
ctx, ctx,
ui.layer_id(), ui.layer_id(),
"tooltip layer".into(), "tooltip layer".into(),
pos2(0.0, ctx.available_rect().max.y), pos2(0.0, ctx.available_rect().max.y),
|ui| ui.add(Label::new(status_text.clone()).extend()), |ui| ui.add(Label::new(status_text.clone()).extend()),
); );
} }
ui.painter().add(PaintCallback { ui.painter().add(PaintCallback {
rect, rect,
callback: Arc::new(CallbackFn::new(move |info, painter| { callback: Arc::new(CallbackFn::new(move |info, painter| {
use glow::HasContext as _; use glow::HasContext as _;
let clip = info.viewport_in_pixels(); let clip = info.viewport_in_pixels();
let x = clip.left_px as gl::GLint; let x = clip.left_px as gl::GLint;
let y = clip.from_bottom_px as gl::GLint; let y = clip.from_bottom_px as gl::GLint;
let width = clip.width_px as gl::GLsizei; let width = clip.width_px as gl::GLsizei;
let height = clip.height_px as gl::GLsizei; let height = clip.height_px as gl::GLsizei;
unsafe { unsafe {
painter.gl().clear_color(0.0, 0.0, 0.0, 0.0); painter.gl().clear_color(0.0, 0.0, 0.0, 0.0);
painter.gl().scissor(x, y, width, height); painter.gl().scissor(x, y, width, height);
painter.gl().enable(gl::SCISSOR_TEST); painter.gl().enable(gl::SCISSOR_TEST);
painter.gl().clear(gl::COLOR_BUFFER_BIT); painter.gl().clear(gl::COLOR_BUFFER_BIT);
painter.gl().disable(gl::SCISSOR_TEST); painter.gl().disable(gl::SCISSOR_TEST);
let servo_fbo = NonZeroU32::new(servo_fbo).map(NativeFramebuffer); let servo_fbo = NonZeroU32::new(servo_fbo).map(NativeFramebuffer);
painter painter
.gl() .gl()
.bind_framebuffer(gl::READ_FRAMEBUFFER, servo_fbo); .bind_framebuffer(gl::READ_FRAMEBUFFER, servo_fbo);
painter painter
.gl() .gl()
.bind_framebuffer(gl::DRAW_FRAMEBUFFER, widget_fbo); .bind_framebuffer(gl::DRAW_FRAMEBUFFER, widget_fbo);
painter.gl().blit_framebuffer( painter.gl().blit_framebuffer(
x, x,
y, y,
x + width, x + width,
y + height, y + height,
x, x,
y, y,
x + width, x + width,
y + height, y + height,
gl::COLOR_BUFFER_BIT, gl::COLOR_BUFFER_BIT,
gl::NEAREST, gl::NEAREST,
); );
painter.gl().bind_framebuffer(gl::FRAMEBUFFER, widget_fbo); painter.gl().bind_framebuffer(gl::FRAMEBUFFER, widget_fbo);
} }
})), })),
});
}); });
});
*last_update = now; *last_update = now;
}); });