diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-09 14:11:13 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-09 14:12:54 +0100 |
commit | 3ccda7f90cfb783d66c5bd793888a3138c1a5643 (patch) | |
tree | 5e02a039ded02b084b774df86f13c869cbbdd010 /components/script_layout_interface | |
parent | ddef6211b39d0b4927aff02646070f6ebc052eaa (diff) | |
download | servo-3ccda7f90cfb783d66c5bd793888a3138c1a5643.tar.gz servo-3ccda7f90cfb783d66c5bd793888a3138c1a5643.zip |
Make a bunch of layout queries morally safer
Diffstat (limited to 'components/script_layout_interface')
-rw-r--r-- | components/script_layout_interface/message.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index 7600ebe372a..144961cb8f5 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -21,6 +21,7 @@ use servo_atoms::Atom; use servo_url::ServoUrl; use std::sync::Arc; use style::context::QuirksMode; +use style::dom::OpaqueNode; use style::properties::PropertyId; use style::selector_parser::PseudoElement; use style::stylesheets::Stylesheet; @@ -111,16 +112,20 @@ pub enum NodesFromPointQueryType { #[derive(Debug, PartialEq)] pub enum QueryMsg { - ContentBoxQuery(TrustedNodeAddress), - ContentBoxesQuery(TrustedNodeAddress), + ContentBoxQuery(OpaqueNode), + ContentBoxesQuery(OpaqueNode), + NodeGeometryQuery(OpaqueNode), + NodeScrollGeometryQuery(OpaqueNode), + OffsetParentQuery(OpaqueNode), + TextIndexQuery(OpaqueNode, Point2D<f32>), + NodesFromPointQuery(Point2D<f32>, NodesFromPointQueryType), + + // FIXME(nox): The following queries use the TrustedNodeAddress to + // access actual DOM nodes, but those values can be constructed from + // garbage values such as `0xdeadbeef as *const _`, this is unsound. NodeScrollIdQuery(TrustedNodeAddress), - NodeGeometryQuery(TrustedNodeAddress), - NodeScrollGeometryQuery(TrustedNodeAddress), ResolvedStyleQuery(TrustedNodeAddress, Option<PseudoElement>, PropertyId), - OffsetParentQuery(TrustedNodeAddress), StyleQuery(TrustedNodeAddress), - TextIndexQuery(TrustedNodeAddress, Point2D<f32>), - NodesFromPointQuery(Point2D<f32>, NodesFromPointQueryType), ElementInnerTextQuery(TrustedNodeAddress), } |