mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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.
This commit is contained in:
parent
b79e2a0b65
commit
dd9f62adcc
15 changed files with 62 additions and 119 deletions
|
@ -2270,7 +2270,7 @@ impl Fragment {
|
|||
fn unique_id(&self) -> u64 {
|
||||
let fragment_type = self.fragment_type();
|
||||
let id = self.node.id();
|
||||
combine_id_with_fragment_type(id, fragment_type) as u64
|
||||
combine_id_with_fragment_type(id, fragment_type)
|
||||
}
|
||||
|
||||
fn fragment_type(&self) -> FragmentType {
|
||||
|
@ -2737,8 +2737,7 @@ impl BlockFlow {
|
|||
let content_size = self.base.overflow.scroll.origin + self.base.overflow.scroll.size;
|
||||
let content_size = Size2D::new(content_size.x, content_size.y);
|
||||
|
||||
let external_id =
|
||||
ExternalScrollId(self.fragment.unique_id(), state.pipeline_id.to_webrender());
|
||||
let external_id = ExternalScrollId(self.fragment.unique_id(), state.pipeline_id.into());
|
||||
let new_clip_scroll_index = state.add_clip_scroll_node(ClipScrollNode {
|
||||
parent_index: self.clipping_and_scrolling().scrolling,
|
||||
clip,
|
||||
|
|
|
@ -133,7 +133,7 @@ impl DisplayList {
|
|||
viewport_size: LayoutSize,
|
||||
epoch: Epoch,
|
||||
) -> (DisplayListBuilder, CompositorDisplayListInfo, IsContentful) {
|
||||
let webrender_pipeline = pipeline_id.to_webrender();
|
||||
let webrender_pipeline = pipeline_id.into();
|
||||
let mut builder = DisplayListBuilder::new(webrender_pipeline);
|
||||
builder.begin();
|
||||
|
||||
|
@ -314,7 +314,7 @@ impl DisplayItem {
|
|||
spatial_id: common.spatial_id,
|
||||
clip_chain_id: common.clip_chain_id,
|
||||
},
|
||||
item.iframe.to_webrender(),
|
||||
item.iframe.into(),
|
||||
true,
|
||||
);
|
||||
IsContentful(false)
|
||||
|
|
|
@ -9,7 +9,6 @@ use std::ops::Deref;
|
|||
|
||||
use app_units::Au;
|
||||
use euclid::default::{Box2D, Point2D, Rect, Size2D, Vector2D};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
|
||||
};
|
||||
|
@ -31,7 +30,6 @@ use style::selector_parser::PseudoElement;
|
|||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
use crate::construct::ConstructionResult;
|
||||
use crate::display_list::items::OpaqueNode;
|
||||
|
@ -571,14 +569,6 @@ pub fn process_client_rect_query(
|
|||
iterator.client_rect
|
||||
}
|
||||
|
||||
pub fn process_node_scroll_id_request<'dom>(
|
||||
id: PipelineId,
|
||||
requested_node: impl LayoutNode<'dom>,
|
||||
) -> ExternalScrollId {
|
||||
let layout_node = requested_node.to_threadsafe();
|
||||
layout_node.generate_scroll_id(id)
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/cssom-view/#scrolling-area>
|
||||
pub fn process_scrolling_area_request(
|
||||
requested_node: Option<OpaqueNode>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue