mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
script: Unify script-based "update the rendering" and throttle it to 60 FPS (#38431)
Instead of running "update the rendering" at every IPC message, only run it when a timeout has occured in script. In addition, avoid updating the rendering if a rendering update isn't necessary. This should greatly reduce the amount of processing that has to happen in script. Because we are running many fewer calls to "update the rendering" it is reasonable now to ensure that these always work the same way. In particular, we always run rAF and update the animation timeline when updating the ernder In addition, pull the following things out of reflow: - Code dealing with informing the Constellation that a Pipeline has become Idle when waiting for a screenshot. - Detecting when it is time to fulfill the `document.fonts.ready` promise. The latter means that reflow can never cause a garbage collection, making timing of reflows more consistent and simplifying many callsites that need to do script queries. Followup changes will seek to simplify the way that ScriptThread-driven animation timeouts happen even simpler. Testing: In general, this should not change testable behavior so much, though it does seem to fix one test. The main improvement here should be that the ScriptThread does less work. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
bcc8314dd5
commit
9416251cab
39 changed files with 607 additions and 672 deletions
|
@ -329,7 +329,6 @@ impl Range {
|
|||
|
||||
fn client_rects(
|
||||
&self,
|
||||
can_gc: CanGc,
|
||||
) -> impl Iterator<Item = euclid::Rect<app_units::Au, euclid::UnknownUnit>> {
|
||||
// FIXME: For text nodes that are only partially selected, this should return the client
|
||||
// rect of the selected part, not the whole text node.
|
||||
|
@ -341,7 +340,7 @@ impl Range {
|
|||
.following_nodes(document.upcast::<Node>())
|
||||
.take_while(move |node| node != &end)
|
||||
.chain(iter::once(end_clone))
|
||||
.flat_map(move |node| node.content_boxes(can_gc))
|
||||
.flat_map(move |node| node.content_boxes())
|
||||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#concept-range-bp-set>
|
||||
|
@ -1153,7 +1152,7 @@ impl RangeMethods<crate::DomTypeHolder> for Range {
|
|||
let window = start.owner_window();
|
||||
|
||||
let client_rects = self
|
||||
.client_rects(can_gc)
|
||||
.client_rects()
|
||||
.map(|rect| {
|
||||
DOMRect::new(
|
||||
window.upcast(),
|
||||
|
@ -1174,7 +1173,7 @@ impl RangeMethods<crate::DomTypeHolder> for Range {
|
|||
let window = self.start_container().owner_window();
|
||||
|
||||
// Step 1. Let list be the result of invoking getClientRects() on the same range this method was invoked on.
|
||||
let list = self.client_rects(can_gc);
|
||||
let list = self.client_rects();
|
||||
|
||||
// Step 2. If list is empty return a DOMRect object whose x, y, width and height members are zero.
|
||||
// Step 3. If all rectangles in list have zero width or height, return the first rectangle in list.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue