diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-04-09 08:43:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 06:43:48 +0000 |
commit | dd9f62adcc2db74e473ba1d385c2005b9c0fd25f (patch) | |
tree | 8693c89802b1fea459148e1de085450344217652 /components/shared/script_layout | |
parent | b79e2a0b6575364de01b1f89021aba0ec3fcf399 (diff) | |
download | servo-dd9f62adcc2db74e473ba1d385c2005b9c0fd25f.tar.gz servo-dd9f62adcc2db74e473ba1d385c2005b9c0fd25f.zip |
chore: Clean up use of `gfx` and `constellation` types (#31981)
This change contains three semi-related clean ups:
1. the `to_webrender()` and `from_webrender()` functions on Pipeline are
turned into more-idiomatic `From` and `Into` implementations.
2. `combine_id_with_fragment_type` now returns a `u64` as that is what is
expected for all callers and not a `usize`.
3. The `query_scroll_id` query is removed entirely. The
`ExternalScrollId` that this queries is easily generated directly
from the node's opaque id. Querying into layout isn't necessary at
all.
Diffstat (limited to 'components/shared/script_layout')
-rw-r--r-- | components/shared/script_layout/lib.rs | 3 | ||||
-rw-r--r-- | components/shared/script_layout/message.rs | 3 | ||||
-rw-r--r-- | components/shared/script_layout/wrapper_traits.rs | 8 |
3 files changed, 2 insertions, 12 deletions
diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs index 3279f993820..20d8c982dc2 100644 --- a/components/shared/script_layout/lib.rs +++ b/components/shared/script_layout/lib.rs @@ -46,7 +46,7 @@ use style::properties::PropertyId; use style::selector_parser::PseudoElement; use style::stylesheets::Stylesheet; use style_traits::CSSPixel; -use webrender_api::{ExternalScrollId, ImageKey}; +use webrender_api::ImageKey; pub type GenericLayoutData = dyn Any + Send + Sync; @@ -235,7 +235,6 @@ pub trait Layout { animations: DocumentAnimationSet, animation_timeline_value: f64, ) -> Option<ServoArc<Font>>; - fn query_scroll_id(&self, node: TrustedNodeAddress) -> ExternalScrollId; fn query_scrolling_area(&self, node: Option<OpaqueNode>) -> Rect<i32>; fn query_text_indext(&self, node: OpaqueNode, point: Point2D<f32>) -> Option<usize>; } diff --git a/components/shared/script_layout/message.rs b/components/shared/script_layout/message.rs index 34de65cd227..018e554e893 100644 --- a/components/shared/script_layout/message.rs +++ b/components/shared/script_layout/message.rs @@ -55,7 +55,6 @@ pub enum QueryMsg { OffsetParentQuery, TextIndexQuery, NodesFromPointQuery, - NodeScrollIdQuery, ResolvedStyleQuery, StyleQuery, ElementInnerTextQuery, @@ -90,7 +89,6 @@ impl ReflowGoal { QueryMsg::ClientRectQuery | QueryMsg::ContentBox | QueryMsg::ContentBoxes | - QueryMsg::NodeScrollIdQuery | QueryMsg::OffsetParentQuery | QueryMsg::ResolvedFontStyleQuery | QueryMsg::ScrollingAreaQuery | @@ -112,7 +110,6 @@ impl ReflowGoal { QueryMsg::ContentBoxes | QueryMsg::ClientRectQuery | QueryMsg::ScrollingAreaQuery | - QueryMsg::NodeScrollIdQuery | QueryMsg::ResolvedStyleQuery | QueryMsg::ResolvedFontStyleQuery | QueryMsg::OffsetParentQuery | diff --git a/components/shared/script_layout/wrapper_traits.rs b/components/shared/script_layout/wrapper_traits.rs index c1bd1fc4d95..846943414ae 100644 --- a/components/shared/script_layout/wrapper_traits.rs +++ b/components/shared/script_layout/wrapper_traits.rs @@ -9,7 +9,7 @@ use std::fmt::Debug; use std::sync::Arc as StdArc; use atomic_refcell::AtomicRef; -use gfx_traits::{combine_id_with_fragment_type, ByteIndex, FragmentType}; +use gfx_traits::{ByteIndex, FragmentType}; use html5ever::{local_name, namespace_url, ns, LocalName, Namespace}; use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::{Image, ImageMetadata}; @@ -23,7 +23,6 @@ use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, TElement, TNode}; use style::properties::ComputedValues; use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl}; use style::stylist::RuleInclusion; -use webrender_api::ExternalScrollId; use crate::{ GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutNodeType, SVGSVGData, StyleData, @@ -315,11 +314,6 @@ pub trait ThreadSafeLayoutNode<'dom>: Clone + Copy + Debug + NodeInfo + PartialE fn fragment_type(&self) -> FragmentType { self.get_pseudo_element_type().fragment_type() } - - fn generate_scroll_id(&self, pipeline_id: PipelineId) -> ExternalScrollId { - let id = combine_id_with_fragment_type(self.opaque().id(), self.fragment_type()); - ExternalScrollId(id as u64, pipeline_id.to_webrender()) - } } pub trait ThreadSafeLayoutElement<'dom>: |