E544 servoshell: Display favicons in tab bar by simonwuelker · Pull Request #36680 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content

Conversation

simonwuelker
Copy link
Contributor

Before:
image

After:
image

This PR moves the favicon, title and close button into a single egui Frame. Doing this allows us to get rid of some of the previous layout magic (like setting a border radius on the left corners of the label and the right corners of the button so they appear as one widget). It also ensures that the tab is highlighted when the close button (not the label) is hovered.

@simonwuelker simonwuelker requested a review from atbrakhi as a code owner April 24, 2025 12:21
@simonwuelker simonwuelker changed the title Display favicons in servoshell tab bar servoshell: Display favicons in tab bar Apr 24, 2025
@simonwuelker simonwuelker force-pushed the favicons branch 2 times, most recently from b394531 to 35bbadb Compare April 24, 2025 12:46
egui_extras = { version = "0.31", features = ["all_loaders"] }
egui_glow = { version = "0.31.1", features = ["winit"] }
egui-winit = { version = "0.31.1", default-features = false, features = ["clipboard", "wayland"] }
egui-winit = { version = "0.31.1", default-features = false, features = ["clipboard", "wayland"] } #
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
egui-winit = { version = "0.31.1", default-features = false, features = ["clipboard", "wayland"] } #
egui-winit = { version = "0.31.1", default-features = false, features = ["clipboard", "wayland"] }


if let Some(favicon_url) = webview.favicon_url() {
tab_frame.content_ui.add(
egui::Image::new(favicon_url.to_string())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do under the hood? Does egui have a networking stack? I'm ok with that in the short term, but we should make it possible for the engine to fetch the icon and the embedder to use the cached response body instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the plan is that eventually the WebView API should expose the favicon as a bitmap as it should be fetched using the cookies, etc of the context that it is loading in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does egui have a networking stack?

Yes, with egui_extras. I also don't like this solution, but it's kinda the only possibility given the current embedding API

@simonwuelker
Copy link
Contributor Author

Unifying the dependencies is proving to be a bit tricky. egui_glow v0.31.1/ egui-winit v0.31.1 depend on arboard v3.3 which really wants image v0.24, but egui_extras v0.31.1 wants image v0.25. And of course mixing and matching different versions of egui crates breaks stuff.

@simonwuelker simonwuelker added the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label May 21, 2025
@simonwuelker
Copy link
Contributor Author

Unifying the dependencies is proving to be a bit tricky. egui_glow v0.31.1/ egui-winit v0.31.1 depend on arboard v3.3 which really wants image v0.24, but egui_extras v0.31.1 wants image v0.25. And of course mixing and matching different versions of egui crates breaks stuff.

This is still true for egui 0.32. I'll see if I can fix it on the egui side.

@jdm
Copy link
Member
jdm commented Aug 2, 2025

@simonwuelker emilk/egui#7406 doesn't make sense to me; the current cargo.toml just means that 3.3 is a minimum requirement, not an exact one. It's still possible to for servo to update a board to any 3.x version independently.

@simonwuelker
Copy link
Contributor Author

...I keep forgetting that the version in Cargo.toml is a minimum. Thanks.

@simonwuelker simonwuelker removed the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label Aug 2, 2025
@simonwuelker
Copy link
Contributor Author

There are only a couple of small duplicate dependencies left which I don't think pose an issue.

However, the updated image 0.25 depends on rav1e which uses libfuzzer-sys, causingtest-tidy to fail with

/home/alaska/servo/Cargo.lock:1: Rust dependency libfuzzer-sys@0.4.10: Rejected license "NCSA - University of Illinois/NCSA Open Source License:"

The fuzzing dependency is behind a cfg(fuzzing) flag, so I don't think we actually use it. cargo-deny errors out because of --all-features being passed. Is it fine to ignore this licensing error?
https://github.com/xiph/rav1e/blob/a2f01b3e233f531c28a20b4c29fb5c9e5d29fa6d/Cargo.toml#L161-L164

@jdm
Copy link
Member
jdm commented Aug 25, 2025

Yeah, that seems totally reasonable to me.

@jdm
Copy link
Member
jdm commented Aug 26, 2025

I suspect the test failures come from a conflict between cryptography providers in egui vs. Servo's unit tests.

@simonwuelker
Copy link
Contributor Author
simonwuelker commented Aug 26, 2025

Thats annoying, ehttp depends on a version of ureq that uses the ring backend, so rustls is no longer able to infer the default crypto provider.

@simonwuelker
Copy link
Contributor Author

I think it will be easier to first update the embedding api such that it returns a bitmap for favicons.

@simonwuelker
Copy link
Contributor Author

This PR now depends on #38949.

github-merge-queue bot pushed a commit that referenced this pull request Aug 27, 2025
…er (#38949)

Currently the embedding API only provides the embedder with the URL for
a favicon. This is not great, for multiple reasons:
* Loading the icon should happen according to the fetch spec which is
not easy for the embedder to recreate (consider CSP, timing information
etc)
* Rasterizing a svg favicon is not trivial

With this change, servo fetches and rasterizes the icon to a bitmap
which is then passed to the embedder.

Testing: I'm not sure how I can write tests for the embedding api. I've
tested the correctness manually using
#36680.
Prepares for #36680

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
@simonwuelker
Copy link
Contributor Author

Would anyone mind re-reviewing this change? This PR has changed significantly since it was last approved.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Merged via the queue into servo:main with commit d65e16d Aug 27, 2025
22 checks passed
@simonwuelker simonwuelker deleted the favicons branch August 27, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0