mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
layout: Use ServoThreadSafeLayoutNode
in more places (#38626)
Use `ServoThreadSafeLayoutNode` in more places in layout rather than `ServoLayoutNode`. The former is meant to be used during layout, but layout 2020 was written against the latter. In general, this reduces the amount of conversion to the thread-safe version in many places in layout. In addition, an unused iterator from the `script` crate `ServoThreadSafeLayoutNodeChildrenIterator` is replaced with the child iterator from `layout`. The `layout` version must be directly in `script` now as it uses the dangerous variants of `next_sibling` and `first_child`, which allow encapsulating the unsafe bits into one module. This will ultimately be useful for storing the layout data of pseudo-element children of pseudo-elements properly. Testing: This should not change any behavior and thus is covered by existing tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
20ad1ce84e
commit
ee7c1d9109
20 changed files with 258 additions and 321 deletions
|
@ -25,6 +25,7 @@ use fonts::{FontContext, FontContextWebFontMethods};
|
|||
use fonts_traits::StylesheetWebFontLoadFinishedCallback;
|
||||
use fxhash::FxHashMap;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use layout_api::wrapper_traits::LayoutNode;
|
||||
use layout_api::{
|
||||
IFrameSizes, Layout, LayoutConfig, LayoutDamage, LayoutFactory, OffsetParentResponse, QueryMsg,
|
||||
ReflowGoal, ReflowPhasesRun, ReflowRequest, ReflowRequestRestyle, ReflowResult,
|
||||
|
@ -272,7 +273,7 @@ impl Layout for LayoutThread {
|
|||
let stacking_context_tree = stacking_context_tree
|
||||
.as_ref()
|
||||
.expect("Should always have a StackingContextTree for content box queries");
|
||||
process_content_box_request(stacking_context_tree, node)
|
||||
process_content_box_request(stacking_context_tree, node.to_threadsafe())
|
||||
}
|
||||
|
||||
/// Get a `Vec` of bounding boxes of this node's `Fragement`s in the coordinate space of the
|
||||
|
@ -292,13 +293,13 @@ impl Layout for LayoutThread {
|
|||
let stacking_context_tree = stacking_context_tree
|
||||
.as_ref()
|
||||
.expect("Should always have a StackingContextTree for content box queries");
|
||||
process_content_boxes_request(stacking_context_tree, node)
|
||||
process_content_boxes_request(stacking_context_tree, node.to_threadsafe())
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_client_rect(&self, node: TrustedNodeAddress) -> UntypedRect<i32> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_client_rect_request(node)
|
||||
process_client_rect_request(node.to_threadsafe())
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
|
@ -376,7 +377,7 @@ impl Layout for LayoutThread {
|
|||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_scrolling_area(&self, node: Option<TrustedNodeAddress>) -> UntypedRect<i32> {
|
||||
let node = node.map(|node| unsafe { ServoLayoutNode::new(&node) });
|
||||
let node = node.map(|node| unsafe { ServoLayoutNode::new(&node).to_threadsafe() });
|
||||
process_node_scroll_area_request(node, self.fragment_tree.borrow().clone())
|
||||
}
|
||||
|
||||
|
@ -907,7 +908,7 @@ impl LayoutThread {
|
|||
.unwrap_or_default();
|
||||
let damage = compute_damage_and_repair_style(
|
||||
&layout_context.style_context,
|
||||
root_node,
|
||||
root_node.to_threadsafe(),
|
||||
damage_from_environment,
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue