Rename script_layout_interface to layout_api (#37591)

Now that we are standardizing on the `_traits` crates becoming `_api`
and exposing the API of the crate that they get their name from [^1],
`script_layout_interface` becomes `layout_api` as it exposes the API for
`layout` that is used by `script` This brings the crate in line with the
naming of the other ones in `shared`.

[^1]:
https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Organizing.20*_traits.20crates/with/396893711

Testing: This should not change any behavior and thus is covered by
existing tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-06-20 19:13:05 +02:00 committed by GitHub
parent 85c849d843
commit 69ff4afa58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 102 additions and 113 deletions

74
Cargo.lock generated
View file

@ -1175,6 +1175,7 @@ dependencies = [
"gaol", "gaol",
"ipc-channel", "ipc-channel",
"keyboard-types", "keyboard-types",
"layout_api",
"log", "log",
"media", "media",
"net", "net",
@ -1182,7 +1183,6 @@ dependencies = [
"parking_lot", "parking_lot",
"profile", "profile",
"profile_traits", "profile_traits",
"script_layout_interface",
"script_traits", "script_traits",
"serde", "serde",
"servo-tracing", "servo-tracing",
@ -4314,6 +4314,7 @@ dependencies = [
"icu_segmenter", "icu_segmenter",
"ipc-channel", "ipc-channel",
"itertools 0.14.0", "itertools 0.14.0",
"layout_api",
"log", "log",
"malloc_size_of_derive", "malloc_size_of_derive",
"net_traits", "net_traits",
@ -4325,7 +4326,6 @@ dependencies = [
"range", "range",
"rayon", "rayon",
"script", "script",
"script_layout_interface",
"script_traits", "script_traits",
"selectors", "selectors",
"servo-tracing", "servo-tracing",
@ -4346,6 +4346,39 @@ dependencies = [
"xi-unicode", "xi-unicode",
] ]
[[package]]
name = "layout_api"
version = "0.0.1"
dependencies = [
"app_units",
"atomic_refcell",
"base",
"compositing_traits",
"constellation_traits",
"embedder_traits",
"euclid",
"fnv",
"fonts",
"fonts_traits",
"fxhash",
"html5ever",
"ipc-channel",
"libc",
"malloc_size_of_derive",
"net_traits",
"pixels",
"profile_traits",
"range",
"script_traits",
"selectors",
"serde",
"servo_arc",
"servo_malloc_size_of",
"servo_url",
"stylo",
"webrender_api",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.5.0" version = "1.5.0"
@ -4453,6 +4486,7 @@ dependencies = [
"ipc-channel", "ipc-channel",
"keyboard-types", "keyboard-types",
"layout", "layout",
"layout_api",
"libservo", "libservo",
"log", "log",
"media", "media",
@ -4465,7 +4499,6 @@ dependencies = [
"rayon", "rayon",
"rustls", "rustls",
"script", "script",
"script_layout_interface",
"script_traits", "script_traits",
"serde", "serde",
"servo-media", "servo-media",
@ -6613,6 +6646,7 @@ dependencies = [
"itertools 0.14.0", "itertools 0.14.0",
"jstraceable_derive", "jstraceable_derive",
"keyboard-types", "keyboard-types",
"layout_api",
"libc", "libc",
"log", "log",
"malloc_size_of_derive", "malloc_size_of_derive",
@ -6634,7 +6668,6 @@ dependencies = [
"range", "range",
"regex", "regex",
"script_bindings", "script_bindings",
"script_layout_interface",
"script_traits", "script_traits",
"selectors", "selectors",
"serde", "serde",
@ -6713,39 +6746,6 @@ dependencies = [
"xml5ever", "xml5ever",
] ]
[[package]]
name = "script_layout_interface"
version = "0.0.1"
dependencies = [
"app_units",
"atomic_refcell",
"base",
"compositing_traits",
"constellation_traits",
"embedder_traits",
"euclid",
"fnv",
"fonts",
"fonts_traits",
"fxhash",
"html5ever",
"ipc-channel",
"libc",
"malloc_size_of_derive",
"net_traits",
"pixels",
"profile_traits",
"range",
"script_traits",
"selectors",
"serde",
"servo_arc",
"servo_malloc_size_of",
"servo_url",
"stylo",
"webrender_api",
]
[[package]] [[package]]
name = "script_tests" name = "script_tests"
version = "0.0.1" version = "0.0.1"

View file

@ -118,7 +118,7 @@ resvg = "0.45.0"
rustls = { version = "0.23", default-features = false, features = ["logging", "std", "tls12"] } rustls = { version = "0.23", default-features = false, features = ["logging", "std", "tls12"] }
rustls-pemfile = "2.0" rustls-pemfile = "2.0"
rustls-pki-types = "1.12" rustls-pki-types = "1.12"
script_layout_interface = { path = "components/shared/script_layout" } layout_api = { path = "components/shared/layout" }
script_traits = { path = "components/shared/script" } script_traits = { path = "components/shared/script" }
selectors = { git = "https://github.com/servo/stylo", branch = "2025-06-03" } selectors = { git = "https://github.com/servo/stylo", branch = "2025-06-03" }
serde = "1.0.219" serde = "1.0.219"

View file

@ -33,6 +33,7 @@ euclid = { workspace = true }
fonts = { path = "../fonts" } fonts = { path = "../fonts" }
ipc-channel = { workspace = true } ipc-channel = { workspace = true }
keyboard-types = { workspace = true } keyboard-types = { workspace = true }
layout_api = { workspace = true }
log = { workspace = true } log = { workspace = true }
media = { path = "../media" } media = { path = "../media" }
net = { path = "../net" } net = { path = "../net" }
@ -40,7 +41,6 @@ net_traits = { workspace = true }
parking_lot = { workspace = true } parking_lot = { workspace = true }
profile = { path = "../profile" } profile = { path = "../profile" }
profile_traits = { workspace = true } profile_traits = { workspace = true }
script_layout_interface = { workspace = true }
script_traits = { workspace = true } script_traits = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
servo_config = { path = "../config" } servo_config = { path = "../config" }

View file

@ -142,6 +142,7 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use keyboard_types::webdriver::Event as WebDriverInputEvent; use keyboard_types::webdriver::Event as WebDriverInputEvent;
use keyboard_types::{Key, KeyState, Modifiers}; use keyboard_types::{Key, KeyState, Modifiers};
use layout_api::{LayoutFactory, ScriptThreadFactory};
use log::{debug, error, info, trace, warn}; use log::{debug, error, info, trace, warn};
use media::WindowGLContext; use media::WindowGLContext;
use net_traits::pub_domains::reg_host; use net_traits::pub_domains::reg_host;
@ -150,7 +151,6 @@ use net_traits::storage_thread::{StorageThreadMsg, StorageType};
use net_traits::{self, IpcSend, ReferrerPolicy, ResourceThreads}; use net_traits::{self, IpcSend, ReferrerPolicy, ResourceThreads};
use profile_traits::mem::ProfilerMsg; use profile_traits::mem::ProfilerMsg;
use profile_traits::{mem, time}; use profile_traits::{mem, time};
use script_layout_interface::{LayoutFactory, ScriptThreadFactory};
use script_traits::{ use script_traits::{
ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, ProgressiveWebMetricType, ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, ProgressiveWebMetricType,
ScriptThreadMessage, UpdatePipelineIdReason, ScriptThreadMessage, UpdatePipelineIdReason,

View file

@ -30,6 +30,7 @@ use fonts::{SystemFontServiceProxy, SystemFontServiceProxySender};
use ipc_channel::Error; use ipc_channel::Error;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use layout_api::{LayoutFactory, ScriptThreadFactory};
use log::{debug, error, warn}; use log::{debug, error, warn};
use media::WindowGLContext; use media::WindowGLContext;
use net::image_cache::ImageCacheImpl; use net::image_cache::ImageCacheImpl;
@ -38,7 +39,6 @@ use net_traits::image_cache::ImageCache;
use profile::system_reporter; use profile::system_reporter;
use profile_traits::mem::{ProfilerMsg, Reporter}; use profile_traits::mem::{ProfilerMsg, Reporter};
use profile_traits::{mem as profile_mem, time}; use profile_traits::{mem as profile_mem, time};
use script_layout_interface::{LayoutFactory, ScriptThreadFactory};
use script_traits::{ use script_traits::{
DiscardBrowsingContext, DocumentActivity, InitialScriptState, NewLayoutInfo, DiscardBrowsingContext, DocumentActivity, InitialScriptState, NewLayoutInfo,
ScriptThreadMessage, ScriptThreadMessage,

View file

@ -35,6 +35,7 @@ icu_locid = { workspace = true }
icu_segmenter = { workspace = true } icu_segmenter = { workspace = true }
ipc-channel = { workspace = true } ipc-channel = { workspace = true }
itertools = { workspace = true } itertools = { workspace = true }
layout_api = { workspace = true }
log = { workspace = true } log = { workspace = true }
malloc_size_of = { workspace = true } malloc_size_of = { workspace = true }
malloc_size_of_derive = { workspace = true } malloc_size_of_derive = { workspace = true }
@ -45,7 +46,6 @@ profile_traits = { workspace = true }
range = { path = "../range" } range = { path = "../range" }
rayon = { workspace = true } rayon = { workspace = true }
script = { path = "../script" } script = { path = "../script" }
script_layout_interface = { workspace = true }
script_traits = { workspace = true } script_traits = { workspace = true }
selectors = { workspace = true } selectors = { workspace = true }
servo_arc = { workspace = true } servo_arc = { workspace = true }

View file

@ -9,15 +9,15 @@ use euclid::Size2D;
use fnv::FnvHashMap; use fnv::FnvHashMap;
use fonts::FontContext; use fonts::FontContext;
use fxhash::FxHashMap; use fxhash::FxHashMap;
use layout_api::{
IFrameSizes, ImageAnimationState, PendingImage, PendingImageState, PendingRasterizationImage,
};
use net_traits::image_cache::{ use net_traits::image_cache::{
Image as CachedImage, ImageCache, ImageCacheResult, ImageOrMetadataAvailable, PendingImageId, Image as CachedImage, ImageCache, ImageCacheResult, ImageOrMetadataAvailable, PendingImageId,
UsePlaceholder, UsePlaceholder,
}; };
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use pixels::RasterImage; use pixels::RasterImage;
use script_layout_interface::{
IFrameSizes, ImageAnimationState, PendingImage, PendingImageState, PendingRasterizationImage,
};
use servo_url::{ImmutableOrigin, ServoUrl}; use servo_url::{ImmutableOrigin, ServoUrl};
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::dom::OpaqueNode; use style::dom::OpaqueNode;

View file

@ -8,15 +8,15 @@ use std::marker::PhantomData;
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use base::id::{BrowsingContextId, PipelineId}; use base::id::{BrowsingContextId, PipelineId};
use html5ever::{local_name, ns}; use html5ever::{local_name, ns};
use layout_api::wrapper_traits::{
LayoutDataTrait, LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use layout_api::{
GenericLayoutDataTrait, LayoutElementType, LayoutNodeType as ScriptLayoutNodeType,
};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use net_traits::image_cache::Image; use net_traits::image_cache::Image;
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::{
LayoutDataTrait, LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use script_layout_interface::{
GenericLayoutDataTrait, LayoutElementType, LayoutNodeType as ScriptLayoutNodeType,
};
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::properties::ComputedValues; use style::properties::ComputedValues;

View file

@ -7,12 +7,10 @@ use std::iter::FusedIterator;
use fonts::ByteIndex; use fonts::ByteIndex;
use html5ever::{LocalName, local_name}; use html5ever::{LocalName, local_name};
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use layout_api::{LayoutElementType, LayoutNodeType};
use range::Range; use range::Range;
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::{
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use script_layout_interface::{LayoutElementType, LayoutNodeType};
use selectors::Element as SelectorsElement; use selectors::Element as SelectorsElement;
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use style::dom::{NodeInfo, TElement, TNode, TShadowRoot}; use style::dom::{NodeInfo, TElement, TNode, TShadowRoot};

View file

@ -6,9 +6,9 @@ use std::vec::IntoIter;
use app_units::Au; use app_units::Au;
use fonts::FontMetrics; use fonts::FontMetrics;
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use style::properties::ComputedValues; use style::properties::ComputedValues;

View file

@ -83,6 +83,7 @@ use bitflags::bitflags;
use construct::InlineFormattingContextBuilder; use construct::InlineFormattingContextBuilder;
use fonts::{ByteIndex, FontMetrics, GlyphStore}; use fonts::{ByteIndex, FontMetrics, GlyphStore};
use inline_box::{InlineBox, InlineBoxContainerState, InlineBoxIdentifier, InlineBoxes}; use inline_box::{InlineBox, InlineBoxContainerState, InlineBoxIdentifier, InlineBoxes};
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use line::{ use line::{
AbsolutelyPositionedLineItem, AtomicLineItem, FloatLineItem, LineItem, LineItemLayout, AbsolutelyPositionedLineItem, AtomicLineItem, FloatLineItem, LineItem, LineItemLayout,
TextRunLineItem, TextRunLineItem,
@ -91,7 +92,6 @@ use line_breaker::LineBreaker;
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use range::Range; use range::Range;
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use servo_arc::Arc; use servo_arc::Arc;
use style::Zero; use style::Zero;
use style::computed_values::text_wrap_mode::T as TextWrapMode; use style::computed_values::text_wrap_mode::T as TextWrapMode;

View file

@ -7,12 +7,10 @@ use atomic_refcell::AtomicRef;
use compositing_traits::display_list::AxesScrollSensitivity; use compositing_traits::display_list::AxesScrollSensitivity;
use euclid::Rect; use euclid::Rect;
use euclid::default::Size2D as UntypedSize2D; use euclid::default::Size2D as UntypedSize2D;
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use layout_api::{LayoutElementType, LayoutNodeType};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::{
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use script_layout_interface::{LayoutElementType, LayoutNodeType};
use servo_arc::Arc; use servo_arc::Arc;
use style::dom::{NodeInfo, TNode}; use style::dom::{NodeInfo, TNode};
use style::properties::ComputedValues; use style::properties::ComputedValues;

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bitflags::bitflags; use bitflags::bitflags;
use layout_api::combine_id_with_fragment_type;
use malloc_size_of::malloc_size_of_is_0; use malloc_size_of::malloc_size_of_is_0;
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use script_layout_interface::combine_id_with_fragment_type;
use style::dom::OpaqueNode; use style::dom::OpaqueNode;
use style::selector_parser::PseudoElement; use style::selector_parser::PseudoElement;

View file

@ -24,6 +24,10 @@ use fonts::{FontContext, FontContextWebFontMethods};
use fonts_traits::StylesheetWebFontLoadFinishedCallback; use fonts_traits::StylesheetWebFontLoadFinishedCallback;
use fxhash::FxHashMap; use fxhash::FxHashMap;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use layout_api::{
Layout, LayoutConfig, LayoutFactory, NodesFromPointQueryType, OffsetParentResponse, ReflowGoal,
ReflowRequest, ReflowResult, TrustedNodeAddress,
};
use log::{debug, error, warn}; use log::{debug, error, warn};
use malloc_size_of::{MallocConditionalSizeOf, MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocConditionalSizeOf, MallocSizeOf, MallocSizeOfOps};
use net_traits::image_cache::{ImageCache, UsePlaceholder}; use net_traits::image_cache::{ImageCache, UsePlaceholder};
@ -35,10 +39,6 @@ use profile_traits::time::{
use profile_traits::{path, time_profile}; use profile_traits::{path, time_profile};
use rayon::ThreadPool; use rayon::ThreadPool;
use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode}; use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
use script_layout_interface::{
Layout, LayoutConfig, LayoutFactory, NodesFromPointQueryType, OffsetParentResponse, ReflowGoal,
ReflowRequest, ReflowResult, TrustedNodeAddress,
};
use script_traits::{DrawAPaintImageResult, PaintWorkletError, Painter, ScriptThreadMessage}; use script_traits::{DrawAPaintImageResult, PaintWorkletError, Painter, ScriptThreadMessage};
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use servo_config::opts::{self, DebugOptions}; use servo_config::opts::{self, DebugOptions};
@ -271,10 +271,7 @@ impl Layout for LayoutThread {
} }
#[servo_tracing::instrument(skip_all)] #[servo_tracing::instrument(skip_all)]
fn query_element_inner_outer_text( fn query_element_inner_outer_text(&self, node: layout_api::TrustedNodeAddress) -> String {
&self,
node: script_layout_interface::TrustedNodeAddress,
) -> String {
let node = unsafe { ServoLayoutNode::new(&node) }; let node = unsafe { ServoLayoutNode::new(&node) };
get_the_text_steps(node) get_the_text_steps(node)
} }

View file

@ -9,11 +9,9 @@ use app_units::Au;
use euclid::default::{Point2D, Rect}; use euclid::default::{Point2D, Rect};
use euclid::{SideOffsets2D, Size2D}; use euclid::{SideOffsets2D, Size2D};
use itertools::Itertools; use itertools::Itertools;
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use layout_api::{LayoutElementType, LayoutNodeType, OffsetParentResponse};
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::{
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use script_layout_interface::{LayoutElementType, LayoutNodeType, OffsetParentResponse};
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use style::computed_values::display::T as Display; use style::computed_values::display::T as Display;

View file

@ -9,10 +9,10 @@ use base::id::{BrowsingContextId, PipelineId};
use data_url::DataUrl; use data_url::DataUrl;
use embedder_traits::ViewportDetails; use embedder_traits::ViewportDetails;
use euclid::{Scale, Size2D}; use euclid::{Scale, Size2D};
use layout_api::IFrameSize;
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use net_traits::image_cache::{Image, ImageOrMetadataAvailable, UsePlaceholder}; use net_traits::image_cache::{Image, ImageOrMetadataAvailable, UsePlaceholder};
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::IFrameSize;
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use style::Zero; use style::Zero;
use style::computed_values::object_fit::T as ObjectFit; use style::computed_values::object_fit::T as ObjectFit;

View file

@ -7,8 +7,8 @@ use std::convert::{TryFrom, TryInto};
use std::iter::repeat; use std::iter::repeat;
use atomic_refcell::AtomicRef; use atomic_refcell::AtomicRef;
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use log::warn; use log::warn;
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use servo_arc::Arc; use servo_arc::Arc;
use style::properties::ComputedValues; use style::properties::ComputedValues;
use style::properties::style_structs::Font; use style::properties::style_structs::Font;

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use layout_api::wrapper_traits::LayoutNode;
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::LayoutNode;
use style::context::{SharedStyleContext, StyleContext}; use style::context::{SharedStyleContext, StyleContext};
use style::data::ElementData; use style::data::ElementData;
use style::dom::{NodeInfo, TElement, TNode}; use style::dom::{NodeInfo, TElement, TNode};

View file

@ -81,6 +81,7 @@ itertools = { workspace = true }
js = { workspace = true } js = { workspace = true }
jstraceable_derive = { path = "../jstraceable_derive" } jstraceable_derive = { path = "../jstraceable_derive" }
keyboard-types = { workspace = true } keyboard-types = { workspace = true }
layout_api = { workspace = true }
libc = { workspace = true } libc = { workspace = true }
log = { workspace = true } log = { workspace = true }
malloc_size_of = { workspace = true } malloc_size_of = { workspace = true }
@ -101,7 +102,6 @@ profile_traits = { workspace = true }
range = { path = "../range" } range = { path = "../range" }
regex = { workspace = true } regex = { workspace = true }
script_bindings = { path = "../script_bindings" } script_bindings = { path = "../script_bindings" }
script_layout_interface = { workspace = true }
script_traits = { workspace = true } script_traits = { workspace = true }
selectors = { workspace = true } selectors = { workspace = true }
serde = { workspace = true, features = ["derive"] } serde = { workspace = true, features = ["derive"] }

View file

@ -5,9 +5,9 @@
//! Common interfaces for Canvas Contexts //! Common interfaces for Canvas Contexts
use euclid::default::Size2D; use euclid::default::Size2D;
use layout_api::HTMLCanvasData;
use pixels::Snapshot; use pixels::Snapshot;
use script_bindings::root::Dom; use script_bindings::root::Dom;
use script_layout_interface::HTMLCanvasData;
use webrender_api::ImageKey; use webrender_api::ImageKey;
use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas; use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;

View file

@ -31,9 +31,9 @@ use std::marker::PhantomData;
use std::{mem, ptr}; use std::{mem, ptr};
use js::jsapi::{JSObject, JSTracer}; use js::jsapi::{JSObject, JSTracer};
use layout_api::TrustedNodeAddress;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
pub(crate) use script_bindings::root::*; pub(crate) use script_bindings::root::*;
use script_layout_interface::TrustedNodeAddress;
use style::thread_state; use style::thread_state;
use crate::dom::bindings::conversions::DerivedFrom; use crate::dom::bindings::conversions::DerivedFrom;

View file

@ -41,6 +41,7 @@ use hyper_serde::Serde;
use ipc_channel::ipc; use ipc_channel::ipc;
use js::rust::{HandleObject, HandleValue}; use js::rust::{HandleObject, HandleValue};
use keyboard_types::{Code, Key, KeyState, Modifiers}; use keyboard_types::{Code, Key, KeyState, Modifiers};
use layout_api::{PendingRestyle, TrustedNodeAddress, node_id_from_scroll_id};
use metrics::{InteractiveFlag, InteractiveWindow, ProgressiveWebMetrics}; use metrics::{InteractiveFlag, InteractiveWindow, ProgressiveWebMetrics};
use net_traits::CookieSource::NonHTTP; use net_traits::CookieSource::NonHTTP;
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
@ -55,7 +56,6 @@ use profile_traits::ipc as profile_ipc;
use profile_traits::time::TimerMetadataFrameType; use profile_traits::time::TimerMetadataFrameType;
use regex::bytes::Regex; use regex::bytes::Regex;
use script_bindings::interfaces::DocumentHelpers; use script_bindings::interfaces::DocumentHelpers;
use script_layout_interface::{PendingRestyle, TrustedNodeAddress, node_id_from_scroll_id};
use script_traits::{ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType}; use script_traits::{ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType};
use servo_arc::Arc; use servo_arc::Arc;
use servo_config::pref; use servo_config::pref;

View file

@ -6,7 +6,7 @@ use std::fmt;
use embedder_traits::UntrustedNodeAddress; use embedder_traits::UntrustedNodeAddress;
use euclid::default::Point2D; use euclid::default::Point2D;
use script_layout_interface::{NodesFromPointQueryType, QueryMsg}; use layout_api::{NodesFromPointQueryType, QueryMsg};
use servo_arc::Arc; use servo_arc::Arc;
use style::invalidation::media_queries::{MediaListKey, ToMediaListKey}; use style::invalidation::media_queries::{MediaListKey, ToMediaListKey};
use style::media_queries::MediaList; use style::media_queries::MediaList;

View file

@ -21,8 +21,8 @@ use image::{ColorType, ImageEncoder, ImageError};
use ipc_channel::ipc::{self as ipcchan}; use ipc_channel::ipc::{self as ipcchan};
use js::error::throw_type_error; use js::error::throw_type_error;
use js::rust::{HandleObject, HandleValue}; use js::rust::{HandleObject, HandleValue};
use layout_api::HTMLCanvasData;
use pixels::{Snapshot, SnapshotAlphaMode, SnapshotPixelFormat}; use pixels::{Snapshot, SnapshotAlphaMode, SnapshotPixelFormat};
use script_layout_interface::HTMLCanvasData;
use servo_media::streams::MediaStreamType; use servo_media::streams::MediaStreamType;
use servo_media::streams::registry::MediaStreamId; use servo_media::streams::registry::MediaStreamId;
use style::attr::AttrValue; use style::attr::AttrValue;

View file

@ -9,7 +9,7 @@ use std::rc::Rc;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix, local_name, ns}; use html5ever::{LocalName, Prefix, local_name, ns};
use js::rust::HandleObject; use js::rust::HandleObject;
use script_layout_interface::QueryMsg; use layout_api::QueryMsg;
use style::attr::AttrValue; use style::attr::AttrValue;
use stylo_dom::ElementState; use stylo_dom::ElementState;

View file

@ -21,6 +21,7 @@ use http::header::{self, HeaderMap, HeaderValue};
use ipc_channel::ipc::{self, IpcSharedMemory, channel}; use ipc_channel::ipc::{self, IpcSharedMemory, channel};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use js::jsapi::JSAutoRealm; use js::jsapi::JSAutoRealm;
use layout_api::MediaFrame;
use media::{GLPlayerMsg, GLPlayerMsgForward, WindowGLContext}; use media::{GLPlayerMsg, GLPlayerMsgForward, WindowGLContext};
use net_traits::request::{Destination, RequestId}; use net_traits::request::{Destination, RequestId};
use net_traits::{ use net_traits::{
@ -32,7 +33,6 @@ use script_bindings::codegen::GenericBindings::TimeRangesBinding::TimeRangesMeth
use script_bindings::codegen::InheritTypes::{ use script_bindings::codegen::InheritTypes::{
ElementTypeId, HTMLElementTypeId, HTMLMediaElementTypeId, NodeTypeId, ElementTypeId, HTMLElementTypeId, HTMLMediaElementTypeId, NodeTypeId,
}; };
use script_layout_interface::MediaFrame;
use servo_config::pref; use servo_config::pref;
use servo_media::player::audio::AudioRenderer; use servo_media::player::audio::AudioRenderer;
use servo_media::player::video::{VideoFrame, VideoFrameRenderer}; use servo_media::player::video::{VideoFrame, VideoFrameRenderer};

View file

@ -10,6 +10,7 @@ use dom_struct::dom_struct;
use euclid::default::Size2D; use euclid::default::Size2D;
use html5ever::{LocalName, Prefix, local_name, ns}; use html5ever::{LocalName, Prefix, local_name, ns};
use js::rust::HandleObject; use js::rust::HandleObject;
use layout_api::{HTMLMediaData, MediaMetadata};
use net_traits::image_cache::{ use net_traits::image_cache::{
ImageCache, ImageCacheResult, ImageLoadListener, ImageOrMetadataAvailable, ImageResponse, ImageCache, ImageCacheResult, ImageLoadListener, ImageOrMetadataAvailable, ImageResponse,
PendingImageId, UsePlaceholder, PendingImageId, UsePlaceholder,
@ -20,7 +21,6 @@ use net_traits::{
ResourceTimingType, ResourceTimingType,
}; };
use pixels::{Snapshot, SnapshotAlphaMode, SnapshotPixelFormat}; use pixels::{Snapshot, SnapshotAlphaMode, SnapshotPixelFormat};
use script_layout_interface::{HTMLMediaData, MediaMetadata};
use servo_media::player::video::VideoFrame; use servo_media::player::video::VideoFrame;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::attr::{AttrValue, LengthOrPercentageOrAuto};

View file

@ -23,15 +23,15 @@ use html5ever::serialize::HtmlSerializer;
use html5ever::{Namespace, Prefix, QualName, ns, serialize as html_serialize}; use html5ever::{Namespace, Prefix, QualName, ns, serialize as html_serialize};
use js::jsapi::JSObject; use js::jsapi::JSObject;
use js::rust::HandleObject; use js::rust::HandleObject;
use layout_api::{
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType, QueryMsg,
SVGSVGData, StyleData, TrustedNodeAddress,
};
use libc::{self, c_void, uintptr_t}; use libc::{self, c_void, uintptr_t};
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use net_traits::image_cache::Image; use net_traits::image_cache::Image;
use pixels::ImageMetadata; use pixels::ImageMetadata;
use script_bindings::codegen::InheritTypes::DocumentFragmentTypeId; use script_bindings::codegen::InheritTypes::DocumentFragmentTypeId;
use script_layout_interface::{
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType, QueryMsg,
SVGSVGData, StyleData, TrustedNodeAddress,
};
use script_traits::DocumentActivity; use script_traits::DocumentActivity;
use selectors::matching::{ use selectors::matching::{
MatchingContext, MatchingForInvalidation, MatchingMode, NeedsSelectorFlags, MatchingContext, MatchingForInvalidation, MatchingMode, NeedsSelectorFlags,

View file

@ -5,7 +5,7 @@
use dom_struct::dom_struct; use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix, local_name, ns}; use html5ever::{LocalName, Prefix, local_name, ns};
use js::rust::HandleObject; use js::rust::HandleObject;
use script_layout_interface::SVGSVGData; use layout_api::SVGSVGData;
use style::attr::AttrValue; use style::attr::AttrValue;
use crate::dom::attr::Attr; use crate::dom::attr::Attr;

View file

@ -51,6 +51,10 @@ use js::rust::{
CustomAutoRooter, CustomAutoRooterGuard, HandleObject, HandleValue, MutableHandleObject, CustomAutoRooter, CustomAutoRooterGuard, HandleObject, HandleValue, MutableHandleObject,
MutableHandleValue, MutableHandleValue,
}; };
use layout_api::{
FragmentType, Layout, PendingImageState, QueryMsg, ReflowGoal, ReflowRequest,
TrustedNodeAddress, combine_id_with_fragment_type,
};
use malloc_size_of::MallocSizeOf; use malloc_size_of::MallocSizeOf;
use media::WindowGLContext; use media::WindowGLContext;
use net_traits::ResourceThreads; use net_traits::ResourceThreads;
@ -67,10 +71,6 @@ use script_bindings::codegen::GenericBindings::NavigatorBinding::NavigatorMethod
use script_bindings::codegen::GenericBindings::PerformanceBinding::PerformanceMethods; use script_bindings::codegen::GenericBindings::PerformanceBinding::PerformanceMethods;
use script_bindings::interfaces::WindowHelpers; use script_bindings::interfaces::WindowHelpers;
use script_bindings::root::Root; use script_bindings::root::Root;
use script_layout_interface::{
FragmentType, Layout, PendingImageState, QueryMsg, ReflowGoal, ReflowRequest,
TrustedNodeAddress, combine_id_with_fragment_type,
};
use script_traits::ScriptThreadMessage; use script_traits::ScriptThreadMessage;
use selectors::attr::CaseSensitivity; use selectors::attr::CaseSensitivity;
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;

View file

@ -9,7 +9,7 @@ use base::id::BrowsingContextId;
use constellation_traits::{IFrameSizeMsg, WindowSizeType}; use constellation_traits::{IFrameSizeMsg, WindowSizeType};
use embedder_traits::ViewportDetails; use embedder_traits::ViewportDetails;
use fnv::FnvHashMap; use fnv::FnvHashMap;
use script_layout_interface::IFrameSizes; use layout_api::IFrameSizes;
use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::root::{Dom, DomRoot};

View file

@ -6,9 +6,9 @@ use compositing_traits::{ImageUpdate, SerializableImageData};
use embedder_traits::UntrustedNodeAddress; use embedder_traits::UntrustedNodeAddress;
use fxhash::{FxHashMap, FxHashSet}; use fxhash::{FxHashMap, FxHashSet};
use ipc_channel::ipc::IpcSharedMemory; use ipc_channel::ipc::IpcSharedMemory;
use layout_api::ImageAnimationState;
use libc::c_void; use libc::c_void;
use script_bindings::root::Dom; use script_bindings::root::Dom;
use script_layout_interface::ImageAnimationState;
use style::dom::OpaqueNode; use style::dom::OpaqueNode;
use webrender_api::units::DeviceIntSize; use webrender_api::units::DeviceIntSize;
use webrender_api::{ImageDescriptor, ImageDescriptorFlags, ImageFormat}; use webrender_api::{ImageDescriptor, ImageDescriptorFlags, ImageFormat};

View file

@ -10,10 +10,8 @@ use atomic_refcell::{AtomicRef, AtomicRefMut};
use embedder_traits::UntrustedNodeAddress; use embedder_traits::UntrustedNodeAddress;
use html5ever::{LocalName, Namespace, local_name, ns}; use html5ever::{LocalName, Namespace, local_name, ns};
use js::jsapi::JSObject; use js::jsapi::JSObject;
use script_layout_interface::wrapper_traits::{ use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode, use layout_api::{LayoutNodeType, StyleData};
};
use script_layout_interface::{LayoutNodeType, StyleData};
use selectors::Element as _; use selectors::Element as _;
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::bloom::{BLOOM_HASH_MASK, BloomFilter}; use selectors::bloom::{BLOOM_HASH_MASK, BloomFilter};

View file

@ -10,14 +10,14 @@ use std::fmt;
use base::id::{BrowsingContextId, PipelineId}; use base::id::{BrowsingContextId, PipelineId};
use fonts_traits::ByteIndex; use fonts_traits::ByteIndex;
use html5ever::{local_name, ns}; use html5ever::{local_name, ns};
use net_traits::image_cache::Image; use layout_api::wrapper_traits::{LayoutDataTrait, LayoutNode, ThreadSafeLayoutNode};
use pixels::ImageMetadata; use layout_api::{
use range::Range;
use script_layout_interface::wrapper_traits::{LayoutDataTrait, LayoutNode, ThreadSafeLayoutNode};
use script_layout_interface::{
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutNodeType, SVGSVGData, StyleData, GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutNodeType, SVGSVGData, StyleData,
TrustedNodeAddress, TrustedNodeAddress,
}; };
use net_traits::image_cache::Image;
use pixels::ImageMetadata;
use range::Range;
use servo_arc::Arc; use servo_arc::Arc;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use style; use style;

View file

@ -69,6 +69,7 @@ use js::jsapi::{
}; };
use js::jsval::UndefinedValue; use js::jsval::UndefinedValue;
use js::rust::ParentRuntime; use js::rust::ParentRuntime;
use layout_api::{LayoutConfig, LayoutFactory, ReflowGoal, ScriptThreadFactory};
use media::WindowGLContext; use media::WindowGLContext;
use metrics::MAX_TASK_NS; use metrics::MAX_TASK_NS;
use net_traits::image_cache::{ImageCache, ImageCacheResponseMessage}; use net_traits::image_cache::{ImageCache, ImageCacheResponseMessage};
@ -83,7 +84,6 @@ use percent_encoding::percent_decode;
use profile_traits::mem::{ProcessReports, ReportsChan, perform_memory_report}; use profile_traits::mem::{ProcessReports, ReportsChan, perform_memory_report};
use profile_traits::time::ProfilerCategory; use profile_traits::time::ProfilerCategory;
use profile_traits::time_profile; use profile_traits::time_profile;
use script_layout_interface::{LayoutConfig, LayoutFactory, ReflowGoal, ScriptThreadFactory};
use script_traits::{ use script_traits::{
ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, InitialScriptState, ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, InitialScriptState,
NewLayoutInfo, Painter, ProgressiveWebMetricType, ScriptThreadMessage, UpdatePipelineIdReason, NewLayoutInfo, Painter, ProgressiveWebMetricType, ScriptThreadMessage, UpdatePipelineIdReason,

View file

@ -89,6 +89,7 @@ gstreamer = { workspace = true, optional = true }
ipc-channel = { workspace = true } ipc-channel = { workspace = true }
keyboard-types = { workspace = true } keyboard-types = { workspace = true }
layout = { path = "../layout" } layout = { path = "../layout" }
layout_api = { workspace = true }
log = { workspace = true } log = { workspace = true }
media = { path = "../media" } media = { path = "../media" }
mozangle = { workspace = true } mozangle = { workspace = true }
@ -99,7 +100,6 @@ profile = { path = "../profile" }
profile_traits = { workspace = true } profile_traits = { workspace = true }
rayon = { workspace = true } rayon = { workspace = true }
script = { path = "../script" } script = { path = "../script" }
script_layout_interface = { workspace = true }
script_traits = { workspace = true } script_traits = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
servo-media = { workspace = true } servo-media = { workspace = true }

View file

@ -116,7 +116,7 @@ use webview::WebViewInner;
pub use webxr; pub use webxr;
pub use { pub use {
background_hang_monitor, base, canvas, canvas_traits, devtools, devtools_traits, euclid, fonts, background_hang_monitor, base, canvas, canvas_traits, devtools, devtools_traits, euclid, fonts,
ipc_channel, media, net, net_traits, profile, profile_traits, script, script_layout_interface, ipc_channel, layout_api, media, net, net_traits, profile, profile_traits, script,
script_traits, servo_config as config, servo_config, servo_geometry, servo_url, style, script_traits, servo_config as config, servo_config, servo_geometry, servo_url, style,
style_traits, webrender_api, style_traits, webrender_api,
}; };

View file

@ -1,5 +1,5 @@
[package] [package]
name = "script_layout_interface" name = "layout_api"
version.workspace = true version.workspace = true
authors.workspace = true authors.workspace = true
license.workspace = true license.workspace = true
@ -8,7 +8,7 @@ publish.workspace = true
rust-version.workspace = true rust-version.workspace = true
[lib] [lib]
name = "script_layout_interface" name = "layout_api"
path = "lib.rs" path = "lib.rs"
[dependencies] [dependencies]

View file

@ -284,7 +284,7 @@ pub trait Layout {
fn query_text_indext(&self, node: OpaqueNode, point: Point2D<f32>) -> Option<usize>; fn query_text_indext(&self, node: OpaqueNode, point: Point2D<f32>) -> Option<usize>;
} }
/// This trait is part of `script_layout_interface` because it depends on both `script_traits` /// This trait is part of `layout_api` because it depends on both `script_traits`
/// and also `LayoutFactory` from this crate. If it was in `script_traits` there would be a /// and also `LayoutFactory` from this crate. If it was in `script_traits` there would be a
/// circular dependency. /// circular dependency.
pub trait ScriptThreadFactory { pub trait ScriptThreadFactory {

View file

@ -185,12 +185,12 @@ class MachCommands(CommandBase):
"fonts", "fonts",
"hyper_serde", "hyper_serde",
"layout", "layout",
"layout_api",
"libservo", "libservo",
"metrics", "metrics",
"net", "net",
"net_traits", "net_traits",
"pixels", "pixels",
"script_layout_interface",
"script_traits", "script_traits",
"selectors", "selectors",
"servo_config", "servo_config",