-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minibrowser: Add loading spinner #31713
Conversation
One common pattern I've seen is a slow spinner in one direction while the initial network request is in flight, then the spinner changes direction or speeds up when the beginning of the response is received. This corresponds to the HeadParsed event. |
Yeah, HeadParsed happens somewhere between LoadStart and LoadComplete. It would be good to show these two periods differently, but if we can’t, then we should treat HeadParsed like LoadStart.
Good point! Since we only use our history_changed flag to check if we should run an egui update (and maybe update some Minibrowser fields), I agree that it would be good to combine them. |
c62cdb5
to
0dced60
Compare
Done. During the
Done. I've also changed the |
There are other data points in the toolbar that might need to be updated. This commit prepares for that by generaliziing the "history_changed" flag to a more generic "need_update" flag. Signed-off-by: Frederik Reiter <hi@frereit.de>
0dced60
to
597872f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! One question…
This makes sense and seems good enough to me. |
597872f
to
45a8883
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
Signed-off-by: Frederik Reiter <hi@frereit.de>
Head branch was pushed to by a user without write access
45a8883
to
3988984
Compare
Apologies for the format errors. Fixed. |
* minibrowser: Rename "history_changed" flag to "need_update" There are other data points in the toolbar that might need to be updated. This commit prepares for that by generaliziing the "history_changed" flag to a more generic "need_update" flag. Signed-off-by: Frederik Reiter <hi@frereit.de> * minibrowser: Add spinner to indicate loading status of the webview Signed-off-by: Frederik Reiter <hi@frereit.de> --------- Signed-off-by: Frederik Reiter <hi@frereit.de>
I've started to implement a simple spinner that indicates when a page is loading. This PR is not complete yet but I'd like to get some feedback and discuss some implementation details if that's possible.
For this "MVP", I've simply added a new bool
loading_changed
analogous to thehistory_changed
field inPumpResult::Continue
. TheWebView
then keeps track of wether or not it is loading and exposes this viaWebView::loading()
, likeWebView::shutdown_requested
. TheMinibrowser
then gets a notification from theApp
whenloading
changed and updates the spinner accordingly.A few questions arose while implementing this:
EmbedderMsg::HeadParsed
should also "influence" the loading state, but I do not understand how this should surface. In my understanding, the spinner simply shows up when the document starts loading and stops once it is complete. What is the intended "intermediary" step here?servo/ports/servoshell/webview.rs
Lines 596 to 598 in 8cfc6a1
xyz_changed
for everything about theWebView
that could be required to bubble up to theMinibrowser
. For example, showing the Favicon might also require afavicon_changed: bool
in the future. Perhaps it would make sense to combine all these into atoolbar_data_changed
ormetadata_changed
or something and let theMinibrowser
figure out what it has to do (or just refresh the entire toolbar when anything changed, that shouldn't really impact performance). Is this something I should implement in this PR?./mach build -d
does not report any errors./mach test-tidy
does not report any errors