mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Further changes required by Servo
This commit is contained in:
parent
f48b95e2e3
commit
a7699d9034
23 changed files with 76 additions and 117 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -5372,6 +5372,7 @@ dependencies = [
|
|||
"phf_codegen",
|
||||
"precomputed-hash",
|
||||
"servo_arc",
|
||||
"size_of_test",
|
||||
"smallvec",
|
||||
"to_shmem",
|
||||
"to_shmem_derive",
|
||||
|
@ -5915,6 +5916,9 @@ checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7"
|
|||
[[package]]
|
||||
name = "size_of_test"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
|
@ -6193,7 +6197,6 @@ dependencies = [
|
|||
"servo_atoms",
|
||||
"servo_config",
|
||||
"servo_url",
|
||||
"size_of_test",
|
||||
"std_test_override",
|
||||
"style",
|
||||
"style_traits",
|
||||
|
@ -6215,6 +6218,7 @@ dependencies = [
|
|||
"servo_arc",
|
||||
"servo_atoms",
|
||||
"servo_url",
|
||||
"size_of_test",
|
||||
"to_shmem",
|
||||
"to_shmem_derive",
|
||||
"webrender_api",
|
||||
|
|
|
@ -44,6 +44,7 @@ servo_atoms = { path = "../atoms" }
|
|||
servo_config = { path = "../config" }
|
||||
servo_geometry = { path = "../geometry" }
|
||||
servo_url = { path = "../url" }
|
||||
size_of_test = { path = "../size_of_test" }
|
||||
smallvec = { workspace = true, features = ["union"] }
|
||||
style = { path = "../style", features = ["servo"] }
|
||||
style_traits = { path = "../style_traits" }
|
||||
|
@ -52,6 +53,3 @@ unicode-script = { workspace = true }
|
|||
webrender_api = { workspace = true }
|
||||
xi-unicode = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
size_of_test = { path = "../size_of_test" }
|
||||
|
||||
|
|
|
@ -158,6 +158,11 @@ pub struct Fragment {
|
|||
pub established_reference_frame: Option<ClipScrollNodeIndex>,
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
size_of_test!(Fragment, 176);
|
||||
#[cfg(not(debug_assertions))]
|
||||
size_of_test!(Fragment, 152);
|
||||
|
||||
impl Serialize for Fragment {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
let mut serializer = serializer.serialize_struct("fragment", 3)?;
|
||||
|
@ -212,6 +217,8 @@ pub enum SpecificFragmentInfo {
|
|||
TruncatedFragment(Box<TruncatedFragmentInfo>),
|
||||
}
|
||||
|
||||
size_of_test!(SpecificFragmentInfo, 24);
|
||||
|
||||
impl SpecificFragmentInfo {
|
||||
fn restyle_damage(&self) -> RestyleDamage {
|
||||
let flow = match *self {
|
||||
|
|
|
@ -16,6 +16,8 @@ extern crate log;
|
|||
extern crate range;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate size_of_test;
|
||||
|
||||
#[macro_use]
|
||||
pub mod layout_debug;
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#![cfg(target_pointer_width = "64")]
|
||||
|
||||
#[macro_use]
|
||||
extern crate size_of_test;
|
||||
|
||||
use layout_2013::Fragment;
|
||||
use layout_2013::SpecificFragmentInfo;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
size_of_test!(test_size_of_fragment, Fragment, 176);
|
||||
#[cfg(not(debug_assertions))]
|
||||
size_of_test!(test_size_of_fragment, Fragment, 152);
|
||||
size_of_test!(
|
||||
test_size_of_specific_fragment_info,
|
||||
SpecificFragmentInfo,
|
||||
24
|
||||
);
|
|
@ -19,7 +19,5 @@ malloc_size_of = { path = "../malloc_size_of" }
|
|||
malloc_size_of_derive = { workspace = true }
|
||||
parking_lot = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
webrender_api = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
size_of_test = { path = "../size_of_test" }
|
||||
webrender_api = { workspace = true }
|
||||
|
|
|
@ -198,6 +198,9 @@ pub struct PipelineNamespaceId(pub u32);
|
|||
|
||||
namespace_id! {PipelineId, PipelineIndex}
|
||||
|
||||
size_of_test!(PipelineId, 8);
|
||||
size_of_test!(Option<PipelineId>, 8);
|
||||
|
||||
impl PipelineId {
|
||||
pub fn new() -> PipelineId {
|
||||
PIPELINE_NAMESPACE.with(|tls| {
|
||||
|
@ -240,6 +243,9 @@ impl fmt::Display for PipelineId {
|
|||
|
||||
namespace_id! {BrowsingContextId, BrowsingContextIndex}
|
||||
|
||||
size_of_test!(BrowsingContextId, 8);
|
||||
size_of_test!(Option<BrowsingContextId>, 8);
|
||||
|
||||
impl BrowsingContextId {
|
||||
pub fn new() -> BrowsingContextId {
|
||||
PIPELINE_NAMESPACE.with(|tls| {
|
||||
|
@ -269,6 +275,9 @@ thread_local!(pub static TOP_LEVEL_BROWSING_CONTEXT_ID: Cell<Option<TopLevelBrow
|
|||
)]
|
||||
pub struct TopLevelBrowsingContextId(pub BrowsingContextId);
|
||||
|
||||
size_of_test!(TopLevelBrowsingContextId, 8);
|
||||
size_of_test!(Option<TopLevelBrowsingContextId>, 8);
|
||||
|
||||
impl TopLevelBrowsingContextId {
|
||||
pub fn new() -> TopLevelBrowsingContextId {
|
||||
TopLevelBrowsingContextId(BrowsingContextId::new())
|
||||
|
|
|
@ -12,5 +12,7 @@ extern crate malloc_size_of;
|
|||
extern crate malloc_size_of_derive;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate size_of_test;
|
||||
|
||||
pub mod constellation_msg;
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#![cfg(target_pointer_width = "64")]
|
||||
|
||||
#[macro_use]
|
||||
extern crate size_of_test;
|
||||
|
||||
use msg::constellation_msg::BrowsingContextId;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use msg::constellation_msg::TopLevelBrowsingContextId;
|
||||
|
||||
size_of_test!(test_size_of_pipeline_id, PipelineId, 8);
|
||||
size_of_test!(test_size_of_optional_pipeline_id, Option<PipelineId>, 8);
|
||||
size_of_test!(test_size_of_browsing_context_id, BrowsingContextId, 8);
|
||||
size_of_test!(
|
||||
test_size_of_optional_browsing_context_id,
|
||||
Option<BrowsingContextId>,
|
||||
8
|
||||
);
|
||||
size_of_test!(
|
||||
test_size_of_top_level_browsing_context_id,
|
||||
TopLevelBrowsingContextId,
|
||||
8
|
||||
);
|
||||
size_of_test!(
|
||||
test_size_of_top_level_optional_browsing_context_id,
|
||||
Option<TopLevelBrowsingContextId>,
|
||||
8
|
||||
);
|
|
@ -28,6 +28,7 @@ log = "0.4"
|
|||
phf = "0.10"
|
||||
precomputed-hash = "0.1"
|
||||
servo_arc = { version = "0.2", path = "../servo_arc" }
|
||||
size_of_test = { path = "../size_of_test" }
|
||||
smallvec = "1.0"
|
||||
to_shmem = { version = "0.0.0", path = "../to_shmem", optional = true }
|
||||
to_shmem_derive = { version = "0.0.0", path = "../to_shmem_derive", optional = true }
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
// Make |cargo bench| work.
|
||||
#![cfg_attr(feature = "bench", feature(test))]
|
||||
|
||||
#[macro_use]
|
||||
extern crate size_of_test;
|
||||
|
||||
pub mod attr;
|
||||
pub mod bloom;
|
||||
mod builder;
|
||||
|
|
|
@ -160,6 +160,8 @@ impl SelectorParsingState {
|
|||
|
||||
pub type SelectorParseError<'i> = ParseError<'i, SelectorParseErrorKind<'i>>;
|
||||
|
||||
size_of_test!(SelectorParseError, 48);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum SelectorParseErrorKind<'i> {
|
||||
NoQualifiedNameInAttributeSelector(Token<'i>),
|
||||
|
@ -184,6 +186,8 @@ pub enum SelectorParseErrorKind<'i> {
|
|||
ClassNeedsIdent(Token<'i>),
|
||||
}
|
||||
|
||||
size_of_test!(SelectorParseErrorKind, 40);
|
||||
|
||||
macro_rules! with_all_bounds {
|
||||
(
|
||||
[ $( $InSelector: tt )* ]
|
||||
|
|
13
components/size_of_test/Cargo.toml
Normal file
13
components/size_of_test/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "size_of_test"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
license = "MPL-2.0"
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
static_assertions = "1.1"
|
14
components/size_of_test/lib.rs
Normal file
14
components/size_of_test/lib.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
pub use static_assertions::const_assert_eq;
|
||||
|
||||
/// Asserts the size of a type at compile time.
|
||||
#[macro_export]
|
||||
macro_rules! size_of_test {
|
||||
($t: ty, $expected_size: expr) => {
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
$crate::const_assert_eq!(std::mem::size_of::<$t>(), $expected_size);
|
||||
};
|
||||
}
|
|
@ -67,6 +67,8 @@ pub struct Dependency {
|
|||
pub parent: Option<Box<Dependency>>,
|
||||
}
|
||||
|
||||
size_of_test!(Dependency, 24);
|
||||
|
||||
/// The kind of elements down the tree this dependency may affect.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum DependencyInvalidationKind {
|
||||
|
|
|
@ -2609,7 +2609,7 @@ pub struct SourcePropertyDeclaration {
|
|||
|
||||
// This is huge, but we allocate it on the stack and then never move it,
|
||||
// we only pass `&mut SourcePropertyDeclaration` references around.
|
||||
size_of_test!(SourcePropertyDeclaration, 600);
|
||||
size_of_test!(SourcePropertyDeclaration, 568);
|
||||
|
||||
impl SourcePropertyDeclaration {
|
||||
/// Create one. It’s big, try not to move it around.
|
||||
|
@ -4242,7 +4242,7 @@ macro_rules! longhand_properties_idents {
|
|||
}
|
||||
|
||||
// Large pages generate tens of thousands of ComputedValues.
|
||||
size_of_test!(ComputedValues, 232);
|
||||
size_of_test!(ComputedValues, 192);
|
||||
// FFI relies on this.
|
||||
size_of_test!(Option<Arc<ComputedValues>>, 8);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ pub type Image =
|
|||
generic::GenericImage<Gradient, MozImageRect, ComputedImageUrl, Color, Percentage, Resolution>;
|
||||
|
||||
// Images should remain small, see https://github.com/servo/servo/pull/18430
|
||||
size_of_test!(Image, 16);
|
||||
size_of_test!(Image, 40);
|
||||
|
||||
/// Computed values for a CSS gradient.
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
|
|
|
@ -40,7 +40,7 @@ pub type Image =
|
|||
generic::Image<Gradient, MozImageRect, SpecifiedImageUrl, Color, Percentage, Resolution>;
|
||||
|
||||
// Images should remain small, see https://github.com/servo/servo/pull/18430
|
||||
size_of_test!(Image, 16);
|
||||
size_of_test!(Image, 40);
|
||||
|
||||
/// Specified values for a CSS gradient.
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
|
|
|
@ -27,6 +27,7 @@ serde = "1.0"
|
|||
servo_arc = { path = "../servo_arc" }
|
||||
servo_atoms = { path = "../atoms", optional = true }
|
||||
servo_url = { path = "../url", optional = true }
|
||||
size_of_test = { path = "../size_of_test" }
|
||||
to_shmem = { path = "../to_shmem" }
|
||||
to_shmem_derive = { path = "../to_shmem_derive" }
|
||||
webrender_api = { workspace = true, optional = true }
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
#![crate_type = "rlib"]
|
||||
#![deny(unsafe_code, missing_docs)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate size_of_test;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -81,9 +84,11 @@ pub use crate::values::{
|
|||
|
||||
/// The error type for all CSS parsing routines.
|
||||
pub type ParseError<'i> = cssparser::ParseError<'i, StyleParseErrorKind<'i>>;
|
||||
size_of_test!(ParseError, 64);
|
||||
|
||||
/// Error in property value parsing
|
||||
pub type ValueParseError<'i> = cssparser::ParseError<'i, ValueParseErrorKind<'i>>;
|
||||
size_of_test!(ValueParseError, 48);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
/// Errors that can be encountered while parsing CSS values.
|
||||
|
@ -148,6 +153,7 @@ pub enum StyleParseErrorKind<'i> {
|
|||
/// The property is not allowed within a page rule.
|
||||
NotAllowedInPageRule,
|
||||
}
|
||||
size_of_test!(StyleParseErrorKind, 56);
|
||||
|
||||
impl<'i> From<ValueParseErrorKind<'i>> for StyleParseErrorKind<'i> {
|
||||
fn from(this: ValueParseErrorKind<'i>) -> Self {
|
||||
|
@ -169,6 +175,7 @@ pub enum ValueParseErrorKind<'i> {
|
|||
/// An invalid filter value was encountered.
|
||||
InvalidFilter(Token<'i>),
|
||||
}
|
||||
size_of_test!(ValueParseErrorKind, 40);
|
||||
|
||||
impl<'i> StyleParseErrorKind<'i> {
|
||||
/// Create an InvalidValue parse error
|
||||
|
|
|
@ -21,7 +21,6 @@ servo_arc = {path = "../../../components/servo_arc"}
|
|||
servo_atoms = {path = "../../../components/atoms"}
|
||||
servo_config = {path = "../../../components/config"}
|
||||
servo_url = {path = "../../../components/url"}
|
||||
size_of_test = {path = "../../../components/size_of_test"}
|
||||
style = {path = "../../../components/style", features = ["servo"]}
|
||||
style_traits = {path = "../../../components/style_traits"}
|
||||
std_test_override = { path = "../../../components/std_test_override" }
|
||||
|
|
|
@ -16,7 +16,6 @@ extern crate serde_json;
|
|||
extern crate servo_arc;
|
||||
extern crate servo_atoms;
|
||||
extern crate servo_url;
|
||||
#[macro_use]
|
||||
extern crate style;
|
||||
extern crate style_traits;
|
||||
extern crate test;
|
||||
|
@ -28,7 +27,6 @@ mod logical_geometry;
|
|||
mod parsing;
|
||||
mod properties;
|
||||
mod rule_tree;
|
||||
mod size_of;
|
||||
mod str;
|
||||
mod stylesheets;
|
||||
mod stylist;
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 selectors::parser::{SelectorParseError, SelectorParseErrorKind};
|
||||
use style::invalidation::element::invalidation_map::Dependency;
|
||||
use style::properties;
|
||||
|
||||
size_of_test!(test_size_of_dependency, Dependency, 24);
|
||||
|
||||
size_of_test!(
|
||||
test_size_of_property_declaration,
|
||||
properties::PropertyDeclaration,
|
||||
32
|
||||
);
|
||||
|
||||
// This is huge, but we allocate it on the stack and then never move it,
|
||||
// we only pass `&mut SourcePropertyDeclaration` references around.
|
||||
size_of_test!(
|
||||
test_size_of_parsed_declaration,
|
||||
properties::SourcePropertyDeclaration,
|
||||
568
|
||||
);
|
||||
|
||||
size_of_test!(
|
||||
test_size_of_selector_parse_error_kind,
|
||||
SelectorParseErrorKind,
|
||||
40
|
||||
);
|
||||
size_of_test!(
|
||||
test_size_of_style_parse_error_kind,
|
||||
::style_traits::StyleParseErrorKind,
|
||||
56
|
||||
);
|
||||
size_of_test!(
|
||||
test_size_of_value_parse_error_kind,
|
||||
::style_traits::ValueParseErrorKind,
|
||||
40
|
||||
);
|
||||
|
||||
size_of_test!(test_size_of_selector_parse_error, SelectorParseError, 48);
|
||||
size_of_test!(
|
||||
test_size_of_style_traits_parse_error,
|
||||
::style_traits::ParseError,
|
||||
64
|
||||
);
|
||||
size_of_test!(
|
||||
test_size_of_value_parse_error,
|
||||
::style_traits::ValueParseError,
|
||||
48
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue