-
Notifications
You must be signed in to change notification settings - Fork 30
Write document about canvas (contexts) #70
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
base: main
Are you sure you want to change the base?
Conversation
a4a1e01
to
b6d695b
Compare
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
I think it's enough baking for first round. |
Reviewing now :) |
Thanks for writing this new chapter, it’s very useful! For new content I think it makes sense to edit and polish before landing, so I’ve done some copyediting. Let me know if I’ve made any mistakes, since script and canvas are not my areas of expertise. |
Co-authored-by: shuppy <delan@azabani.com> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
src/architecture/canvas.md
Outdated
As part of HTML event loop, script thread runs a task (parsing, script evaluating, callbacks, events, ...) and after that it [performs a microtask checkpoint](https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint) that drains microtasks queue. | ||
In [window event loop](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model:window-event-loop-3) we queue a global task to [updates the rendering](https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering) if there is an [rendering opportunity](https://html.spec.whatwg.org/multipage/webappapis.html#rendering-opportunity) (usually driven by compositor based on hardware refresh rate). | ||
In servo we do not actually queue a task, but instead we [run updates the rendering on any IPC messages in the ScriptThread](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1418) and [then perform a microtask checkpoint to as event loop would done after a task is completed](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1371). | ||
[Updates the rendering](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1201) does various resize, scroll and animations steps (which also includes performing a microtask checkpoint; to resolve promises) and then [run the animation frame callbacks](https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#run-the-animation-frame-callbacks) (callbacks added with [`requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame)). | ||
Here draw commands are issued to painters to create new frame of animation. | ||
Then we update the rendering of those that do not require a reflow (animated images and WebGPU). | ||
Finally we triggers reflow (layout), which takes the DOM and its styles, builds a `DisplayList`, and sends that to WebRender for rendering. | ||
Dirty WebGL and 2D canvases are flushed as part of a reflow. |
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.
@gterzian could you check if my understanding is correct.
Also driving force of rendering opportunities is not just compositor (via any script msg), but also script itself, at least for now.
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
807ba53
to
dc25c23
Compare
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
No description provided.