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
|
@ -6,7 +6,7 @@ use std::borrow::Cow;
|
|||
use std::iter::repeat;
|
||||
|
||||
use atomic_refcell::AtomicRef;
|
||||
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
|
||||
use layout_api::wrapper_traits::ThreadSafeLayoutNode;
|
||||
use log::warn;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -1028,9 +1028,8 @@ impl<'dom> TraversalHandler<'dom> for TableRowBuilder<'_, '_, 'dom, '_> {
|
|||
// This value will already have filtered out rowspan=0
|
||||
// in quirks mode, so we don't have to worry about that.
|
||||
let (rowspan, colspan) = if info.pseudo_element_type.is_none() {
|
||||
let node = info.node.to_threadsafe();
|
||||
let rowspan = node.get_rowspan().unwrap_or(1) as usize;
|
||||
let colspan = node.get_colspan().unwrap_or(1) as usize;
|
||||
let rowspan = info.node.get_rowspan().unwrap_or(1) as usize;
|
||||
let colspan = info.node.get_colspan().unwrap_or(1) as usize;
|
||||
|
||||
// The HTML specification clamps value of `rowspan` to [0, 65534] and
|
||||
// `colspan` to [1, 1000].
|
||||
|
@ -1150,7 +1149,7 @@ fn add_column(
|
|||
old_column: Option<ArcRefCell<TableTrack>>,
|
||||
) -> ArcRefCell<TableTrack> {
|
||||
let span = if column_info.pseudo_element_type.is_none() {
|
||||
column_info.node.to_threadsafe().get_span().unwrap_or(1)
|
||||
column_info.node.get_span().unwrap_or(1)
|
||||
} else {
|
||||
1
|
||||
};
|
||||
|
|
|
@ -76,7 +76,7 @@ pub(crate) use construct::AnonymousTableContent;
|
|||
pub use construct::TableBuilder;
|
||||
use euclid::{Point2D, Size2D, UnknownUnit, Vector2D};
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use script::layout_dom::{ServoLayoutElement, ServoLayoutNode};
|
||||
use script::layout_dom::{ServoLayoutElement, ServoThreadSafeLayoutNode};
|
||||
use servo_arc::Arc;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -425,7 +425,7 @@ impl TableLevelBox {
|
|||
pub(crate) fn repair_style(
|
||||
&self,
|
||||
context: &SharedStyleContext<'_>,
|
||||
node: &ServoLayoutNode,
|
||||
node: &ServoThreadSafeLayoutNode,
|
||||
new_style: &Arc<ComputedValues>,
|
||||
) {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue