mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
script: No longer do explicit reflows for display (#34599)
These all happen now in *update the rendering*, typically after the message that triggered this code is processed, though in two cases reflow needs to be triggered explicitly. This makes `ReflowReason` redundant though perhaps `ReflowCondition` can be expanded later to give more insight into why the page is dirty. - Handling of the "reflow timer" concept has been explained a bit more via data structures and rustdoc comments. - Theme changes are cleaned up a little to simplify what happens during reflow and to avoid unecessary reflows when the theme doesn't change. Notably, layout queries and scrolling still trigger normal reflows and don't update the rendering. This needs more investigation as it's unclear to me currently whether or not they should update the rendering and simply delay event dispatch or only reflow. In general, this is a simplfication of the code. Fixes #31871. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
682eba9f74
commit
471d3572b7
9 changed files with 179 additions and 191 deletions
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use embedder_traits::EmbedderMsg;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
|
@ -26,9 +24,6 @@ use crate::dom::node::{document_from_node, window_from_node, BindContext, Node};
|
|||
use crate::dom::virtualmethods::VirtualMethods;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
/// How long we should wait before performing the initial reflow after `<body>` is parsed.
|
||||
const INITIAL_REFLOW_DELAY: Duration = Duration::from_millis(200);
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLBodyElement {
|
||||
htmlelement: HTMLElement,
|
||||
|
@ -158,11 +153,9 @@ impl VirtualMethods for HTMLBodyElement {
|
|||
}
|
||||
|
||||
let window = window_from_node(self);
|
||||
let document = window.Document();
|
||||
document.set_reflow_timeout(INITIAL_REFLOW_DELAY);
|
||||
window.prevent_layout_until_load_event();
|
||||
if window.is_top_level() {
|
||||
let msg = EmbedderMsg::HeadParsed;
|
||||
window.send_to_embedder(msg);
|
||||
window.send_to_embedder(EmbedderMsg::HeadParsed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue