mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
script: Clean up Window::force_reflow
a little (#37725)
- Move some of the image handling code to a separate function. - Move reflow event debugging into layout itself and use the `Debug` implementation to print the event. - A few other small cleanups Testing: This should not change behavior and is thus covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
a93d977020
commit
5e44582277
5 changed files with 96 additions and 108 deletions
|
@ -6,7 +6,7 @@ use std::cell::Cell;
|
|||
use std::default::Default;
|
||||
|
||||
use base::id::BrowsingContextId;
|
||||
use constellation_traits::{IFrameSizeMsg, WindowSizeType};
|
||||
use constellation_traits::{IFrameSizeMsg, ScriptToConstellationMessage, WindowSizeType};
|
||||
use embedder_traits::ViewportDetails;
|
||||
use fnv::FnvHashMap;
|
||||
use layout_api::IFrameSizes;
|
||||
|
@ -15,7 +15,7 @@ use crate::dom::bindings::inheritance::Castable;
|
|||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::htmliframeelement::HTMLIFrameElement;
|
||||
use crate::dom::node::{Node, ShadowIncluding};
|
||||
use crate::dom::types::Document;
|
||||
use crate::dom::types::{Document, Window};
|
||||
use crate::script_thread::with_script_thread;
|
||||
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
|
@ -111,13 +111,14 @@ impl IFrameCollection {
|
|||
/// message is only sent when the size actually changes.
|
||||
pub(crate) fn handle_new_iframe_sizes_after_layout(
|
||||
&mut self,
|
||||
window: &Window,
|
||||
new_iframe_sizes: IFrameSizes,
|
||||
) -> Vec<IFrameSizeMsg> {
|
||||
) {
|
||||
if new_iframe_sizes.is_empty() {
|
||||
return vec![];
|
||||
return;
|
||||
}
|
||||
|
||||
new_iframe_sizes
|
||||
let size_messages: Vec<_> = new_iframe_sizes
|
||||
.into_iter()
|
||||
.filter_map(|(browsing_context_id, iframe_size)| {
|
||||
// Batch resize message to any local `Pipeline`s now, rather than waiting for them
|
||||
|
@ -151,7 +152,11 @@ impl IFrameCollection {
|
|||
type_: size_type,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
.collect();
|
||||
|
||||
if !size_messages.is_empty() {
|
||||
window.send_to_constellation(ScriptToConstellationMessage::IFrameSizes(size_messages));
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn iter(&self) -> impl Iterator<Item = DomRoot<HTMLIFrameElement>> + use<'_> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue