mirror of
https://github.com/servo/servo.git
synced 2025-07-30 18:50:36 +01:00
script_layout: Remove script to layout messages (#32081)
Instead of communicating with layout via messages, script can simply call methods on the layout trait. This simplifies the way that script communicates with layout and opens the path to sharing more data structures between the two systems. This is part of a continuing series of cleanups after removing the layout thread. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they should not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
parent
97376e6d96
commit
7d63c7607f
14 changed files with 324 additions and 416 deletions
|
@ -2,7 +2,7 @@
|
|||
* 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 script_layout_interface::message::ReflowGoal;
|
||||
use script_layout_interface::ReflowGoal;
|
||||
|
||||
use crate::dom::element::Element;
|
||||
use crate::dom::event::Event;
|
||||
|
|
|
@ -44,8 +44,7 @@ use num_traits::ToPrimitive;
|
|||
use percent_encoding::percent_decode;
|
||||
use profile_traits::ipc as profile_ipc;
|
||||
use profile_traits::time::{TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType};
|
||||
use script_layout_interface::message::{Msg, PendingRestyle, ReflowGoal};
|
||||
use script_layout_interface::TrustedNodeAddress;
|
||||
use script_layout_interface::{PendingRestyle, ReflowGoal, TrustedNodeAddress};
|
||||
use script_traits::{
|
||||
AnimationState, DocumentActivity, MouseButton, MouseEventType, MsDuration, ScriptMsg,
|
||||
TouchEventType, TouchId, UntrustedNodeAddress, WheelDelta,
|
||||
|
@ -841,7 +840,7 @@ impl Document {
|
|||
if old_mode != new_mode {
|
||||
let _ = self
|
||||
.window
|
||||
.with_layout(move |layout| layout.process(Msg::SetQuirksMode(new_mode)));
|
||||
.with_layout(move |layout| layout.set_quirks_mode(new_mode));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std::fmt;
|
||||
|
||||
use euclid::default::Point2D;
|
||||
use script_layout_interface::message::{NodesFromPointQueryType, QueryMsg};
|
||||
use script_layout_interface::{NodesFromPointQueryType, QueryMsg};
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use servo_arc::Arc;
|
||||
use servo_atoms::Atom;
|
||||
|
|
|
@ -28,7 +28,7 @@ use js::rust::HandleObject;
|
|||
use msg::constellation_msg::InputMethodType;
|
||||
use net_traits::request::CorsSettings;
|
||||
use net_traits::ReferrerPolicy;
|
||||
use script_layout_interface::message::ReflowGoal;
|
||||
use script_layout_interface::ReflowGoal;
|
||||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::bloom::{BloomFilter, BLOOM_HASH_MASK};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::rc::Rc;
|
|||
use dom_struct::dom_struct;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use script_layout_interface::message::QueryMsg;
|
||||
use script_layout_interface::QueryMsg;
|
||||
use style::attr::AttrValue;
|
||||
use style_traits::dom::ElementState;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
|||
use js::rust::HandleObject;
|
||||
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
|
||||
use profile_traits::ipc as ProfiledIpc;
|
||||
use script_layout_interface::message::ReflowGoal;
|
||||
use script_layout_interface::ReflowGoal;
|
||||
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use script_traits::{
|
||||
HistoryEntryReplacement, IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData,
|
||||
|
|
|
@ -24,9 +24,8 @@ use libc::{self, c_void, uintptr_t};
|
|||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
use net_traits::image::base::{Image, ImageMetadata};
|
||||
use script_layout_interface::message::QueryMsg;
|
||||
use script_layout_interface::{
|
||||
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType,
|
||||
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType, QueryMsg,
|
||||
SVGSVGData, StyleData, TrustedNodeAddress,
|
||||
};
|
||||
use script_traits::{DocumentActivity, UntrustedNodeAddress};
|
||||
|
|
|
@ -49,8 +49,9 @@ use parking_lot::Mutex as ParkMutex;
|
|||
use profile_traits::ipc as ProfiledIpc;
|
||||
use profile_traits::mem::ProfilerChan as MemProfilerChan;
|
||||
use profile_traits::time::ProfilerChan as TimeProfilerChan;
|
||||
use script_layout_interface::message::{Msg, QueryMsg, Reflow, ReflowGoal, ScriptReflow};
|
||||
use script_layout_interface::{Layout, PendingImageState, TrustedNodeAddress};
|
||||
use script_layout_interface::{
|
||||
Layout, PendingImageState, QueryMsg, Reflow, ReflowGoal, ScriptReflow, TrustedNodeAddress,
|
||||
};
|
||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
use script_traits::{
|
||||
ConstellationControlMsg, DocumentState, HistoryEntryReplacement, LoadData, ScriptMsg,
|
||||
|
@ -1875,7 +1876,7 @@ impl Window {
|
|||
animations: document.animations().sets.clone(),
|
||||
};
|
||||
|
||||
let _ = self.with_layout(move |layout| layout.process(Msg::Reflow(reflow)));
|
||||
let _ = self.with_layout(move |layout| layout.reflow(reflow));
|
||||
|
||||
let complete = match join_port.try_recv() {
|
||||
Err(TryRecvError::Empty) => {
|
||||
|
|
|
@ -71,8 +71,9 @@ use parking_lot::Mutex;
|
|||
use percent_encoding::percent_decode;
|
||||
use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan};
|
||||
use profile_traits::time::{self as profile_time, profile, ProfilerCategory};
|
||||
use script_layout_interface::message::{Msg, ReflowGoal};
|
||||
use script_layout_interface::{Layout, LayoutConfig, LayoutFactory, ScriptThreadFactory};
|
||||
use script_layout_interface::{
|
||||
Layout, LayoutConfig, LayoutFactory, ReflowGoal, ScriptThreadFactory,
|
||||
};
|
||||
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
||||
use script_traits::CompositorEvent::{
|
||||
CompositionEvent, GamepadEvent, IMEDismissedEvent, KeyboardEvent, MouseButtonEvent,
|
||||
|
@ -1210,7 +1211,7 @@ impl ScriptThread {
|
|||
};
|
||||
|
||||
let _ = window
|
||||
.with_layout(|layout| layout.process(Msg::RegisterPaint(name, properties, painter)));
|
||||
.with_layout(|layout| layout.register_paint_worklet_modules(name, properties, painter));
|
||||
}
|
||||
|
||||
pub fn push_new_element_queue() {
|
||||
|
@ -2907,9 +2908,7 @@ impl ScriptThread {
|
|||
}
|
||||
|
||||
debug!("{id}: Shutting down layout");
|
||||
let _ = document.window().with_layout(|layout| {
|
||||
layout.process(Msg::ExitNow);
|
||||
});
|
||||
let _ = document.window().with_layout(|layout| layout.exit_now());
|
||||
|
||||
debug!("{id}: Sending PipelineExited message to constellation");
|
||||
self.script_sender
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue