mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +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
|
@ -7,9 +7,10 @@
|
|||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use inline::InlineFormattingContext;
|
||||
use layout_api::wrapper_traits::ThreadSafeLayoutNode;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator};
|
||||
use script::layout_dom::ServoLayoutNode;
|
||||
use script::layout_dom::ServoThreadSafeLayoutNode;
|
||||
use servo_arc::Arc;
|
||||
use style::Zero;
|
||||
use style::computed_values::clear::T as StyleClear;
|
||||
|
@ -23,7 +24,6 @@ use style::values::specified::{Display, TextAlignKeyword};
|
|||
|
||||
use crate::cell::ArcRefCell;
|
||||
use crate::context::LayoutContext;
|
||||
use crate::dom::NodeExt;
|
||||
use crate::flow::float::{
|
||||
Clear, ContainingBlockPositionInfo, FloatBox, FloatSide, PlacementAmongFloats,
|
||||
SequentialLayoutState,
|
||||
|
@ -76,7 +76,11 @@ impl BlockContainer {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn repair_style(&mut self, node: &ServoLayoutNode, new_style: &Arc<ComputedValues>) {
|
||||
pub(crate) fn repair_style(
|
||||
&mut self,
|
||||
node: &ServoThreadSafeLayoutNode,
|
||||
new_style: &Arc<ComputedValues>,
|
||||
) {
|
||||
match self {
|
||||
BlockContainer::BlockLevelBoxes(..) => {},
|
||||
BlockContainer::InlineFormattingContext(inline_formatting_context) => {
|
||||
|
@ -103,7 +107,7 @@ impl BlockLevelBox {
|
|||
pub(crate) fn repair_style(
|
||||
&mut self,
|
||||
context: &SharedStyleContext,
|
||||
node: &ServoLayoutNode,
|
||||
node: &ServoThreadSafeLayoutNode,
|
||||
new_style: &Arc<ComputedValues>,
|
||||
) {
|
||||
self.with_base_mut(|base| {
|
||||
|
@ -412,7 +416,7 @@ impl OutsideMarker {
|
|||
fn repair_style(
|
||||
&mut self,
|
||||
context: &SharedStyleContext,
|
||||
node: &ServoLayoutNode,
|
||||
node: &ServoThreadSafeLayoutNode,
|
||||
new_style: &Arc<ComputedValues>,
|
||||
) {
|
||||
self.list_item_style = node.style(context);
|
||||
|
@ -477,7 +481,11 @@ impl BlockFormattingContext {
|
|||
LayoutStyle::Default(&base.style)
|
||||
}
|
||||
|
||||
pub(crate) fn repair_style(&mut self, node: &ServoLayoutNode, new_style: &Arc<ComputedValues>) {
|
||||
pub(crate) fn repair_style(
|
||||
&mut self,
|
||||
node: &ServoThreadSafeLayoutNode,
|
||||
new_style: &Arc<ComputedValues>,
|
||||
) {
|
||||
self.contents.repair_style(node, new_style);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue