aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock28
-rw-r--r--Cargo.toml20
-rw-r--r--components/script/dom/cssrule.rs1
-rw-r--r--components/script/dom/node.rs29
-rw-r--r--components/script/layout_dom/element.rs16
-rw-r--r--tests/unit/style/animated_properties.rs11
-rw-r--r--tests/unit/style/stylesheets.rs2
-rw-r--r--tests/wpt/meta/css/css-values/calc-infinity-nan-computed.html.ini9
-rw-r--r--tests/wpt/meta/css/css-values/calc-infinity-nan-serialize-length.html.ini15
9 files changed, 68 insertions, 63 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 68e12733284..3aa55502e88 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1298,7 +1298,7 @@ dependencies = [
[[package]]
name = "derive_common"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"darling",
"proc-macro2",
@@ -1486,7 +1486,7 @@ dependencies = [
[[package]]
name = "dom"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"bitflags 2.6.0",
]
@@ -4118,7 +4118,7 @@ dependencies = [
[[package]]
name = "malloc_size_of"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"accountable-refcell",
"app_units",
@@ -5911,7 +5911,7 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.24.0"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"bitflags 2.6.0",
"cssparser",
@@ -6199,7 +6199,7 @@ dependencies = [
[[package]]
name = "servo_arc"
version = "0.2.0"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"serde",
"stable_deref_trait",
@@ -6208,7 +6208,7 @@ dependencies = [
[[package]]
name = "servo_atoms"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"string_cache",
"string_cache_codegen",
@@ -6426,7 +6426,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "size_of_test"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"static_assertions",
]
@@ -6567,7 +6567,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "static_prefs"
version = "0.1.0"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
[[package]]
name = "strck"
@@ -6620,7 +6620,7 @@ dependencies = [
[[package]]
name = "style"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"app_units",
"arrayvec",
@@ -6678,7 +6678,7 @@ dependencies = [
[[package]]
name = "style_config"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"lazy_static",
]
@@ -6686,7 +6686,7 @@ dependencies = [
[[package]]
name = "style_derive"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"darling",
"derive_common",
@@ -6717,7 +6717,7 @@ dependencies = [
[[package]]
name = "style_traits"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"app_units",
"bitflags 2.6.0",
@@ -7084,7 +7084,7 @@ dependencies = [
[[package]]
name = "to_shmem"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"cssparser",
"servo_arc",
@@ -7097,7 +7097,7 @@ dependencies = [
[[package]]
name = "to_shmem_derive"
version = "0.0.1"
-source = "git+https://github.com/servo/stylo?branch=2024-07-16#f1f1ce0e737ae8f99522cc52c47e2c6363789e28"
+source = "git+https://github.com/servo/stylo?branch=2024-09-02#89bbdff5ad80cf0a9814a7102379b5eeca89363e"
dependencies = [
"darling",
"derive_common",
diff --git a/Cargo.toml b/Cargo.toml
index 670abd37a77..18dce9be8ab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -76,7 +76,7 @@ keyboard-types = "0.7"
libc = "0.2"
log = "0.4"
mach2 = "0.4"
-malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
+malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-09-02", features = ["servo"] }
malloc_size_of_derive = "0.1"
mime = "0.3.13"
mime_guess = "2.0.5"
@@ -99,31 +99,31 @@ rustls = { version = "0.21.12", features = ["dangerous_configuration"] }
rustls-pemfile = "1.0.4"
script_layout_interface = { path = "components/shared/script_layout" }
script_traits = { path = "components/shared/script" }
-selectors = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
+selectors = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
serde = "1.0.209"
serde_bytes = "0.11"
serde_json = "1.0"
servo-media = { git = "https://github.com/servo/media" }
servo-media-dummy = { git = "https://github.com/servo/media" }
servo-media-gstreamer = { git = "https://github.com/servo/media" }
-servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
-servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
-size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
+servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-09-02", features = ["servo"] }
+servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
+size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
smallbitvec = "2.5.3"
smallvec = "1.13"
sparkle = "0.1.26"
string_cache = "0.8"
string_cache_codegen = "0.5"
-style = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
-style_config = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
-style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-07-16" }
-style_traits = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
+style = { git = "https://github.com/servo/stylo", branch = "2024-09-02", features = ["servo"] }
+style_config = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
+style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-09-02" }
+style_traits = { git = "https://github.com/servo/stylo", branch = "2024-09-02", features = ["servo"] }
surfman = { version = "0.9.8", features = ["chains"] }
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
synstructure = "0.13"
thin-vec = "0.2.13"
time_03 = { package = "time", version = "0.3", features = ["large-dates", "local-offset", "serde"] }
-to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
+to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
tokio = "1"
tokio-rustls = "0.24"
tungstenite = "0.20"
diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs
index 25281bf4d96..465dcce7aa2 100644
--- a/components/script/dom/cssrule.rs
+++ b/components/script/dom/cssrule.rs
@@ -119,6 +119,7 @@ impl CSSRule {
StyleCssRule::Margin(_) => unimplemented!(), // TODO
StyleCssRule::Scope(_) => unimplemented!(), // TODO
StyleCssRule::StartingStyle(_) => unimplemented!(), // TODO
+ StyleCssRule::PositionTry(_) => unimplemented!(), // TODO
}
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 6122db3221a..f53f7193bdf 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -1297,16 +1297,7 @@ where
/// returns it.
#[allow(unsafe_code)]
pub unsafe fn from_untrusted_node_address(candidate: UntrustedNodeAddress) -> DomRoot<Node> {
- // https://github.com/servo/servo/issues/6383
- let candidate = candidate.0 as usize;
- // let object: *mut JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime,
- // candidate);
- let object = candidate as *mut JSObject;
- if object.is_null() {
- panic!("Attempted to create a `Dom<Node>` from an invalid pointer!")
- }
- let boxed_node = conversions::private_from_object(object) as *const Node;
- DomRoot::from_ref(&*boxed_node)
+ DomRoot::from_ref(Node::from_untrusted_node_address(candidate))
}
#[allow(unsafe_code)]
@@ -2430,6 +2421,24 @@ impl Node {
.map_or(ns!(), |elem| elem.locate_namespace(prefix)),
}
}
+
+ /// If the given untrusted node address represents a valid DOM node in the given runtime,
+ /// returns it.
+ ///
+ /// # Safety
+ ///
+ /// Callers should ensure they pass an UntrustedNodeAddress that points to a valid `JSObject`
+ /// in memory that represents a `Node`.
+ #[allow(unsafe_code)]
+ pub unsafe fn from_untrusted_node_address(candidate: UntrustedNodeAddress) -> &'static Self {
+ // https://github.com/servo/servo/issues/6383
+ let candidate = candidate.0 as usize;
+ let object = candidate as *mut JSObject;
+ if object.is_null() {
+ panic!("Attempted to create a `Node` from an invalid pointer!")
+ }
+ &*(conversions::private_from_object(object) as *const Self)
+ }
}
impl NodeMethods for Node {
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index e5cf8d068c4..05a3b990bb6 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -8,10 +8,12 @@ use std::sync::atomic::Ordering;
use atomic_refcell::{AtomicRef, AtomicRefMut};
use html5ever::{local_name, namespace_url, ns, LocalName, Namespace};
+use js::jsapi::JSObject;
use script_layout_interface::wrapper_traits::{
LayoutNode, PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use script_layout_interface::{LayoutNodeType, StyleData};
+use script_traits::UntrustedNodeAddress;
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::bloom::{BloomFilter, BLOOM_HASH_MASK};
use selectors::matching::{ElementSelectorFlags, MatchingContext, VisitedHandlingMode};
@@ -44,7 +46,7 @@ use crate::dom::bindings::inheritance::{
use crate::dom::bindings::root::LayoutDom;
use crate::dom::characterdata::LayoutCharacterDataHelpers;
use crate::dom::element::{Element, LayoutElementHelpers};
-use crate::dom::node::{LayoutNodeHelpers, NodeFlags};
+use crate::dom::node::{LayoutNodeHelpers, Node, NodeFlags};
use crate::layout_dom::{ServoLayoutNode, ServoShadowRoot, ServoThreadSafeLayoutNode};
/// A wrapper around elements that ensures layout can only ever access safe properties.
@@ -429,6 +431,18 @@ impl<'dom> style::dom::TElement for ServoLayoutElement<'dom> {
F: FnMut(&AtomIdent),
{
}
+
+ /// Convert an opaque element back into the element.
+ fn unopaque(opaque: ::selectors::OpaqueElement) -> Self {
+ unsafe {
+ let ptr = opaque.as_const_ptr::<JSObject>();
+ let untrusted_address = UntrustedNodeAddress::from_id(ptr as usize);
+ let node = Node::from_untrusted_node_address(untrusted_address);
+ let trusted_address = node.to_trusted_node_address();
+ let servo_layout_node = ServoLayoutNode::new(&trusted_address);
+ servo_layout_node.as_element().unwrap()
+ }
+ }
}
impl<'dom> ::selectors::Element for ServoLayoutElement<'dom> {
diff --git a/tests/unit/style/animated_properties.rs b/tests/unit/style/animated_properties.rs
index 174ba914c28..cf7c9ac8c9a 100644
--- a/tests/unit/style/animated_properties.rs
+++ b/tests/unit/style/animated_properties.rs
@@ -3,11 +3,16 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use style::color::{AbsoluteColor, ColorSpace};
-use style::values::animated::{Animate, Procedure, ToAnimatedValue};
+use style::properties::style_structs::Font;
+use style::properties::ComputedValues;
+use style::values::animated::{Animate, Context, Procedure, ToAnimatedValue};
fn interpolate_color(from: AbsoluteColor, to: AbsoluteColor, progress: f64) -> AbsoluteColor {
- let from = from.to_animated_value();
- let to = to.to_animated_value();
+ let context = Context {
+ style: &ComputedValues::initial_values_with_font_override(Font::initial_values()),
+ };
+ let from = from.to_animated_value(&context);
+ let to = to.to_animated_value(&context);
AbsoluteColor::from_animated_value(
from.animate(&to, Procedure::Interpolate { progress })
.unwrap(),
diff --git a/tests/unit/style/stylesheets.rs b/tests/unit/style/stylesheets.rs
index 4c8b780a357..683fe8662e5 100644
--- a/tests/unit/style/stylesheets.rs
+++ b/tests/unit/style/stylesheets.rs
@@ -134,7 +134,7 @@ fn test_report_error_stylesheet() {
(
14,
52,
- "Unsupported keyframe property declaration: 'margin: 0 invalid 0;'",
+ "Unsupported property declaration: 'margin: 0 invalid 0;'",
),
]);
diff --git a/tests/wpt/meta/css/css-values/calc-infinity-nan-computed.html.ini b/tests/wpt/meta/css/css-values/calc-infinity-nan-computed.html.ini
index 5191974d8e9..93ba67d2517 100644
--- a/tests/wpt/meta/css/css-values/calc-infinity-nan-computed.html.ini
+++ b/tests/wpt/meta/css/css-values/calc-infinity-nan-computed.html.ini
@@ -1,7 +1,4 @@
[calc-infinity-nan-computed.html]
- [Property width value 'calc(min(NaN * 1px, infinity * 1px) + max(infinity * 1px, -infinity * 1px))']
- expected: FAIL
-
[Property rotate(calc(infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001]
expected: FAIL
@@ -38,12 +35,6 @@
[Property rotate(calc(NaN * 1grad)) value expected same with rotate(0grad) in +/-0.0001]
expected: FAIL
- [Property width value 'max(15px, NaN * 1px)']
- expected: FAIL
-
- [Property width value 'max(NaN * 1px, 15px)']
- expected: FAIL
-
[Property rotate(calc(infinity * 1turn)) value expected same with rotate(0deg) in +/-0.0001]
expected: FAIL
diff --git a/tests/wpt/meta/css/css-values/calc-infinity-nan-serialize-length.html.ini b/tests/wpt/meta/css/css-values/calc-infinity-nan-serialize-length.html.ini
deleted file mode 100644
index 25c7df750c4..00000000000
--- a/tests/wpt/meta/css/css-values/calc-infinity-nan-serialize-length.html.ini
+++ /dev/null
@@ -1,15 +0,0 @@
-[calc-infinity-nan-serialize-length.html]
- ['calc(1 * max(nAn*2px, 0px))' as a specified value should serialize as 'calc(NaN * 1px)'.]
- expected: FAIL
-
- ['calc(1 * min(nan*3px, 0px))' as a specified value should serialize as 'calc(NaN * 1px)'.]
- expected: FAIL
-
- ['calc(1 * min(NaN * 1pt, NaN * 1cm))' as a specified value should serialize as 'calc(NaN * 1px)'.]
- expected: FAIL
-
- ['calc(1 * max(NaN * 1cm, NaN * 2Q))' as a specified value should serialize as 'calc(NaN * 1px)'.]
- expected: FAIL
-
- ['calc(1 * min(NaN * 2px, NaN * 4em))' as a specified value should serialize as 'calc(NaN * 1px)'.]
- expected: FAIL