diff options
author | Mukilan Thiyagarajan <mukilan@igalia.com> | 2025-02-07 11:39:08 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-07 06:09:08 +0000 |
commit | 2ef12cf40f8173a2da6810fc8afe11e9f6781aef (patch) | |
tree | 70dec3d15df1d1f6e3e83e9cd0764c7b2b04fedd | |
parent | bbbff61840e87d82ba9e143f7c93505dde83a58b (diff) | |
download | servo-2ef12cf40f8173a2da6810fc8afe11e9f6781aef.tar.gz servo-2ef12cf40f8173a2da6810fc8afe11e9f6781aef.zip |
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>
-rw-r--r-- | Cargo.lock | 67 | ||||
-rw-r--r-- | deny.toml | 6 | ||||
-rw-r--r-- | ports/servoshell/Cargo.toml | 8 | ||||
-rw-r--r-- | ports/servoshell/desktop/dialog.rs | 4 | ||||
-rw-r--r-- | ports/servoshell/desktop/minibrowser.rs | 175 |
5 files changed, 143 insertions, 117 deletions
diff --git a/Cargo.lock b/Cargo.lock index 652ef211e18..92365f0b191 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1602,11 +1602,11 @@ dependencies = [ [[package]] name = "directories" -version = "5.0.1" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" dependencies = [ - "dirs-sys", + "dirs-sys 0.5.0", ] [[package]] @@ -1615,7 +1615,7 @@ version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ - "dirs-sys", + "dirs-sys 0.4.1", ] [[package]] @@ -1626,11 +1626,23 @@ checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", "option-ext", - "redox_users", + "redox_users 0.4.6", "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]] name = "dispatch" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1740,9 +1752,9 @@ dependencies = [ [[package]] name = "ecolor" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d72e9c39f6e11a2e922d04a34ec5e7ef522ea3f5a1acfca7a19d16ad5fe50f5" +checksum = "878e9005799dd739e5d5d89ff7480491c12d0af571d44399bcaefa1ee172dd76" dependencies = [ "bytemuck", "emath", @@ -1750,11 +1762,12 @@ dependencies = [ [[package]] name = "egui" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "252d52224d35be1535d7fd1d6139ce071fb42c9097773e79f7665604f5596b5e" +checksum = "7d2768eaa6d5c80a6e2a008da1f0e062dff3c83eb2b28605ea2d0732d46e74d6" dependencies = [ "ahash", + "bitflags 2.8.0", "emath", "epaint", "log", @@ -1764,9 +1777,9 @@ dependencies = [ [[package]] name = "egui-file-dialog" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4167fcddb279f41863074b96b877c6e48c02d543b7d6111d1f3957b9a5874f" +checksum = "bee10521c25a2fd1ef0d9568ef181087c7648165d61aa7e82f879f408d4c3b4e" dependencies = [ "directories", "dunce", @@ -1777,12 +1790,13 @@ dependencies = [ [[package]] name = "egui-winit" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e84c2919cd9f3a38a91e8f84ac6a245c19251fd95226ed9fae61d5ea564fce3" +checksum = "ace791b367c1f63e6044aef2f3834904509d1d1a6912fd23ebf3f6a9af92cd84" dependencies = [ "ahash", "arboard", + "bytemuck", "egui", "log", "profiling", @@ -1794,9 +1808,9 @@ dependencies = [ [[package]] name = "egui_glow" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eaf6264cc7608e3e69a7d57a6175f438275f1b3889c1a551b418277721c95e6" +checksum = "9a53e2374a964c3c793cb0b8ead81bca631f24974bc0b747d1a5622f4e39fdd0" dependencies = [ "ahash", "bytemuck", @@ -1819,9 +1833,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "emath" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fe73c1207b864ee40aa0b0c038d6092af1030744678c60188a05c28553515d" +checksum = "55b7b6be5ad1d247f11738b0e4699d9c20005ed366f2c29f5ec1f8e1de180bc2" dependencies = [ "bytemuck", ] @@ -1910,9 +1924,9 @@ dependencies = [ [[package]] name = "epaint" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5666f8d25236293c966fbb3635eac18b04ad1914e3bab55bc7d44b9980cafcac" +checksum = "275b665a7b9611d8317485187e5458750850f9e64604d3c58434bb3fc1d22915" dependencies = [ "ab_glyph", "ahash", @@ -1928,9 +1942,9 @@ dependencies = [ [[package]] name = "epaint_default_fonts" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66f6ddac3e6ac6fd4c3d48bb8b1943472f8da0f43a4303bcd8a18aa594401c80" +checksum = "9343d356d7cac894dacafc161b4654e0881301097bdf32a122ed503d97cb94b6" [[package]] name = "equivalent" @@ -6009,6 +6023,17 @@ dependencies = [ ] [[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]] name = "ref_filter_map" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/deny.toml b/deny.toml index c380877b568..80b5fe2d57d 100644 --- a/deny.toml +++ b/deny.toml @@ -34,11 +34,11 @@ allow = [ "BSL-1.0", "CC0-1.0", "ISC", - "LicenseRef-UFL-1.0", # No official SPDX, see https://github.com/emilk/egui/issues/2321. "MIT", "MPL-2.0", "OpenSSL", "OFL-1.1", + "Ubuntu-font-1.0", "Unicode-3.0", "Zlib", "zlib-acknowledgement", @@ -156,6 +156,10 @@ skip = [ "http", "http-body", "hyper", + + # duplicated by font-kit + "redox_users", + "dirs-sys", ] # github.com organizations to allow git sources for diff --git a/ports/servoshell/Cargo.toml b/ports/servoshell/Cargo.toml index daee196334c..396ef64cc0b 100644 --- a/ports/servoshell/Cargo.toml +++ b/ports/servoshell/Cargo.toml @@ -107,9 +107,9 @@ serde_json = { workspace = true } servo_allocator = { path = "../../components/allocator" } arboard = { version = "3" } dirs = "5.0" -egui = { version = "0.30.0" } -egui_glow = { version = "0.30.0", features = ["winit"] } -egui-winit = { version = "0.30.0", default-features = false, features = ["clipboard", "wayland"] } +egui = { version = "0.31.0" } +egui_glow = { version = "0.31.0", features = ["winit"] } +egui-winit = { version = "0.31.0", default-features = false, features = ["clipboard", "wayland"] } gilrs = "0.11.0" gleam = { workspace = true } glow = "0.16.0" @@ -122,7 +122,7 @@ serde_json = { workspace = true } shellwords = "1.0.0" surfman = { workspace = true, features = ["sm-x11", "sm-raw-window-handle-06"] } tinyfiledialogs = "3.0" -egui-file-dialog = "0.8.0" +egui-file-dialog = "0.9.0" winit = "0.30.9" [target.'cfg(any(all(target_os = "linux", not(target_env = "ohos")), target_os = "windows"))'.dependencies] diff --git a/ports/servoshell/desktop/dialog.rs b/ports/servoshell/desktop/dialog.rs index e50893f45c7..68aa3ca5356 100644 --- a/ports/servoshell/desktop/dialog.rs +++ b/ports/servoshell/desktop/dialog.rs @@ -69,13 +69,13 @@ impl Dialog { match state { DialogState::Open => true, - DialogState::Selected(path) => { + DialogState::Picked(path) => { if let Err(e) = dialog.response_sender.send(Some(vec![path])) { warn!("Failed to send file selection response: {}", e); } false }, - DialogState::SelectedMultiple(paths) => { + DialogState::PickedMultiple(paths) => { if let Err(e) = dialog.response_sender.send(Some(paths)) { warn!("Failed to send file selection response: {}", e); } diff --git a/ports/servoshell/desktop/minibrowser.rs b/ports/servoshell/desktop/minibrowser.rs index d7687cd431a..31c4f5c6688 100644 --- a/ports/servoshell/desktop/minibrowser.rs +++ b/ports/servoshell/desktop/minibrowser.rs @@ -211,15 +211,15 @@ impl Minibrowser { visuals.widgets.hovered.expansion = 0.0; // The rounding is changed so it looks as though the 2 widgets are a single widget // with a uniform rounding - let rounding = egui::Rounding { - ne: 0.0, - nw: 4.0, - sw: 4.0, - se: 0.0, + let corner_radius = egui::CornerRadius { + ne: 0, + nw: 4, + sw: 4, + se: 0, }; - visuals.widgets.active.rounding = rounding; - visuals.widgets.hovered.rounding = rounding; - visuals.widgets.inactive.rounding = rounding; + visuals.widgets.active.corner_radius = corner_radius; + visuals.widgets.hovered.corner_radius = corner_radius; + visuals.widgets.inactive.corner_radius = corner_radius; let selected = webview.focused(); let tab = ui.add(SelectableLabel::new( @@ -230,16 +230,16 @@ impl Minibrowser { ui.label(label); }); - let rounding = egui::Rounding { - ne: 4.0, - nw: 0.0, - sw: 0.0, - se: 4.0, + let corner_radius = egui::CornerRadius { + ne: 4, + nw: 0, + sw: 0, + se: 4, }; let visuals = ui.visuals_mut(); - visuals.widgets.active.rounding = rounding; - visuals.widgets.hovered.rounding = rounding; - visuals.widgets.inactive.rounding = rounding; + visuals.widgets.active.corner_radius = corner_radius; + visuals.widgets.hovered.corner_radius = corner_radius; + visuals.widgets.inactive.corner_radius = corner_radius; let fill_color = if selected || tab.hovered() { active_bg_color @@ -386,80 +386,77 @@ impl Minibrowser { let Some(webview) = state.focused_webview() else { return; }; - CentralPanel::default() - .frame(Frame::none()) - .show(ctx, |ui| { - let Pos2 { x, y } = ui.cursor().min; - let Vec2 { - x: width, - y: height, - } = ui.available_size(); - let rect = Box2D::from_origin_and_size( - Point2D::new(x, y), - Size2D::new(width, height), - ) * scale; - if rect != webview.rect() { - webview.move_resize(rect); - } - let min = ui.cursor().min; - 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 { - return; - }; - - if let Some(status_text) = &self.status_text { - egui::containers::popup::show_tooltip_at( - ctx, - ui.layer_id(), - "tooltip layer".into(), - pos2(0.0, ctx.available_rect().max.y), - |ui| ui.add(Label::new(status_text.clone()).extend()), - ); - } - - ui.painter().add(PaintCallback { - rect, - callback: Arc::new(CallbackFn::new(move |info, painter| { - use glow::HasContext as _; - let clip = info.viewport_in_pixels(); - let x = clip.left_px as gl::GLint; - let y = clip.from_bottom_px as gl::GLint; - let width = clip.width_px as gl::GLsizei; - let height = clip.height_px as gl::GLsizei; - unsafe { - painter.gl().clear_color(0.0, 0.0, 0.0, 0.0); - painter.gl().scissor(x, y, width, height); - painter.gl().enable(gl::SCISSOR_TEST); - painter.gl().clear(gl::COLOR_BUFFER_BIT); - painter.gl().disable(gl::SCISSOR_TEST); - - let servo_fbo = NonZeroU32::new(servo_fbo).map(NativeFramebuffer); - painter - .gl() - .bind_framebuffer(gl::READ_FRAMEBUFFER, servo_fbo); - painter - .gl() - .bind_framebuffer(gl::DRAW_FRAMEBUFFER, widget_fbo); - painter.gl().blit_framebuffer( - x, - y, - x + width, - y + height, - x, - y, - x + width, - y + height, - gl::COLOR_BUFFER_BIT, - gl::NEAREST, - ); - painter.gl().bind_framebuffer(gl::FRAMEBUFFER, widget_fbo); - } - })), - }); + CentralPanel::default().frame(Frame::NONE).show(ctx, |ui| { + let Pos2 { x, y } = ui.cursor().min; + let Vec2 { + x: width, + y: height, + } = ui.available_size(); + let rect = + Box2D::from_origin_and_size(Point2D::new(x, y), Size2D::new(width, height)) * + scale; + if rect != webview.rect() { + webview.move_resize(rect); + } + let min = ui.cursor().min; + 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 { + return; + }; + + if let Some(status_text) = &self.status_text { + egui::containers::popup::show_tooltip_at( + ctx, + ui.layer_id(), + "tooltip layer".into(), + pos2(0.0, ctx.available_rect().max.y), + |ui| ui.add(Label::new(status_text.clone()).extend()), + ); + } + + ui.painter().add(PaintCallback { + rect, + callback: Arc::new(CallbackFn::new(move |info, painter| { + use glow::HasContext as _; + let clip = info.viewport_in_pixels(); + let x = clip.left_px as gl::GLint; + let y = clip.from_bottom_px as gl::GLint; + let width = clip.width_px as gl::GLsizei; + let height = clip.height_px as gl::GLsizei; + unsafe { + painter.gl().clear_color(0.0, 0.0, 0.0, 0.0); + painter.gl().scissor(x, y, width, height); + painter.gl().enable(gl::SCISSOR_TEST); + painter.gl().clear(gl::COLOR_BUFFER_BIT); + painter.gl().disable(gl::SCISSOR_TEST); + + let servo_fbo = NonZeroU32::new(servo_fbo).map(NativeFramebuffer); + painter + .gl() + .bind_framebuffer(gl::READ_FRAMEBUFFER, servo_fbo); + painter + .gl() + .bind_framebuffer(gl::DRAW_FRAMEBUFFER, widget_fbo); + painter.gl().blit_framebuffer( + x, + y, + x + width, + y + height, + x, + y, + x + width, + y + height, + gl::COLOR_BUFFER_BIT, + gl::NEAREST, + ); + painter.gl().bind_framebuffer(gl::FRAMEBUFFER, widget_fbo); + } + })), }); + }); *last_update = now; }); |